diff --git a/micromamba_root/Lib/asyncio/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..abd9c8aca7e4b6c5a7213292c52480b4beffdeb2 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/base_events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/base_events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e68d4dd48bccc3f1a31f86e6c6526aac8a75a651 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/base_events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/base_futures.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/base_futures.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c85d6564252fd1577ad765b72d345cdf7e242570 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/base_futures.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/base_subprocess.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/base_subprocess.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11d832f89a0ebf99a62bc216b16561e15cc43cd8 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/base_subprocess.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/base_tasks.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/base_tasks.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95fc66370174cc403b87d22b5ef6a8d5d92aac69 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/base_tasks.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/constants.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/constants.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b24b1312a15ef395131a1cdd755280312614a49 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/constants.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/coroutines.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/coroutines.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..834f470bfa78f225e8154b9fd6bb8a3cfad366f7 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/coroutines.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8340158e5bc22526f3313094a9ddbdcfecc9f730 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/exceptions.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/exceptions.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e321307eed880f8ee005e1f70353e461567b29a Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/exceptions.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/format_helpers.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/format_helpers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..013aa950790cf0cf8c2ad70910409216efca5c85 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/format_helpers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/futures.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/futures.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecd355d705d0ea45f4b0864bece7d22f3d5eb466 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/futures.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/graph.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/graph.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b29ccf578992e485fc563ba00baac5fc6a5ab08 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/graph.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/locks.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/locks.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..786d65bf6cf23bda16cdab6057040faf65f1e43e Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/locks.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/log.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/log.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c708efb29dc3d4e0b39151a61a33788fc8262f3 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/log.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/mixins.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/mixins.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0174cbc043af2cd230dcd76b982848d7760c53ff Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/mixins.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/proactor_events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/proactor_events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e6f5b4681cfcc1f2cc407be4ff827749a0a31a6 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/proactor_events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/protocols.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/protocols.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7568150e4b4a6c0daea52100c879cfd1d7cab63a Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/protocols.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/queues.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/queues.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..618905ab2723735b98278fd0d26c6de31061b7e1 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/queues.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/runners.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/runners.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b7caabe89bd7a1be7e730250b8055266393dfa7 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/runners.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/selector_events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/selector_events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..076670ae2e71b3907a0fed433134403842fbb28c Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/selector_events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/sslproto.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/sslproto.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43f67445d00071611064ec05c2b64ecda9b4cead Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/sslproto.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/staggered.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/staggered.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df2ee600d25180447cdd539073c13ecfa09d7d59 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/staggered.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/streams.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/streams.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2255e09901aa57f3fb75bdc6b59e55734ae87c9b Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/streams.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/subprocess.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/subprocess.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6e7c5fa886519ee1fc00184acb5e26635443a28 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/subprocess.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/taskgroups.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/taskgroups.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..870ff2ecd6de1c849e24d81aedbf98ad1ece44ab Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/taskgroups.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/tasks.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/tasks.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee40cb8a1781676d58fdc268eb31dcf1fbd19f63 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/tasks.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/threads.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/threads.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..197a4a0afc529ed397232e80de501b4aed189d14 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/threads.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/timeouts.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/timeouts.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c69813f70c06cfb966320d38400f4aa9bb0e08c7 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/timeouts.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/tools.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/tools.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cba80b347fd07d1edf5ced8f368c5c1e6da25dd2 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/tools.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/transports.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/transports.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..649b20d5e270291574e3546ead204feeaabc3ca7 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/transports.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/trsock.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/trsock.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b05e431a10ea7a143ae323704e077fc655b99b38 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/trsock.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/unix_events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/unix_events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c09e290c78d1a9737814b7a27917fc6001967c9 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/unix_events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/windows_events.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/windows_events.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5202abd10a702c4963deda13f582cca86f48f80 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/windows_events.cpython-314.pyc differ diff --git a/micromamba_root/Lib/asyncio/__pycache__/windows_utils.cpython-314.pyc b/micromamba_root/Lib/asyncio/__pycache__/windows_utils.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..634e4dfe9848d178f200ee9f034b0dae6a2ae983 Binary files /dev/null and b/micromamba_root/Lib/asyncio/__pycache__/windows_utils.cpython-314.pyc differ diff --git a/micromamba_root/Lib/collections/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/collections/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e66bcfc47f4b533b1a67b25bf9bf7f2bdeea7d0 Binary files /dev/null and b/micromamba_root/Lib/collections/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/compression/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..250de8fbc33886e3c3b7b08abf164ebd03e5a6e6 Binary files /dev/null and b/micromamba_root/Lib/compression/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/__pycache__/bz2.cpython-314.pyc b/micromamba_root/Lib/compression/__pycache__/bz2.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2cf037436645283b51d76b465dad0e37c28a04f7 Binary files /dev/null and b/micromamba_root/Lib/compression/__pycache__/bz2.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/__pycache__/gzip.cpython-314.pyc b/micromamba_root/Lib/compression/__pycache__/gzip.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb571e1a1e8fa72f4a4f8ae32f4816ad76b3313c Binary files /dev/null and b/micromamba_root/Lib/compression/__pycache__/gzip.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/__pycache__/lzma.cpython-314.pyc b/micromamba_root/Lib/compression/__pycache__/lzma.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..833bab409c0059e8cb0b647d0851cb6f50cf0c24 Binary files /dev/null and b/micromamba_root/Lib/compression/__pycache__/lzma.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/__pycache__/zlib.cpython-314.pyc b/micromamba_root/Lib/compression/__pycache__/zlib.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aff18a028391efcddb93884c91e31a6203b97121 Binary files /dev/null and b/micromamba_root/Lib/compression/__pycache__/zlib.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/_common/__init__.py b/micromamba_root/Lib/compression/_common/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/Lib/compression/_common/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/compression/_common/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d76e27c8bdad34ee469229e175e7a07f97763e01 Binary files /dev/null and b/micromamba_root/Lib/compression/_common/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/_common/__pycache__/_streams.cpython-314.pyc b/micromamba_root/Lib/compression/_common/__pycache__/_streams.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f60cb1efc66f078640487114751b671f1f5f8019 Binary files /dev/null and b/micromamba_root/Lib/compression/_common/__pycache__/_streams.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/_common/_streams.py b/micromamba_root/Lib/compression/_common/_streams.py new file mode 100644 index 0000000000000000000000000000000000000000..9f367d4e30440f75d9a32c035713b281f3fbb26a --- /dev/null +++ b/micromamba_root/Lib/compression/_common/_streams.py @@ -0,0 +1,162 @@ +"""Internal classes used by compression modules""" + +import io +import sys + +BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE # Compressed data read chunk size + + +class BaseStream(io.BufferedIOBase): + """Mode-checking helper functions.""" + + def _check_not_closed(self): + if self.closed: + raise ValueError("I/O operation on closed file") + + def _check_can_read(self): + if not self.readable(): + raise io.UnsupportedOperation("File not open for reading") + + def _check_can_write(self): + if not self.writable(): + raise io.UnsupportedOperation("File not open for writing") + + def _check_can_seek(self): + if not self.readable(): + raise io.UnsupportedOperation("Seeking is only supported " + "on files open for reading") + if not self.seekable(): + raise io.UnsupportedOperation("The underlying file object " + "does not support seeking") + + +class DecompressReader(io.RawIOBase): + """Adapts the decompressor API to a RawIOBase reader API""" + + def readable(self): + return True + + def __init__(self, fp, decomp_factory, trailing_error=(), **decomp_args): + self._fp = fp + self._eof = False + self._pos = 0 # Current offset in decompressed stream + + # Set to size of decompressed stream once it is known, for SEEK_END + self._size = -1 + + # Save the decompressor factory and arguments. + # If the file contains multiple compressed streams, each + # stream will need a separate decompressor object. A new decompressor + # object is also needed when implementing a backwards seek(). + self._decomp_factory = decomp_factory + self._decomp_args = decomp_args + self._decompressor = self._decomp_factory(**self._decomp_args) + + # Exception class to catch from decompressor signifying invalid + # trailing data to ignore + self._trailing_error = trailing_error + + def close(self): + self._decompressor = None + return super().close() + + def seekable(self): + return self._fp.seekable() + + def readinto(self, b): + with memoryview(b) as view, view.cast("B") as byte_view: + data = self.read(len(byte_view)) + byte_view[:len(data)] = data + return len(data) + + def read(self, size=-1): + if size < 0: + return self.readall() + + if not size or self._eof: + return b"" + data = None # Default if EOF is encountered + # Depending on the input data, our call to the decompressor may not + # return any data. In this case, try again after reading another block. + while True: + if self._decompressor.eof: + rawblock = (self._decompressor.unused_data or + self._fp.read(BUFFER_SIZE)) + if not rawblock: + break + # Continue to next stream. + self._decompressor = self._decomp_factory( + **self._decomp_args) + try: + data = self._decompressor.decompress(rawblock, size) + except self._trailing_error: + # Trailing data isn't a valid compressed stream; ignore it. + break + else: + if self._decompressor.needs_input: + rawblock = self._fp.read(BUFFER_SIZE) + if not rawblock: + raise EOFError("Compressed file ended before the " + "end-of-stream marker was reached") + else: + rawblock = b"" + data = self._decompressor.decompress(rawblock, size) + if data: + break + if not data: + self._eof = True + self._size = self._pos + return b"" + self._pos += len(data) + return data + + def readall(self): + chunks = [] + # sys.maxsize means the max length of output buffer is unlimited, + # so that the whole input buffer can be decompressed within one + # .decompress() call. + while data := self.read(sys.maxsize): + chunks.append(data) + + return b"".join(chunks) + + # Rewind the file to the beginning of the data stream. + def _rewind(self): + self._fp.seek(0) + self._eof = False + self._pos = 0 + self._decompressor = self._decomp_factory(**self._decomp_args) + + def seek(self, offset, whence=io.SEEK_SET): + # Recalculate offset as an absolute file position. + if whence == io.SEEK_SET: + pass + elif whence == io.SEEK_CUR: + offset = self._pos + offset + elif whence == io.SEEK_END: + # Seeking relative to EOF - we need to know the file's size. + if self._size < 0: + while self.read(io.DEFAULT_BUFFER_SIZE): + pass + offset = self._size + offset + else: + raise ValueError("Invalid value for whence: {}".format(whence)) + + # Make it so that offset is the number of bytes to skip forward. + if offset < self._pos: + self._rewind() + else: + offset -= self._pos + + # Read and discard data until we reach the desired position. + while offset > 0: + data = self.read(min(io.DEFAULT_BUFFER_SIZE, offset)) + if not data: + break + offset -= len(data) + + return self._pos + + def tell(self): + """Return the current file position.""" + return self._pos diff --git a/micromamba_root/Lib/compression/zstd/__init__.py b/micromamba_root/Lib/compression/zstd/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..84b25914b0aa93a6c0f0aba6dc02bc8be077ece5 --- /dev/null +++ b/micromamba_root/Lib/compression/zstd/__init__.py @@ -0,0 +1,242 @@ +"""Python bindings to the Zstandard (zstd) compression library (RFC-8878).""" + +__all__ = ( + # compression.zstd + 'COMPRESSION_LEVEL_DEFAULT', + 'compress', + 'CompressionParameter', + 'decompress', + 'DecompressionParameter', + 'finalize_dict', + 'get_frame_info', + 'Strategy', + 'train_dict', + + # compression.zstd._zstdfile + 'open', + 'ZstdFile', + + # _zstd + 'get_frame_size', + 'zstd_version', + 'zstd_version_info', + 'ZstdCompressor', + 'ZstdDecompressor', + 'ZstdDict', + 'ZstdError', +) + +import _zstd +import enum +from _zstd import (ZstdCompressor, ZstdDecompressor, ZstdDict, ZstdError, + get_frame_size, zstd_version) +from compression.zstd._zstdfile import ZstdFile, open, _nbytes + +# zstd_version_number is (MAJOR * 100 * 100 + MINOR * 100 + RELEASE) +zstd_version_info = (*divmod(_zstd.zstd_version_number // 100, 100), + _zstd.zstd_version_number % 100) +"""Version number of the runtime zstd library as a tuple of integers.""" + +COMPRESSION_LEVEL_DEFAULT = _zstd.ZSTD_CLEVEL_DEFAULT +"""The default compression level for Zstandard, currently '3'.""" + + +class FrameInfo: + """Information about a Zstandard frame.""" + + __slots__ = 'decompressed_size', 'dictionary_id' + + def __init__(self, decompressed_size, dictionary_id): + super().__setattr__('decompressed_size', decompressed_size) + super().__setattr__('dictionary_id', dictionary_id) + + def __repr__(self): + return (f'FrameInfo(decompressed_size={self.decompressed_size}, ' + f'dictionary_id={self.dictionary_id})') + + def __setattr__(self, name, _): + raise AttributeError(f"can't set attribute {name!r}") + + +def get_frame_info(frame_buffer): + """Get Zstandard frame information from a frame header. + + *frame_buffer* is a bytes-like object. It should start from the beginning + of a frame, and needs to include at least the frame header (6 to 18 bytes). + + The returned FrameInfo object has two attributes. + 'decompressed_size' is the size in bytes of the data in the frame when + decompressed, or None when the decompressed size is unknown. + 'dictionary_id' is an int in the range (0, 2**32). The special value 0 + means that the dictionary ID was not recorded in the frame header, + the frame may or may not need a dictionary to be decoded, + and the ID of such a dictionary is not specified. + """ + return FrameInfo(*_zstd.get_frame_info(frame_buffer)) + + +def train_dict(samples, dict_size): + """Return a ZstdDict representing a trained Zstandard dictionary. + + *samples* is an iterable of samples, where a sample is a bytes-like + object representing a file. + + *dict_size* is the dictionary's maximum size, in bytes. + """ + if not isinstance(dict_size, int): + ds_cls = type(dict_size).__qualname__ + raise TypeError(f'dict_size must be an int object, not {ds_cls!r}.') + + samples = tuple(samples) + chunks = b''.join(samples) + chunk_sizes = tuple(_nbytes(sample) for sample in samples) + if not chunks: + raise ValueError("samples contained no data; can't train dictionary.") + dict_content = _zstd.train_dict(chunks, chunk_sizes, dict_size) + return ZstdDict(dict_content) + + +def finalize_dict(zstd_dict, /, samples, dict_size, level): + """Return a ZstdDict representing a finalized Zstandard dictionary. + + Given a custom content as a basis for dictionary, and a set of samples, + finalize *zstd_dict* by adding headers and statistics according to the + Zstandard dictionary format. + + You may compose an effective dictionary content by hand, which is used as + basis dictionary, and use some samples to finalize a dictionary. The basis + dictionary may be a "raw content" dictionary. See *is_raw* in ZstdDict. + + *samples* is an iterable of samples, where a sample is a bytes-like object + representing a file. + *dict_size* is the dictionary's maximum size, in bytes. + *level* is the expected compression level. The statistics for each + compression level differ, so tuning the dictionary to the compression level + can provide improvements. + """ + + if not isinstance(zstd_dict, ZstdDict): + raise TypeError('zstd_dict argument should be a ZstdDict object.') + if not isinstance(dict_size, int): + raise TypeError('dict_size argument should be an int object.') + if not isinstance(level, int): + raise TypeError('level argument should be an int object.') + + samples = tuple(samples) + chunks = b''.join(samples) + chunk_sizes = tuple(_nbytes(sample) for sample in samples) + if not chunks: + raise ValueError("The samples are empty content, can't finalize the " + "dictionary.") + dict_content = _zstd.finalize_dict(zstd_dict.dict_content, chunks, + chunk_sizes, dict_size, level) + return ZstdDict(dict_content) + + +def compress(data, level=None, options=None, zstd_dict=None): + """Return Zstandard compressed *data* as bytes. + + *level* is an int specifying the compression level to use, defaulting to + COMPRESSION_LEVEL_DEFAULT ('3'). + *options* is a dict object that contains advanced compression + parameters. See CompressionParameter for more on options. + *zstd_dict* is a ZstdDict object, a pre-trained Zstandard dictionary. See + the function train_dict for how to train a ZstdDict on sample data. + + For incremental compression, use a ZstdCompressor instead. + """ + comp = ZstdCompressor(level=level, options=options, zstd_dict=zstd_dict) + return comp.compress(data, mode=ZstdCompressor.FLUSH_FRAME) + + +def decompress(data, zstd_dict=None, options=None): + """Decompress one or more frames of Zstandard compressed *data*. + + *zstd_dict* is a ZstdDict object, a pre-trained Zstandard dictionary. See + the function train_dict for how to train a ZstdDict on sample data. + *options* is a dict object that contains advanced compression + parameters. See DecompressionParameter for more on options. + + For incremental decompression, use a ZstdDecompressor instead. + """ + results = [] + while True: + decomp = ZstdDecompressor(options=options, zstd_dict=zstd_dict) + results.append(decomp.decompress(data)) + if not decomp.eof: + raise ZstdError('Compressed data ended before the ' + 'end-of-stream marker was reached') + data = decomp.unused_data + if not data: + break + return b''.join(results) + + +class CompressionParameter(enum.IntEnum): + """Compression parameters.""" + + compression_level = _zstd.ZSTD_c_compressionLevel + window_log = _zstd.ZSTD_c_windowLog + hash_log = _zstd.ZSTD_c_hashLog + chain_log = _zstd.ZSTD_c_chainLog + search_log = _zstd.ZSTD_c_searchLog + min_match = _zstd.ZSTD_c_minMatch + target_length = _zstd.ZSTD_c_targetLength + strategy = _zstd.ZSTD_c_strategy + + enable_long_distance_matching = _zstd.ZSTD_c_enableLongDistanceMatching + ldm_hash_log = _zstd.ZSTD_c_ldmHashLog + ldm_min_match = _zstd.ZSTD_c_ldmMinMatch + ldm_bucket_size_log = _zstd.ZSTD_c_ldmBucketSizeLog + ldm_hash_rate_log = _zstd.ZSTD_c_ldmHashRateLog + + content_size_flag = _zstd.ZSTD_c_contentSizeFlag + checksum_flag = _zstd.ZSTD_c_checksumFlag + dict_id_flag = _zstd.ZSTD_c_dictIDFlag + + nb_workers = _zstd.ZSTD_c_nbWorkers + job_size = _zstd.ZSTD_c_jobSize + overlap_log = _zstd.ZSTD_c_overlapLog + + def bounds(self): + """Return the (lower, upper) int bounds of a compression parameter. + + Both the lower and upper bounds are inclusive. + """ + return _zstd.get_param_bounds(self.value, is_compress=True) + + +class DecompressionParameter(enum.IntEnum): + """Decompression parameters.""" + + window_log_max = _zstd.ZSTD_d_windowLogMax + + def bounds(self): + """Return the (lower, upper) int bounds of a decompression parameter. + + Both the lower and upper bounds are inclusive. + """ + return _zstd.get_param_bounds(self.value, is_compress=False) + + +class Strategy(enum.IntEnum): + """Compression strategies, listed from fastest to strongest. + + Note that new strategies might be added in the future. + Only the order (from fast to strong) is guaranteed, + the numeric value might change. + """ + + fast = _zstd.ZSTD_fast + dfast = _zstd.ZSTD_dfast + greedy = _zstd.ZSTD_greedy + lazy = _zstd.ZSTD_lazy + lazy2 = _zstd.ZSTD_lazy2 + btlazy2 = _zstd.ZSTD_btlazy2 + btopt = _zstd.ZSTD_btopt + btultra = _zstd.ZSTD_btultra + btultra2 = _zstd.ZSTD_btultra2 + + +# Check validity of the CompressionParameter & DecompressionParameter types +_zstd.set_parameter_types(CompressionParameter, DecompressionParameter) diff --git a/micromamba_root/Lib/compression/zstd/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/compression/zstd/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79196e928d6aa205b2e104a7f80857dab5c46254 Binary files /dev/null and b/micromamba_root/Lib/compression/zstd/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/zstd/__pycache__/_zstdfile.cpython-314.pyc b/micromamba_root/Lib/compression/zstd/__pycache__/_zstdfile.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..99d78a79e126ec5c029c3c3c5686c21cbc5972b6 Binary files /dev/null and b/micromamba_root/Lib/compression/zstd/__pycache__/_zstdfile.cpython-314.pyc differ diff --git a/micromamba_root/Lib/compression/zstd/_zstdfile.py b/micromamba_root/Lib/compression/zstd/_zstdfile.py new file mode 100644 index 0000000000000000000000000000000000000000..d709f5efc658fa45aaba751081781ceee8a69b3b --- /dev/null +++ b/micromamba_root/Lib/compression/zstd/_zstdfile.py @@ -0,0 +1,345 @@ +import io +from os import PathLike +from _zstd import ZstdCompressor, ZstdDecompressor, ZSTD_DStreamOutSize +from compression._common import _streams + +__all__ = ('ZstdFile', 'open') + +_MODE_CLOSED = 0 +_MODE_READ = 1 +_MODE_WRITE = 2 + + +def _nbytes(dat, /): + if isinstance(dat, (bytes, bytearray)): + return len(dat) + with memoryview(dat) as mv: + return mv.nbytes + + +class ZstdFile(_streams.BaseStream): + """A file-like object providing transparent Zstandard (de)compression. + + A ZstdFile can act as a wrapper for an existing file object, or refer + directly to a named file on disk. + + ZstdFile provides a *binary* file interface. Data is read and returned as + bytes, and may only be written to objects that support the Buffer Protocol. + """ + + FLUSH_BLOCK = ZstdCompressor.FLUSH_BLOCK + FLUSH_FRAME = ZstdCompressor.FLUSH_FRAME + + def __init__(self, file, /, mode='r', *, + level=None, options=None, zstd_dict=None): + """Open a Zstandard compressed file in binary mode. + + *file* can be either an file-like object, or a file name to open. + + *mode* can be 'r' for reading (default), 'w' for (over)writing, 'x' for + creating exclusively, or 'a' for appending. These can equivalently be + given as 'rb', 'wb', 'xb' and 'ab' respectively. + + *level* is an optional int specifying the compression level to use, + or COMPRESSION_LEVEL_DEFAULT if not given. + + *options* is an optional dict for advanced compression parameters. + See CompressionParameter and DecompressionParameter for the possible + options. + + *zstd_dict* is an optional ZstdDict object, a pre-trained Zstandard + dictionary. See train_dict() to train ZstdDict on sample data. + """ + self._fp = None + self._close_fp = False + self._mode = _MODE_CLOSED + self._buffer = None + + if not isinstance(mode, str): + raise ValueError('mode must be a str') + if options is not None and not isinstance(options, dict): + raise TypeError('options must be a dict or None') + mode = mode.removesuffix('b') # handle rb, wb, xb, ab + if mode == 'r': + if level is not None: + raise TypeError('level is illegal in read mode') + self._mode = _MODE_READ + elif mode in {'w', 'a', 'x'}: + if level is not None and not isinstance(level, int): + raise TypeError('level must be int or None') + self._mode = _MODE_WRITE + self._compressor = ZstdCompressor(level=level, options=options, + zstd_dict=zstd_dict) + self._pos = 0 + else: + raise ValueError(f'Invalid mode: {mode!r}') + + if isinstance(file, (str, bytes, PathLike)): + self._fp = io.open(file, f'{mode}b') + self._close_fp = True + elif ((mode == 'r' and hasattr(file, 'read')) + or (mode != 'r' and hasattr(file, 'write'))): + self._fp = file + else: + raise TypeError('file must be a file-like object ' + 'or a str, bytes, or PathLike object') + + if self._mode == _MODE_READ: + raw = _streams.DecompressReader( + self._fp, + ZstdDecompressor, + zstd_dict=zstd_dict, + options=options, + ) + self._buffer = io.BufferedReader(raw) + + def close(self): + """Flush and close the file. + + May be called multiple times. Once the file has been closed, + any other operation on it will raise ValueError. + """ + if self._fp is None: + return + try: + if self._mode == _MODE_READ: + if getattr(self, '_buffer', None): + self._buffer.close() + self._buffer = None + elif self._mode == _MODE_WRITE: + self.flush(self.FLUSH_FRAME) + self._compressor = None + finally: + self._mode = _MODE_CLOSED + try: + if self._close_fp: + self._fp.close() + finally: + self._fp = None + self._close_fp = False + + def write(self, data, /): + """Write a bytes-like object *data* to the file. + + Returns the number of uncompressed bytes written, which is + always the length of data in bytes. Note that due to buffering, + the file on disk may not reflect the data written until .flush() + or .close() is called. + """ + self._check_can_write() + + length = _nbytes(data) + + compressed = self._compressor.compress(data) + self._fp.write(compressed) + self._pos += length + return length + + def flush(self, mode=FLUSH_BLOCK): + """Flush remaining data to the underlying stream. + + The mode argument can be FLUSH_BLOCK or FLUSH_FRAME. Abuse of this + method will reduce compression ratio, use it only when necessary. + + If the program is interrupted afterwards, all data can be recovered. + To ensure saving to disk, also need to use os.fsync(fd). + + This method does nothing in reading mode. + """ + if self._mode == _MODE_READ: + return + self._check_not_closed() + if mode not in {self.FLUSH_BLOCK, self.FLUSH_FRAME}: + raise ValueError('Invalid mode argument, expected either ' + 'ZstdFile.FLUSH_FRAME or ' + 'ZstdFile.FLUSH_BLOCK') + if self._compressor.last_mode == mode: + return + # Flush zstd block/frame, and write. + data = self._compressor.flush(mode) + self._fp.write(data) + if hasattr(self._fp, 'flush'): + self._fp.flush() + + def read(self, size=-1): + """Read up to size uncompressed bytes from the file. + + If size is negative or omitted, read until EOF is reached. + Returns b'' if the file is already at EOF. + """ + if size is None: + size = -1 + self._check_can_read() + return self._buffer.read(size) + + def read1(self, size=-1): + """Read up to size uncompressed bytes, while trying to avoid + making multiple reads from the underlying stream. Reads up to a + buffer's worth of data if size is negative. + + Returns b'' if the file is at EOF. + """ + self._check_can_read() + if size < 0: + # Note this should *not* be io.DEFAULT_BUFFER_SIZE. + # ZSTD_DStreamOutSize is the minimum amount to read guaranteeing + # a full block is read. + size = ZSTD_DStreamOutSize + return self._buffer.read1(size) + + def readinto(self, b): + """Read bytes into b. + + Returns the number of bytes read (0 for EOF). + """ + self._check_can_read() + return self._buffer.readinto(b) + + def readinto1(self, b): + """Read bytes into b, while trying to avoid making multiple reads + from the underlying stream. + + Returns the number of bytes read (0 for EOF). + """ + self._check_can_read() + return self._buffer.readinto1(b) + + def readline(self, size=-1): + """Read a line of uncompressed bytes from the file. + + The terminating newline (if present) is retained. If size is + non-negative, no more than size bytes will be read (in which + case the line may be incomplete). Returns b'' if already at EOF. + """ + self._check_can_read() + return self._buffer.readline(size) + + def seek(self, offset, whence=io.SEEK_SET): + """Change the file position. + + The new position is specified by offset, relative to the + position indicated by whence. Possible values for whence are: + + 0: start of stream (default): offset must not be negative + 1: current stream position + 2: end of stream; offset must not be positive + + Returns the new file position. + + Note that seeking is emulated, so depending on the arguments, + this operation may be extremely slow. + """ + self._check_can_read() + + # BufferedReader.seek() checks seekable + return self._buffer.seek(offset, whence) + + def peek(self, size=-1): + """Return buffered data without advancing the file position. + + Always returns at least one byte of data, unless at EOF. + The exact number of bytes returned is unspecified. + """ + # Relies on the undocumented fact that BufferedReader.peek() always + # returns at least one byte (except at EOF) + self._check_can_read() + return self._buffer.peek(size) + + def __next__(self): + if ret := self._buffer.readline(): + return ret + raise StopIteration + + def tell(self): + """Return the current file position.""" + self._check_not_closed() + if self._mode == _MODE_READ: + return self._buffer.tell() + elif self._mode == _MODE_WRITE: + return self._pos + + def fileno(self): + """Return the file descriptor for the underlying file.""" + self._check_not_closed() + return self._fp.fileno() + + @property + def name(self): + self._check_not_closed() + return self._fp.name + + @property + def mode(self): + return 'wb' if self._mode == _MODE_WRITE else 'rb' + + @property + def closed(self): + """True if this file is closed.""" + return self._mode == _MODE_CLOSED + + def seekable(self): + """Return whether the file supports seeking.""" + return self.readable() and self._buffer.seekable() + + def readable(self): + """Return whether the file was opened for reading.""" + self._check_not_closed() + return self._mode == _MODE_READ + + def writable(self): + """Return whether the file was opened for writing.""" + self._check_not_closed() + return self._mode == _MODE_WRITE + + +def open(file, /, mode='rb', *, level=None, options=None, zstd_dict=None, + encoding=None, errors=None, newline=None): + """Open a Zstandard compressed file in binary or text mode. + + file can be either a file name (given as a str, bytes, or PathLike object), + in which case the named file is opened, or it can be an existing file object + to read from or write to. + + The mode parameter can be 'r', 'rb' (default), 'w', 'wb', 'x', 'xb', 'a', + 'ab' for binary mode, or 'rt', 'wt', 'xt', 'at' for text mode. + + The level, options, and zstd_dict parameters specify the settings the same + as ZstdFile. + + When using read mode (decompression), the options parameter is a dict + representing advanced decompression options. The level parameter is not + supported in this case. When using write mode (compression), only one of + level, an int representing the compression level, or options, a dict + representing advanced compression options, may be passed. In both modes, + zstd_dict is a ZstdDict instance containing a trained Zstandard dictionary. + + For binary mode, this function is equivalent to the ZstdFile constructor: + ZstdFile(filename, mode, ...). In this case, the encoding, errors and + newline parameters must not be provided. + + For text mode, an ZstdFile object is created, and wrapped in an + io.TextIOWrapper instance with the specified encoding, error handling + behavior, and line ending(s). + """ + + text_mode = 't' in mode + mode = mode.replace('t', '') + + if text_mode: + if 'b' in mode: + raise ValueError(f'Invalid mode: {mode!r}') + else: + if encoding is not None: + raise ValueError('Argument "encoding" not supported in binary mode') + if errors is not None: + raise ValueError('Argument "errors" not supported in binary mode') + if newline is not None: + raise ValueError('Argument "newline" not supported in binary mode') + + binary_file = ZstdFile(file, mode, level=level, options=options, + zstd_dict=zstd_dict) + + if text_mode: + return io.TextIOWrapper(binary_file, encoding, errors, newline) + else: + return binary_file diff --git a/micromamba_root/Lib/concurrent/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/concurrent/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17ac2ac381e16ae104a822727075cd21f8e15bd8 Binary files /dev/null and b/micromamba_root/Lib/concurrent/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/__init__.py b/micromamba_root/Lib/concurrent/futures/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d6ac4b3e0b675f60cfdaa949ddba883a160298c8 --- /dev/null +++ b/micromamba_root/Lib/concurrent/futures/__init__.py @@ -0,0 +1,65 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Execute computations asynchronously using threads or processes.""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +from concurrent.futures._base import (FIRST_COMPLETED, + FIRST_EXCEPTION, + ALL_COMPLETED, + CancelledError, + TimeoutError, + InvalidStateError, + BrokenExecutor, + Future, + Executor, + wait, + as_completed) + +__all__ = [ + 'FIRST_COMPLETED', + 'FIRST_EXCEPTION', + 'ALL_COMPLETED', + 'CancelledError', + 'TimeoutError', + 'InvalidStateError', + 'BrokenExecutor', + 'Future', + 'Executor', + 'wait', + 'as_completed', + 'ProcessPoolExecutor', + 'ThreadPoolExecutor', +] + + +try: + import _interpreters +except ImportError: + _interpreters = None + +if _interpreters: + __all__.append('InterpreterPoolExecutor') + + +def __dir__(): + return __all__ + ['__author__', '__doc__'] + + +def __getattr__(name): + global ProcessPoolExecutor, ThreadPoolExecutor, InterpreterPoolExecutor + + if name == 'ProcessPoolExecutor': + from .process import ProcessPoolExecutor + return ProcessPoolExecutor + + if name == 'ThreadPoolExecutor': + from .thread import ThreadPoolExecutor + return ThreadPoolExecutor + + if _interpreters and name == 'InterpreterPoolExecutor': + from .interpreter import InterpreterPoolExecutor + return InterpreterPoolExecutor + + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/micromamba_root/Lib/concurrent/futures/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/concurrent/futures/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81ad09c3be9e301e464af7678d36a93b81f9d6f9 Binary files /dev/null and b/micromamba_root/Lib/concurrent/futures/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/__pycache__/_base.cpython-314.pyc b/micromamba_root/Lib/concurrent/futures/__pycache__/_base.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41e14d40a5549c6aca3d0422a77c87474338b815 Binary files /dev/null and b/micromamba_root/Lib/concurrent/futures/__pycache__/_base.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/__pycache__/interpreter.cpython-314.pyc b/micromamba_root/Lib/concurrent/futures/__pycache__/interpreter.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9edb7d3383b3df6d8895d98e9b6b66fd80ab8373 Binary files /dev/null and b/micromamba_root/Lib/concurrent/futures/__pycache__/interpreter.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/__pycache__/process.cpython-314.pyc b/micromamba_root/Lib/concurrent/futures/__pycache__/process.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a673d761d674624ef21b969e6001cf570b8805a0 Binary files /dev/null and b/micromamba_root/Lib/concurrent/futures/__pycache__/process.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/__pycache__/thread.cpython-314.pyc b/micromamba_root/Lib/concurrent/futures/__pycache__/thread.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6530a67792bbd712e822631bf322b672ec0f9e1b Binary files /dev/null and b/micromamba_root/Lib/concurrent/futures/__pycache__/thread.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/futures/_base.py b/micromamba_root/Lib/concurrent/futures/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..d98b1ebdd584b5a331c4925c5d80fbb2e1dc9552 --- /dev/null +++ b/micromamba_root/Lib/concurrent/futures/_base.py @@ -0,0 +1,674 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +import collections +import logging +import threading +import time +import types +import weakref +from itertools import islice + +FIRST_COMPLETED = 'FIRST_COMPLETED' +FIRST_EXCEPTION = 'FIRST_EXCEPTION' +ALL_COMPLETED = 'ALL_COMPLETED' +_AS_COMPLETED = '_AS_COMPLETED' + +# Possible future states (for internal use by the futures package). +PENDING = 'PENDING' +RUNNING = 'RUNNING' +# The future was cancelled by the user... +CANCELLED = 'CANCELLED' +# ...and _Waiter.add_cancelled() was called by a worker. +CANCELLED_AND_NOTIFIED = 'CANCELLED_AND_NOTIFIED' +FINISHED = 'FINISHED' + +_STATE_TO_DESCRIPTION_MAP = { + PENDING: "pending", + RUNNING: "running", + CANCELLED: "cancelled", + CANCELLED_AND_NOTIFIED: "cancelled", + FINISHED: "finished" +} + +# Logger for internal use by the futures package. +LOGGER = logging.getLogger("concurrent.futures") + +class Error(Exception): + """Base class for all future-related exceptions.""" + pass + +class CancelledError(Error): + """The Future was cancelled.""" + pass + +TimeoutError = TimeoutError # make local alias for the standard exception + +class InvalidStateError(Error): + """The operation is not allowed in this state.""" + pass + +class _Waiter(object): + """Provides the event that wait() and as_completed() block on.""" + def __init__(self): + self.event = threading.Event() + self.finished_futures = [] + + def add_result(self, future): + self.finished_futures.append(future) + + def add_exception(self, future): + self.finished_futures.append(future) + + def add_cancelled(self, future): + self.finished_futures.append(future) + +class _AsCompletedWaiter(_Waiter): + """Used by as_completed().""" + + def __init__(self): + super(_AsCompletedWaiter, self).__init__() + self.lock = threading.Lock() + + def add_result(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_result(future) + self.event.set() + + def add_exception(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_exception(future) + self.event.set() + + def add_cancelled(self, future): + with self.lock: + super(_AsCompletedWaiter, self).add_cancelled(future) + self.event.set() + +class _FirstCompletedWaiter(_Waiter): + """Used by wait(return_when=FIRST_COMPLETED).""" + + def add_result(self, future): + super().add_result(future) + self.event.set() + + def add_exception(self, future): + super().add_exception(future) + self.event.set() + + def add_cancelled(self, future): + super().add_cancelled(future) + self.event.set() + +class _AllCompletedWaiter(_Waiter): + """Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED).""" + + def __init__(self, num_pending_calls, stop_on_exception): + self.num_pending_calls = num_pending_calls + self.stop_on_exception = stop_on_exception + self.lock = threading.Lock() + super().__init__() + + def _decrement_pending_calls(self): + with self.lock: + self.num_pending_calls -= 1 + if not self.num_pending_calls: + self.event.set() + + def add_result(self, future): + super().add_result(future) + self._decrement_pending_calls() + + def add_exception(self, future): + super().add_exception(future) + if self.stop_on_exception: + self.event.set() + else: + self._decrement_pending_calls() + + def add_cancelled(self, future): + super().add_cancelled(future) + self._decrement_pending_calls() + +class _AcquireFutures(object): + """A context manager that does an ordered acquire of Future conditions.""" + + def __init__(self, futures): + self.futures = sorted(futures, key=id) + + def __enter__(self): + for future in self.futures: + future._condition.acquire() + + def __exit__(self, *args): + for future in self.futures: + future._condition.release() + +def _create_and_install_waiters(fs, return_when): + if return_when == _AS_COMPLETED: + waiter = _AsCompletedWaiter() + elif return_when == FIRST_COMPLETED: + waiter = _FirstCompletedWaiter() + else: + pending_count = sum( + f._state not in [CANCELLED_AND_NOTIFIED, FINISHED] for f in fs) + + if return_when == FIRST_EXCEPTION: + waiter = _AllCompletedWaiter(pending_count, stop_on_exception=True) + elif return_when == ALL_COMPLETED: + waiter = _AllCompletedWaiter(pending_count, stop_on_exception=False) + else: + raise ValueError("Invalid return condition: %r" % return_when) + + for f in fs: + f._waiters.append(waiter) + + return waiter + + +def _yield_finished_futures(fs, waiter, ref_collect): + """ + Iterate on the list *fs*, yielding finished futures one by one in + reverse order. + Before yielding a future, *waiter* is removed from its waiters + and the future is removed from each set in the collection of sets + *ref_collect*. + + The aim of this function is to avoid keeping stale references after + the future is yielded and before the iterator resumes. + """ + while fs: + f = fs[-1] + for futures_set in ref_collect: + futures_set.remove(f) + with f._condition: + f._waiters.remove(waiter) + del f + # Careful not to keep a reference to the popped value + yield fs.pop() + + +def as_completed(fs, timeout=None): + """An iterator over the given futures that yields each as it completes. + + Args: + fs: The sequence of Futures (possibly created by different Executors) to + iterate over. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + + Returns: + An iterator that yields the given Futures as they complete (finished or + cancelled). If any given Futures are duplicated, they will be returned + once. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + """ + if timeout is not None: + end_time = timeout + time.monotonic() + + fs = set(fs) + total_futures = len(fs) + with _AcquireFutures(fs): + finished = set( + f for f in fs + if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]) + pending = fs - finished + waiter = _create_and_install_waiters(fs, _AS_COMPLETED) + finished = list(finished) + try: + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs,)) + + while pending: + if timeout is None: + wait_timeout = None + else: + wait_timeout = end_time - time.monotonic() + if wait_timeout < 0: + raise TimeoutError( + '%d (of %d) futures unfinished' % ( + len(pending), total_futures)) + + waiter.event.wait(wait_timeout) + + with waiter.lock: + finished = waiter.finished_futures + waiter.finished_futures = [] + waiter.event.clear() + + # reverse to keep finishing order + finished.reverse() + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs, pending)) + + finally: + # Remove waiter from unfinished futures + for f in fs: + with f._condition: + f._waiters.remove(waiter) + +DoneAndNotDoneFutures = collections.namedtuple( + 'DoneAndNotDoneFutures', 'done not_done') +def wait(fs, timeout=None, return_when=ALL_COMPLETED): + """Wait for the futures in the given sequence to complete. + + Args: + fs: The sequence of Futures (possibly created by different Executors) to + wait upon. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + return_when: Indicates when this function should return. The options + are: + + FIRST_COMPLETED - Return when any future finishes or is + cancelled. + FIRST_EXCEPTION - Return when any future finishes by raising an + exception. If no future raises an exception + then it is equivalent to ALL_COMPLETED. + ALL_COMPLETED - Return when all futures finish or are cancelled. + + Returns: + A named 2-tuple of sets. The first set, named 'done', contains the + futures that completed (is finished or cancelled) before the wait + completed. The second set, named 'not_done', contains uncompleted + futures. Duplicate futures given to *fs* are removed and will be + returned only once. + """ + fs = set(fs) + with _AcquireFutures(fs): + done = {f for f in fs + if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]} + not_done = fs - done + if (return_when == FIRST_COMPLETED) and done: + return DoneAndNotDoneFutures(done, not_done) + elif (return_when == FIRST_EXCEPTION) and done: + if any(f for f in done + if not f.cancelled() and f.exception() is not None): + return DoneAndNotDoneFutures(done, not_done) + + if len(done) == len(fs): + return DoneAndNotDoneFutures(done, not_done) + + waiter = _create_and_install_waiters(fs, return_when) + + waiter.event.wait(timeout) + for f in fs: + with f._condition: + f._waiters.remove(waiter) + + done.update(waiter.finished_futures) + return DoneAndNotDoneFutures(done, fs - done) + + +def _result_or_cancel(fut, timeout=None): + try: + try: + return fut.result(timeout) + finally: + fut.cancel() + finally: + # Break a reference cycle with the exception in self._exception + del fut + + +class Future(object): + """Represents the result of an asynchronous computation.""" + + def __init__(self): + """Initializes the future. Should not be called by clients.""" + self._condition = threading.Condition() + self._state = PENDING + self._result = None + self._exception = None + self._waiters = [] + self._done_callbacks = [] + + def _invoke_callbacks(self): + for callback in self._done_callbacks: + try: + callback(self) + except Exception: + LOGGER.exception('exception calling callback for %r', self) + + def __repr__(self): + with self._condition: + if self._state == FINISHED: + if self._exception: + return '<%s at %#x state=%s raised %s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state], + self._exception.__class__.__name__) + else: + return '<%s at %#x state=%s returned %s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state], + self._result.__class__.__name__) + return '<%s at %#x state=%s>' % ( + self.__class__.__name__, + id(self), + _STATE_TO_DESCRIPTION_MAP[self._state]) + + def cancel(self): + """Cancel the future if possible. + + Returns True if the future was cancelled, False otherwise. A future + cannot be cancelled if it is running or has already completed. + """ + with self._condition: + if self._state in [RUNNING, FINISHED]: + return False + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + return True + + self._state = CANCELLED + self._condition.notify_all() + + self._invoke_callbacks() + return True + + def cancelled(self): + """Return True if the future was cancelled.""" + with self._condition: + return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED] + + def running(self): + """Return True if the future is currently executing.""" + with self._condition: + return self._state == RUNNING + + def done(self): + """Return True if the future was cancelled or finished executing.""" + with self._condition: + return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED] + + def __get_result(self): + if self._exception is not None: + try: + raise self._exception + finally: + # Break a reference cycle with the exception in self._exception + self = None + else: + return self._result + + def add_done_callback(self, fn): + """Attaches a callable that will be called when the future finishes. + + Args: + fn: A callable that will be called with this future as its only + argument when the future completes or is cancelled. The callable + will always be called by a thread in the same process in which + it was added. If the future has already completed or been + cancelled then the callable will be called immediately. These + callables are called in the order that they were added. + """ + with self._condition: + if self._state not in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]: + self._done_callbacks.append(fn) + return + try: + fn(self) + except Exception: + LOGGER.exception('exception calling callback for %r', self) + + def result(self, timeout=None): + """Return the result of the call that the future represents. + + Args: + timeout: The number of seconds to wait for the result if the future + isn't done. If None, then there is no limit on the wait time. + + Returns: + The result of the call that the future represents. + + Raises: + CancelledError: If the future was cancelled. + TimeoutError: If the future didn't finish executing before the given + timeout. + Exception: If the call raised then that exception will be raised. + """ + try: + with self._condition: + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self.__get_result() + + self._condition.wait(timeout) + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self.__get_result() + else: + raise TimeoutError() + finally: + # Break a reference cycle with the exception in self._exception + self = None + + def exception(self, timeout=None): + """Return the exception raised by the call that the future represents. + + Args: + timeout: The number of seconds to wait for the exception if the + future isn't done. If None, then there is no limit on the wait + time. + + Returns: + The exception raised by the call that the future represents or None + if the call completed without raising. + + Raises: + CancelledError: If the future was cancelled. + TimeoutError: If the future didn't finish executing before the given + timeout. + """ + + with self._condition: + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self._exception + + self._condition.wait(timeout) + + if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: + raise CancelledError() + elif self._state == FINISHED: + return self._exception + else: + raise TimeoutError() + + # The following methods should only be used by Executors and in tests. + def set_running_or_notify_cancel(self): + """Mark the future as running or process any cancel notifications. + + Should only be used by Executor implementations and unit tests. + + If the future has been cancelled (cancel() was called and returned + True) then any threads waiting on the future completing (though calls + to as_completed() or wait()) are notified and False is returned. + + If the future was not cancelled then it is put in the running state + (future calls to running() will return True) and True is returned. + + This method should be called by Executor implementations before + executing the work associated with this future. If this method returns + False then the work should not be executed. + + Returns: + False if the Future was cancelled, True otherwise. + + Raises: + RuntimeError: if this method was already called or if set_result() + or set_exception() was called. + """ + with self._condition: + if self._state == CANCELLED: + self._state = CANCELLED_AND_NOTIFIED + for waiter in self._waiters: + waiter.add_cancelled(self) + # self._condition.notify_all() is not necessary because + # self.cancel() triggers a notification. + return False + elif self._state == PENDING: + self._state = RUNNING + return True + else: + LOGGER.critical('Future %s in unexpected state: %s', + id(self), + self._state) + raise RuntimeError('Future in unexpected state') + + def set_result(self, result): + """Sets the return value of work associated with the future. + + Should only be used by Executor implementations and unit tests. + """ + with self._condition: + if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}: + raise InvalidStateError('{}: {!r}'.format(self._state, self)) + self._result = result + self._state = FINISHED + for waiter in self._waiters: + waiter.add_result(self) + self._condition.notify_all() + self._invoke_callbacks() + + def set_exception(self, exception): + """Sets the result of the future as being the given exception. + + Should only be used by Executor implementations and unit tests. + """ + with self._condition: + if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}: + raise InvalidStateError('{}: {!r}'.format(self._state, self)) + self._exception = exception + self._state = FINISHED + for waiter in self._waiters: + waiter.add_exception(self) + self._condition.notify_all() + self._invoke_callbacks() + + __class_getitem__ = classmethod(types.GenericAlias) + +class Executor(object): + """This is an abstract base class for concrete asynchronous executors.""" + + def submit(self, fn, /, *args, **kwargs): + """Submits a callable to be executed with the given arguments. + + Schedules the callable to be executed as fn(*args, **kwargs) and returns + a Future instance representing the execution of the callable. + + Returns: + A Future representing the given call. + """ + raise NotImplementedError() + + def map(self, fn, *iterables, timeout=None, chunksize=1, buffersize=None): + """Returns an iterator equivalent to map(fn, iter). + + Args: + fn: A callable that will take as many arguments as there are + passed iterables. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + chunksize: The size of the chunks the iterable will be broken into + before being passed to a child process. This argument is only + used by ProcessPoolExecutor; it is ignored by + ThreadPoolExecutor. + buffersize: The number of submitted tasks whose results have not + yet been yielded. If the buffer is full, iteration over the + iterables pauses until a result is yielded from the buffer. + If None, all input elements are eagerly collected, and a task is + submitted for each. + + Returns: + An iterator equivalent to: map(func, *iterables) but the calls may + be evaluated out-of-order. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + Exception: If fn(*args) raises for any values. + """ + if buffersize is not None and not isinstance(buffersize, int): + raise TypeError("buffersize must be an integer or None") + if buffersize is not None and buffersize < 1: + raise ValueError("buffersize must be None or > 0") + + if timeout is not None: + end_time = timeout + time.monotonic() + + zipped_iterables = zip(*iterables) + if buffersize: + fs = collections.deque( + self.submit(fn, *args) for args in islice(zipped_iterables, buffersize) + ) + else: + fs = [self.submit(fn, *args) for args in zipped_iterables] + + # Use a weak reference to ensure that the executor can be garbage + # collected independently of the result_iterator closure. + executor_weakref = weakref.ref(self) + + # Yield must be hidden in closure so that the futures are submitted + # before the first iterator value is required. + def result_iterator(): + try: + # reverse to keep finishing order + fs.reverse() + while fs: + if ( + buffersize + and (executor := executor_weakref()) + and (args := next(zipped_iterables, None)) + ): + fs.appendleft(executor.submit(fn, *args)) + # Careful not to keep a reference to the popped future + if timeout is None: + yield _result_or_cancel(fs.pop()) + else: + yield _result_or_cancel(fs.pop(), end_time - time.monotonic()) + finally: + for future in fs: + future.cancel() + return result_iterator() + + def shutdown(self, wait=True, *, cancel_futures=False): + """Clean-up the resources associated with the Executor. + + It is safe to call this method several times. Otherwise, no other + methods can be called after this one. + + Args: + wait: If True then shutdown will not return until all running + futures have finished executing and the resources used by the + executor have been reclaimed. + cancel_futures: If True then shutdown will cancel all pending + futures. Futures that are completed or running will not be + cancelled. + """ + pass + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown(wait=True) + return False + + +class BrokenExecutor(RuntimeError): + """ + Raised when a executor has become non-functional after a severe failure. + """ diff --git a/micromamba_root/Lib/concurrent/futures/interpreter.py b/micromamba_root/Lib/concurrent/futures/interpreter.py new file mode 100644 index 0000000000000000000000000000000000000000..85c1da2c7228943cc168d7430e2ce06898eb6282 --- /dev/null +++ b/micromamba_root/Lib/concurrent/futures/interpreter.py @@ -0,0 +1,123 @@ +"""Implements InterpreterPoolExecutor.""" + +from concurrent import interpreters +import sys +from . import thread as _thread +import traceback + + +def do_call(results, func, args, kwargs): + try: + return func(*args, **kwargs) + except BaseException as exc: + # Send the captured exception out on the results queue, + # but still leave it unhandled for the interpreter to handle. + try: + results.put(exc) + except interpreters.NotShareableError: + # The exception is not shareable. + print('exception is not shareable:', file=sys.stderr) + traceback.print_exception(exc) + results.put(None) + raise # re-raise + + +class WorkerContext(_thread.WorkerContext): + + @classmethod + def prepare(cls, initializer, initargs): + def resolve_task(fn, args, kwargs): + if isinstance(fn, str): + # XXX Circle back to this later. + raise TypeError('scripts not supported') + else: + task = (fn, args, kwargs) + return task + + if initializer is not None: + try: + initdata = resolve_task(initializer, initargs, {}) + except ValueError: + if isinstance(initializer, str) and initargs: + raise ValueError(f'an initializer script does not take args, got {initargs!r}') + raise # re-raise + else: + initdata = None + def create_context(): + return cls(initdata) + return create_context, resolve_task + + def __init__(self, initdata): + self.initdata = initdata + self.interp = None + self.results = None + + def __del__(self): + if self.interp is not None: + self.finalize() + + def initialize(self): + assert self.interp is None, self.interp + self.interp = interpreters.create() + try: + maxsize = 0 + self.results = interpreters.create_queue(maxsize) + + if self.initdata: + self.run(self.initdata) + except BaseException: + self.finalize() + raise # re-raise + + def finalize(self): + interp = self.interp + results = self.results + self.results = None + self.interp = None + if results is not None: + del results + if interp is not None: + interp.close() + + def run(self, task): + try: + return self.interp.call(do_call, self.results, *task) + except interpreters.ExecutionFailed as wrapper: + # Wait for the exception data to show up. + exc = self.results.get() + if exc is None: + # The exception must have been not shareable. + raise # re-raise + raise exc from wrapper + + +class BrokenInterpreterPool(_thread.BrokenThreadPool): + """ + Raised when a worker thread in an InterpreterPoolExecutor failed initializing. + """ + + +class InterpreterPoolExecutor(_thread.ThreadPoolExecutor): + + BROKEN = BrokenInterpreterPool + + @classmethod + def prepare_context(cls, initializer, initargs): + return WorkerContext.prepare(initializer, initargs) + + def __init__(self, max_workers=None, thread_name_prefix='', + initializer=None, initargs=()): + """Initializes a new InterpreterPoolExecutor instance. + + Args: + max_workers: The maximum number of interpreters that can be used to + execute the given calls. + thread_name_prefix: An optional name prefix to give our threads. + initializer: A callable or script used to initialize + each worker interpreter. + initargs: A tuple of arguments to pass to the initializer. + """ + thread_name_prefix = (thread_name_prefix or + (f"InterpreterPoolExecutor-{self._counter()}")) + super().__init__(max_workers, thread_name_prefix, + initializer, initargs) diff --git a/micromamba_root/Lib/concurrent/futures/process.py b/micromamba_root/Lib/concurrent/futures/process.py new file mode 100644 index 0000000000000000000000000000000000000000..a14650bf5fa47cd65037b078a4e6572ace4480c5 --- /dev/null +++ b/micromamba_root/Lib/concurrent/futures/process.py @@ -0,0 +1,939 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Implements ProcessPoolExecutor. + +The following diagram and text describe the data-flow through the system: + +|======================= In-process =====================|== Out-of-process ==| + ++----------+ +----------+ +--------+ +-----------+ +---------+ +| | => | Work Ids | | | | Call Q | | Process | +| | +----------+ | | +-----------+ | Pool | +| | | ... | | | | ... | +---------+ +| | | 6 | => | | => | 5, call() | => | | +| | | 7 | | | | ... | | | +| Process | | ... | | Local | +-----------+ | Process | +| Pool | +----------+ | Worker | | #1..n | +| Executor | | Thread | | | +| | +----------- + | | +-----------+ | | +| | <=> | Work Items | <=> | | <= | Result Q | <= | | +| | +------------+ | | +-----------+ | | +| | | 6: call() | | | | ... | | | +| | | future | | | | 4, result | | | +| | | ... | | | | 3, except | | | ++----------+ +------------+ +--------+ +-----------+ +---------+ + +Executor.submit() called: +- creates a uniquely numbered _WorkItem and adds it to the "Work Items" dict +- adds the id of the _WorkItem to the "Work Ids" queue + +Local worker thread: +- reads work ids from the "Work Ids" queue and looks up the corresponding + WorkItem from the "Work Items" dict: if the work item has been cancelled then + it is simply removed from the dict, otherwise it is repackaged as a + _CallItem and put in the "Call Q". New _CallItems are put in the "Call Q" + until "Call Q" is full. NOTE: the size of the "Call Q" is kept small because + calls placed in the "Call Q" can no longer be cancelled with Future.cancel(). +- reads _ResultItems from "Result Q", updates the future stored in the + "Work Items" dict and deletes the dict entry + +Process #1..n: +- reads _CallItems from "Call Q", executes the calls, and puts the resulting + _ResultItems in "Result Q" +""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +import os +from concurrent.futures import _base +import queue +import multiprocessing as mp +# This import is required to load the multiprocessing.connection submodule +# so that it can be accessed later as `mp.connection` +import multiprocessing.connection +from multiprocessing.queues import Queue +import threading +import weakref +from functools import partial +import itertools +import sys +from traceback import format_exception + + +_threads_wakeups = weakref.WeakKeyDictionary() +_global_shutdown = False + + +class _ThreadWakeup: + def __init__(self): + self._closed = False + self._lock = threading.Lock() + self._reader, self._writer = mp.Pipe(duplex=False) + + def close(self): + # Please note that we do not take the self._lock when + # calling clear() (to avoid deadlocking) so this method can + # only be called safely from the same thread as all calls to + # clear() even if you hold the lock. Otherwise we + # might try to read from the closed pipe. + with self._lock: + if not self._closed: + self._closed = True + self._writer.close() + self._reader.close() + + def wakeup(self): + with self._lock: + if not self._closed: + self._writer.send_bytes(b"") + + def clear(self): + if self._closed: + raise RuntimeError('operation on closed _ThreadWakeup') + while self._reader.poll(): + self._reader.recv_bytes() + + +def _python_exit(): + global _global_shutdown + _global_shutdown = True + items = list(_threads_wakeups.items()) + for _, thread_wakeup in items: + # call not protected by ProcessPoolExecutor._shutdown_lock + thread_wakeup.wakeup() + for t, _ in items: + t.join() + +# Register for `_python_exit()` to be called just before joining all +# non-daemon threads. This is used instead of `atexit.register()` for +# compatibility with subinterpreters, which no longer support daemon threads. +# See bpo-39812 for context. +threading._register_atexit(_python_exit) + +# Controls how many more calls than processes will be queued in the call queue. +# A smaller number will mean that processes spend more time idle waiting for +# work while a larger number will make Future.cancel() succeed less frequently +# (Futures in the call queue cannot be cancelled). +EXTRA_QUEUED_CALLS = 1 + + +# On Windows, WaitForMultipleObjects is used to wait for processes to finish. +# It can wait on, at most, 63 objects. There is an overhead of two objects: +# - the result queue reader +# - the thread wakeup reader +_MAX_WINDOWS_WORKERS = 63 - 2 + +# Hack to embed stringification of remote traceback in local traceback + +class _RemoteTraceback(Exception): + def __init__(self, tb): + self.tb = tb + def __str__(self): + return self.tb + +class _ExceptionWithTraceback: + def __init__(self, exc, tb): + tb = ''.join(format_exception(type(exc), exc, tb)) + self.exc = exc + # Traceback object needs to be garbage-collected as its frames + # contain references to all the objects in the exception scope + self.exc.__traceback__ = None + self.tb = '\n"""\n%s"""' % tb + def __reduce__(self): + return _rebuild_exc, (self.exc, self.tb) + +def _rebuild_exc(exc, tb): + exc.__cause__ = _RemoteTraceback(tb) + return exc + +class _WorkItem(object): + def __init__(self, future, fn, args, kwargs): + self.future = future + self.fn = fn + self.args = args + self.kwargs = kwargs + +class _ResultItem(object): + def __init__(self, work_id, exception=None, result=None, exit_pid=None): + self.work_id = work_id + self.exception = exception + self.result = result + self.exit_pid = exit_pid + +class _CallItem(object): + def __init__(self, work_id, fn, args, kwargs): + self.work_id = work_id + self.fn = fn + self.args = args + self.kwargs = kwargs + + +class _SafeQueue(Queue): + """Safe Queue set exception to the future object linked to a job""" + def __init__(self, max_size=0, *, ctx, pending_work_items, thread_wakeup): + self.pending_work_items = pending_work_items + self.thread_wakeup = thread_wakeup + super().__init__(max_size, ctx=ctx) + + def _on_queue_feeder_error(self, e, obj): + if isinstance(obj, _CallItem): + tb = format_exception(type(e), e, e.__traceback__) + e.__cause__ = _RemoteTraceback('\n"""\n{}"""'.format(''.join(tb))) + work_item = self.pending_work_items.pop(obj.work_id, None) + self.thread_wakeup.wakeup() + # work_item can be None if another process terminated. In this + # case, the executor_manager_thread fails all work_items + # with BrokenProcessPool + if work_item is not None: + work_item.future.set_exception(e) + else: + super()._on_queue_feeder_error(e, obj) + + +def _process_chunk(fn, chunk): + """ Processes a chunk of an iterable passed to map. + + Runs the function passed to map() on a chunk of the + iterable passed to map. + + This function is run in a separate process. + + """ + return [fn(*args) for args in chunk] + + +def _sendback_result(result_queue, work_id, result=None, exception=None, + exit_pid=None): + """Safely send back the given result or exception""" + try: + result_queue.put(_ResultItem(work_id, result=result, + exception=exception, exit_pid=exit_pid)) + except BaseException as e: + exc = _ExceptionWithTraceback(e, e.__traceback__) + result_queue.put(_ResultItem(work_id, exception=exc, + exit_pid=exit_pid)) + + +def _process_worker(call_queue, result_queue, initializer, initargs, max_tasks=None): + """Evaluates calls from call_queue and places the results in result_queue. + + This worker is run in a separate process. + + Args: + call_queue: A ctx.Queue of _CallItems that will be read and + evaluated by the worker. + result_queue: A ctx.Queue of _ResultItems that will written + to by the worker. + initializer: A callable initializer, or None + initargs: A tuple of args for the initializer + """ + if initializer is not None: + try: + initializer(*initargs) + except BaseException: + _base.LOGGER.critical('Exception in initializer:', exc_info=True) + # The parent will notice that the process stopped and + # mark the pool broken + return + num_tasks = 0 + exit_pid = None + while True: + call_item = call_queue.get(block=True) + if call_item is None: + # Wake up queue management thread + result_queue.put(os.getpid()) + return + + if max_tasks is not None: + num_tasks += 1 + if num_tasks >= max_tasks: + exit_pid = os.getpid() + + try: + r = call_item.fn(*call_item.args, **call_item.kwargs) + except BaseException as e: + exc = _ExceptionWithTraceback(e, e.__traceback__) + _sendback_result(result_queue, call_item.work_id, exception=exc, + exit_pid=exit_pid) + else: + _sendback_result(result_queue, call_item.work_id, result=r, + exit_pid=exit_pid) + del r + + # Liberate the resource as soon as possible, to avoid holding onto + # open files or shared memory that is not needed anymore + del call_item + + if exit_pid is not None: + return + + +class _ExecutorManagerThread(threading.Thread): + """Manages the communication between this process and the worker processes. + + The manager is run in a local thread. + + Args: + executor: A reference to the ProcessPoolExecutor that owns + this thread. A weakref will be own by the manager as well as + references to internal objects used to introspect the state of + the executor. + """ + + def __init__(self, executor): + # Store references to necessary internals of the executor. + + # A _ThreadWakeup to allow waking up the queue_manager_thread from the + # main Thread and avoid deadlocks caused by permanently locked queues. + self.thread_wakeup = executor._executor_manager_thread_wakeup + self.shutdown_lock = executor._shutdown_lock + + # A weakref.ref to the ProcessPoolExecutor that owns this thread. Used + # to determine if the ProcessPoolExecutor has been garbage collected + # and that the manager can exit. + # When the executor gets garbage collected, the weakref callback + # will wake up the queue management thread so that it can terminate + # if there is no pending work item. + def weakref_cb(_, + thread_wakeup=self.thread_wakeup, + mp_util_debug=mp.util.debug): + mp_util_debug('Executor collected: triggering callback for' + ' QueueManager wakeup') + thread_wakeup.wakeup() + + self.executor_reference = weakref.ref(executor, weakref_cb) + + # A list of the ctx.Process instances used as workers. + self.processes = executor._processes + + # A ctx.Queue that will be filled with _CallItems derived from + # _WorkItems for processing by the process workers. + self.call_queue = executor._call_queue + + # A ctx.SimpleQueue of _ResultItems generated by the process workers. + self.result_queue = executor._result_queue + + # A queue.Queue of work ids e.g. Queue([5, 6, ...]). + self.work_ids_queue = executor._work_ids + + # Maximum number of tasks a worker process can execute before + # exiting safely + self.max_tasks_per_child = executor._max_tasks_per_child + + # A dict mapping work ids to _WorkItems e.g. + # {5: <_WorkItem...>, 6: <_WorkItem...>, ...} + self.pending_work_items = executor._pending_work_items + + super().__init__() + + def run(self): + # Main loop for the executor manager thread. + + while True: + # gh-109047: During Python finalization, self.call_queue.put() + # creation of a thread can fail with RuntimeError. + try: + self.add_call_item_to_queue() + except BaseException as exc: + cause = format_exception(exc) + self.terminate_broken(cause) + return + + result_item, is_broken, cause = self.wait_result_broken_or_wakeup() + + if is_broken: + self.terminate_broken(cause) + return + if result_item is not None: + self.process_result_item(result_item) + + process_exited = result_item.exit_pid is not None + if process_exited: + p = self.processes.pop(result_item.exit_pid) + p.join() + + # Delete reference to result_item to avoid keeping references + # while waiting on new results. + del result_item + + if executor := self.executor_reference(): + if process_exited: + with self.shutdown_lock: + executor._adjust_process_count() + else: + executor._idle_worker_semaphore.release() + del executor + + if self.is_shutting_down(): + self.flag_executor_shutting_down() + + # When only canceled futures remain in pending_work_items, our + # next call to wait_result_broken_or_wakeup would hang forever. + # This makes sure we have some running futures or none at all. + self.add_call_item_to_queue() + + # Since no new work items can be added, it is safe to shutdown + # this thread if there are no pending work items. + if not self.pending_work_items: + self.join_executor_internals() + return + + def add_call_item_to_queue(self): + # Fills call_queue with _WorkItems from pending_work_items. + # This function never blocks. + while True: + if self.call_queue.full(): + return + try: + work_id = self.work_ids_queue.get(block=False) + except queue.Empty: + return + else: + work_item = self.pending_work_items[work_id] + + if work_item.future.set_running_or_notify_cancel(): + self.call_queue.put(_CallItem(work_id, + work_item.fn, + work_item.args, + work_item.kwargs), + block=True) + else: + del self.pending_work_items[work_id] + continue + + def wait_result_broken_or_wakeup(self): + # Wait for a result to be ready in the result_queue while checking + # that all worker processes are still running, or for a wake up + # signal send. The wake up signals come either from new tasks being + # submitted, from the executor being shutdown/gc-ed, or from the + # shutdown of the python interpreter. + result_reader = self.result_queue._reader + assert not self.thread_wakeup._closed + wakeup_reader = self.thread_wakeup._reader + readers = [result_reader, wakeup_reader] + worker_sentinels = [p.sentinel for p in list(self.processes.values())] + ready = mp.connection.wait(readers + worker_sentinels) + + cause = None + is_broken = True + result_item = None + if result_reader in ready: + try: + result_item = result_reader.recv() + is_broken = False + except BaseException as exc: + cause = format_exception(exc) + + elif wakeup_reader in ready: + is_broken = False + + self.thread_wakeup.clear() + + return result_item, is_broken, cause + + def process_result_item(self, result_item): + # Process the received a result_item. This can be either the PID of a + # worker that exited gracefully or a _ResultItem + + # Received a _ResultItem so mark the future as completed. + work_item = self.pending_work_items.pop(result_item.work_id, None) + # work_item can be None if another process terminated (see above) + if work_item is not None: + if result_item.exception is not None: + work_item.future.set_exception(result_item.exception) + else: + work_item.future.set_result(result_item.result) + + def is_shutting_down(self): + # Check whether we should start shutting down the executor. + executor = self.executor_reference() + # No more work items can be added if: + # - The interpreter is shutting down OR + # - The executor that owns this worker has been collected OR + # - The executor that owns this worker has been shutdown. + return (_global_shutdown or executor is None + or executor._shutdown_thread) + + def _terminate_broken(self, cause): + # Terminate the executor because it is in a broken state. The cause + # argument can be used to display more information on the error that + # lead the executor into becoming broken. + + # Mark the process pool broken so that submits fail right now. + executor = self.executor_reference() + if executor is not None: + executor._broken = ('A child process terminated ' + 'abruptly, the process pool is not ' + 'usable anymore') + executor._shutdown_thread = True + executor = None + + # All pending tasks are to be marked failed with the following + # BrokenProcessPool error + bpe = BrokenProcessPool("A process in the process pool was " + "terminated abruptly while the future was " + "running or pending.") + if cause is not None: + bpe.__cause__ = _RemoteTraceback( + f"\n'''\n{''.join(cause)}'''") + + # Mark pending tasks as failed. + for work_id, work_item in self.pending_work_items.items(): + try: + work_item.future.set_exception(bpe) + except _base.InvalidStateError: + # set_exception() fails if the future is cancelled: ignore it. + # Trying to check if the future is cancelled before calling + # set_exception() would leave a race condition if the future is + # cancelled between the check and set_exception(). + pass + # Delete references to object. See issue16284 + del work_item + self.pending_work_items.clear() + + # Terminate remaining workers forcibly: the queues or their + # locks may be in a dirty state and block forever. + for p in self.processes.values(): + p.terminate() + + self.call_queue._terminate_broken() + + # clean up resources + self._join_executor_internals(broken=True) + + def terminate_broken(self, cause): + with self.shutdown_lock: + self._terminate_broken(cause) + + def flag_executor_shutting_down(self): + # Flag the executor as shutting down and cancel remaining tasks if + # requested as early as possible if it is not gc-ed yet. + executor = self.executor_reference() + if executor is not None: + executor._shutdown_thread = True + # Cancel pending work items if requested. + if executor._cancel_pending_futures: + # Cancel all pending futures and update pending_work_items + # to only have futures that are currently running. + new_pending_work_items = {} + for work_id, work_item in self.pending_work_items.items(): + if not work_item.future.cancel(): + new_pending_work_items[work_id] = work_item + self.pending_work_items = new_pending_work_items + # Drain work_ids_queue since we no longer need to + # add items to the call queue. + while True: + try: + self.work_ids_queue.get_nowait() + except queue.Empty: + break + # Make sure we do this only once to not waste time looping + # on running processes over and over. + executor._cancel_pending_futures = False + + def shutdown_workers(self): + n_children_to_stop = self.get_n_children_alive() + n_sentinels_sent = 0 + # Send the right number of sentinels, to make sure all children are + # properly terminated. + while (n_sentinels_sent < n_children_to_stop + and self.get_n_children_alive() > 0): + for i in range(n_children_to_stop - n_sentinels_sent): + try: + self.call_queue.put_nowait(None) + n_sentinels_sent += 1 + except queue.Full: + break + + def join_executor_internals(self): + with self.shutdown_lock: + self._join_executor_internals() + + def _join_executor_internals(self, broken=False): + # If broken, call_queue was closed and so can no longer be used. + if not broken: + self.shutdown_workers() + + # Release the queue's resources as soon as possible. + self.call_queue.close() + self.call_queue.join_thread() + self.thread_wakeup.close() + + # If .join() is not called on the created processes then + # some ctx.Queue methods may deadlock on Mac OS X. + for p in self.processes.values(): + if broken: + p.terminate() + p.join() + + def get_n_children_alive(self): + # This is an upper bound on the number of children alive. + return sum(p.is_alive() for p in self.processes.values()) + + +_system_limits_checked = False +_system_limited = None + + +def _check_system_limits(): + global _system_limits_checked, _system_limited + if _system_limits_checked: + if _system_limited: + raise NotImplementedError(_system_limited) + _system_limits_checked = True + try: + import multiprocessing.synchronize # noqa: F401 + except ImportError: + _system_limited = ( + "This Python build lacks multiprocessing.synchronize, usually due " + "to named semaphores being unavailable on this platform." + ) + raise NotImplementedError(_system_limited) + try: + nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") + except (AttributeError, ValueError): + # sysconf not available or setting not available + return + if nsems_max == -1: + # indetermined limit, assume that limit is determined + # by available memory only + return + if nsems_max >= 256: + # minimum number of semaphores available + # according to POSIX + return + _system_limited = ("system provides too few semaphores (%d" + " available, 256 necessary)" % nsems_max) + raise NotImplementedError(_system_limited) + + +def _chain_from_iterable_of_lists(iterable): + """ + Specialized implementation of itertools.chain.from_iterable. + Each item in *iterable* should be a list. This function is + careful not to keep references to yielded objects. + """ + for element in iterable: + element.reverse() + while element: + yield element.pop() + + +class BrokenProcessPool(_base.BrokenExecutor): + """ + Raised when a process in a ProcessPoolExecutor terminated abruptly + while a future was in the running state. + """ + +_TERMINATE = "terminate" +_KILL = "kill" + +_SHUTDOWN_CALLBACK_OPERATION = { + _TERMINATE, + _KILL +} + + +class ProcessPoolExecutor(_base.Executor): + def __init__(self, max_workers=None, mp_context=None, + initializer=None, initargs=(), *, max_tasks_per_child=None): + """Initializes a new ProcessPoolExecutor instance. + + Args: + max_workers: The maximum number of processes that can be used to + execute the given calls. If None or not given then as many + worker processes will be created as the machine has processors. + mp_context: A multiprocessing context to launch the workers created + using the multiprocessing.get_context('start method') API. This + object should provide SimpleQueue, Queue and Process. + initializer: A callable used to initialize worker processes. + initargs: A tuple of arguments to pass to the initializer. + max_tasks_per_child: The maximum number of tasks a worker process + can complete before it will exit and be replaced with a fresh + worker process. The default of None means worker process will + live as long as the executor. Requires a non-'fork' mp_context + start method. When given, we default to using 'spawn' if no + mp_context is supplied. + """ + _check_system_limits() + + if max_workers is None: + self._max_workers = os.process_cpu_count() or 1 + if sys.platform == 'win32': + self._max_workers = min(_MAX_WINDOWS_WORKERS, + self._max_workers) + else: + if max_workers <= 0: + raise ValueError("max_workers must be greater than 0") + elif (sys.platform == 'win32' and + max_workers > _MAX_WINDOWS_WORKERS): + raise ValueError( + f"max_workers must be <= {_MAX_WINDOWS_WORKERS}") + + self._max_workers = max_workers + + if mp_context is None: + if max_tasks_per_child is not None: + mp_context = mp.get_context("spawn") + else: + mp_context = mp.get_context() + self._mp_context = mp_context + + # https://github.com/python/cpython/issues/90622 + self._safe_to_dynamically_spawn_children = ( + self._mp_context.get_start_method(allow_none=False) != "fork") + + if initializer is not None and not callable(initializer): + raise TypeError("initializer must be a callable") + self._initializer = initializer + self._initargs = initargs + + if max_tasks_per_child is not None: + if not isinstance(max_tasks_per_child, int): + raise TypeError("max_tasks_per_child must be an integer") + elif max_tasks_per_child <= 0: + raise ValueError("max_tasks_per_child must be >= 1") + if self._mp_context.get_start_method(allow_none=False) == "fork": + # https://github.com/python/cpython/issues/90622 + raise ValueError("max_tasks_per_child is incompatible with" + " the 'fork' multiprocessing start method;" + " supply a different mp_context.") + self._max_tasks_per_child = max_tasks_per_child + + # Management thread + self._executor_manager_thread = None + + # Map of pids to processes + self._processes = {} + + # Shutdown is a two-step process. + self._shutdown_thread = False + self._shutdown_lock = threading.Lock() + self._idle_worker_semaphore = threading.Semaphore(0) + self._broken = False + self._queue_count = 0 + self._pending_work_items = {} + self._cancel_pending_futures = False + + # _ThreadWakeup is a communication channel used to interrupt the wait + # of the main loop of executor_manager_thread from another thread (e.g. + # when calling executor.submit or executor.shutdown). We do not use the + # _result_queue to send wakeup signals to the executor_manager_thread + # as it could result in a deadlock if a worker process dies with the + # _result_queue write lock still acquired. + # + # Care must be taken to only call clear and close from the + # executor_manager_thread, since _ThreadWakeup.clear() is not protected + # by a lock. + self._executor_manager_thread_wakeup = _ThreadWakeup() + + # Create communication channels for the executor + # Make the call queue slightly larger than the number of processes to + # prevent the worker processes from idling. But don't make it too big + # because futures in the call queue cannot be cancelled. + queue_size = self._max_workers + EXTRA_QUEUED_CALLS + self._call_queue = _SafeQueue( + max_size=queue_size, ctx=self._mp_context, + pending_work_items=self._pending_work_items, + thread_wakeup=self._executor_manager_thread_wakeup) + # Killed worker processes can produce spurious "broken pipe" + # tracebacks in the queue's own worker thread. But we detect killed + # processes anyway, so silence the tracebacks. + self._call_queue._ignore_epipe = True + self._result_queue = mp_context.SimpleQueue() + self._work_ids = queue.Queue() + + def _start_executor_manager_thread(self): + if self._executor_manager_thread is None: + # Start the processes so that their sentinels are known. + if not self._safe_to_dynamically_spawn_children: # ie, using fork. + self._launch_processes() + self._executor_manager_thread = _ExecutorManagerThread(self) + self._executor_manager_thread.start() + _threads_wakeups[self._executor_manager_thread] = \ + self._executor_manager_thread_wakeup + + def _adjust_process_count(self): + # gh-132969: avoid error when state is reset and executor is still running, + # which will happen when shutdown(wait=False) is called. + if self._processes is None: + return + + # if there's an idle process, we don't need to spawn a new one. + if self._idle_worker_semaphore.acquire(blocking=False): + return + + process_count = len(self._processes) + if process_count < self._max_workers: + # Assertion disabled as this codepath is also used to replace a + # worker that unexpectedly dies, even when using the 'fork' start + # method. That means there is still a potential deadlock bug. If a + # 'fork' mp_context worker dies, we'll be forking a new one when + # we know a thread is running (self._executor_manager_thread). + #assert self._safe_to_dynamically_spawn_children or not self._executor_manager_thread, 'https://github.com/python/cpython/issues/90622' + self._spawn_process() + + def _launch_processes(self): + # https://github.com/python/cpython/issues/90622 + assert not self._executor_manager_thread, ( + 'Processes cannot be fork()ed after the thread has started, ' + 'deadlock in the child processes could result.') + for _ in range(len(self._processes), self._max_workers): + self._spawn_process() + + def _spawn_process(self): + p = self._mp_context.Process( + target=_process_worker, + args=(self._call_queue, + self._result_queue, + self._initializer, + self._initargs, + self._max_tasks_per_child)) + p.start() + self._processes[p.pid] = p + + def submit(self, fn, /, *args, **kwargs): + with self._shutdown_lock: + if self._broken: + raise BrokenProcessPool(self._broken) + if self._shutdown_thread: + raise RuntimeError('cannot schedule new futures after shutdown') + if _global_shutdown: + raise RuntimeError('cannot schedule new futures after ' + 'interpreter shutdown') + + f = _base.Future() + w = _WorkItem(f, fn, args, kwargs) + + self._pending_work_items[self._queue_count] = w + self._work_ids.put(self._queue_count) + self._queue_count += 1 + # Wake up queue management thread + self._executor_manager_thread_wakeup.wakeup() + + if self._safe_to_dynamically_spawn_children: + self._adjust_process_count() + self._start_executor_manager_thread() + return f + submit.__doc__ = _base.Executor.submit.__doc__ + + def map(self, fn, *iterables, timeout=None, chunksize=1, buffersize=None): + """Returns an iterator equivalent to map(fn, iter). + + Args: + fn: A callable that will take as many arguments as there are + passed iterables. + timeout: The maximum number of seconds to wait. If None, then there + is no limit on the wait time. + chunksize: If greater than one, the iterables will be chopped into + chunks of size chunksize and submitted to the process pool. + If set to one, the items in the list will be sent one at a time. + buffersize: The number of submitted tasks whose results have not + yet been yielded. If the buffer is full, iteration over the + iterables pauses until a result is yielded from the buffer. + If None, all input elements are eagerly collected, and a task is + submitted for each. + + Returns: + An iterator equivalent to: map(func, *iterables) but the calls may + be evaluated out-of-order. + + Raises: + TimeoutError: If the entire result iterator could not be generated + before the given timeout. + Exception: If fn(*args) raises for any values. + """ + if chunksize < 1: + raise ValueError("chunksize must be >= 1.") + + results = super().map(partial(_process_chunk, fn), + itertools.batched(zip(*iterables), chunksize), + timeout=timeout, + buffersize=buffersize) + return _chain_from_iterable_of_lists(results) + + def shutdown(self, wait=True, *, cancel_futures=False): + with self._shutdown_lock: + self._cancel_pending_futures = cancel_futures + self._shutdown_thread = True + if self._executor_manager_thread_wakeup is not None: + # Wake up queue management thread + self._executor_manager_thread_wakeup.wakeup() + + if self._executor_manager_thread is not None and wait: + self._executor_manager_thread.join() + # To reduce the risk of opening too many files, remove references to + # objects that use file descriptors. + self._executor_manager_thread = None + self._call_queue = None + if self._result_queue is not None and wait: + self._result_queue.close() + self._result_queue = None + self._processes = None + self._executor_manager_thread_wakeup = None + + shutdown.__doc__ = _base.Executor.shutdown.__doc__ + + def _force_shutdown(self, operation): + """Attempts to terminate or kill the executor's workers based off the + given operation. Iterates through all of the current processes and + performs the relevant task if the process is still alive. + + After terminating workers, the pool will be in a broken state + and no longer usable (for instance, new tasks should not be + submitted). + """ + if operation not in _SHUTDOWN_CALLBACK_OPERATION: + raise ValueError(f"Unsupported operation: {operation!r}") + + processes = {} + if self._processes: + processes = self._processes.copy() + + # shutdown will invalidate ._processes, so we copy it right before + # calling. If we waited here, we would deadlock if a process decides not + # to exit. + self.shutdown(wait=False, cancel_futures=True) + + if not processes: + return + + for proc in processes.values(): + try: + if not proc.is_alive(): + continue + except ValueError: + # The process is already exited/closed out. + continue + + try: + if operation == _TERMINATE: + proc.terminate() + elif operation == _KILL: + proc.kill() + except ProcessLookupError: + # The process just ended before our signal + continue + + def terminate_workers(self): + """Attempts to terminate the executor's workers. + Iterates through all of the current worker processes and terminates + each one that is still alive. + + After terminating workers, the pool will be in a broken state + and no longer usable (for instance, new tasks should not be + submitted). + """ + return self._force_shutdown(operation=_TERMINATE) + + def kill_workers(self): + """Attempts to kill the executor's workers. + Iterates through all of the current worker processes and kills + each one that is still alive. + + After killing workers, the pool will be in a broken state + and no longer usable (for instance, new tasks should not be + submitted). + """ + return self._force_shutdown(operation=_KILL) diff --git a/micromamba_root/Lib/concurrent/futures/thread.py b/micromamba_root/Lib/concurrent/futures/thread.py new file mode 100644 index 0000000000000000000000000000000000000000..909359b648709fe980db610c8834c34f2b2d2e76 --- /dev/null +++ b/micromamba_root/Lib/concurrent/futures/thread.py @@ -0,0 +1,274 @@ +# Copyright 2009 Brian Quinlan. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Implements ThreadPoolExecutor.""" + +__author__ = 'Brian Quinlan (brian@sweetapp.com)' + +from concurrent.futures import _base +import itertools +import queue +import threading +import types +import weakref +import os + + +_threads_queues = weakref.WeakKeyDictionary() +_shutdown = False +# Lock that ensures that new workers are not created while the interpreter is +# shutting down. Must be held while mutating _threads_queues and _shutdown. +_global_shutdown_lock = threading.Lock() + +def _python_exit(): + global _shutdown + with _global_shutdown_lock: + _shutdown = True + items = list(_threads_queues.items()) + for t, q in items: + q.put(None) + for t, q in items: + t.join() + +# Register for `_python_exit()` to be called just before joining all +# non-daemon threads. This is used instead of `atexit.register()` for +# compatibility with subinterpreters, which no longer support daemon threads. +# See bpo-39812 for context. +threading._register_atexit(_python_exit) + +# At fork, reinitialize the `_global_shutdown_lock` lock in the child process +if hasattr(os, 'register_at_fork'): + os.register_at_fork(before=_global_shutdown_lock.acquire, + after_in_child=_global_shutdown_lock._at_fork_reinit, + after_in_parent=_global_shutdown_lock.release) + os.register_at_fork(after_in_child=_threads_queues.clear) + + +class WorkerContext: + + @classmethod + def prepare(cls, initializer, initargs): + if initializer is not None: + if not callable(initializer): + raise TypeError("initializer must be a callable") + def create_context(): + return cls(initializer, initargs) + def resolve_task(fn, args, kwargs): + return (fn, args, kwargs) + return create_context, resolve_task + + def __init__(self, initializer, initargs): + self.initializer = initializer + self.initargs = initargs + + def initialize(self): + if self.initializer is not None: + self.initializer(*self.initargs) + + def finalize(self): + pass + + def run(self, task): + fn, args, kwargs = task + return fn(*args, **kwargs) + + +class _WorkItem: + def __init__(self, future, task): + self.future = future + self.task = task + + def run(self, ctx): + if not self.future.set_running_or_notify_cancel(): + return + + try: + result = ctx.run(self.task) + except BaseException as exc: + self.future.set_exception(exc) + # Break a reference cycle with the exception 'exc' + self = None + else: + self.future.set_result(result) + + __class_getitem__ = classmethod(types.GenericAlias) + + +def _worker(executor_reference, ctx, work_queue): + try: + ctx.initialize() + except BaseException: + _base.LOGGER.critical('Exception in initializer:', exc_info=True) + executor = executor_reference() + if executor is not None: + executor._initializer_failed() + return + try: + while True: + try: + work_item = work_queue.get_nowait() + except queue.Empty: + # attempt to increment idle count if queue is empty + executor = executor_reference() + if executor is not None: + executor._idle_semaphore.release() + del executor + work_item = work_queue.get(block=True) + + if work_item is not None: + work_item.run(ctx) + # Delete references to object. See GH-60488 + del work_item + continue + + executor = executor_reference() + # Exit if: + # - The interpreter is shutting down OR + # - The executor that owns the worker has been collected OR + # - The executor that owns the worker has been shutdown. + if _shutdown or executor is None or executor._shutdown: + # Flag the executor as shutting down as early as possible if it + # is not gc-ed yet. + if executor is not None: + executor._shutdown = True + # Notice other workers + work_queue.put(None) + return + del executor + except BaseException: + _base.LOGGER.critical('Exception in worker', exc_info=True) + finally: + ctx.finalize() + + +class BrokenThreadPool(_base.BrokenExecutor): + """ + Raised when a worker thread in a ThreadPoolExecutor failed initializing. + """ + + +class ThreadPoolExecutor(_base.Executor): + + BROKEN = BrokenThreadPool + + # Used to assign unique thread names when thread_name_prefix is not supplied. + _counter = itertools.count().__next__ + + @classmethod + def prepare_context(cls, initializer, initargs): + return WorkerContext.prepare(initializer, initargs) + + def __init__(self, max_workers=None, thread_name_prefix='', + initializer=None, initargs=(), **ctxkwargs): + """Initializes a new ThreadPoolExecutor instance. + + Args: + max_workers: The maximum number of threads that can be used to + execute the given calls. + thread_name_prefix: An optional name prefix to give our threads. + initializer: A callable used to initialize worker threads. + initargs: A tuple of arguments to pass to the initializer. + ctxkwargs: Additional arguments to cls.prepare_context(). + """ + if max_workers is None: + # ThreadPoolExecutor is often used to: + # * CPU bound task which releases GIL + # * I/O bound task (which releases GIL, of course) + # + # We use process_cpu_count + 4 for both types of tasks. + # But we limit it to 32 to avoid consuming surprisingly large resource + # on many core machine. + max_workers = min(32, (os.process_cpu_count() or 1) + 4) + if max_workers <= 0: + raise ValueError("max_workers must be greater than 0") + + (self._create_worker_context, + self._resolve_work_item_task, + ) = type(self).prepare_context(initializer, initargs, **ctxkwargs) + + self._max_workers = max_workers + self._work_queue = queue.SimpleQueue() + self._idle_semaphore = threading.Semaphore(0) + self._threads = set() + self._broken = False + self._shutdown = False + self._shutdown_lock = threading.Lock() + self._thread_name_prefix = (thread_name_prefix or + ("ThreadPoolExecutor-%d" % self._counter())) + + def submit(self, fn, /, *args, **kwargs): + with self._shutdown_lock, _global_shutdown_lock: + if self._broken: + raise self.BROKEN(self._broken) + + if self._shutdown: + raise RuntimeError('cannot schedule new futures after shutdown') + if _shutdown: + raise RuntimeError('cannot schedule new futures after ' + 'interpreter shutdown') + + f = _base.Future() + task = self._resolve_work_item_task(fn, args, kwargs) + w = _WorkItem(f, task) + + self._work_queue.put(w) + self._adjust_thread_count() + return f + submit.__doc__ = _base.Executor.submit.__doc__ + + def _adjust_thread_count(self): + # if idle threads are available, don't spin new threads + if self._idle_semaphore.acquire(timeout=0): + return + + # When the executor gets lost, the weakref callback will wake up + # the worker threads. + def weakref_cb(_, q=self._work_queue): + q.put(None) + + num_threads = len(self._threads) + if num_threads < self._max_workers: + thread_name = '%s_%d' % (self._thread_name_prefix or self, + num_threads) + t = threading.Thread(name=thread_name, target=_worker, + args=(weakref.ref(self, weakref_cb), + self._create_worker_context(), + self._work_queue)) + t.start() + self._threads.add(t) + _threads_queues[t] = self._work_queue + + def _initializer_failed(self): + with self._shutdown_lock: + self._broken = ('A thread initializer failed, the thread pool ' + 'is not usable anymore') + # Drain work queue and mark pending futures failed + while True: + try: + work_item = self._work_queue.get_nowait() + except queue.Empty: + break + if work_item is not None: + work_item.future.set_exception(self.BROKEN(self._broken)) + + def shutdown(self, wait=True, *, cancel_futures=False): + with self._shutdown_lock: + self._shutdown = True + if cancel_futures: + # Drain all work items from the queue, and then cancel their + # associated futures. + while True: + try: + work_item = self._work_queue.get_nowait() + except queue.Empty: + break + if work_item is not None: + work_item.future.cancel() + + # Send a wake-up to prevent threads calling + # _work_queue.get(block=True) from permanently blocking. + self._work_queue.put(None) + if wait: + for t in self._threads: + t.join() + shutdown.__doc__ = _base.Executor.shutdown.__doc__ diff --git a/micromamba_root/Lib/concurrent/interpreters/__init__.py b/micromamba_root/Lib/concurrent/interpreters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ea4147ee9a25da554cddc06632e04e620008a6d2 --- /dev/null +++ b/micromamba_root/Lib/concurrent/interpreters/__init__.py @@ -0,0 +1,247 @@ +"""Subinterpreters High Level Module.""" + +import threading +import weakref +import _interpreters + +# aliases: +from _interpreters import ( + InterpreterError, InterpreterNotFoundError, NotShareableError, + is_shareable, +) +from ._queues import ( + create as create_queue, + Queue, QueueEmpty, QueueFull, +) + + +__all__ = [ + 'get_current', 'get_main', 'create', 'list_all', 'is_shareable', + 'Interpreter', + 'InterpreterError', 'InterpreterNotFoundError', 'ExecutionFailed', + 'NotShareableError', + 'create_queue', 'Queue', 'QueueEmpty', 'QueueFull', +] + + +_EXEC_FAILURE_STR = """ +{superstr} + +Uncaught in the interpreter: + +{formatted} +""".strip() + +class ExecutionFailed(InterpreterError): + """An unhandled exception happened during execution. + + This is raised from Interpreter.exec() and Interpreter.call(). + """ + + def __init__(self, excinfo): + msg = excinfo.formatted + if not msg: + if excinfo.type and excinfo.msg: + msg = f'{excinfo.type.__name__}: {excinfo.msg}' + else: + msg = excinfo.type.__name__ or excinfo.msg + super().__init__(msg) + self.excinfo = excinfo + + def __str__(self): + try: + formatted = self.excinfo.errdisplay + except Exception: + return super().__str__() + else: + return _EXEC_FAILURE_STR.format( + superstr=super().__str__(), + formatted=formatted, + ) + + +def create(): + """Return a new (idle) Python interpreter.""" + id = _interpreters.create(reqrefs=True) + return Interpreter(id, _ownsref=True) + + +def list_all(): + """Return all existing interpreters.""" + return [Interpreter(id, _whence=whence) + for id, whence in _interpreters.list_all(require_ready=True)] + + +def get_current(): + """Return the currently running interpreter.""" + id, whence = _interpreters.get_current() + return Interpreter(id, _whence=whence) + + +def get_main(): + """Return the main interpreter.""" + id, whence = _interpreters.get_main() + assert whence == _interpreters.WHENCE_RUNTIME, repr(whence) + return Interpreter(id, _whence=whence) + + +_known = weakref.WeakValueDictionary() + +class Interpreter: + """A single Python interpreter. + + Attributes: + + "id" - the unique process-global ID number for the interpreter + "whence" - indicates where the interpreter was created + + If the interpreter wasn't created by this module + then any method that modifies the interpreter will fail, + i.e. .close(), .prepare_main(), .exec(), and .call() + """ + + _WHENCE_TO_STR = { + _interpreters.WHENCE_UNKNOWN: 'unknown', + _interpreters.WHENCE_RUNTIME: 'runtime init', + _interpreters.WHENCE_LEGACY_CAPI: 'legacy C-API', + _interpreters.WHENCE_CAPI: 'C-API', + _interpreters.WHENCE_XI: 'cross-interpreter C-API', + _interpreters.WHENCE_STDLIB: '_interpreters module', + } + + def __new__(cls, id, /, _whence=None, _ownsref=None): + # There is only one instance for any given ID. + if not isinstance(id, int): + raise TypeError(f'id must be an int, got {id!r}') + id = int(id) + if _whence is None: + if _ownsref: + _whence = _interpreters.WHENCE_STDLIB + else: + _whence = _interpreters.whence(id) + assert _whence in cls._WHENCE_TO_STR, repr(_whence) + if _ownsref is None: + _ownsref = (_whence == _interpreters.WHENCE_STDLIB) + try: + self = _known[id] + assert hasattr(self, '_ownsref') + except KeyError: + self = super().__new__(cls) + _known[id] = self + self._id = id + self._whence = _whence + self._ownsref = _ownsref + if _ownsref: + # This may raise InterpreterNotFoundError: + _interpreters.incref(id) + return self + + def __repr__(self): + return f'{type(self).__name__}({self.id})' + + def __hash__(self): + return hash(self._id) + + def __del__(self): + self._decref() + + # for pickling: + def __reduce__(self): + return (type(self), (self._id,)) + + # gh-135729: Globals might be destroyed by the time this is called, so we + # need to keep references ourself + def _decref(self, *, + InterpreterNotFoundError=InterpreterNotFoundError, + _interp_decref=_interpreters.decref, + ): + if not self._ownsref: + return + self._ownsref = False + try: + _interp_decref(self._id) + except InterpreterNotFoundError: + pass + + @property + def id(self): + return self._id + + @property + def whence(self): + return self._WHENCE_TO_STR[self._whence] + + def is_running(self): + """Return whether or not the identified interpreter is running.""" + return _interpreters.is_running(self._id) + + # Everything past here is available only to interpreters created by + # interpreters.create(). + + def close(self): + """Finalize and destroy the interpreter. + + Attempting to destroy the current interpreter results + in an InterpreterError. + """ + return _interpreters.destroy(self._id, restrict=True) + + def prepare_main(self, ns=None, /, **kwargs): + """Bind the given values into the interpreter's __main__. + + The values must be shareable. + """ + ns = dict(ns, **kwargs) if ns is not None else kwargs + _interpreters.set___main___attrs(self._id, ns, restrict=True) + + def exec(self, code, /): + """Run the given source code in the interpreter. + + This is essentially the same as calling the builtin "exec" + with this interpreter, using the __dict__ of its __main__ + module as both globals and locals. + + There is no return value. + + If the code raises an unhandled exception then an ExecutionFailed + exception is raised, which summarizes the unhandled exception. + The actual exception is discarded because objects cannot be + shared between interpreters. + + This blocks the current Python thread until done. During + that time, the previous interpreter is allowed to run + in other threads. + """ + excinfo = _interpreters.exec(self._id, code, restrict=True) + if excinfo is not None: + raise ExecutionFailed(excinfo) + + def _call(self, callable, args, kwargs): + res, excinfo = _interpreters.call(self._id, callable, args, kwargs, restrict=True) + if excinfo is not None: + raise ExecutionFailed(excinfo) + return res + + def call(self, callable, /, *args, **kwargs): + """Call the object in the interpreter with given args/kwargs. + + Nearly all callables, args, kwargs, and return values are + supported. All "shareable" objects are supported, as are + "stateless" functions (meaning non-closures that do not use + any globals). This method will fall back to pickle. + + If the callable raises an exception then the error display + (including full traceback) is sent back between the interpreters + and an ExecutionFailed exception is raised, much like what + happens with Interpreter.exec(). + """ + return self._call(callable, args, kwargs) + + def call_in_thread(self, callable, /, *args, **kwargs): + """Return a new thread that calls the object in the interpreter. + + The return value and any raised exception are discarded. + """ + t = threading.Thread(target=self._call, args=(callable, args, kwargs)) + t.start() + return t diff --git a/micromamba_root/Lib/concurrent/interpreters/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/concurrent/interpreters/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3da611d5bc830c848baceb6ae294bf1385da34bf Binary files /dev/null and b/micromamba_root/Lib/concurrent/interpreters/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/interpreters/__pycache__/_crossinterp.cpython-314.pyc b/micromamba_root/Lib/concurrent/interpreters/__pycache__/_crossinterp.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e52de6a5e4b0e714df8325c365d2958d1a1bea9d Binary files /dev/null and b/micromamba_root/Lib/concurrent/interpreters/__pycache__/_crossinterp.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/interpreters/__pycache__/_queues.cpython-314.pyc b/micromamba_root/Lib/concurrent/interpreters/__pycache__/_queues.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c9839a0fa284bfcbc8bcd4064dc409e2b001f51 Binary files /dev/null and b/micromamba_root/Lib/concurrent/interpreters/__pycache__/_queues.cpython-314.pyc differ diff --git a/micromamba_root/Lib/concurrent/interpreters/_crossinterp.py b/micromamba_root/Lib/concurrent/interpreters/_crossinterp.py new file mode 100644 index 0000000000000000000000000000000000000000..a5f46b20fbb4c561f2878a6bbdc1792ea3b46e4e --- /dev/null +++ b/micromamba_root/Lib/concurrent/interpreters/_crossinterp.py @@ -0,0 +1,107 @@ +"""Common code between queues and channels.""" + + +class ItemInterpreterDestroyed(Exception): + """Raised when trying to get an item whose interpreter was destroyed.""" + + +class classonly: + """A non-data descriptor that makes a value only visible on the class. + + This is like the "classmethod" builtin, but does not show up on + instances of the class. It may be used as a decorator. + """ + + def __init__(self, value): + self.value = value + self.getter = classmethod(value).__get__ + self.name = None + + def __set_name__(self, cls, name): + if self.name is not None: + raise TypeError('already used') + self.name = name + + def __get__(self, obj, cls): + if obj is not None: + raise AttributeError(self.name) + # called on the class + return self.getter(None, cls) + + +class UnboundItem: + """Represents a cross-interpreter item no longer bound to an interpreter. + + An item is unbound when the interpreter that added it to the + cross-interpreter container is destroyed. + """ + + __slots__ = () + + @classonly + def singleton(cls, kind, module, name='UNBOUND'): + doc = cls.__doc__ + if doc: + doc = doc.replace( + 'cross-interpreter container', kind, + ).replace( + 'cross-interpreter', kind, + ) + subclass = type( + f'Unbound{kind.capitalize()}Item', + (cls,), + { + "_MODULE": module, + "_NAME": name, + "__doc__": doc, + }, + ) + return object.__new__(subclass) + + _MODULE = __name__ + _NAME = 'UNBOUND' + + def __new__(cls): + raise Exception(f'use {cls._MODULE}.{cls._NAME}') + + def __repr__(self): + return f'{self._MODULE}.{self._NAME}' +# return f'interpreters._queues.UNBOUND' + + +UNBOUND = object.__new__(UnboundItem) +UNBOUND_ERROR = object() +UNBOUND_REMOVE = object() + +_UNBOUND_CONSTANT_TO_FLAG = { + UNBOUND_REMOVE: 1, + UNBOUND_ERROR: 2, + UNBOUND: 3, +} +_UNBOUND_FLAG_TO_CONSTANT = {v: k + for k, v in _UNBOUND_CONSTANT_TO_FLAG.items()} + + +def serialize_unbound(unbound): + op = unbound + try: + flag = _UNBOUND_CONSTANT_TO_FLAG[op] + except KeyError: + raise NotImplementedError(f'unsupported unbound replacement op {op!r}') + return flag, + + +def resolve_unbound(flag, exctype_destroyed): + try: + op = _UNBOUND_FLAG_TO_CONSTANT[flag] + except KeyError: + raise NotImplementedError(f'unsupported unbound replacement op {flag!r}') + if op is UNBOUND_REMOVE: + # "remove" not possible here + raise NotImplementedError + elif op is UNBOUND_ERROR: + raise exctype_destroyed("item's original interpreter destroyed") + elif op is UNBOUND: + return UNBOUND + else: + raise NotImplementedError(repr(op)) diff --git a/micromamba_root/Lib/concurrent/interpreters/_queues.py b/micromamba_root/Lib/concurrent/interpreters/_queues.py new file mode 100644 index 0000000000000000000000000000000000000000..81ea1098d7f9f317d82db2b29c23d38f010e8a09 --- /dev/null +++ b/micromamba_root/Lib/concurrent/interpreters/_queues.py @@ -0,0 +1,289 @@ +"""Cross-interpreter Queues High Level Module.""" + +import pickle +import queue +import time +import weakref +import _interpqueues as _queues +from . import _crossinterp + +# aliases: +from _interpqueues import ( + QueueError, QueueNotFoundError, +) +from ._crossinterp import ( + UNBOUND_ERROR, UNBOUND_REMOVE, +) + +__all__ = [ + 'UNBOUND', 'UNBOUND_ERROR', 'UNBOUND_REMOVE', + 'create', 'list_all', + 'Queue', + 'QueueError', 'QueueNotFoundError', 'QueueEmpty', 'QueueFull', + 'ItemInterpreterDestroyed', +] + + +class QueueEmpty(QueueError, queue.Empty): + """Raised from get_nowait() when the queue is empty. + + It is also raised from get() if it times out. + """ + + +class QueueFull(QueueError, queue.Full): + """Raised from put_nowait() when the queue is full. + + It is also raised from put() if it times out. + """ + + +class ItemInterpreterDestroyed(QueueError, + _crossinterp.ItemInterpreterDestroyed): + """Raised from get() and get_nowait().""" + + +_SHARED_ONLY = 0 +_PICKLED = 1 + + +UNBOUND = _crossinterp.UnboundItem.singleton('queue', __name__) + + +def _serialize_unbound(unbound): + if unbound is UNBOUND: + unbound = _crossinterp.UNBOUND + return _crossinterp.serialize_unbound(unbound) + + +def _resolve_unbound(flag): + resolved = _crossinterp.resolve_unbound(flag, ItemInterpreterDestroyed) + if resolved is _crossinterp.UNBOUND: + resolved = UNBOUND + return resolved + + +def create(maxsize=0, *, unbounditems=UNBOUND): + """Return a new cross-interpreter queue. + + The queue may be used to pass data safely between interpreters. + + "unbounditems" sets the default for Queue.put(); see that method for + supported values. The default value is UNBOUND, which replaces + the unbound item. + """ + unbound = _serialize_unbound(unbounditems) + unboundop, = unbound + qid = _queues.create(maxsize, unboundop, -1) + self = Queue(qid) + self._set_unbound(unboundop, unbounditems) + return self + + +def list_all(): + """Return a list of all open queues.""" + queues = [] + for qid, unboundop, _ in _queues.list_all(): + self = Queue(qid) + if not hasattr(self, '_unbound'): + self._set_unbound(unboundop) + else: + assert self._unbound[0] == unboundop + queues.append(self) + return queues + + +_known_queues = weakref.WeakValueDictionary() + +class Queue: + """A cross-interpreter queue.""" + + def __new__(cls, id, /): + # There is only one instance for any given ID. + if isinstance(id, int): + id = int(id) + else: + raise TypeError(f'id must be an int, got {id!r}') + try: + self = _known_queues[id] + except KeyError: + self = super().__new__(cls) + self._id = id + _known_queues[id] = self + _queues.bind(id) + return self + + def __del__(self): + try: + _queues.release(self._id) + except QueueNotFoundError: + pass + try: + del _known_queues[self._id] + except KeyError: + pass + + def __repr__(self): + return f'{type(self).__name__}({self.id})' + + def __hash__(self): + return hash(self._id) + + # for pickling: + def __reduce__(self): + return (type(self), (self._id,)) + + def _set_unbound(self, op, items=None): + assert not hasattr(self, '_unbound') + if items is None: + items = _resolve_unbound(op) + unbound = (op, items) + self._unbound = unbound + return unbound + + @property + def id(self): + return self._id + + @property + def unbounditems(self): + try: + _, items = self._unbound + except AttributeError: + op, _ = _queues.get_queue_defaults(self._id) + _, items = self._set_unbound(op) + return items + + @property + def maxsize(self): + try: + return self._maxsize + except AttributeError: + self._maxsize = _queues.get_maxsize(self._id) + return self._maxsize + + def empty(self): + return self.qsize() == 0 + + def full(self): + return _queues.is_full(self._id) + + def qsize(self): + return _queues.get_count(self._id) + + def put(self, obj, block=True, timeout=None, *, + unbounditems=None, + _delay=10 / 1000, # 10 milliseconds + ): + """Add the object to the queue. + + If "block" is true, this blocks while the queue is full. + + For most objects, the object received through Queue.get() will + be a new one, equivalent to the original and not sharing any + actual underlying data. The notable exceptions include + cross-interpreter types (like Queue) and memoryview, where the + underlying data is actually shared. Furthermore, some types + can be sent through a queue more efficiently than others. This + group includes various immutable types like int, str, bytes, and + tuple (if the items are likewise efficiently shareable). See interpreters.is_shareable(). + + "unbounditems" controls the behavior of Queue.get() for the given + object if the current interpreter (calling put()) is later + destroyed. + + If "unbounditems" is None (the default) then it uses the + queue's default, set with create_queue(), + which is usually UNBOUND. + + If "unbounditems" is UNBOUND_ERROR then get() will raise an + ItemInterpreterDestroyed exception if the original interpreter + has been destroyed. This does not otherwise affect the queue; + the next call to put() will work like normal, returning the next + item in the queue. + + If "unbounditems" is UNBOUND_REMOVE then the item will be removed + from the queue as soon as the original interpreter is destroyed. + Be aware that this will introduce an imbalance between put() + and get() calls. + + If "unbounditems" is UNBOUND then it is returned by get() in place + of the unbound item. + """ + if not block: + return self.put_nowait(obj, unbounditems=unbounditems) + if unbounditems is None: + unboundop = -1 + else: + unboundop, = _serialize_unbound(unbounditems) + if timeout is not None: + timeout = int(timeout) + if timeout < 0: + raise ValueError(f'timeout value must be non-negative') + end = time.time() + timeout + while True: + try: + _queues.put(self._id, obj, unboundop) + except QueueFull as exc: + if timeout is not None and time.time() >= end: + raise # re-raise + time.sleep(_delay) + else: + break + + def put_nowait(self, obj, *, unbounditems=None): + if unbounditems is None: + unboundop = -1 + else: + unboundop, = _serialize_unbound(unbounditems) + _queues.put(self._id, obj, unboundop) + + def get(self, block=True, timeout=None, *, + _delay=10 / 1000, # 10 milliseconds + ): + """Return the next object from the queue. + + If "block" is true, this blocks while the queue is empty. + + If the next item's original interpreter has been destroyed + then the "next object" is determined by the value of the + "unbounditems" argument to put(). + """ + if not block: + return self.get_nowait() + if timeout is not None: + timeout = int(timeout) + if timeout < 0: + raise ValueError(f'timeout value must be non-negative') + end = time.time() + timeout + while True: + try: + obj, unboundop = _queues.get(self._id) + except QueueEmpty as exc: + if timeout is not None and time.time() >= end: + raise # re-raise + time.sleep(_delay) + else: + break + if unboundop is not None: + assert obj is None, repr(obj) + return _resolve_unbound(unboundop) + return obj + + def get_nowait(self): + """Return the next object from the channel. + + If the queue is empty then raise QueueEmpty. Otherwise this + is the same as get(). + """ + try: + obj, unboundop = _queues.get(self._id) + except QueueEmpty as exc: + raise # re-raise + if unboundop is not None: + assert obj is None, repr(obj) + return _resolve_unbound(unboundop) + return obj + + +_queues._register_heap_types(Queue, QueueEmpty, QueueFull) diff --git a/micromamba_root/Lib/ctypes/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03bc932b2e7b8a93eabf2d86daca78b761d17997 Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/__pycache__/_aix.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/_aix.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a42d5501be7ea7244299ddc905978dadaa37b1e5 Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/_aix.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/__pycache__/_endian.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/_endian.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..106b860cba72a0e55787b7f8955873495d4dadfa Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/_endian.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/__pycache__/_layout.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/_layout.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2a0ed3533e282188764ccefc3fbb3e4741874b3 Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/_layout.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/__pycache__/util.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e167b8bd45374899b3116f51c6a13af98cf51294 Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/__pycache__/wintypes.cpython-314.pyc b/micromamba_root/Lib/ctypes/__pycache__/wintypes.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd21bac20ea5b8ba46e67783a3f08040a7466142 Binary files /dev/null and b/micromamba_root/Lib/ctypes/__pycache__/wintypes.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/macholib/README.ctypes b/micromamba_root/Lib/ctypes/macholib/README.ctypes new file mode 100644 index 0000000000000000000000000000000000000000..2866e9f349288a4059e7bacee8f0ad9ed886d068 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/README.ctypes @@ -0,0 +1,7 @@ +Files in this directory come from Bob Ippolito's py2app. + +License: Any components of the py2app suite may be distributed under +the MIT or PSF open source licenses. + +This is version 1.0, SVN revision 789, from 2006/01/25. +The main repository is http://svn.red-bean.com/bob/macholib/trunk/macholib/ \ No newline at end of file diff --git a/micromamba_root/Lib/ctypes/macholib/__init__.py b/micromamba_root/Lib/ctypes/macholib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5621defccd61d1c4b0c64b8e136ef4357052dcb3 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/__init__.py @@ -0,0 +1,9 @@ +""" +Enough Mach-O to make your head spin. + +See the relevant header files in /usr/include/mach-o + +And also Apple's documentation. +""" + +__version__ = '1.0' diff --git a/micromamba_root/Lib/ctypes/macholib/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/ctypes/macholib/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05fedf368309ed69831948205cb2b264f591fdaf Binary files /dev/null and b/micromamba_root/Lib/ctypes/macholib/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/macholib/__pycache__/dyld.cpython-314.pyc b/micromamba_root/Lib/ctypes/macholib/__pycache__/dyld.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..226f2c4a3b8b7d20483c95f6b8548ab81d25e6a0 Binary files /dev/null and b/micromamba_root/Lib/ctypes/macholib/__pycache__/dyld.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/macholib/__pycache__/dylib.cpython-314.pyc b/micromamba_root/Lib/ctypes/macholib/__pycache__/dylib.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b82b6bc2d20be23551702eb18718ab586a059e2a Binary files /dev/null and b/micromamba_root/Lib/ctypes/macholib/__pycache__/dylib.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/macholib/__pycache__/framework.cpython-314.pyc b/micromamba_root/Lib/ctypes/macholib/__pycache__/framework.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc6740a846c01a28137cc705bb122a8f4815c248 Binary files /dev/null and b/micromamba_root/Lib/ctypes/macholib/__pycache__/framework.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ctypes/macholib/dyld.py b/micromamba_root/Lib/ctypes/macholib/dyld.py new file mode 100644 index 0000000000000000000000000000000000000000..ab9b01c87e27d15d7fc02c2b25270f7d17428780 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/dyld.py @@ -0,0 +1,169 @@ +""" +dyld emulation +""" + +import os +from ctypes.macholib.framework import framework_info +from ctypes.macholib.dylib import dylib_info +from itertools import * +try: + from _ctypes import _dyld_shared_cache_contains_path +except ImportError: + def _dyld_shared_cache_contains_path(*args): + raise NotImplementedError + +__all__ = [ + 'dyld_find', 'framework_find', + 'framework_info', 'dylib_info', +] + +# These are the defaults as per man dyld(1) +# +DEFAULT_FRAMEWORK_FALLBACK = [ + os.path.expanduser("~/Library/Frameworks"), + "/Library/Frameworks", + "/Network/Library/Frameworks", + "/System/Library/Frameworks", +] + +DEFAULT_LIBRARY_FALLBACK = [ + os.path.expanduser("~/lib"), + "/usr/local/lib", + "/lib", + "/usr/lib", +] + +def dyld_env(env, var): + if env is None: + env = os.environ + rval = env.get(var) + if rval is None: + return [] + return rval.split(':') + +def dyld_image_suffix(env=None): + if env is None: + env = os.environ + return env.get('DYLD_IMAGE_SUFFIX') + +def dyld_framework_path(env=None): + return dyld_env(env, 'DYLD_FRAMEWORK_PATH') + +def dyld_library_path(env=None): + return dyld_env(env, 'DYLD_LIBRARY_PATH') + +def dyld_fallback_framework_path(env=None): + return dyld_env(env, 'DYLD_FALLBACK_FRAMEWORK_PATH') + +def dyld_fallback_library_path(env=None): + return dyld_env(env, 'DYLD_FALLBACK_LIBRARY_PATH') + +def dyld_image_suffix_search(iterator, env=None): + """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" + suffix = dyld_image_suffix(env) + if suffix is None: + return iterator + def _inject(iterator=iterator, suffix=suffix): + for path in iterator: + if path.endswith('.dylib'): + yield path[:-len('.dylib')] + suffix + '.dylib' + else: + yield path + suffix + yield path + return _inject() + +def dyld_override_search(name, env=None): + # If DYLD_FRAMEWORK_PATH is set and this dylib_name is a + # framework name, use the first file that exists in the framework + # path if any. If there is none go on to search the DYLD_LIBRARY_PATH + # if any. + + framework = framework_info(name) + + if framework is not None: + for path in dyld_framework_path(env): + yield os.path.join(path, framework['name']) + + # If DYLD_LIBRARY_PATH is set then use the first file that exists + # in the path. If none use the original name. + for path in dyld_library_path(env): + yield os.path.join(path, os.path.basename(name)) + +def dyld_executable_path_search(name, executable_path=None): + # If we haven't done any searching and found a library and the + # dylib_name starts with "@executable_path/" then construct the + # library name. + if not executable_path: + import sys + if sys.prefix: + executable_path = os.path.join(sys.prefix, 'bin') + if name.startswith('@executable_path/') and executable_path is not None: + yield os.path.join(executable_path, name[len('@executable_path/'):]) + +def dyld_default_search(name, env=None): + yield name + + framework = framework_info(name) + + if framework is not None: + fallback_framework_path = dyld_fallback_framework_path(env) + for path in fallback_framework_path: + yield os.path.join(path, framework['name']) + + fallback_library_path = dyld_fallback_library_path(env) + for path in fallback_library_path: + yield os.path.join(path, os.path.basename(name)) + + if framework is not None and not fallback_framework_path: + for path in DEFAULT_FRAMEWORK_FALLBACK: + yield os.path.join(path, framework['name']) + + if not fallback_library_path: + for path in DEFAULT_LIBRARY_FALLBACK: + yield os.path.join(path, os.path.basename(name)) + +def dyld_find(name, executable_path=None, env=None): + """ + Find a library or framework using dyld semantics + """ + for path in dyld_image_suffix_search(chain( + dyld_override_search(name, env), + dyld_executable_path_search(name, executable_path), + dyld_default_search(name, env), + ), env): + + if os.path.isfile(path): + return path + try: + if _dyld_shared_cache_contains_path(path): + return path + except NotImplementedError: + pass + + raise ValueError("dylib %s could not be found" % (name,)) + +def framework_find(fn, executable_path=None, env=None): + """ + Find a framework using dyld semantics in a very loose manner. + + Will take input such as: + Python + Python.framework + Python.framework/Versions/Current + """ + error = None + try: + return dyld_find(fn, executable_path=executable_path, env=env) + except ValueError as e: + error = e + fmwk_index = fn.rfind('.framework') + if fmwk_index == -1: + fmwk_index = len(fn) + fn += '.framework' + fn = os.path.join(fn, os.path.basename(fn[:fmwk_index])) + try: + return dyld_find(fn, executable_path=executable_path, env=env) + except ValueError: + raise error + finally: + error = None diff --git a/micromamba_root/Lib/ctypes/macholib/dylib.py b/micromamba_root/Lib/ctypes/macholib/dylib.py new file mode 100644 index 0000000000000000000000000000000000000000..0ad4cba8da3521756942a18942bd11aaaad95a58 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/dylib.py @@ -0,0 +1,42 @@ +""" +Generic dylib path manipulation +""" + +import re + +__all__ = ['dylib_info'] + +DYLIB_RE = re.compile(r"""(?x) +(?P^.*)(?:^|/) +(?P + (?P\w+?) + (?:\.(?P[^._]+))? + (?:_(?P[^._]+))? + \.dylib$ +) +""") + +def dylib_info(filename): + """ + A dylib name can take one of the following four forms: + Location/Name.SomeVersion_Suffix.dylib + Location/Name.SomeVersion.dylib + Location/Name_Suffix.dylib + Location/Name.dylib + + returns None if not found or a mapping equivalent to: + dict( + location='Location', + name='Name.SomeVersion_Suffix.dylib', + shortname='Name', + version='SomeVersion', + suffix='Suffix', + ) + + Note that SomeVersion and Suffix are optional and may be None + if not present. + """ + is_dylib = DYLIB_RE.match(filename) + if not is_dylib: + return None + return is_dylib.groupdict() diff --git a/micromamba_root/Lib/ctypes/macholib/fetch_macholib b/micromamba_root/Lib/ctypes/macholib/fetch_macholib new file mode 100644 index 0000000000000000000000000000000000000000..e6d6a2265956293a8ac5eeb0e0e32309694a4a66 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/fetch_macholib @@ -0,0 +1,2 @@ +#!/bin/sh +svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ . diff --git a/micromamba_root/Lib/ctypes/macholib/fetch_macholib.bat b/micromamba_root/Lib/ctypes/macholib/fetch_macholib.bat new file mode 100644 index 0000000000000000000000000000000000000000..f474d5cd0a26f72be2c53228a4465c8b91a0e649 --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/fetch_macholib.bat @@ -0,0 +1 @@ +svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ . diff --git a/micromamba_root/Lib/ctypes/macholib/framework.py b/micromamba_root/Lib/ctypes/macholib/framework.py new file mode 100644 index 0000000000000000000000000000000000000000..495679fff19d418a8248c492bb5959f52787123c --- /dev/null +++ b/micromamba_root/Lib/ctypes/macholib/framework.py @@ -0,0 +1,42 @@ +""" +Generic framework path manipulation +""" + +import re + +__all__ = ['framework_info'] + +STRICT_FRAMEWORK_RE = re.compile(r"""(?x) +(?P^.*)(?:^|/) +(?P + (?P\w+).framework/ + (?:Versions/(?P[^/]+)/)? + (?P=shortname) + (?:_(?P[^_]+))? +)$ +""") + +def framework_info(filename): + """ + A framework name can take one of the following four forms: + Location/Name.framework/Versions/SomeVersion/Name_Suffix + Location/Name.framework/Versions/SomeVersion/Name + Location/Name.framework/Name_Suffix + Location/Name.framework/Name + + returns None if not found, or a mapping equivalent to: + dict( + location='Location', + name='Name.framework/Versions/SomeVersion/Name_Suffix', + shortname='Name', + version='SomeVersion', + suffix='Suffix', + ) + + Note that SomeVersion and Suffix are optional and may be None + if not present + """ + is_framework = STRICT_FRAMEWORK_RE.match(filename) + if not is_framework: + return None + return is_framework.groupdict() diff --git a/micromamba_root/Lib/curses/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/curses/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5dfe8729d814a857357b6493d99397349391259d Binary files /dev/null and b/micromamba_root/Lib/curses/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/curses/__pycache__/ascii.cpython-314.pyc b/micromamba_root/Lib/curses/__pycache__/ascii.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6726658ff0201ca2f2ada1f1866051fee62ffbce Binary files /dev/null and b/micromamba_root/Lib/curses/__pycache__/ascii.cpython-314.pyc differ diff --git a/micromamba_root/Lib/curses/__pycache__/has_key.cpython-314.pyc b/micromamba_root/Lib/curses/__pycache__/has_key.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3c36b1fd740784f581527db4faea90fb87cc31c Binary files /dev/null and b/micromamba_root/Lib/curses/__pycache__/has_key.cpython-314.pyc differ diff --git a/micromamba_root/Lib/curses/__pycache__/panel.cpython-314.pyc b/micromamba_root/Lib/curses/__pycache__/panel.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af5371113ea88acc8f6aabc89de98d950b154cbf Binary files /dev/null and b/micromamba_root/Lib/curses/__pycache__/panel.cpython-314.pyc differ diff --git a/micromamba_root/Lib/curses/__pycache__/textpad.cpython-314.pyc b/micromamba_root/Lib/curses/__pycache__/textpad.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4dfb261849fe39ba93472840545caa5b9a50d462 Binary files /dev/null and b/micromamba_root/Lib/curses/__pycache__/textpad.cpython-314.pyc differ diff --git a/micromamba_root/Lib/dbm/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/dbm/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..643c6e7793611c8d71a36e7b22f420fda1ba59c3 Binary files /dev/null and b/micromamba_root/Lib/dbm/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/dbm/__pycache__/dumb.cpython-314.pyc b/micromamba_root/Lib/dbm/__pycache__/dumb.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ea5268eb9586434cba0916ddfb604db1dced298 Binary files /dev/null and b/micromamba_root/Lib/dbm/__pycache__/dumb.cpython-314.pyc differ diff --git a/micromamba_root/Lib/dbm/__pycache__/gnu.cpython-314.pyc b/micromamba_root/Lib/dbm/__pycache__/gnu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50092999eb87f8f2445d27aab416639186790f1c Binary files /dev/null and b/micromamba_root/Lib/dbm/__pycache__/gnu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/dbm/__pycache__/ndbm.cpython-314.pyc b/micromamba_root/Lib/dbm/__pycache__/ndbm.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cbe69cfddd93e71e983e62f2486a8786f66a18f Binary files /dev/null and b/micromamba_root/Lib/dbm/__pycache__/ndbm.cpython-314.pyc differ diff --git a/micromamba_root/Lib/dbm/__pycache__/sqlite3.cpython-314.pyc b/micromamba_root/Lib/dbm/__pycache__/sqlite3.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba8933d11c3b59d3dca6bfa9c30b0e7154d244ea Binary files /dev/null and b/micromamba_root/Lib/dbm/__pycache__/sqlite3.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e8ff779db4019c8a07f3a0cd79e885a477d84d7 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/_encoded_words.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/_encoded_words.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5babda82874e47010ee0131387083bbcf7f05d2c Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/_encoded_words.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/_parseaddr.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/_parseaddr.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d4dcbca771ed43d5d745f88ec0492af61e26888 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/_parseaddr.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/_policybase.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/_policybase.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa4e184993b9734e08fd5a18a29fc7bcbf63aab5 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/_policybase.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/base64mime.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/base64mime.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0079e4841156f90ccf00a30c7c313246568587af Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/base64mime.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/charset.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/charset.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b682eb33b2e22eedd92d79618025dbfe9c848e36 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/charset.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/contentmanager.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/contentmanager.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..58f2b7f9a477833ac7fce40eff664fd8ef6056b2 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/contentmanager.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/encoders.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/encoders.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5195ed5c1e3bbaf1220578a98c50b96f9c4c636b Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/encoders.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/errors.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/errors.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c15e1c86ff0bedb8c385aac414db42682706fcd Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/errors.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/feedparser.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/feedparser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9cbe217877cccb2be97d4301b79704c122fc14b4 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/feedparser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/generator.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/generator.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..422bf3f25af2733f89deabbf92c70a477df441a5 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/generator.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/header.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/header.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47b594cc1669d2f968333db00af8cc603808686d Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/header.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/headerregistry.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/headerregistry.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80a510ae0f3bece777d4f6060cc4d8090a6d1725 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/headerregistry.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/iterators.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/iterators.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1b8aef6a1f399d111e598d1d9b25c74d8df11c62 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/iterators.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/message.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/message.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..213cb8808c119da8a58605900e630a47c0152351 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/message.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/parser.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/parser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bbc9538cc9b82cf52df12b245c14f01d8a9e1b05 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/parser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/policy.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/policy.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f96a2d62bd0ed7fd73b38c4a418b13c6b4a89fb1 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/policy.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/quoprimime.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/quoprimime.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e0258ef67eee1499bc79e26a37fa801ba7bbc91 Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/quoprimime.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/__pycache__/utils.cpython-314.pyc b/micromamba_root/Lib/email/__pycache__/utils.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3c1ddf1f4a5cf79dd954c18a756c2534607265d Binary files /dev/null and b/micromamba_root/Lib/email/__pycache__/utils.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__init__.py b/micromamba_root/Lib/email/mime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/Lib/email/mime/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ee14d4f53c94ce3f247646b651e449af5eb5aa0 Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/application.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/application.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6887bbcf075d608161a202ed65c4a87b3657af76 Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/application.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/audio.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/audio.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9334c4bed4af0fa77be655b56eb0fc89d0a968cd Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/audio.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/base.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/base.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80631b57523f673b6e7bd7261d3e023e3063d72a Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/base.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/image.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/image.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da472d70b9e63116198b299f2b8be7208b71cfac Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/image.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/message.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/message.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9bebbf3c4ffc4a26bf640142bf631cacba80cba Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/message.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/multipart.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/multipart.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a77e8ad5af1a934fb664be2950b94f7347b9c2d9 Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/multipart.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/nonmultipart.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/nonmultipart.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bd8e78ef9b9aa1cb7dc6963d270b21cf181f6a13 Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/nonmultipart.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/__pycache__/text.cpython-314.pyc b/micromamba_root/Lib/email/mime/__pycache__/text.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff79bc14f580bb052f84d9d88d524653bb00a7b7 Binary files /dev/null and b/micromamba_root/Lib/email/mime/__pycache__/text.cpython-314.pyc differ diff --git a/micromamba_root/Lib/email/mime/application.py b/micromamba_root/Lib/email/mime/application.py new file mode 100644 index 0000000000000000000000000000000000000000..9a9d213d2a940d1cdb094dbe9c3f2d2cdde214eb --- /dev/null +++ b/micromamba_root/Lib/email/mime/application.py @@ -0,0 +1,37 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Keith Dart +# Contact: email-sig@python.org + +"""Class representing application/* type MIME documents.""" + +__all__ = ["MIMEApplication"] + +from email import encoders +from email.mime.nonmultipart import MIMENonMultipart + + +class MIMEApplication(MIMENonMultipart): + """Class for generating application/* MIME documents.""" + + def __init__(self, _data, _subtype='octet-stream', + _encoder=encoders.encode_base64, *, policy=None, **_params): + """Create an application/* type MIME document. + + _data contains the bytes for the raw application data. + + _subtype is the MIME content type subtype, defaulting to + 'octet-stream'. + + _encoder is a function which will perform the actual encoding for + transport of the application data, defaulting to base64 encoding. + + Any additional keyword arguments are passed to the base class + constructor, which turns them into parameters on the Content-Type + header. + """ + if _subtype is None: + raise TypeError('Invalid application MIME subtype') + MIMENonMultipart.__init__(self, 'application', _subtype, policy=policy, + **_params) + self.set_payload(_data) + _encoder(self) diff --git a/micromamba_root/Lib/email/mime/audio.py b/micromamba_root/Lib/email/mime/audio.py new file mode 100644 index 0000000000000000000000000000000000000000..85f4a955238c52060e01a688301e276d50fdb3f6 --- /dev/null +++ b/micromamba_root/Lib/email/mime/audio.py @@ -0,0 +1,97 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Anthony Baxter +# Contact: email-sig@python.org + +"""Class representing audio/* type MIME documents.""" + +__all__ = ['MIMEAudio'] + +from email import encoders +from email.mime.nonmultipart import MIMENonMultipart + + +class MIMEAudio(MIMENonMultipart): + """Class for generating audio/* MIME documents.""" + + def __init__(self, _audiodata, _subtype=None, + _encoder=encoders.encode_base64, *, policy=None, **_params): + """Create an audio/* type MIME document. + + _audiodata contains the bytes for the raw audio data. If this data + can be decoded as au, wav, aiff, or aifc, then the + subtype will be automatically included in the Content-Type header. + Otherwise, you can specify the specific audio subtype via the + _subtype parameter. If _subtype is not given, and no subtype can be + guessed, a TypeError is raised. + + _encoder is a function which will perform the actual encoding for + transport of the image data. It takes one argument, which is this + Image instance. It should use get_payload() and set_payload() to + change the payload to the encoded form. It should also add any + Content-Transfer-Encoding or other headers to the message as + necessary. The default encoding is Base64. + + Any additional keyword arguments are passed to the base class + constructor, which turns them into parameters on the Content-Type + header. + """ + if _subtype is None: + _subtype = _what(_audiodata) + if _subtype is None: + raise TypeError('Could not find audio MIME subtype') + MIMENonMultipart.__init__(self, 'audio', _subtype, policy=policy, + **_params) + self.set_payload(_audiodata) + _encoder(self) + + +_rules = [] + + +# Originally from the sndhdr module. +# +# There are others in sndhdr that don't have MIME types. :( +# Additional ones to be added to sndhdr? midi, mp3, realaudio, wma?? +def _what(data): + # Try to identify a sound file type. + # + # sndhdr.what() had a pretty cruddy interface, unfortunately. This is why + # we re-do it here. It would be easier to reverse engineer the Unix 'file' + # command and use the standard 'magic' file, as shipped with a modern Unix. + for testfn in _rules: + if res := testfn(data): + return res + else: + return None + + +def rule(rulefunc): + _rules.append(rulefunc) + return rulefunc + + +@rule +def _aiff(h): + if not h.startswith(b'FORM'): + return None + if h[8:12] in {b'AIFC', b'AIFF'}: + return 'x-aiff' + else: + return None + + +@rule +def _au(h): + if h.startswith(b'.snd'): + return 'basic' + else: + return None + + +@rule +def _wav(h): + # 'RIFF' 'WAVE' 'fmt ' + if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ': + return None + else: + return "x-wav" diff --git a/micromamba_root/Lib/email/mime/base.py b/micromamba_root/Lib/email/mime/base.py new file mode 100644 index 0000000000000000000000000000000000000000..da4c6e591a5cb8545d8eca5892215fce2e63ee6c --- /dev/null +++ b/micromamba_root/Lib/email/mime/base.py @@ -0,0 +1,29 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Base class for MIME specializations.""" + +__all__ = ['MIMEBase'] + +import email.policy + +from email import message + + +class MIMEBase(message.Message): + """Base class for MIME specializations.""" + + def __init__(self, _maintype, _subtype, *, policy=None, **_params): + """This constructor adds a Content-Type: and a MIME-Version: header. + + The Content-Type: header is taken from the _maintype and _subtype + arguments. Additional parameters for this header are taken from the + keyword arguments. + """ + if policy is None: + policy = email.policy.compat32 + message.Message.__init__(self, policy=policy) + ctype = '%s/%s' % (_maintype, _subtype) + self.add_header('Content-Type', ctype, **_params) + self['MIME-Version'] = '1.0' diff --git a/micromamba_root/Lib/email/mime/image.py b/micromamba_root/Lib/email/mime/image.py new file mode 100644 index 0000000000000000000000000000000000000000..dab9685848172b34e255c01d947be57372dc13c0 --- /dev/null +++ b/micromamba_root/Lib/email/mime/image.py @@ -0,0 +1,152 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Class representing image/* type MIME documents.""" + +__all__ = ['MIMEImage'] + +from email import encoders +from email.mime.nonmultipart import MIMENonMultipart + + +class MIMEImage(MIMENonMultipart): + """Class for generating image/* type MIME documents.""" + + def __init__(self, _imagedata, _subtype=None, + _encoder=encoders.encode_base64, *, policy=None, **_params): + """Create an image/* type MIME document. + + _imagedata contains the bytes for the raw image data. If the data + type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm, + rast, xbm, bmp, webp, and exr attempted), then the subtype will be + automatically included in the Content-Type header. Otherwise, you can + specify the specific image subtype via the _subtype parameter. + + _encoder is a function which will perform the actual encoding for + transport of the image data. It takes one argument, which is this + Image instance. It should use get_payload() and set_payload() to + change the payload to the encoded form. It should also add any + Content-Transfer-Encoding or other headers to the message as + necessary. The default encoding is Base64. + + Any additional keyword arguments are passed to the base class + constructor, which turns them into parameters on the Content-Type + header. + """ + _subtype = _what(_imagedata) if _subtype is None else _subtype + if _subtype is None: + raise TypeError('Could not guess image MIME subtype') + MIMENonMultipart.__init__(self, 'image', _subtype, policy=policy, + **_params) + self.set_payload(_imagedata) + _encoder(self) + + +_rules = [] + + +# Originally from the imghdr module. +def _what(data): + for rule in _rules: + if res := rule(data): + return res + else: + return None + + +def rule(rulefunc): + _rules.append(rulefunc) + return rulefunc + + +@rule +def _jpeg(h): + """JPEG data with JFIF or Exif markers; and raw JPEG""" + if h[6:10] in (b'JFIF', b'Exif'): + return 'jpeg' + elif h[:4] == b'\xff\xd8\xff\xdb': + return 'jpeg' + + +@rule +def _png(h): + if h.startswith(b'\211PNG\r\n\032\n'): + return 'png' + + +@rule +def _gif(h): + """GIF ('87 and '89 variants)""" + if h[:6] in (b'GIF87a', b'GIF89a'): + return 'gif' + + +@rule +def _tiff(h): + """TIFF (can be in Motorola or Intel byte order)""" + if h[:2] in (b'MM', b'II'): + return 'tiff' + + +@rule +def _rgb(h): + """SGI image library""" + if h.startswith(b'\001\332'): + return 'rgb' + + +@rule +def _pbm(h): + """PBM (portable bitmap)""" + if len(h) >= 3 and \ + h[0] == ord(b'P') and h[1] in b'14' and h[2] in b' \t\n\r': + return 'pbm' + + +@rule +def _pgm(h): + """PGM (portable graymap)""" + if len(h) >= 3 and \ + h[0] == ord(b'P') and h[1] in b'25' and h[2] in b' \t\n\r': + return 'pgm' + + +@rule +def _ppm(h): + """PPM (portable pixmap)""" + if len(h) >= 3 and \ + h[0] == ord(b'P') and h[1] in b'36' and h[2] in b' \t\n\r': + return 'ppm' + + +@rule +def _rast(h): + """Sun raster file""" + if h.startswith(b'\x59\xA6\x6A\x95'): + return 'rast' + + +@rule +def _xbm(h): + """X bitmap (X10 or X11)""" + if h.startswith(b'#define '): + return 'xbm' + + +@rule +def _bmp(h): + if h.startswith(b'BM'): + return 'bmp' + + +@rule +def _webp(h): + if h.startswith(b'RIFF') and h[8:12] == b'WEBP': + return 'webp' + + +@rule +def _exr(h): + if h.startswith(b'\x76\x2f\x31\x01'): + return 'exr' diff --git a/micromamba_root/Lib/email/mime/message.py b/micromamba_root/Lib/email/mime/message.py new file mode 100644 index 0000000000000000000000000000000000000000..13d9ff599f86dbb9383442189f170276cd88154a --- /dev/null +++ b/micromamba_root/Lib/email/mime/message.py @@ -0,0 +1,33 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Class representing message/* MIME documents.""" + +__all__ = ['MIMEMessage'] + +from email import message +from email.mime.nonmultipart import MIMENonMultipart + + +class MIMEMessage(MIMENonMultipart): + """Class representing message/* MIME documents.""" + + def __init__(self, _msg, _subtype='rfc822', *, policy=None): + """Create a message/* type MIME document. + + _msg is a message object and must be an instance of Message, or a + derived class of Message, otherwise a TypeError is raised. + + Optional _subtype defines the subtype of the contained message. The + default is "rfc822" (this is defined by the MIME standard, even though + the term "rfc822" is technically outdated by RFC 2822). + """ + MIMENonMultipart.__init__(self, 'message', _subtype, policy=policy) + if not isinstance(_msg, message.Message): + raise TypeError('Argument is not an instance of Message') + # It's convenient to use this base class method. We need to do it + # this way or we'll get an exception + message.Message.attach(self, _msg) + # And be sure our default type is set correctly + self.set_default_type('message/rfc822') diff --git a/micromamba_root/Lib/email/mime/multipart.py b/micromamba_root/Lib/email/mime/multipart.py new file mode 100644 index 0000000000000000000000000000000000000000..1abb84d5fed0bb2f5809b7ba8cf3e054abf97f61 --- /dev/null +++ b/micromamba_root/Lib/email/mime/multipart.py @@ -0,0 +1,47 @@ +# Copyright (C) 2002 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Base class for MIME multipart/* type messages.""" + +__all__ = ['MIMEMultipart'] + +from email.mime.base import MIMEBase + + +class MIMEMultipart(MIMEBase): + """Base class for MIME multipart/* type messages.""" + + def __init__(self, _subtype='mixed', boundary=None, _subparts=None, + *, policy=None, + **_params): + """Creates a multipart/* type message. + + By default, creates a multipart/mixed message, with proper + Content-Type and MIME-Version headers. + + _subtype is the subtype of the multipart content type, defaulting to + 'mixed'. + + boundary is the multipart boundary string. By default it is + calculated as needed. + + _subparts is a sequence of initial subparts for the payload. It + must be an iterable object, such as a list. You can always + attach new subparts to the message by using the attach() method. + + Additional parameters for the Content-Type header are taken from the + keyword arguments (or passed into the _params argument). + """ + MIMEBase.__init__(self, 'multipart', _subtype, policy=policy, **_params) + + # Initialise _payload to an empty list as the Message superclass's + # implementation of is_multipart assumes that _payload is a list for + # multipart messages. + self._payload = [] + + if _subparts: + for p in _subparts: + self.attach(p) + if boundary: + self.set_boundary(boundary) diff --git a/micromamba_root/Lib/email/mime/nonmultipart.py b/micromamba_root/Lib/email/mime/nonmultipart.py new file mode 100644 index 0000000000000000000000000000000000000000..5beab3a441e2bc6f4b88337718c8daa4711188a8 --- /dev/null +++ b/micromamba_root/Lib/email/mime/nonmultipart.py @@ -0,0 +1,21 @@ +# Copyright (C) 2002 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Base class for MIME type messages that are not multipart.""" + +__all__ = ['MIMENonMultipart'] + +from email import errors +from email.mime.base import MIMEBase + + +class MIMENonMultipart(MIMEBase): + """Base class for MIME non-multipart type messages.""" + + def attach(self, payload): + # The public API prohibits attaching multiple subparts to MIMEBase + # derived subtypes since none of them are, by definition, of content + # type multipart/* + raise errors.MultipartConversionError( + 'Cannot attach additional subparts to non-multipart/*') diff --git a/micromamba_root/Lib/email/mime/text.py b/micromamba_root/Lib/email/mime/text.py new file mode 100644 index 0000000000000000000000000000000000000000..aa4da7f8217e433186c518604e4ae531d2d78c48 --- /dev/null +++ b/micromamba_root/Lib/email/mime/text.py @@ -0,0 +1,40 @@ +# Copyright (C) 2001 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Class representing text/* type MIME documents.""" + +__all__ = ['MIMEText'] + +from email.mime.nonmultipart import MIMENonMultipart + + +class MIMEText(MIMENonMultipart): + """Class for generating text/* type MIME documents.""" + + def __init__(self, _text, _subtype='plain', _charset=None, *, policy=None): + """Create a text/* type MIME document. + + _text is the string for this message object. + + _subtype is the MIME sub content type, defaulting to "plain". + + _charset is the character set parameter added to the Content-Type + header. This defaults to "us-ascii". Note that as a side-effect, the + Content-Transfer-Encoding header will also be set. + """ + + # If no _charset was specified, check to see if there are non-ascii + # characters present. If not, use 'us-ascii', otherwise use utf-8. + # XXX: This can be removed once #7304 is fixed. + if _charset is None: + try: + _text.encode('us-ascii') + _charset = 'us-ascii' + except UnicodeEncodeError: + _charset = 'utf-8' + + MIMENonMultipart.__init__(self, 'text', _subtype, policy=policy, + charset=str(_charset)) + + self.set_payload(_text, _charset) diff --git a/micromamba_root/Lib/encodings/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de6a2da91651577ee732375c6d2fe5661362c740 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/_win_cp_codecs.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/_win_cp_codecs.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a17fbe05d4c0e0ea25ceb77fa552babd70126c9 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/_win_cp_codecs.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/aliases.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/aliases.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70e664e5af6cd7902df73a3478792e4c27d80af4 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/aliases.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/ascii.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/ascii.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86bb180294188d05ad7728ed49feafb8526c0eab Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/ascii.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/base64_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/base64_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..323247b9a117833b32663961ef55f963893f8cce Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/base64_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/big5.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/big5.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..271ea3c2ac91404bfd63fe2b710e9e21b1159593 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/big5.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/big5hkscs.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/big5hkscs.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b88b3feb57203e3f767c951f5399f479f65c2b4d Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/big5hkscs.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/bz2_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/bz2_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9deba2527fcbd7ddaac37adaab3ad9a99ea9ac25 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/bz2_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/charmap.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/charmap.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b9c07c63b3dad5d6af7f1b92f9939130e59c6f6 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/charmap.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp037.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp037.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7301ac9a4ae2b72e9773e8ab8013b443380d090 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp037.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1006.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1006.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4128c2151d981cc8d12e16eb70b9e065a41523fb Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1006.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1026.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1026.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a1ec0f1103b68769ba91b18e0b6df59946c6e91 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1026.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1125.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1125.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b615fa4b37ab4e7f7b2e1323e7663302462413f Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1125.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1140.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1140.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a606ad2d527b92c62d25d35420b6a580b98e1880 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1140.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1250.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1250.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9867f35370f6a9402e03053e344242769e58849c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1250.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1251.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1251.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff63945bdb1ed1e37a3b966d96b6cd870150f9be Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1251.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1252.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1252.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0cd98d94dd8425f2ad4472eb61a25f7ca0917cdf Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1252.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1253.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1253.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..662a20ef395ed15e161562fb49fa35285af8a091 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1253.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1254.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1254.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3a60745f192066efbe481f1c3fde28f8a8417de Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1254.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1255.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1255.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a71a2c90f372c15ee41860d45441054883d98bd2 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1255.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1256.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1256.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61ba53ed9b8600972e5cbd2bf78fe3e991317138 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1256.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1257.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1257.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..801b8a2a612c3192752db083dd3a336e81759ff6 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1257.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp1258.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp1258.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a75918c75fcfe20118f3c828958f377821765489 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp1258.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp273.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp273.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0760da216949ebd6b9bc82fe0e466aab03f58679 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp273.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp424.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp424.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f9c660e9bb78bd25d495341b838b89ff826cb9c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp424.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp437.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp437.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33c17ae009692854352ae131ad7e1ed00ae62963 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp437.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp500.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp500.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38e89c1ff26bb0d785806dbbae12e9be6a3342db Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp500.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp720.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp720.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b6bfdfa50b49537ecf32f635da51b89b7a3614c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp720.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp737.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp737.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57b1833fd28dcf1fbb10bd4ac263733a8ede866e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp737.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp775.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp775.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d49ded03506a91bb12ee0867da8c3d14ede7e3a Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp775.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp850.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp850.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94d12516878983a86d3595eae7cc453ea60ea6f1 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp850.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp852.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp852.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5f9b7bef1d05d9717f95b0cb5410c0c8ceeb9fb Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp852.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp855.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp855.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bde473792edf8f9efa2e1cd78392158e91b40bd4 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp855.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp856.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp856.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3488634252c68eb90d9100b549b1dc214b48653 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp856.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp857.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp857.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7133b5e1c93d8f4846c52336df11bff163f7b359 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp857.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp858.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp858.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e4385a95f541960b47ca0476f5ee0ab399614ce Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp858.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp860.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp860.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2851ae1ac22d9e6582c2c09acc6b8c0f6c2430dd Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp860.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp861.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp861.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4756c3562e4d7e9c77e3b27e0bf281517fe2590f Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp861.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp862.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp862.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4848b0acf917477864084e3518119454da299990 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp862.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp863.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp863.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee04f6ecd602018188bcb08f4a8fe2456b7d8780 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp863.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp864.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp864.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c3229ecff547e4c96a6e7b30d47ca2a4b71b543 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp864.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp865.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp865.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20fc63c2549f5e8f07a6189870b11c977a51dc7e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp865.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp866.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp866.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3c0c5cfd1e3a5e17eb64bb04a64e0dfa25ff338 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp866.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp869.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp869.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e995bbb36e093b0c3b64d957f0f010e4264d9b6 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp869.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp874.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp874.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed240bd31e75896ca1172ad482a3b9443e6f3a6d Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp874.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp875.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp875.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b70715aceb4dd4eae507da436a6a7a02654dbaec Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp875.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp932.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp932.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68d0eb3d70b7413804c5263426c3837481870076 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp932.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp949.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp949.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c203e93470051f480f392b0ac774f0ff30efebde Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp949.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/cp950.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/cp950.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2e260338c0dfb041f0ffeef3d6e53071e80fbad Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/cp950.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/euc_jis_2004.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/euc_jis_2004.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7fa46d3778457594fc8a3fd4a405a11988809137 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/euc_jis_2004.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/euc_jisx0213.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/euc_jisx0213.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7af8c6a2f9cac56e21fee059a4032dc9bda89b3 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/euc_jisx0213.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/euc_jp.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/euc_jp.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce0ed4714656b650596f99aee4be120f0115cbc5 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/euc_jp.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/euc_kr.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/euc_kr.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c0a95957fa0719294cd05d662844c326aa9898c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/euc_kr.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/gb18030.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/gb18030.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..860bf97307b22eb950b82dfd70a0712a6dfb0a8c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/gb18030.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/gb2312.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/gb2312.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47dddbc4b0a437bc3c5922145a62c8416c702b9e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/gb2312.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/gbk.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/gbk.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e9e3c4eef683d34f82b10ae6b8b774a166348fa Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/gbk.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/hex_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/hex_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8bff5233d7f49d8cf84775f78e4d800992046cf Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/hex_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/hp_roman8.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/hp_roman8.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03265da200b9453455be25e53138c01804f72eb7 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/hp_roman8.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/hz.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/hz.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19e2fd2cb57bb354ee20fc69bf8c5fca0c078a52 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/hz.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/idna.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/idna.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a17fb3b24c676e13f89a95fffab32f888b599819 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/idna.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6c398bf7f62928b2468426a2fe3c0e81fa6a6cb Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_1.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_1.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8807c46a759cd27fe5b1a3948fe087c4c8ffdf0 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_1.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e036a45f1134e1a757f2e56cf8aff563349b6ab8 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2004.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2004.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..76b8bf95af727d0f441d9ab21911c4e1698351ba Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_2004.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_3.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_3.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..500b87aeff4209d4287c057b1cf044e1470c901b Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_3.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_ext.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_ext.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cb6e71a29decfd8db7d59c024f890cd72ee203e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_jp_ext.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso2022_kr.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso2022_kr.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..750ba28fca1d778fcb6158a6134827b8d078473c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso2022_kr.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_1.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_1.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b9a2fd53cda913f53d6c00988645a5cb0a1a683 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_1.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_10.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_10.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f0f6bc5ea59fbe8316a0d3bd8be396f998d6aa5 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_10.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_11.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_11.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..604cbe196354a35747c4a2ac7acde61a0213c551 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_11.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_13.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_13.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be728591ccef8f529b5059135987cfa0873ed41a Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_13.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_14.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_14.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d1c1583f17d4878b860ad0fffb1817933635b5e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_14.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_15.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_15.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1b06fb3cfd3145991de82590dc1cc34c22162520 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_15.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_16.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_16.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e1a39c7c015784d5101ef44ab5f91d008b59fb97 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_16.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_2.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_2.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0c78b6f755dce677fba72e53f70e275cd7ca597 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_2.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_3.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_3.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c860179bca2c9cdf536b3658ffd59dd72c2d75b5 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_3.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_4.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_4.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1edfbb4d66bfd9bfff255acb92d776b9b0e9c2a Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_4.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_5.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_5.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79c66693a1d2922f83393330ec2ed12079466b50 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_5.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_6.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_6.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bfbe5e72d713ad9ac016601e288cd90d22e316ea Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_6.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_7.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_7.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17fad2a680682fbcc84c4bc025561cb013ae023e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_7.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_8.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_8.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72283d0f875927f7fa857a6f4015ee0423c1ae4e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_8.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/iso8859_9.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/iso8859_9.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8be4e9ff7d296ecbdea09a238c46e06a4988ec76 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/iso8859_9.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/johab.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/johab.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4c9db0f07ad511d7fdcd8403fcb988f555df196 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/johab.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/koi8_r.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/koi8_r.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ae24f19c0740cd661ad5276538036896a9b910b Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/koi8_r.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/koi8_t.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/koi8_t.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..efcfb7ca19bd11a341fd1e6ff0b16ea8a49791b0 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/koi8_t.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/koi8_u.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/koi8_u.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..848d989c1ea0af493e0692030ce94f597f057532 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/koi8_u.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/kz1048.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/kz1048.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d530a83b657e429711831dc5f7e381a9ba42a39 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/kz1048.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/latin_1.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/latin_1.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..500e159dee5a1acc014cebebfbf2f53d80b57446 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/latin_1.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_arabic.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_arabic.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66cbacb61af5c07906e2fa61f77dde56850b3f72 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_arabic.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_croatian.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_croatian.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77bad3e233705ed02795ecbf5783fd9cbbbbfcf3 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_croatian.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_cyrillic.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_cyrillic.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e02ed9a58d1f71fba6e4dd11c50b25e1f0b65f1d Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_cyrillic.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_farsi.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_farsi.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16b20aa88046171aa4369b1332afd47820206ad2 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_farsi.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_greek.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_greek.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ce8f35b4340cbb4dc0e0402d6884439192cca06 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_greek.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_iceland.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_iceland.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a25aa60c79729b8022844096acd8a47736b8c01 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_iceland.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_latin2.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_latin2.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..429620ee8685d68baaa6b5d306ff8ac8d8635c82 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_latin2.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_roman.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_roman.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..32c9f22b03334bbda0fa3357fce51ebc3f6f80db Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_roman.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_romanian.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_romanian.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1918bb5726e57cc5a61b93d96ce79e9d9a66a02e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_romanian.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mac_turkish.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mac_turkish.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52a29165c86c81139652cea705c97c33a16a7848 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mac_turkish.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/mbcs.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/mbcs.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2bace6e62e0adea7cc6ab718d920ee5b590471e4 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/mbcs.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/oem.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/oem.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6614989deaabc6b5f958535919bce29f34a66abc Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/oem.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/palmos.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/palmos.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5db3e48d800682246e0b9de0d1bf6f7f3686442c Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/palmos.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/ptcp154.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/ptcp154.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b01df6e7d16f45abefff9370c6d92983e09482b6 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/ptcp154.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/punycode.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/punycode.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d6c49fbb6357c1987e7b2bc221a9f3b7d6ac38e8 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/punycode.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/quopri_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/quopri_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a0824c406516dc7b6178d40c8a99125b502c8f0 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/quopri_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/raw_unicode_escape.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/raw_unicode_escape.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2f47a799763d61d8ac314ed8db2e6b064264b9b9 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/raw_unicode_escape.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/rot_13.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/rot_13.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a1240a069aea6b2044454a7896836a4a6fa59ac Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/rot_13.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/shift_jis.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/shift_jis.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..774a322823bbe4b969b3040789c7020167d6893f Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/shift_jis.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/shift_jis_2004.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/shift_jis_2004.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60159ccb8b94bdb9a91c7531122762fb886f3592 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/shift_jis_2004.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/shift_jisx0213.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/shift_jisx0213.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40995d9fa60c76b889aa4307e32cf3b6823a9df3 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/shift_jisx0213.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/tis_620.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/tis_620.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0cf21df16385fa203609ef586456286b36e4fe4 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/tis_620.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/undefined.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/undefined.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ce06328070a7a6d613ef0a38f1b56b20c4f0296 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/undefined.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/unicode_escape.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/unicode_escape.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21c61f6af1c368e49d0d21c12b8a6a345c5be8c7 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/unicode_escape.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_16.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_16.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb248b8379e0f1d1a4165c2c53e5c2b09195533e Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_16.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_16_be.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_16_be.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cea3822419049de57a556f8a6b47de8e838cc002 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_16_be.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_16_le.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_16_le.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..37cacabbfac4c4637abf83c96ebb648bb1ce3308 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_16_le.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_32.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_32.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2027a41dc0e1c4ee33cc453cfa5a2c783279499d Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_32.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_32_be.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_32_be.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae64e529eff351861846f9135dad226bfbcdcc4f Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_32_be.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_32_le.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_32_le.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2cb2b2d096415a54d13bd9ba2d5669b6eb094a53 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_32_le.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_7.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_7.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e12c31f4a1a20fa859867bf91d76df178a3ff957 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_7.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_8.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_8.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a4623bbcea9dc4bf41826a6b666fe681a9478bc Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_8.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/utf_8_sig.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/utf_8_sig.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9aab0cb37d90b4dc5d83125f2c5667556b1f206b Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/utf_8_sig.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/uu_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/uu_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17900bc06ce89bc9473a3377bb5ca12447f91e32 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/uu_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/encodings/__pycache__/zlib_codec.cpython-314.pyc b/micromamba_root/Lib/encodings/__pycache__/zlib_codec.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8468fac54df5aef7006af9127cc648b546cb4636 Binary files /dev/null and b/micromamba_root/Lib/encodings/__pycache__/zlib_codec.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ensurepip/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/ensurepip/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35e473b6ee8fa57e54815e5bcab3e6dcaabf960d Binary files /dev/null and b/micromamba_root/Lib/ensurepip/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ensurepip/__pycache__/__main__.cpython-314.pyc b/micromamba_root/Lib/ensurepip/__pycache__/__main__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..390f34adff9b9cb62ec23de837923495cbed1cb2 Binary files /dev/null and b/micromamba_root/Lib/ensurepip/__pycache__/__main__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/ensurepip/__pycache__/_uninstall.cpython-314.pyc b/micromamba_root/Lib/ensurepip/__pycache__/_uninstall.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67e7c19eed79e211d48999af4fa0ab2e835f3f20 Binary files /dev/null and b/micromamba_root/Lib/ensurepip/__pycache__/_uninstall.cpython-314.pyc differ diff --git a/micromamba_root/Lib/html/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/html/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f5996eefe014d875b95742ace630ca4cee1dd95 Binary files /dev/null and b/micromamba_root/Lib/html/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/html/__pycache__/entities.cpython-314.pyc b/micromamba_root/Lib/html/__pycache__/entities.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71ae59fab7d54ea879be3ca21c4272880e3af534 Binary files /dev/null and b/micromamba_root/Lib/html/__pycache__/entities.cpython-314.pyc differ diff --git a/micromamba_root/Lib/html/__pycache__/parser.cpython-314.pyc b/micromamba_root/Lib/html/__pycache__/parser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..351d09ac730e8d119798a03db317d82a0c0c216f Binary files /dev/null and b/micromamba_root/Lib/html/__pycache__/parser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/http/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/http/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f042afa8b4486b361eb7fc071137961a4f49f7a Binary files /dev/null and b/micromamba_root/Lib/http/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/http/__pycache__/client.cpython-314.pyc b/micromamba_root/Lib/http/__pycache__/client.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7dc3324b4f52651035131b74464c42efe8fb4bc Binary files /dev/null and b/micromamba_root/Lib/http/__pycache__/client.cpython-314.pyc differ diff --git a/micromamba_root/Lib/http/__pycache__/cookiejar.cpython-314.pyc b/micromamba_root/Lib/http/__pycache__/cookiejar.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d75b004491ce85791f6d85e4b1655fe0bdf8ce18 Binary files /dev/null and b/micromamba_root/Lib/http/__pycache__/cookiejar.cpython-314.pyc differ diff --git a/micromamba_root/Lib/http/__pycache__/cookies.cpython-314.pyc b/micromamba_root/Lib/http/__pycache__/cookies.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2e4d3b7e8b2b94c7176763ebdbedbf7e9312e12 Binary files /dev/null and b/micromamba_root/Lib/http/__pycache__/cookies.cpython-314.pyc differ diff --git a/micromamba_root/Lib/http/__pycache__/server.cpython-314.pyc b/micromamba_root/Lib/http/__pycache__/server.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7a1ba2992b732739101d6ece2e0c234f22edcb2 Binary files /dev/null and b/micromamba_root/Lib/http/__pycache__/server.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/Icons/README.txt b/micromamba_root/Lib/idlelib/Icons/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..e245bc0b26e121eb19df5eb9f8464e12dcf6ebde --- /dev/null +++ b/micromamba_root/Lib/idlelib/Icons/README.txt @@ -0,0 +1,51 @@ +IDLE-PYTHON LOGOS + +These are sent to tk on Windows, *NIX, and non-Aqua macOS +in pyshell following "# set application icon". + + +2006?: Andrew Clover made variously sized python icons for win23. +https://www.doxdesk.com/software/py/pyicons.html + +2006: 16, 32, and 48 bit .png versions were copied to CPython +as Python application icons, maybe in PC/icons/py.ico. +https://github.com/python/cpython/issues/43372 + +2014: They were copied (perhaps a bit revised) to idlelib/Icons. +https://github.com/python/cpython/issues/64605 +.gif versions were also added. + +2020: Add Clover's 256-bit image. +https://github.com/python/cpython/issues/82620 +Other fixups were done. + +The idle.ico file used for Windows was created with ImageMagick: + $ convert idle_16.png idle_32.png idle_48.png idle_256.png idle.ico +** This needs redoing whenever files are changed. +?? Do Start, Desktop, and Taskbar use idlelib/Icons files? + +Issue added Windows Store PC/icons/idlex44.png and .../idlex150.png. +https://github.com/python/cpython/pull/22817 +?? Should these be updated with major changes? + +2022: Optimize .png images in CPython repository with external program. +https://github.com/python/cpython/pull/21348 +idle.ico (and idlex##) were not updated. + +The idlexx.gif files are only needed for *nix running tcl/tk 8.5. +As of 2022, this was known true for 1 'major' Linux distribution. +(Same would be true for any non-Aqua macOS with 8.5, but now none?) +Can be deleted when we require 8.6 or it is known always used. + +Future: Derivatives of Python logo should be submitted for approval. +PSF Trademark Working Group / Committee psf-trademarks@python.org +https://www.python.org/community/logos/ # Original files +https://www.python.org/psf/trademarks-faq/ +https://www.python.org/psf/trademarks/ # Usage. + + +OTHER GIFS: These are used by browsers using idlelib.tree. +At least some will not be used when tree is replaced by ttk.Treeview. + + +Edited 2024 August 26 by TJR. diff --git a/micromamba_root/Lib/idlelib/Icons/idle.ico b/micromamba_root/Lib/idlelib/Icons/idle.ico new file mode 100644 index 0000000000000000000000000000000000000000..2aa9a8300d9e29670ecbe585f5ab21579dece9c2 Binary files /dev/null and b/micromamba_root/Lib/idlelib/Icons/idle.ico differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9a963d5bb8ce54af7c57abd6e5a93e5608fec5e Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/__main__.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/__main__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a87c75cbbeb2ca3edc02873c604ee46310b29ca3 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/__main__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/autocomplete.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/autocomplete.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bf65c59901d7f985cda6889190ad0aced7583de Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/autocomplete.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/autocomplete_w.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/autocomplete_w.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da779424ea3aadf2ad379418156a531979ce8ce0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/autocomplete_w.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/autoexpand.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/autoexpand.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c616733b572b7a82ee6667974df2a14a5c44a4b Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/autoexpand.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/browser.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/browser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b791ae8fda38b014decfda29f1e9d04ed70ec9b0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/browser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/calltip.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/calltip.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6effb6261cd082689511ba7b7f125c3c27a73230 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/calltip.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/calltip_w.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/calltip_w.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28847bd860ca13902709962a5c83df1dc5c593ed Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/calltip_w.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/codecontext.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/codecontext.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..367088ce2d3d8e14a18a38a9875f9b790bd87558 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/codecontext.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/colorizer.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/colorizer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f3209f019517c15dfc64caae355b11ead9bbef2 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/colorizer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/config.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/config.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0c9550aad92f7982d262ba103ac653b44b9723a Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/config.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/config_key.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/config_key.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac101cf82499a9761a09897699c6d40874adadb9 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/config_key.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/debugger.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/debugger.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90d9ddc0d6058f3d83ccc40c38f34cca2fffb29e Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/debugger.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/debugger_r.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/debugger_r.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d56f0197185a8944f72c0fb67c3a82fbd56bb78 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/debugger_r.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/debugobj.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/debugobj.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b41f8255caef464c9ef1a5804945fcd6d9a1c5b5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/debugobj.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/debugobj_r.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/debugobj_r.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca4d9af2c8f3958dd6bcd3fc123127f25795ebb4 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/debugobj_r.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/delegator.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/delegator.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1eef6f9e335b0b9741de730ba36cb219f31e0f5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/delegator.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/dynoption.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/dynoption.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b93bf375e240723427a673c4ca99a7763d312f97 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/dynoption.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/editor.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/editor.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f0020d59e3fca8431d73e1e615655c94cf38983 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/editor.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/filelist.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/filelist.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2334cd83f0bb4a133ac7fcd8b7f0885830124dd Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/filelist.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/format.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/format.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f68f1c88e5d906a5043bcb4f945ce4bb498bb3b4 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/format.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/grep.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/grep.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..382101541c52ec0f5dfa853eafb2e1a2cd40647f Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/grep.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/help.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/help.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b82bec90c4882cdb4edcc7df7a4ea78d443112f2 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/help.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/help_about.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/help_about.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caebb687974bd455c0e867d042dd7ae501787feb Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/help_about.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/history.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/history.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9093960513b73869828879e326039a8889c107c Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/history.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/hyperparser.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/hyperparser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d6d3d44a5cdc6263ec76461df599ab6e516d1c30 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/hyperparser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/idle.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/idle.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3bb20cdbcdc1f311b49f00dd7f7ea3fb8e84b3c0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/idle.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/iomenu.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/iomenu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0609b428a47a9231d1aed1aab9a94e08d538e9bc Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/iomenu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/macosx.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/macosx.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0be4e89158710a5519684007ae8287969728b79c Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/macosx.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/mainmenu.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/mainmenu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05f44395621b51ca8475a1ce11b668086f16f1df Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/mainmenu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/multicall.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/multicall.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b903fceb36532987f93ad2f7886c999fea2a02a Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/multicall.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/outwin.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/outwin.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a0c2c2aaeccdd0eab79a5e31d0ba3145fb368f7 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/outwin.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/parenmatch.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/parenmatch.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ec7f9e1799d84927ae5dc464424235272a8b9be Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/parenmatch.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/pathbrowser.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/pathbrowser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4a9e015783246eef72ab035d0c4d91c1bc75946 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/pathbrowser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/percolator.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/percolator.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..211c18245899743e4aee1ec8a0e9d23c2556667d Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/percolator.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/pyparse.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/pyparse.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b0bfbc1a4ace3282d8b62cc5a8a371eb05f388e Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/pyparse.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/pyshell.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/pyshell.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08c7b6d54662c4c953c093c07d84c3be285e2c5c Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/pyshell.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/query.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/query.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d25e4d16bb88935cbd5869851f29002a09738f8 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/query.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/redirector.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/redirector.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cb4881557c331eebe3645542ddc76da7fdb69ea Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/redirector.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/replace.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/replace.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71c099a23aef71e6f986beb279e841e6aec09772 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/replace.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/rpc.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/rpc.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2ac99a9314f5d363b7f7123314a29a7f09e41fd Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/rpc.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/run.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/run.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bd7debc4f77efd8b5efcf9fbf0ba33cd11bc787 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/run.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/runscript.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/runscript.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05443560d1b99a02aa695eb649cb7fc28efe2928 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/runscript.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/scrolledlist.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/scrolledlist.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2c560d6fe868ec2aebc6119c2ac10ace940230b0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/scrolledlist.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/search.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/search.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd3769e48d8aae0168102b773d847fca52182abf Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/search.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/searchbase.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/searchbase.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f004bf831896d58bb56eae5654225085d9ba00ef Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/searchbase.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/searchengine.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/searchengine.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41ddc9dc6db998c3edd8de4e8a909cbaf8e6a2e1 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/searchengine.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/sidebar.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/sidebar.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04e1968e8253e7e822d902f99bc7f7d33a403fe5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/sidebar.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/squeezer.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/squeezer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..304e8628601b71a0a5f8a806259273b37d822e2f Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/squeezer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/stackviewer.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/stackviewer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ebcc948382412f4e33f51c317eb2e8012094e5d8 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/stackviewer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/statusbar.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/statusbar.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d66157573198de18a70d15607efc8422a9fa64db Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/statusbar.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/textview.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/textview.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d95719c7ea6689ced15a3bf5d3f0fce8e63e1d0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/textview.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/tooltip.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/tooltip.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3fd11d81f2de0b26b5038333b0f3c2741242bce Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/tooltip.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/tree.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/tree.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9c287b8799e6826e6640097552620e85833d9a0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/tree.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/undo.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/undo.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6fb93d905a42b0e855c657d4c7d9215b2a9783e5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/undo.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/util.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1088ecff6762dd57ef2b69855853569040865ea3 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/window.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/window.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8b50053911b7acedd080d9fa98eb626972e808b Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/window.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/zoomheight.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/zoomheight.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5fe7e0e2c09f68038a775dcc19f84978813ea01a Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/zoomheight.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/__pycache__/zzdummy.cpython-314.pyc b/micromamba_root/Lib/idlelib/__pycache__/zzdummy.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4cee5ef06fc405aec9b2b2a4d853923f7691eb65 Binary files /dev/null and b/micromamba_root/Lib/idlelib/__pycache__/zzdummy.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/README.txt b/micromamba_root/Lib/idlelib/idle_test/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..cacd06db873d039baa144a95fa45914565ca6197 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/README.txt @@ -0,0 +1,241 @@ +README FOR IDLE TESTS IN IDLELIB.IDLE_TEST + +0. Quick Start + +Automated unit tests were added in 3.3 for Python 3.x. +To run the tests from a command line: + +python -m test.test_idle + +Human-mediated tests were added later in 3.4. + +python -m idlelib.idle_test.htest + + +1. Test Files + +The idle directory, idlelib, has over 60 xyz.py files. The idle_test +subdirectory contains test_xyz.py for each implementation file xyz.py. +To add a test for abc.py, open idle_test/template.py and immediately +Save As test_abc.py. Insert 'abc' on the first line, and replace +'zzdummy' with 'abc. + +Remove the imports of requires and tkinter if not needed. Otherwise, +add to the tkinter imports as needed. + +Add a prefix to 'Test' for the initial test class. The template class +contains code needed or possibly needed for gui tests. See the next +section if doing gui tests. If not, and not needed for further classes, +this code can be removed. + +Add the following at the end of abc.py. If an htest was added first, +insert the import and main lines before the htest lines. + +if __name__ == "__main__": + from unittest import main + main('idlelib.idle_test.test_abc', verbosity=2, exit=False) + +The ', exit=False' is only needed if an htest follows. + + + +2. GUI Tests + +When run as part of the Python test suite, Idle GUI tests need to run +test.support.requires('gui'). A test is a GUI test if it creates a +tkinter.Tk root or master object either directly or indirectly by +instantiating a tkinter or idle class. GUI tests cannot run in test +processes that either have no graphical environment available or are not +allowed to use it. + +To guard a module consisting entirely of GUI tests, start with + +from test.support import requires +requires('gui') + +To guard a test class, put "requires('gui')" in its setUpClass function. +The template.py file does this. + +To avoid interfering with other GUI tests, all GUI objects must be +destroyed and deleted by the end of the test. The Tk root created in a +setUpX function should be destroyed in the corresponding tearDownX and +the module or class attribute deleted. Others widgets should descend +from the single root and the attributes deleted BEFORE root is +destroyed. See https://bugs.python.org/issue20567. + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.text = tk.Text(root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + +The update_idletasks call is sometimes needed to prevent the following +warning either when running a test alone or as part of the test suite +(#27196). It should not hurt if not needed. + + can't invoke "event" command: application has been destroyed + ... + "ttk::ThemeChanged" + +If a test creates instance 'e' of EditorWindow, call 'e._close()' before +or as the first part of teardown. The effect of omitting this depends +on the later shutdown. Then enable the after_cancel loop in the +template. This prevents messages like the following. + +bgerror failed to handle background error. + Original error: invalid command name "106096696timer_event" + Error in bgerror: can't invoke "tk" command: application has been destroyed + +Requires('gui') causes the test(s) it guards to be skipped if any of +these conditions are met: + + - The tests are being run by regrtest.py, and it was started without + enabling the "gui" resource with the "-u" command line option. + + - The tests are being run on Windows by a service that is not allowed + to interact with the graphical environment. + + - The tests are being run on Linux and X Windows is not available. + + - The tests are being run on Mac OSX in a process that cannot make a + window manager connection. + + - tkinter.Tk cannot be successfully instantiated for some reason. + + - test.support.use_resources has been set by something other than + regrtest.py and does not contain "gui". + +Tests of non-GUI operations should avoid creating tk widgets. Incidental +uses of tk variables and messageboxes can be replaced by the mock +classes in idle_test/mock_tk.py. The mock text handles some uses of the +tk Text widget. + + +3. Running Unit Tests + +Assume that xyz.py and test_xyz.py both end with a unittest.main() call. +Running either from an Idle editor runs all tests in the test_xyz file +with the version of Python running Idle. Test output appears in the +Shell window. The 'verbosity=2' option lists all test methods in the +file, which is appropriate when developing tests. The 'exit=False' +option is needed in xyx.py files when an htest follows. + +The following command lines also run all test methods, including +GUI tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' +start Idle and so cannot run tests.) + +python -m idlelib.xyz +python -m idlelib.idle_test.test_xyz + +The following runs all idle_test/test_*.py tests interactively. + +>>> import unittest +>>> unittest.main('idlelib.idle_test', verbosity=2) + +The following run all Idle tests at a command line. Option '-v' is the +same as 'verbosity=2'. + +python -m unittest -v idlelib.idle_test +python -m test -v -ugui test_idle +python -m test.test_idle + +IDLE tests are 'discovered' by idlelib.idle_test.__init__.load_tests +when this is imported into test.test_idle. Normally, neither file +should be changed when working on individual test modules. The third +command runs unittest indirectly through regrtest. The same happens when +the entire test suite is run with 'python -m test'. So that command must +work for buildbots to stay green. IDLE tests must not disturb the +environment in a way that makes other tests fail (GH-62281). + +To test subsets of modules, see idlelib.idle_test.__init__. This +can be used to find refleaks or possible sources of "Theme changed" +tcl messages (GH-71383). + +To run an individual Testcase or test method, extend the dotted name +given to unittest on the command line or use the test -m option. The +latter allows use of other regrtest options. When using the latter, +all components of the pattern must be present, but any can be replaced +by '*'. + +python -m unittest -v idlelib.idle_test.test_xyz.Test_case.test_meth +python -m test -m idlelib.idle_test.text_xyz.Test_case.test_meth test_idle + +The test suite can be run in an IDLE user process from Shell. +>>> import test.autotest # Issue 25588, 2017/10/13, 3.6.4, 3.7.0a2. +There are currently failures not usually present, and this does not +work when run from the editor. + + +4. Human-mediated Tests + +Human-mediated tests are widget tests that cannot be automated but need +human verification. They are contained in idlelib/idle_test/htest.py, +which has instructions. (Some modules need an auxiliary function, +identified with "# htest # on the header line.) The set is about +complete, though some tests need improvement. To run all htests, run the +htest file from an editor or from the command line with: + +python -m idlelib.idle_test.htest + + +5. Test Coverage + +Install the coverage package into your Python 3.6 site-packages +directory. (Its exact location depends on the OS). +> python3 -m pip install coverage +(On Windows, replace 'python3 with 'py -3.6' or perhaps just 'python'.) + +The problem with running coverage with repository python is that +coverage uses absolute imports for its submodules, hence it needs to be +in a directory in sys.path. One solution: copy the package to the +directory containing the cpython repository. Call it 'dev'. Then run +coverage either directly or from a script in that directory so that +'dev' is prepended to sys.path. + +Either edit or add dev/.coveragerc so it looks something like this. +--- +# .coveragerc sets coverage options. +[run] +branch = True + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + + .*# htest # + if not _utest: + if _htest: +--- +The additions for IDLE are 'branch = True', to test coverage both ways, +and the last three exclude lines, to exclude things peculiar to IDLE +that are not executed during tests. + +A script like the following cover.bat (for Windows) is very handy. +--- +@echo off +rem Usage: cover filename [test_ suffix] # proper case required by coverage +rem filename without .py, 2nd parameter if test is not test_filename +setlocal +set py=f:\dev\3x\pcbuild\win32\python_d.exe +set src=idlelib.%1 +if "%2" EQU "" set tst=f:/dev/3x/Lib/idlelib/idle_test/test_%1.py +if "%2" NEQ "" set tst=f:/dev/ex/Lib/idlelib/idle_test/test_%2.py + +%py% -m coverage run --pylib --source=%src% %tst% +%py% -m coverage report --show-missing +%py% -m coverage html +start htmlcov\3x_Lib_idlelib_%1_py.html +rem Above opens new report; htmlcov\index.html displays report index +--- +The second parameter was added for tests of module x not named test_x. +(There were several before modules were renamed, now only one is left.) diff --git a/micromamba_root/Lib/idlelib/idle_test/__init__.py b/micromamba_root/Lib/idlelib/idle_test/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8eed2699c4121119eec4e38d7b19e6a360404f70 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/__init__.py @@ -0,0 +1,23 @@ +"""idlelib.idle_test implements test.test_idle, which tests the IDLE +application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle (-v)". + +This package and its contained modules are subject to change and +any direct use is at your own risk. +""" +from os.path import dirname + +# test_idle imports load_tests for test discovery (default all). +# To run subsets of idlelib module tests, insert '[]' after '_'. +# Example: insert '[ac]' for modules beginning with 'a' or 'c'. +# Additional .discover/.addTest pairs with separate inserts work. +# Example: pairs with 'c' and 'g' test c* files and grep. + +def load_tests(loader, standard_tests, pattern): + this_dir = dirname(__file__) + top_dir = dirname(dirname(this_dir)) + module_tests = loader.discover(start_dir=this_dir, + pattern='test_*.py', # Insert here. + top_level_dir=top_dir) + standard_tests.addTests(module_tests) + return standard_tests diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0fc31aed42a3b746505e376b8ab7ad941cb14bf Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/htest.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/htest.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b39c1e797325fc25ea8830bc1373a08b98390283 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/htest.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_idle.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_idle.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8f3fc7031ec3dda7ce8b262b554ad35a7a62432 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_idle.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_tk.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_tk.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df07ef82d2101bec34a0cd8171bb712200a858e5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/mock_tk.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/template.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/template.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0312493fe1c281f0da6da8c457ec50e991a7f3e6 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/template.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f08bbf8addf75a02575e69f0e078c9cfbad919d Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c95cd98c7d3212e65ad782beeeecc82ad207c24 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autoexpand.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autoexpand.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6e50404170115f8bebab57d0d8efb36740daf5d Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_autoexpand.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_browser.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_browser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60de72444162191e1add733f1b0cecbab09434a0 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_browser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..545029f6b3768ed4905e17086bb6922138be7f05 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip_w.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip_w.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..99aa1194033e6c5926798a7e676b18ebd6c0ebf4 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_calltip_w.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_codecontext.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_codecontext.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bed429269296287ea20b5da9d6fc4a3456478501 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_codecontext.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_colorizer.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_colorizer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5336cbadb5089cf2fee7ba8973f5ba6ff0aefa02 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_colorizer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..58dfb9cc5c4888caa2cc0da2ce595d9d89925046 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config_key.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config_key.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..141f94b3ffd156c8d1dfa400df3747c3330c9e00 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_config_key.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_configdialog.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_configdialog.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e1f3174b3361003de8516539d777ff07166cb47 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_configdialog.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9c43f296de10f05f953d2dee9912805cd60e63d Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger_r.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger_r.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b78a8d84825175841ca0cf55f93778d6ba893f95 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugger_r.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8266f24889d5f8fc7caac237359fc902f888082c Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7a567e8af0fee7f3ebac6f8141cb87030c8cd28 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_debugobj_r.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_delegator.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_delegator.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03030f6b158dfe1ec9dd4dd58f8723aa32e68d05 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_delegator.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editmenu.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editmenu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cac167f014707af3c4a036752808e58b0cab821b Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editmenu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editor.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editor.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..868ed23be054ee2d3e976a01c61892f553a585b5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_editor.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_filelist.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_filelist.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..76d028cb4e2962bd274d3410d84582f2a0737d14 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_filelist.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_format.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_format.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e0b0dd3f7847cde822dfa847fed5d02fe26adfb Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_format.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_grep.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_grep.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79f1713e629062a45c8107840a5d01037b1844bc Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_grep.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77d510020dbeedd00f4d2a72a4b58cfde2bd825a Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help_about.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help_about.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d14db421174f5f1423570c21727a9c2084d400f Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_help_about.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_history.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_history.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..003f4568493a69b7832aed0d033dc937d2d7bffb Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_history.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_hyperparser.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_hyperparser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6582179767901e0d30393c7ad004c6ca626d479 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_hyperparser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_iomenu.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_iomenu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9942855d96a6af28431f5b5ce7604f097527d32 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_iomenu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_macosx.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_macosx.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a3b5be343ef947de1f8009f5cca3debf3818600c Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_macosx.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_mainmenu.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_mainmenu.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f912c89b0c092aed8501249989827043c398d58d Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_mainmenu.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_multicall.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_multicall.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09c4b98a54cbe15a5f5f28b688bbe074abdc9728 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_multicall.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_outwin.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_outwin.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d70d87761add026d5944f7ee42d5b15c559abe3 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_outwin.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_parenmatch.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_parenmatch.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2fe0fce409571825ff145cd7f0492fa1e744b968 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_parenmatch.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45a0b57bc6d30dd5cd77c477d141f199f72c7d60 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_percolator.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_percolator.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d87f467da7c73cbbbeaf6934531fe985462810e4 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_percolator.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyparse.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyparse.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d819bac73682cf60cee4f6929130464be65d5d5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyparse.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyshell.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyshell.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..328e0a5db47c86bdaf1ce5f2d9ec402d797a3d56 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_pyshell.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_query.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_query.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84e75cd07ea3478816df5e469098d193cca1512c Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_query.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_redirector.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_redirector.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b7cc46d08cb20b900d7998eb3ce7d15e8120b28 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_redirector.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_replace.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_replace.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d7800f2cccbcee791e36988495057df39470619 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_replace.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_rpc.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_rpc.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6a9cfbb5f5d1d3b6dadd79c8e1db99aed69db2e Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_rpc.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_run.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_run.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..afbe81cf1b88083a0f93edcd6192e2f5b21dee56 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_run.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_runscript.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_runscript.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b6b925cba707b33263020fcc57b15724e9c5d31 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_runscript.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15b85ac172eb56bdd897d710f0fd0e722a77a4f3 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_scrolledlist.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_search.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_search.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00ae8b445703008102ad553ab235c1b01f3f31b3 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_search.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchbase.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchbase.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..012d6efd9fea7d46609821448bdbdebb5fe81ef4 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchbase.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchengine.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchengine.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d28510465be6404514c20da582cfa279de623f2 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_searchengine.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_sidebar.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_sidebar.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..919e3b8b713cc25e8213955dc2cb15d42b93499c Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_sidebar.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_squeezer.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_squeezer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee232b597f61befac6c53ed6fdf48bb451b74947 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_squeezer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_stackviewer.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_stackviewer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7da05abe26d5843857d9f92e3636c1a5272ea384 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_stackviewer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_statusbar.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_statusbar.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89ee6917cb73e5ecfc87f8b61ca80a64c1d7b8c6 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_statusbar.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_text.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_text.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5264aa7c7ad0c3e091b5c1d15e3c59831120ad5 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_text.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_textview.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_textview.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82f1e764e9aad7476848fdf37ab33e0cd5df0673 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_textview.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tooltip.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tooltip.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a919d8027d4a634becf0ab47d250e63537a8c69a Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tooltip.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tree.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tree.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d1777af31dd30e8883108e24777d31c460192b9e Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_tree.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_undo.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_undo.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79b6a0ce882d5751bd8e719e2ebfe7dbed29b0bd Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_undo.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_util.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..762f03cbb910905a04794800120bd7252e606ad7 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_warning.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_warning.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..237d98539349f4542b6d4c1a5813d3fd48024113 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_warning.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_window.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_window.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d39fb25a95c37ed79632038e7d8386ecbf0282d9 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_window.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zoomheight.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zoomheight.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c9cb0b06035b2d0a9ff7fc2af793503d340f42f Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zoomheight.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zzdummy.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zzdummy.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19684ce596854b56b73b4f452e8d2625ae927c1b Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/test_zzdummy.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-314.pyc b/micromamba_root/Lib/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bcc939201f8f6e870d04ed8eaf237e5834961476 Binary files /dev/null and b/micromamba_root/Lib/idlelib/idle_test/__pycache__/tkinter_testing_utils.cpython-314.pyc differ diff --git a/micromamba_root/Lib/idlelib/idle_test/example_noext b/micromamba_root/Lib/idlelib/idle_test/example_noext new file mode 100644 index 0000000000000000000000000000000000000000..7d2510e30bc0ae41fde1a2e2fa30cdbb55318893 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/example_noext @@ -0,0 +1,4 @@ +#!usr/bin/env python + +def example_function(some_argument): + pass diff --git a/micromamba_root/Lib/idlelib/idle_test/example_stub.pyi b/micromamba_root/Lib/idlelib/idle_test/example_stub.pyi new file mode 100644 index 0000000000000000000000000000000000000000..abcdbc17529974ca9892cb0b70f30425160bb279 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/example_stub.pyi @@ -0,0 +1,4 @@ +# An example file to test recognition of a .pyi file as Python source code. + +class Example: + def method(self, argument1: str, argument2: list[int]) -> None: ... diff --git a/micromamba_root/Lib/idlelib/idle_test/htest.py b/micromamba_root/Lib/idlelib/idle_test/htest.py new file mode 100644 index 0000000000000000000000000000000000000000..b63ff9ec2877b96ef225d7f8a4073a19b294cd94 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/htest.py @@ -0,0 +1,442 @@ +"""Run human tests of Idle's window, dialog, and popup widgets. + +run(*tests) Create a master Tk() htest window. Within that, run each +callable in tests after finding the matching test spec in this file. If +tests is empty, run an htest for each spec dict in this file after +finding the matching callable in the module named in the spec. Close +the master window to end testing. + +In a tested module, let X be a global name bound to a callable (class or +function) whose .__name__ attribute is also X (the usual situation). The +first parameter of X must be 'parent' or 'master'. When called, the +first argument will be the root window. X must create a child +Toplevel(parent/master) (or subclass thereof). The Toplevel may be a +test widget or dialog, in which case the callable is the corresponding +class. Or the Toplevel may contain the widget to be tested or set up a +context in which a test widget is invoked. In this latter case, the +callable is a wrapper function that sets up the Toplevel and other +objects. Wrapper function names, such as _editor_window', should start +with '_' and be lowercase. + + +End the module with + +if __name__ == '__main__': + + from idlelib.idle_test.htest import run + run(callable) # There could be multiple comma-separated callables. + +To have wrapper functions ignored by coverage reports, tag the def +header like so: "def _wrapper(parent): # htest #". Use the same tag +for htest lines in widget code. Make sure that the 'if __name__' line +matches the above. Then have make sure that .coveragerc includes the +following: + +[report] +exclude_lines = + .*# htest # + if __name__ == .__main__.: + +(The "." instead of "'" is intentional and necessary.) + + +To run any X, this file must contain a matching instance of the +following template, with X.__name__ prepended to '_spec'. +When all tests are run, the prefix is use to get X. + +callable_spec = { + 'file': '', + 'kwds': {'title': ''}, + 'msg': "" + } + +file (no .py): run() imports file.py. +kwds: augmented with {'parent':root} and passed to X as **kwds. +title: an example kwd; some widgets need this, delete line if not. +msg: master window hints about testing the widget. + + +TODO test these modules and classes: + autocomplete_w.AutoCompleteWindow + debugger.Debugger + outwin.OutputWindow (indirectly being tested with grep test) + pyshell.PyShellEditorWindow +""" + +import idlelib.pyshell # Set Windows DPI awareness before Tk(). +from importlib import import_module +import textwrap +import tkinter as tk +from tkinter.ttk import Scrollbar +tk.NoDefaultRoot() + +AboutDialog_spec = { + 'file': 'help_about', + 'kwds': {'title': 'help_about test', + '_htest': True, + }, + 'msg': "Click on URL to open in default browser.\n" + "Verify x.y.z versions and test each button, including Close.\n " + } + +# TODO implement ^\; adding '' to function does not work. +_calltip_window_spec = { + 'file': 'calltip_w', + 'kwds': {}, + 'msg': "Typing '(' should display a calltip.\n" + "Typing ') should hide the calltip.\n" + "So should moving cursor out of argument area.\n" + "Force-open-calltip does not work here.\n" + } + +_color_delegator_spec = { + 'file': 'colorizer', + 'kwds': {}, + 'msg': "The text is sample Python code.\n" + "Ensure components like comments, keywords, builtins,\n" + "string, definitions, and break are correctly colored.\n" + "The default color scheme is in idlelib/config-highlight.def" + } + +ConfigDialog_spec = { + 'file': 'configdialog', + 'kwds': {'title': 'ConfigDialogTest', + '_htest': True,}, + 'msg': "IDLE preferences dialog.\n" + "In the 'Fonts/Tabs' tab, changing font face, should update the " + "font face of the text in the area below it.\nIn the " + "'Highlighting' tab, try different color schemes. Clicking " + "items in the sample program should update the choices above it." + "\nIn the 'Keys', 'General' and 'Extensions' tabs, test settings " + "of interest." + "\n[Ok] to close the dialog.[Apply] to apply the settings and " + "and [Cancel] to revert all changes.\nRe-run the test to ensure " + "changes made have persisted." + } + +CustomRun_spec = { + 'file': 'query', + 'kwds': {'title': 'Customize query.py Run', + '_htest': True}, + 'msg': "Enter with or [OK]. Print valid entry to Shell\n" + "Arguments are parsed into a list\n" + "Mode is currently restart True or False\n" + "Close dialog with valid entry, , [Cancel], [X]" + } + +_debug_object_browser_spec = { + 'file': 'debugobj', + 'kwds': {}, + 'msg': "Double click on items up to the lowest level.\n" + "Attributes of the objects and related information " + "will be displayed side-by-side at each level." + } + +# TODO Improve message +_dyn_option_menu_spec = { + 'file': 'dynoption', + 'kwds': {}, + 'msg': "Select one of the many options in the 'old option set'.\n" + "Click the button to change the option set.\n" + "Select one of the many options in the 'new option set'." + } + +# TODO edit wrapper +_editor_window_spec = { + 'file': 'editor', + 'kwds': {}, + 'msg': "Test editor functions of interest.\n" + "Best to close editor first." + } + +GetKeysWindow_spec = { + 'file': 'config_key', + 'kwds': {'title': 'Test keybindings', + 'action': 'find-again', + 'current_key_sequences': [['', '', '']], + '_htest': True, + }, + 'msg': "Test for different key modifier sequences.\n" + " is invalid.\n" + "No modifier key is invalid.\n" + "Shift key with [a-z],[0-9], function key, move key, tab, space " + "is invalid.\nNo validity checking if advanced key binding " + "entry is used." + } + +_grep_dialog_spec = { + 'file': 'grep', + 'kwds': {}, + 'msg': "Click the 'Show GrepDialog' button.\n" + "Test the various 'Find-in-files' functions.\n" + "The results should be displayed in a new '*Output*' window.\n" + "'Right-click'->'Go to file/line' in the search results\n " + "should open that file in a new EditorWindow." + } + +HelpSource_spec = { + 'file': 'query', + 'kwds': {'title': 'Help name and source', + 'menuitem': 'test', + 'filepath': __file__, + 'used_names': {'abc'}, + '_htest': True}, + 'msg': "Enter menu item name and help file path\n" + "'', > than 30 chars, and 'abc' are invalid menu item names.\n" + "'' and file does not exist are invalid path items.\n" + "Any url ('www...', 'http...') is accepted.\n" + "Test Browse with and without path, as cannot unittest.\n" + "[Ok] or prints valid entry to shell\n" + ", [Cancel], or [X] prints None to shell" + } + +_io_binding_spec = { + 'file': 'iomenu', + 'kwds': {}, + 'msg': "Test the following bindings.\n" + " to open file from dialog.\n" + "Edit the file.\n" + " to print the file.\n" + " to save the file.\n" + " to save-as another file.\n" + " to save-copy-as another file.\n" + "Check that changes were saved by opening the file elsewhere." + } + +_multi_call_spec = { + 'file': 'multicall', + 'kwds': {}, + 'msg': "The following should trigger a print to console or IDLE Shell.\n" + "Entering and leaving the text area, key entry, ,\n" + ", , , \n" + ", and focusing elsewhere." + } + +_module_browser_spec = { + 'file': 'browser', + 'kwds': {}, + 'msg': textwrap.dedent(""" + "Inspect names of module, class(with superclass if applicable), + "methods and functions. Toggle nested items. Double clicking + "on items prints a traceback for an exception that is ignored.""") + } + +_multistatus_bar_spec = { + 'file': 'statusbar', + 'kwds': {}, + 'msg': "Ensure presence of multi-status bar below text area.\n" + "Click 'Update Status' to change the status text" + } + +PathBrowser_spec = { + 'file': 'pathbrowser', + 'kwds': {'_htest': True}, + 'msg': "Test for correct display of all paths in sys.path.\n" + "Toggle nested items out to the lowest level.\n" + "Double clicking on an item prints a traceback\n" + "for an exception that is ignored." + } + +_percolator_spec = { + 'file': 'percolator', + 'kwds': {}, + 'msg': "There are two tracers which can be toggled using a checkbox.\n" + "Toggling a tracer 'on' by checking it should print tracer " + "output to the console or to the IDLE shell.\n" + "If both the tracers are 'on', the output from the tracer which " + "was switched 'on' later, should be printed first\n" + "Test for actions like text entry, and removal." + } + +Query_spec = { + 'file': 'query', + 'kwds': {'title': 'Query', + 'message': 'Enter something', + 'text0': 'Go', + '_htest': True}, + 'msg': "Enter with or [Ok]. Print valid entry to Shell\n" + "Blank line, after stripping, is ignored\n" + "Close dialog with valid entry, , [Cancel], [X]" + } + + +_replace_dialog_spec = { + 'file': 'replace', + 'kwds': {}, + 'msg': "Click the 'Replace' button.\n" + "Test various replace options in the 'Replace dialog'.\n" + "Click [Close] or [X] to close the 'Replace Dialog'." + } + +_scrolled_list_spec = { + 'file': 'scrolledlist', + 'kwds': {}, + 'msg': "You should see a scrollable list of items\n" + "Selecting (clicking) or double clicking an item " + "prints the name to the console or Idle shell.\n" + "Right clicking an item will display a popup." + } + +_search_dialog_spec = { + 'file': 'search', + 'kwds': {}, + 'msg': "Click the 'Search' button.\n" + "Test various search options in the 'Search dialog'.\n" + "Click [Close] or [X] to close the 'Search Dialog'." + } + +_searchbase_spec = { + 'file': 'searchbase', + 'kwds': {}, + 'msg': "Check the appearance of the base search dialog\n" + "Its only action is to close." + } + +show_idlehelp_spec = { + 'file': 'help', + 'kwds': {}, + 'msg': "If the help text displays, this works.\n" + "Text is selectable. Window is scrollable." + } + +_sidebar_number_scrolling_spec = { + 'file': 'sidebar', + 'kwds': {}, + 'msg': textwrap.dedent("""\ + 1. Click on the line numbers and drag down below the edge of the + window, moving the mouse a bit and then leaving it there for a + while. The text and line numbers should gradually scroll down, + with the selection updated continuously. + + 2. With the lines still selected, click on a line number above + or below the selected lines. Only the line whose number was + clicked should be selected. + + 3. Repeat step #1, dragging to above the window. The text and + line numbers should gradually scroll up, with the selection + updated continuously. + + 4. Repeat step #2, clicking a line number below the selection."""), + } + +_stackbrowser_spec = { + 'file': 'stackviewer', + 'kwds': {}, + 'msg': "A stacktrace for a NameError exception.\n" + "Should have NameError and 1 traceback line." + } + +_tooltip_spec = { + 'file': 'tooltip', + 'kwds': {}, + 'msg': "Place mouse cursor over both the buttons\n" + "A tooltip should appear with some text." + } + +_tree_widget_spec = { + 'file': 'tree', + 'kwds': {}, + 'msg': "The canvas is scrollable.\n" + "Click on folders up to the lowest level." + } + +_undo_delegator_spec = { + 'file': 'undo', + 'kwds': {}, + 'msg': "Click [Undo] to undo any action.\n" + "Click [Redo] to redo any action.\n" + "Click [Dump] to dump the current state " + "by printing to the console or the IDLE shell.\n" + } + +ViewWindow_spec = { + 'file': 'textview', + 'kwds': {'title': 'Test textview', + 'contents': 'The quick brown fox jumps over the lazy dog.\n'*35, + '_htest': True}, + 'msg': "Test for read-only property of text.\n" + "Select text, scroll window, close" + } + +_widget_redirector_spec = { + 'file': 'redirector', + 'kwds': {}, + 'msg': "Every text insert should be printed to the console " + "or the IDLE shell." + } + +def run(*tests): + "Run callables in tests." + root = tk.Tk() + root.title('IDLE htest') + root.resizable(0, 0) + + # A scrollable Label-like constant width text widget. + frameLabel = tk.Frame(root, padx=10) + frameLabel.pack() + text = tk.Text(frameLabel, wrap='word') + text.configure(bg=root.cget('bg'), relief='flat', height=4, width=70) + scrollbar = Scrollbar(frameLabel, command=text.yview) + text.config(yscrollcommand=scrollbar.set) + scrollbar.pack(side='right', fill='y', expand=False) + text.pack(side='left', fill='both', expand=True) + + test_list = [] # Make list of (spec, callable) tuples. + if tests: + for test in tests: + test_spec = globals()[test.__name__ + '_spec'] + test_spec['name'] = test.__name__ + test_list.append((test_spec, test)) + else: + for key, dic in globals().items(): + if key.endswith('_spec'): + test_name = key[:-5] + test_spec = dic + test_spec['name'] = test_name + mod = import_module('idlelib.' + test_spec['file']) + test = getattr(mod, test_name) + test_list.append((test_spec, test)) + test_list.reverse() # So can pop in proper order in next_test. + + test_name = tk.StringVar(root) + callable_object = None + test_kwds = None + + def next_test(): + nonlocal test_name, callable_object, test_kwds + if len(test_list) == 1: + next_button.pack_forget() + test_spec, callable_object = test_list.pop() + test_kwds = test_spec['kwds'] + test_name.set('Test ' + test_spec['name']) + + text['state'] = 'normal' # Enable text replacement. + text.delete('1.0', 'end') + text.insert("1.0", test_spec['msg']) + text['state'] = 'disabled' # Restore read-only property. + + def run_test(_=None): + widget = callable_object(root, **test_kwds) + try: + print(widget.result) # Only true for query classes(?). + except AttributeError: + pass + + def close(_=None): + root.destroy() + + button = tk.Button(root, textvariable=test_name, + default='active', command=run_test) + next_button = tk.Button(root, text="Next", command=next_test) + button.pack() + next_button.pack() + next_button.focus_set() + root.bind('', run_test) + root.bind('', close) + + next_test() + root.mainloop() + + +if __name__ == '__main__': + run() diff --git a/micromamba_root/Lib/idlelib/idle_test/mock_idle.py b/micromamba_root/Lib/idlelib/idle_test/mock_idle.py new file mode 100644 index 0000000000000000000000000000000000000000..71fa480ce4d05c1d4bcb32fb1cf2d10f8695a2e5 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/mock_idle.py @@ -0,0 +1,61 @@ +'''Mock classes that imitate idlelib modules or classes. + +Attributes and methods will be added as needed for tests. +''' + +from idlelib.idle_test.mock_tk import Text + +class Func: + '''Record call, capture args, return/raise result set by test. + + When mock function is called, set or use attributes: + self.called - increment call number even if no args, kwds passed. + self.args - capture positional arguments. + self.kwds - capture keyword arguments. + self.result - return or raise value set in __init__. + self.return_self - return self instead, to mock query class return. + + Most common use will probably be to mock instance methods. + Given class instance, can set and delete as instance attribute. + Mock_tk.Var and Mbox_func are special variants of this. + ''' + def __init__(self, result=None, return_self=False): + self.called = 0 + self.result = result + self.return_self = return_self + self.args = None + self.kwds = None + def __call__(self, *args, **kwds): + self.called += 1 + self.args = args + self.kwds = kwds + if isinstance(self.result, BaseException): + raise self.result + elif self.return_self: + return self + else: + return self.result + + +class Editor: + '''Minimally imitate editor.EditorWindow class. + ''' + def __init__(self, flist=None, filename=None, key=None, root=None, + text=None): # Allow real Text with mock Editor. + self.text = text or Text() + self.undo = UndoDelegator() + + def get_selection_indices(self): + first = self.text.index('1.0') + last = self.text.index('end') + return first, last + + +class UndoDelegator: + '''Minimally imitate undo.UndoDelegator class. + ''' + # A real undo block is only needed for user interaction. + def undo_block_start(*args): + pass + def undo_block_stop(*args): + pass diff --git a/micromamba_root/Lib/idlelib/idle_test/mock_tk.py b/micromamba_root/Lib/idlelib/idle_test/mock_tk.py new file mode 100644 index 0000000000000000000000000000000000000000..8304734b847a835e5ad17227a66a0ff3b21eeaf7 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/mock_tk.py @@ -0,0 +1,307 @@ +"""Classes that replace tkinter gui objects used by an object being tested. + +A gui object is anything with a master or parent parameter, which is +typically required in spite of what the doc strings say. +""" +import re +from _tkinter import TclError + + +class Event: + '''Minimal mock with attributes for testing event handlers. + + This is not a gui object, but is used as an argument for callbacks + that access attributes of the event passed. If a callback ignores + the event, other than the fact that is happened, pass 'event'. + + Keyboard, mouse, window, and other sources generate Event instances. + Event instances have the following attributes: serial (number of + event), time (of event), type (of event as number), widget (in which + event occurred), and x,y (position of mouse). There are other + attributes for specific events, such as keycode for key events. + tkinter.Event.__doc__ has more but is still not complete. + ''' + def __init__(self, **kwds): + "Create event with attributes needed for test" + self.__dict__.update(kwds) + + +class Var: + "Use for String/Int/BooleanVar: incomplete" + def __init__(self, master=None, value=None, name=None): + self.master = master + self.value = value + self.name = name + def set(self, value): + self.value = value + def get(self): + return self.value + + +class Mbox_func: + """Generic mock for messagebox functions, which all have the same signature. + + Instead of displaying a message box, the mock's call method saves the + arguments as instance attributes, which test functions can then examine. + The test can set the result returned to ask function + """ + def __init__(self, result=None): + self.result = result # Return None for all show funcs + def __call__(self, title, message, *args, **kwds): + # Save all args for possible examination by tester + self.title = title + self.message = message + self.args = args + self.kwds = kwds + return self.result # Set by tester for ask functions + + +class Mbox: + """Mock for tkinter.messagebox with an Mbox_func for each function. + + Example usage in test_module.py for testing functions in module.py: + --- +from idlelib.idle_test.mock_tk import Mbox +import module + +orig_mbox = module.messagebox +showerror = Mbox.showerror # example, for attribute access in test methods + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + module.messagebox = Mbox + + @classmethod + def tearDownClass(cls): + module.messagebox = orig_mbox + --- + For 'ask' functions, set func.result return value before calling the method + that uses the message function. When messagebox functions are the + only GUI calls in a method, this replacement makes the method GUI-free, + """ + askokcancel = Mbox_func() # True or False + askquestion = Mbox_func() # 'yes' or 'no' + askretrycancel = Mbox_func() # True or False + askyesno = Mbox_func() # True or False + askyesnocancel = Mbox_func() # True, False, or None + showerror = Mbox_func() # None + showinfo = Mbox_func() # None + showwarning = Mbox_func() # None + + +class Text: + """A semi-functional non-gui replacement for tkinter.Text text editors. + + The mock's data model is that a text is a list of \n-terminated lines. + The mock adds an empty string at the beginning of the list so that the + index of actual lines start at 1, as with Tk. The methods never see this. + Tk initializes files with a terminal \n that cannot be deleted. It is + invisible in the sense that one cannot move the cursor beyond it. + + This class is only tested (and valid) with strings of ascii chars. + For testing, we are not concerned with Tk Text's treatment of, + for instance, 0-width characters or character + accent. + """ + def __init__(self, master=None, cnf={}, **kw): + '''Initialize mock, non-gui, text-only Text widget. + + At present, all args are ignored. Almost all affect visual behavior. + There are just a few Text-only options that affect text behavior. + ''' + self.data = ['', '\n'] + + def index(self, index): + "Return string version of index decoded according to current text." + return "%s.%s" % self._decode(index, endflag=1) + + def _decode(self, index, endflag=0): + """Return a (line, char) tuple of int indexes into self.data. + + This implements .index without converting the result back to a string. + The result is constrained by the number of lines and linelengths of + self.data. For many indexes, the result is initially (1, 0). + + The input index may have any of several possible forms: + * line.char float: converted to 'line.char' string; + * 'line.char' string, where line and char are decimal integers; + * 'line.char lineend', where lineend='lineend' (and char is ignored); + * 'line.end', where end='end' (same as above); + * 'insert', the positions before terminal \n; + * 'end', whose meaning depends on the endflag passed to ._endex. + * 'sel.first' or 'sel.last', where sel is a tag -- not implemented. + """ + if isinstance(index, (float, bytes)): + index = str(index) + try: + index=index.lower() + except AttributeError: + raise TclError('bad text index "%s"' % index) from None + + lastline = len(self.data) - 1 # same as number of text lines + if index == 'insert': + return lastline, len(self.data[lastline]) - 1 + elif index == 'end': + return self._endex(endflag) + + line, char = index.split('.') + line = int(line) + + # Out of bounds line becomes first or last ('end') index + if line < 1: + return 1, 0 + elif line > lastline: + return self._endex(endflag) + + linelength = len(self.data[line]) -1 # position before/at \n + if char.endswith(' lineend') or char == 'end': + return line, linelength + # Tk requires that ignored chars before ' lineend' be valid int + if m := re.fullmatch(r'end-(\d*)c', char, re.A): # Used by hyperparser. + return line, linelength - int(m.group(1)) + + # Out of bounds char becomes first or last index of line + char = int(char) + if char < 0: + char = 0 + elif char > linelength: + char = linelength + return line, char + + def _endex(self, endflag): + '''Return position for 'end' or line overflow corresponding to endflag. + + -1: position before terminal \n; for .insert(), .delete + 0: position after terminal \n; for .get, .delete index 1 + 1: same viewed as beginning of non-existent next line (for .index) + ''' + n = len(self.data) + if endflag == 1: + return n, 0 + else: + n -= 1 + return n, len(self.data[n]) + endflag + + def insert(self, index, chars): + "Insert chars before the character at index." + + if not chars: # ''.splitlines() is [], not [''] + return + chars = chars.splitlines(True) + if chars[-1][-1] == '\n': + chars.append('') + line, char = self._decode(index, -1) + before = self.data[line][:char] + after = self.data[line][char:] + self.data[line] = before + chars[0] + self.data[line+1:line+1] = chars[1:] + self.data[line+len(chars)-1] += after + + def get(self, index1, index2=None): + "Return slice from index1 to index2 (default is 'index1+1')." + + startline, startchar = self._decode(index1) + if index2 is None: + endline, endchar = startline, startchar+1 + else: + endline, endchar = self._decode(index2) + + if startline == endline: + return self.data[startline][startchar:endchar] + else: + lines = [self.data[startline][startchar:]] + for i in range(startline+1, endline): + lines.append(self.data[i]) + lines.append(self.data[endline][:endchar]) + return ''.join(lines) + + def delete(self, index1, index2=None): + '''Delete slice from index1 to index2 (default is 'index1+1'). + + Adjust default index2 ('index+1) for line ends. + Do not delete the terminal \n at the very end of self.data ([-1][-1]). + ''' + startline, startchar = self._decode(index1, -1) + if index2 is None: + if startchar < len(self.data[startline])-1: + # not deleting \n + endline, endchar = startline, startchar+1 + elif startline < len(self.data) - 1: + # deleting non-terminal \n, convert 'index1+1 to start of next line + endline, endchar = startline+1, 0 + else: + # do not delete terminal \n if index1 == 'insert' + return + else: + endline, endchar = self._decode(index2, -1) + # restricting end position to insert position excludes terminal \n + + if startline == endline and startchar < endchar: + self.data[startline] = self.data[startline][:startchar] + \ + self.data[startline][endchar:] + elif startline < endline: + self.data[startline] = self.data[startline][:startchar] + \ + self.data[endline][endchar:] + startline += 1 + for i in range(startline, endline+1): + del self.data[startline] + + def compare(self, index1, op, index2): + line1, char1 = self._decode(index1) + line2, char2 = self._decode(index2) + if op == '<': + return line1 < line2 or line1 == line2 and char1 < char2 + elif op == '<=': + return line1 < line2 or line1 == line2 and char1 <= char2 + elif op == '>': + return line1 > line2 or line1 == line2 and char1 > char2 + elif op == '>=': + return line1 > line2 or line1 == line2 and char1 >= char2 + elif op == '==': + return line1 == line2 and char1 == char2 + elif op == '!=': + return line1 != line2 or char1 != char2 + else: + raise TclError('''bad comparison operator "%s": ''' + '''must be <, <=, ==, >=, >, or !=''' % op) + + # The following Text methods normally do something and return None. + # Whether doing nothing is sufficient for a test will depend on the test. + + def mark_set(self, name, index): + "Set mark *name* before the character at index." + pass + + def mark_unset(self, *markNames): + "Delete all marks in markNames." + + def tag_remove(self, tagName, index1, index2=None): + "Remove tag tagName from all characters between index1 and index2." + pass + + # The following Text methods affect the graphics screen and return None. + # Doing nothing should always be sufficient for tests. + + def scan_dragto(self, x, y): + "Adjust the view of the text according to scan_mark" + + def scan_mark(self, x, y): + "Remember the current X, Y coordinates." + + def see(self, index): + "Scroll screen to make the character at INDEX is visible." + pass + + # The following is a Misc method inherited by Text. + # It should properly go in a Misc mock, but is included here for now. + + def bind(sequence=None, func=None, add=None): + "Bind to this widget at event sequence a call to function func." + pass + + +class Entry: + "Mock for tkinter.Entry." + def focus_set(self): + pass diff --git a/micromamba_root/Lib/idlelib/idle_test/template.py b/micromamba_root/Lib/idlelib/idle_test/template.py new file mode 100644 index 0000000000000000000000000000000000000000..725a55b9c47230c32c63b3e6cd036f0319173046 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/template.py @@ -0,0 +1,30 @@ +"Test , coverage %." + +from idlelib import zzdummy +import unittest +from test.support import requires +from tkinter import Tk + + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + self.assertTrue(True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_autocomplete.py b/micromamba_root/Lib/idlelib/idle_test/test_autocomplete.py new file mode 100644 index 0000000000000000000000000000000000000000..a811363c18d04e5770ec7071e08f0273dd04f0bf --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_autocomplete.py @@ -0,0 +1,305 @@ +"Test autocomplete, coverage 93%." + +import unittest +from unittest.mock import Mock, patch +from test.support import requires +from tkinter import Tk, Text +import os +import __main__ + +import idlelib.autocomplete as ac +import idlelib.autocomplete_w as acw +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Event + + +class DummyEditwin: + def __init__(self, root, text): + self.root = root + self.text = text + self.indentwidth = 8 + self.tabwidth = 8 + self.prompt_last_line = '>>>' # Currently not used by autocomplete. + + +class AutoCompleteTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.editor = DummyEditwin(cls.root, cls.text) + + @classmethod + def tearDownClass(cls): + del cls.editor, cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.delete('1.0', 'end') + self.autocomplete = ac.AutoComplete(self.editor) + + def test_init(self): + self.assertEqual(self.autocomplete.editwin, self.editor) + self.assertEqual(self.autocomplete.text, self.text) + + def test_make_autocomplete_window(self): + testwin = self.autocomplete._make_autocomplete_window() + self.assertIsInstance(testwin, acw.AutoCompleteWindow) + + def test_remove_autocomplete_window(self): + acp = self.autocomplete + acp.autocompletewindow = m = Mock() + acp._remove_autocomplete_window() + m.hide_window.assert_called_once() + self.assertIsNone(acp.autocompletewindow) + + def test_force_open_completions_event(self): + # Call _open_completions and break. + acp = self.autocomplete + open_c = Func() + acp.open_completions = open_c + self.assertEqual(acp.force_open_completions_event('event'), 'break') + self.assertEqual(open_c.args[0], ac.FORCE) + + def test_autocomplete_event(self): + Equal = self.assertEqual + acp = self.autocomplete + + # Result of autocomplete event: If modified tab, None. + ev = Event(mc_state=True) + self.assertIsNone(acp.autocomplete_event(ev)) + del ev.mc_state + + # If tab after whitespace, None. + self.text.insert('1.0', ' """Docstring.\n ') + self.assertIsNone(acp.autocomplete_event(ev)) + self.text.delete('1.0', 'end') + + # If active autocomplete window, complete() and 'break'. + self.text.insert('1.0', 're.') + acp.autocompletewindow = mock = Mock() + mock.is_active = Mock(return_value=True) + Equal(acp.autocomplete_event(ev), 'break') + mock.complete.assert_called_once() + acp.autocompletewindow = None + + # If no active autocomplete window, open_completions(), None/break. + open_c = Func(result=False) + acp.open_completions = open_c + Equal(acp.autocomplete_event(ev), None) + Equal(open_c.args[0], ac.TAB) + open_c.result = True + Equal(acp.autocomplete_event(ev), 'break') + Equal(open_c.args[0], ac.TAB) + + def test_try_open_completions_event(self): + Equal = self.assertEqual + text = self.text + acp = self.autocomplete + trycompletions = acp.try_open_completions_event + after = Func(result='after1') + acp.text.after = after + + # If no text or trigger, after not called. + trycompletions() + Equal(after.called, 0) + text.insert('1.0', 're') + trycompletions() + Equal(after.called, 0) + + # Attribute needed, no existing callback. + text.insert('insert', ' re.') + acp._delayed_completion_id = None + trycompletions() + Equal(acp._delayed_completion_index, text.index('insert')) + Equal(after.args, + (acp.popupwait, acp._delayed_open_completions, ac.TRY_A)) + cb1 = acp._delayed_completion_id + Equal(cb1, 'after1') + + # File needed, existing callback cancelled. + text.insert('insert', ' "./Lib/') + after.result = 'after2' + cancel = Func() + acp.text.after_cancel = cancel + trycompletions() + Equal(acp._delayed_completion_index, text.index('insert')) + Equal(cancel.args, (cb1,)) + Equal(after.args, + (acp.popupwait, acp._delayed_open_completions, ac.TRY_F)) + Equal(acp._delayed_completion_id, 'after2') + + def test_delayed_open_completions(self): + Equal = self.assertEqual + acp = self.autocomplete + open_c = Func() + acp.open_completions = open_c + self.text.insert('1.0', '"dict.') + + # Set autocomplete._delayed_completion_id to None. + # Text index changed, don't call open_completions. + acp._delayed_completion_id = 'after' + acp._delayed_completion_index = self.text.index('insert+1c') + acp._delayed_open_completions('dummy') + self.assertIsNone(acp._delayed_completion_id) + Equal(open_c.called, 0) + + # Text index unchanged, call open_completions. + acp._delayed_completion_index = self.text.index('insert') + acp._delayed_open_completions((1, 2, 3, ac.FILES)) + self.assertEqual(open_c.args[0], (1, 2, 3, ac.FILES)) + + def test_oc_cancel_comment(self): + none = self.assertIsNone + acp = self.autocomplete + + # Comment is in neither code or string. + acp._delayed_completion_id = 'after' + after = Func(result='after') + acp.text.after_cancel = after + self.text.insert(1.0, '# comment') + none(acp.open_completions(ac.TAB)) # From 'else' after 'elif'. + none(acp._delayed_completion_id) + + def test_oc_no_list(self): + acp = self.autocomplete + fetch = Func(result=([],[])) + acp.fetch_completions = fetch + self.text.insert('1.0', 'object') + self.assertIsNone(acp.open_completions(ac.TAB)) + self.text.insert('insert', '.') + self.assertIsNone(acp.open_completions(ac.TAB)) + self.assertEqual(fetch.called, 2) + + + def test_open_completions_none(self): + # Test other two None returns. + none = self.assertIsNone + acp = self.autocomplete + + # No object for attributes or need call not allowed. + self.text.insert(1.0, '.') + none(acp.open_completions(ac.TAB)) + self.text.insert('insert', ' int().') + none(acp.open_completions(ac.TAB)) + + # Blank or quote trigger 'if complete ...'. + self.text.delete(1.0, 'end') + self.assertFalse(acp.open_completions(ac.TAB)) + self.text.insert('1.0', '"') + self.assertFalse(acp.open_completions(ac.TAB)) + self.text.delete('1.0', 'end') + + class dummy_acw: + __init__ = Func() + show_window = Func(result=False) + hide_window = Func() + + def test_open_completions(self): + # Test completions of files and attributes. + acp = self.autocomplete + fetch = Func(result=(['tem'],['tem', '_tem'])) + acp.fetch_completions = fetch + def make_acw(): return self.dummy_acw() + acp._make_autocomplete_window = make_acw + + self.text.insert('1.0', 'int.') + acp.open_completions(ac.TAB) + self.assertIsInstance(acp.autocompletewindow, self.dummy_acw) + self.text.delete('1.0', 'end') + + # Test files. + self.text.insert('1.0', '"t') + self.assertTrue(acp.open_completions(ac.TAB)) + self.text.delete('1.0', 'end') + + def test_completion_kwds(self): + self.assertIn('and', ac.completion_kwds) + self.assertIn('case', ac.completion_kwds) + self.assertNotIn('None', ac.completion_kwds) + + def test_fetch_completions(self): + # Test that fetch_completions returns 2 lists: + # For attribute completion, a large list containing all variables, and + # a small list containing non-private variables. + # For file completion, a large list containing all files in the path, + # and a small list containing files that do not start with '.'. + acp = self.autocomplete + small, large = acp.fetch_completions( + '', ac.ATTRS) + if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__: + self.assertNotIn('AutoComplete', small) # See issue 36405. + + # Test attributes + s, b = acp.fetch_completions('', ac.ATTRS) + self.assertLess(len(small), len(large)) + self.assertTrue(all(filter(lambda x: x.startswith('_'), s))) + self.assertTrue(any(filter(lambda x: x.startswith('_'), b))) + + # Test smalll should respect to __all__. + with patch.dict('__main__.__dict__', {'__all__': ['a', 'b']}): + s, b = acp.fetch_completions('', ac.ATTRS) + self.assertEqual(s, ['a', 'b']) + self.assertIn('__name__', b) # From __main__.__dict__. + self.assertIn('sum', b) # From __main__.__builtins__.__dict__. + self.assertIn('nonlocal', b) # From keyword.kwlist. + pos = b.index('False') # Test False not included twice. + self.assertNotEqual(b[pos+1], 'False') + + # Test attributes with name entity. + mock = Mock() + mock._private = Mock() + with patch.dict('__main__.__dict__', {'foo': mock}): + s, b = acp.fetch_completions('foo', ac.ATTRS) + self.assertNotIn('_private', s) + self.assertIn('_private', b) + self.assertEqual(s, [i for i in sorted(dir(mock)) if i[:1] != '_']) + self.assertEqual(b, sorted(dir(mock))) + + # Test files + def _listdir(path): + # This will be patch and used in fetch_completions. + if path == '.': + return ['foo', 'bar', '.hidden'] + return ['monty', 'python', '.hidden'] + + with patch.object(os, 'listdir', _listdir): + s, b = acp.fetch_completions('', ac.FILES) + self.assertEqual(s, ['bar', 'foo']) + self.assertEqual(b, ['.hidden', 'bar', 'foo']) + + s, b = acp.fetch_completions('~', ac.FILES) + self.assertEqual(s, ['monty', 'python']) + self.assertEqual(b, ['.hidden', 'monty', 'python']) + + def test_get_entity(self): + # Test that a name is in the namespace of sys.modules and + # __main__.__dict__. + acp = self.autocomplete + Equal = self.assertEqual + + Equal(acp.get_entity('int'), int) + + # Test name from sys.modules. + mock = Mock() + with patch.dict('sys.modules', {'tempfile': mock}): + Equal(acp.get_entity('tempfile'), mock) + + # Test name from __main__.__dict__. + di = {'foo': 10, 'bar': 20} + with patch.dict('__main__.__dict__', {'d': di}): + Equal(acp.get_entity('d'), di) + + # Test name not in namespace. + with patch.dict('__main__.__dict__', {}): + with self.assertRaises(NameError): + acp.get_entity('not_exist') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_autocomplete_w.py b/micromamba_root/Lib/idlelib/idle_test/test_autocomplete_w.py new file mode 100644 index 0000000000000000000000000000000000000000..a59a375c90fd807e1d3219cde60b3f2612d24fac --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_autocomplete_w.py @@ -0,0 +1,32 @@ +"Test autocomplete_w, coverage 11%." + +import unittest +from test.support import requires +from tkinter import Tk, Text + +import idlelib.autocomplete_w as acw + + +class AutoCompleteWindowTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.acw = acw.AutoCompleteWindow(cls.text, tags=None) + + @classmethod + def tearDownClass(cls): + del cls.text, cls.acw + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_init(self): + self.assertEqual(self.acw.widget, self.text) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_autoexpand.py b/micromamba_root/Lib/idlelib/idle_test/test_autoexpand.py new file mode 100644 index 0000000000000000000000000000000000000000..e734a8be714a2adc3ea1a6fca6957cac2815309e --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_autoexpand.py @@ -0,0 +1,155 @@ +"Test autoexpand, coverage 100%." + +from idlelib.autoexpand import AutoExpand +import unittest +from test.support import requires +from tkinter import Text, Tk + + +class DummyEditwin: + # AutoExpand.__init__ only needs .text + def __init__(self, text): + self.text = text + +class AutoExpandTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.tk = Tk() + cls.text = Text(cls.tk) + cls.auto_expand = AutoExpand(DummyEditwin(cls.text)) + cls.auto_expand.bell = lambda: None + +# If mock_tk.Text._decode understood indexes 'insert' with suffixed 'linestart', +# 'wordstart', and 'lineend', used by autoexpand, we could use the following +# to run these test on non-gui machines (but check bell). +## try: +## requires('gui') +## #raise ResourceDenied() # Uncomment to test mock. +## except ResourceDenied: +## from idlelib.idle_test.mock_tk import Text +## cls.text = Text() +## cls.text.bell = lambda: None +## else: +## from tkinter import Tk, Text +## cls.tk = Tk() +## cls.text = Text(cls.tk) + + @classmethod + def tearDownClass(cls): + del cls.text, cls.auto_expand + if hasattr(cls, 'tk'): + cls.tk.destroy() + del cls.tk + + def tearDown(self): + self.text.delete('1.0', 'end') + + def test_get_prevword(self): + text = self.text + previous = self.auto_expand.getprevword + equal = self.assertEqual + + equal(previous(), '') + + text.insert('insert', 't') + equal(previous(), 't') + + text.insert('insert', 'his') + equal(previous(), 'this') + + text.insert('insert', ' ') + equal(previous(), '') + + text.insert('insert', 'is') + equal(previous(), 'is') + + text.insert('insert', '\nsample\nstring') + equal(previous(), 'string') + + text.delete('3.0', 'insert') + equal(previous(), '') + + text.delete('1.0', 'end') + equal(previous(), '') + + def test_before_only(self): + previous = self.auto_expand.getprevword + expand = self.auto_expand.expand_word_event + equal = self.assertEqual + + self.text.insert('insert', 'ab ac bx ad ab a') + equal(self.auto_expand.getwords(), ['ab', 'ad', 'ac', 'a']) + expand('event') + equal(previous(), 'ab') + expand('event') + equal(previous(), 'ad') + expand('event') + equal(previous(), 'ac') + expand('event') + equal(previous(), 'a') + + def test_after_only(self): + # Also add punctuation 'noise' that should be ignored. + text = self.text + previous = self.auto_expand.getprevword + expand = self.auto_expand.expand_word_event + equal = self.assertEqual + + text.insert('insert', 'a, [ab] ac: () bx"" cd ac= ad ya') + text.mark_set('insert', '1.1') + equal(self.auto_expand.getwords(), ['ab', 'ac', 'ad', 'a']) + expand('event') + equal(previous(), 'ab') + expand('event') + equal(previous(), 'ac') + expand('event') + equal(previous(), 'ad') + expand('event') + equal(previous(), 'a') + + def test_both_before_after(self): + text = self.text + previous = self.auto_expand.getprevword + expand = self.auto_expand.expand_word_event + equal = self.assertEqual + + text.insert('insert', 'ab xy yz\n') + text.insert('insert', 'a ac by ac') + + text.mark_set('insert', '2.1') + equal(self.auto_expand.getwords(), ['ab', 'ac', 'a']) + expand('event') + equal(previous(), 'ab') + expand('event') + equal(previous(), 'ac') + expand('event') + equal(previous(), 'a') + + def test_other_expand_cases(self): + text = self.text + expand = self.auto_expand.expand_word_event + equal = self.assertEqual + + # no expansion candidate found + equal(self.auto_expand.getwords(), []) + equal(expand('event'), 'break') + + text.insert('insert', 'bx cy dz a') + equal(self.auto_expand.getwords(), []) + + # reset state by successfully expanding once + # move cursor to another position and expand again + text.insert('insert', 'ac xy a ac ad a') + text.mark_set('insert', '1.7') + expand('event') + initial_state = self.auto_expand.state + text.mark_set('insert', '1.end') + expand('event') + new_state = self.auto_expand.state + self.assertNotEqual(initial_state, new_state) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_browser.py b/micromamba_root/Lib/idlelib/idle_test/test_browser.py new file mode 100644 index 0000000000000000000000000000000000000000..6cfea3888cd6a9064be1b9b5f5c13febdc701b96 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_browser.py @@ -0,0 +1,257 @@ +"Test browser, coverage 90%." + +from idlelib import browser +from test.support import requires +import unittest +from unittest import mock +from idlelib.idle_test.mock_idle import Func +from idlelib.util import py_extensions + +from collections import deque +import os.path +import pyclbr +from tkinter import Tk + +from idlelib.tree import TreeNode + + +class ModuleBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.mb = browser.ModuleBrowser(cls.root, __file__, _utest=True) + + @classmethod + def tearDownClass(cls): + cls.mb.close() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root, cls.mb + + def test_init(self): + mb = self.mb + eq = self.assertEqual + eq(mb.path, __file__) + eq(pyclbr._modules, {}) + self.assertIsInstance(mb.node, TreeNode) + self.assertIsNotNone(browser.file_open) + + def test_settitle(self): + mb = self.mb + self.assertIn(os.path.basename(__file__), mb.top.title()) + self.assertEqual(mb.top.iconname(), 'Module Browser') + + def test_rootnode(self): + mb = self.mb + rn = mb.rootnode() + self.assertIsInstance(rn, browser.ModuleBrowserTreeItem) + + def test_close(self): + mb = self.mb + mb.top.destroy = Func() + mb.node.destroy = Func() + mb.close() + self.assertTrue(mb.top.destroy.called) + self.assertTrue(mb.node.destroy.called) + del mb.top.destroy, mb.node.destroy + + def test_is_browseable_extension(self): + path = "/path/to/file" + for ext in py_extensions: + with self.subTest(ext=ext): + filename = f'{path}{ext}' + actual = browser.is_browseable_extension(filename) + expected = ext not in browser.browseable_extension_blocklist + self.assertEqual(actual, expected) + + +# Nested tree same as in test_pyclbr.py except for supers on C0. C1. +mb = pyclbr +module, fname = 'test', 'test.py' +C0 = mb.Class(module, 'C0', ['base'], fname, 1, end_lineno=9) +F1 = mb._nest_function(C0, 'F1', 3, 5) +C1 = mb._nest_class(C0, 'C1', 6, 9, ['']) +C2 = mb._nest_class(C1, 'C2', 7, 9) +F3 = mb._nest_function(C2, 'F3', 9, 9) +f0 = mb.Function(module, 'f0', fname, 11, end_lineno=15) +f1 = mb._nest_function(f0, 'f1', 12, 14) +f2 = mb._nest_function(f1, 'f2', 13, 13) +c1 = mb._nest_class(f0, 'c1', 15, 15) +mock_pyclbr_tree = {'C0': C0, 'f0': f0} + +# Adjust C0.name, C1.name so tests do not depend on order. +browser.transform_children(mock_pyclbr_tree, 'test') # C0(base) +browser.transform_children(C0.children) # C1() + +# The class below checks that the calls above are correct +# and that duplicate calls have no effect. + + +class TransformChildrenTest(unittest.TestCase): + + def test_transform_module_children(self): + eq = self.assertEqual + transform = browser.transform_children + # Parameter matches tree module. + tcl = list(transform(mock_pyclbr_tree, 'test')) + eq(tcl, [C0, f0]) + eq(tcl[0].name, 'C0(base)') + eq(tcl[1].name, 'f0') + # Check that second call does not change suffix. + tcl = list(transform(mock_pyclbr_tree, 'test')) + eq(tcl[0].name, 'C0(base)') + # Nothing to traverse if parameter name isn't same as tree module. + tcl = list(transform(mock_pyclbr_tree, 'different name')) + eq(tcl, []) + + def test_transform_node_children(self): + eq = self.assertEqual + transform = browser.transform_children + # Class with two children, one name altered. + tcl = list(transform(C0.children)) + eq(tcl, [F1, C1]) + eq(tcl[0].name, 'F1') + eq(tcl[1].name, 'C1()') + tcl = list(transform(C0.children)) + eq(tcl[1].name, 'C1()') + # Function with two children. + eq(list(transform(f0.children)), [f1, c1]) + + +class ModuleBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.mbt = browser.ModuleBrowserTreeItem(fname) + + def test_init(self): + self.assertEqual(self.mbt.file, fname) + + def test_gettext(self): + self.assertEqual(self.mbt.GetText(), fname) + + def test_geticonname(self): + self.assertEqual(self.mbt.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.mbt.IsExpandable()) + + def test_listchildren(self): + save_rex = browser.pyclbr.readmodule_ex + save_tc = browser.transform_children + browser.pyclbr.readmodule_ex = Func(result=mock_pyclbr_tree) + browser.transform_children = Func(result=[f0, C0]) + try: + self.assertEqual(self.mbt.listchildren(), [f0, C0]) + finally: + browser.pyclbr.readmodule_ex = save_rex + browser.transform_children = save_tc + + def test_getsublist(self): + mbt = self.mbt + mbt.listchildren = Func(result=[f0, C0]) + sub0, sub1 = mbt.GetSubList() + del mbt.listchildren + self.assertIsInstance(sub0, browser.ChildBrowserTreeItem) + self.assertIsInstance(sub1, browser.ChildBrowserTreeItem) + self.assertEqual(sub0.name, 'f0') + self.assertEqual(sub1.name, 'C0(base)') + + @mock.patch('idlelib.browser.file_open') + def test_ondoubleclick(self, fopen): + mbt = self.mbt + + with mock.patch('os.path.exists', return_value=False): + mbt.OnDoubleClick() + fopen.assert_not_called() + + with mock.patch('os.path.exists', return_value=True): + mbt.OnDoubleClick() + fopen.assert_called_once_with(fname) + + +class ChildBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + CBT = browser.ChildBrowserTreeItem + cls.cbt_f1 = CBT(f1) + cls.cbt_C1 = CBT(C1) + cls.cbt_F1 = CBT(F1) + + @classmethod + def tearDownClass(cls): + del cls.cbt_C1, cls.cbt_f1, cls.cbt_F1 + + def test_init(self): + eq = self.assertEqual + eq(self.cbt_C1.name, 'C1()') + self.assertFalse(self.cbt_C1.isfunction) + eq(self.cbt_f1.name, 'f1') + self.assertTrue(self.cbt_f1.isfunction) + + def test_gettext(self): + self.assertEqual(self.cbt_C1.GetText(), 'class C1()') + self.assertEqual(self.cbt_f1.GetText(), 'def f1(...)') + + def test_geticonname(self): + self.assertEqual(self.cbt_C1.GetIconName(), 'folder') + self.assertEqual(self.cbt_f1.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.cbt_C1.IsExpandable()) + self.assertTrue(self.cbt_f1.IsExpandable()) + self.assertFalse(self.cbt_F1.IsExpandable()) + + def test_getsublist(self): + eq = self.assertEqual + CBT = browser.ChildBrowserTreeItem + + f1sublist = self.cbt_f1.GetSubList() + self.assertIsInstance(f1sublist[0], CBT) + eq(len(f1sublist), 1) + eq(f1sublist[0].name, 'f2') + + eq(self.cbt_F1.GetSubList(), []) + + @mock.patch('idlelib.browser.file_open') + def test_ondoubleclick(self, fopen): + goto = fopen.return_value.gotoline = mock.Mock() + self.cbt_F1.OnDoubleClick() + fopen.assert_called() + goto.assert_called() + goto.assert_called_with(self.cbt_F1.obj.lineno) + # Failure test would have to raise OSError or AttributeError. + + +class NestedChildrenTest(unittest.TestCase): + "Test that all the nodes in a nested tree are added to the BrowserTree." + + def test_nested(self): + queue = deque() + actual_names = [] + # The tree items are processed in breadth first order. + # Verify that processing each sublist hits every node and + # in the right order. + expected_names = ['f0', 'C0(base)', + 'f1', 'c1', 'F1', 'C1()', + 'f2', 'C2', + 'F3'] + CBT = browser.ChildBrowserTreeItem + queue.extend((CBT(f0), CBT(C0))) + while queue: + cb = queue.popleft() + sublist = cb.GetSubList() + queue.extend(sublist) + self.assertIn(cb.name, cb.GetText()) + self.assertIn(cb.GetIconName(), ('python', 'folder')) + self.assertIs(cb.IsExpandable(), sublist != []) + actual_names.append(cb.name) + self.assertEqual(actual_names, expected_names) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_calltip.py b/micromamba_root/Lib/idlelib/idle_test/test_calltip.py new file mode 100644 index 0000000000000000000000000000000000000000..28c196a42672fcd2b025753341a7aac656926a6a --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_calltip.py @@ -0,0 +1,372 @@ +"Test calltip, coverage 76%" + +from idlelib import calltip +import unittest +from unittest.mock import Mock +import textwrap +import types +import re +from idlelib.idle_test.mock_tk import Text +from test.support import MISSING_C_DOCSTRINGS + + +# Test Class TC is used in multiple get_argspec test methods +class TC: + 'doc' + tip = "(ai=None, *b)" + def __init__(self, ai=None, *b): 'doc' + __init__.tip = "(self, ai=None, *b)" + def t1(self): 'doc' + t1.tip = "(self)" + def t2(self, ai, b=None): 'doc' + t2.tip = "(self, ai, b=None)" + def t3(self, ai, *args): 'doc' + t3.tip = "(self, ai, *args)" + def t4(self, *args): 'doc' + t4.tip = "(self, *args)" + def t5(self, ai, b=None, *args, **kw): 'doc' + t5.tip = "(self, ai, b=None, *args, **kw)" + def t6(no, self): 'doc' + t6.tip = "(no, self)" + def __call__(self, ci): 'doc' + __call__.tip = "(self, ci)" + def nd(self): pass # No doc. + # attaching .tip to wrapped methods does not work + @classmethod + def cm(cls, a): 'doc' + @staticmethod + def sm(b): 'doc' + + +tc = TC() +default_tip = calltip._default_callable_argspec +get_spec = calltip.get_argspec + + +class Get_argspecTest(unittest.TestCase): + # The get_spec function must return a string, even if blank. + # Test a variety of objects to be sure that none cause it to raise + # (quite aside from getting as correct an answer as possible). + # The tests of builtins may break if inspect or the docstrings change, + # but a red buildbot is better than a user crash (as has happened). + # For a simple mismatch, change the expected output to the actual. + + @unittest.skipIf(MISSING_C_DOCSTRINGS, + "Signature information for builtins requires docstrings") + def test_builtins(self): + + def tiptest(obj, out): + self.assertEqual(get_spec(obj), out) + + # Python class that inherits builtin methods + class List(list): "List() doc" + + # Simulate builtin with no docstring for default tip test + class SB: __call__ = None + + if List.__doc__ is not None: + tiptest(List, + f'(iterable=(), /)' + f'\n{List.__doc__}') + tiptest(list.__new__, + '(*args, **kwargs)\n' + 'Create and return a new object. ' + 'See help(type) for accurate signature.') + tiptest(list.__init__, + '(self, /, *args, **kwargs)\n' + 'Initialize self. See help(type(self)) for accurate signature.') + append_doc = "\nAppend object to the end of the list." + tiptest(list.append, '(self, object, /)' + append_doc) + tiptest(List.append, '(self, object, /)' + append_doc) + tiptest([].append, '(object, /)' + append_doc) + # The use of 'object' above matches the signature text. + + tiptest(types.MethodType, + '(function, instance, /)\n' + 'Create a bound instance method object.') + tiptest(SB(), default_tip) + + p = re.compile('') + tiptest(re.sub, '''\ +(pattern, repl, string, count=0, flags=0) +Return the string obtained by replacing the leftmost +non-overlapping occurrences of the pattern in string by the +replacement repl. repl can be either a string or a callable; +if a string, backslash escapes in it are processed. If it is +a callable, it's passed the Match object and must return''') + tiptest(p.sub, '''\ +(repl, string, count=0) +Return the string obtained by replacing the leftmost \ +non-overlapping occurrences o...''') + + def test_signature_wrap(self): + if textwrap.TextWrapper.__doc__ is not None: + self.assertEqual(get_spec(textwrap.TextWrapper), '''\ +(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, + replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, + drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, + placeholder=' [...]') +Object for wrapping/filling text. The public interface consists of +the wrap() and fill() methods; the other methods are just there for +subclasses to override in order to tweak the default behaviour. +If you want to completely replace the main wrapping algorithm, +you\'ll probably have to override _wrap_chunks().''') + + def test_properly_formatted(self): + + def foo(s='a'*100): + pass + + def bar(s='a'*100): + """Hello Guido""" + pass + + def baz(s='a'*100, z='b'*100): + pass + + indent = calltip._INDENT + + sfoo = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')" + sbar = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')\nHello Guido" + sbaz = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbb\n" + indent + "bbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbbbbbbb')" + + for func,doc in [(foo, sfoo), (bar, sbar), (baz, sbaz)]: + with self.subTest(func=func, doc=doc): + self.assertEqual(get_spec(func), doc) + + def test_docline_truncation(self): + def f(): pass + f.__doc__ = 'a'*300 + self.assertEqual(get_spec(f), f"()\n{'a'*(calltip._MAX_COLS-3) + '...'}") + + @unittest.skipIf(MISSING_C_DOCSTRINGS, + "Signature information for builtins requires docstrings") + def test_multiline_docstring(self): + # Test fewer lines than max. + self.assertEqual(get_spec(range), + "range(stop) -> range object\n" + "range(start, stop[, step]) -> range object") + + # Test max lines + self.assertEqual(get_spec(bytes), '''\ +bytes(iterable_of_ints) -> bytes +bytes(string, encoding[, errors]) -> bytes +bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer +bytes(int) -> bytes object of size given by the parameter initialized with null bytes +bytes() -> empty bytes object''') + + def test_multiline_docstring_2(self): + # Test more than max lines + def f(): pass + f.__doc__ = 'a\n' * 15 + self.assertEqual(get_spec(f), '()' + '\na' * calltip._MAX_LINES) + + def test_functions(self): + def t1(): 'doc' + t1.tip = "()" + def t2(a, b=None): 'doc' + t2.tip = "(a, b=None)" + def t3(a, *args): 'doc' + t3.tip = "(a, *args)" + def t4(*args): 'doc' + t4.tip = "(*args)" + def t5(a, b=None, *args, **kw): 'doc' + t5.tip = "(a, b=None, *args, **kw)" + + doc = '\ndoc' if t1.__doc__ is not None else '' + for func in (t1, t2, t3, t4, t5, TC): + with self.subTest(func=func): + self.assertEqual(get_spec(func), func.tip + doc) + + def test_methods(self): + doc = '\ndoc' if TC.__doc__ is not None else '' + for meth in (TC.t1, TC.t2, TC.t3, TC.t4, TC.t5, TC.t6, TC.__call__): + with self.subTest(meth=meth): + self.assertEqual(get_spec(meth), meth.tip + doc) + self.assertEqual(get_spec(TC.cm), "(a)" + doc) + self.assertEqual(get_spec(TC.sm), "(b)" + doc) + + def test_bound_methods(self): + # test that first parameter is correctly removed from argspec + doc = '\ndoc' if TC.__doc__ is not None else '' + for meth, mtip in ((tc.t1, "()"), (tc.t4, "(*args)"), + (tc.t6, "(self)"), (tc.__call__, '(ci)'), + (tc, '(ci)'), (TC.cm, "(a)"),): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip + doc) + + def test_starred_parameter(self): + # test that starred first parameter is *not* removed from argspec + class C: + def m1(*args): pass + c = C() + for meth, mtip in ((C.m1, '(*args)'), (c.m1, "(*args)"),): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_invalid_method_get_spec(self): + class C: + def m2(**kwargs): pass + class Test: + def __call__(*, a): pass + + mtip = calltip._invalid_method + self.assertEqual(get_spec(C().m2), mtip) + self.assertEqual(get_spec(Test()), mtip) + + def test_non_ascii_name(self): + # test that re works to delete a first parameter name that + # includes non-ascii chars, such as various forms of A. + uni = "(A\u0391\u0410\u05d0\u0627\u0905\u1e00\u3042, a)" + assert calltip._first_param.sub('', uni) == '(a)' + + def test_no_docstring(self): + for meth, mtip in ((TC.nd, "(self)"), (tc.nd, "()")): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_buggy_getattr_class(self): + class NoCall: + def __getattr__(self, name): # Not invoked for class attribute. + raise IndexError # Bug. + class CallA(NoCall): + def __call__(self, ci): # Bug does not matter. + pass + class CallB(NoCall): + def __call__(oui, a, b, c): # Non-standard 'self'. + pass + + for meth, mtip in ((NoCall, default_tip), (CallA, default_tip), + (NoCall(), ''), (CallA(), '(ci)'), + (CallB(), '(a, b, c)')): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_metaclass_class(self): # Failure case for issue 38689. + class Type(type): # Type() requires 3 type args, returns class. + __class__ = property({}.__getitem__, {}.__setitem__) + class Object(metaclass=Type): + __slots__ = '__class__' + for meth, mtip in ((Type, get_spec(type)), (Object, default_tip), + (Object(), '')): + with self.subTest(meth=meth, mtip=mtip): + self.assertEqual(get_spec(meth), mtip) + + def test_non_callables(self): + for obj in (0, 0.0, '0', b'0', [], {}): + with self.subTest(obj=obj): + self.assertEqual(get_spec(obj), '') + + +class Get_entityTest(unittest.TestCase): + def test_bad_entity(self): + self.assertIsNone(calltip.get_entity('1/0')) + def test_good_entity(self): + self.assertIs(calltip.get_entity('int'), int) + + +# Test the 9 Calltip methods. +# open_calltip is about half the code; the others are fairly trivial. +# The default mocks are what are needed for open_calltip. + +class mock_Shell: + "Return mock sufficient to pass to hyperparser." + def __init__(self, text): + text.tag_prevrange = Mock(return_value=None) + self.text = text + self.prompt_last_line = ">>> " + self.indentwidth = 4 + self.tabwidth = 8 + + +class mock_TipWindow: + def __init__(self): + pass + + def showtip(self, text, parenleft, parenright): + self.args = parenleft, parenright + self.parenline, self.parencol = map(int, parenleft.split('.')) + + +class WrappedCalltip(calltip.Calltip): + def _make_tk_calltip_window(self): + return mock_TipWindow() + + def remove_calltip_window(self, event=None): + if self.active_calltip: # Setup to None. + self.active_calltip = None + self.tips_removed += 1 # Setup to 0. + + def fetch_tip(self, expression): + return 'tip' + + +class CalltipTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.text = Text() + cls.ct = WrappedCalltip(mock_Shell(cls.text)) + + def setUp(self): + self.text.delete('1.0', 'end') # Insert and call + self.ct.active_calltip = None + # Test .active_calltip, +args + self.ct.tips_removed = 0 + + def open_close(self, testfunc): + # Open-close template with testfunc called in between. + opentip = self.ct.open_calltip + self.text.insert(1.0, 'f(') + opentip(False) + self.tip = self.ct.active_calltip + testfunc(self) ### + self.text.insert('insert', ')') + opentip(False) + self.assertIsNone(self.ct.active_calltip, None) + + def test_open_close(self): + def args(self): + self.assertEqual(self.tip.args, ('1.1', '1.end')) + self.open_close(args) + + def test_repeated_force(self): + def force(self): + for char in 'abc': + self.text.insert('insert', 'a') + self.ct.open_calltip(True) + self.ct.open_calltip(True) + self.assertIs(self.ct.active_calltip, self.tip) + self.open_close(force) + + def test_repeated_parens(self): + def parens(self): + for context in "a", "'": + with self.subTest(context=context): + self.text.insert('insert', context) + for char in '(()())': + self.text.insert('insert', char) + self.assertIs(self.ct.active_calltip, self.tip) + self.text.insert('insert', "'") + self.open_close(parens) + + def test_comment_parens(self): + def comment(self): + self.text.insert('insert', "# ") + for char in '(()())': + self.text.insert('insert', char) + self.assertIs(self.ct.active_calltip, self.tip) + self.text.insert('insert', "\n") + self.open_close(comment) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_calltip_w.py b/micromamba_root/Lib/idlelib/idle_test/test_calltip_w.py new file mode 100644 index 0000000000000000000000000000000000000000..a5ec76e15ffdf3ed8c4259dd3c9435ca9e0ec3a4 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_calltip_w.py @@ -0,0 +1,29 @@ +"Test calltip_w, coverage 18%." + +from idlelib import calltip_w +import unittest +from test.support import requires +from tkinter import Tk, Text + + +class CallTipWindowTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.calltip = calltip_w.CalltipWindow(cls.text) + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.text, cls.root + + def test_init(self): + self.assertEqual(self.calltip.anchor_widget, self.text) + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_codecontext.py b/micromamba_root/Lib/idlelib/idle_test/test_codecontext.py new file mode 100644 index 0000000000000000000000000000000000000000..6969ad73b01a81a7ec896a2c1991905e26e7a564 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_codecontext.py @@ -0,0 +1,455 @@ +"Test codecontext, coverage 100%" + +from idlelib import codecontext +import unittest +import unittest.mock +from test.support import requires +from tkinter import NSEW, Tk, Frame, Text, TclError + +from unittest import mock +import re +from idlelib import config + + +usercfg = codecontext.idleConf.userCfg +testcfg = { + 'main': config.IdleUserConfParser(''), + 'highlight': config.IdleUserConfParser(''), + 'keys': config.IdleUserConfParser(''), + 'extensions': config.IdleUserConfParser(''), +} +code_sample = """\ + +class C1: + # Class comment. + def __init__(self, a, b): + self.a = a + self.b = b + def compare(self): + if a > b: + return a + elif a < b: + return b + else: + return None +""" + + +class DummyEditwin: + def __init__(self, root, frame, text): + self.root = root + self.top = root + self.text_frame = frame + self.text = text + self.label = '' + + def getlineno(self, index): + return int(float(self.text.index(index))) + + def update_menu_label(self, **kwargs): + self.label = kwargs['label'] + + +class CodeContextTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + frame = cls.frame = Frame(root) + text = cls.text = Text(frame) + text.insert('1.0', code_sample) + # Need to pack for creation of code context text widget. + frame.pack(side='left', fill='both', expand=1) + text.grid(row=1, column=1, sticky=NSEW) + cls.editor = DummyEditwin(root, frame, text) + codecontext.idleConf.userCfg = testcfg + + @classmethod + def tearDownClass(cls): + codecontext.idleConf.userCfg = usercfg + cls.editor.text.delete('1.0', 'end') + del cls.editor, cls.frame, cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.yview(0) + self.text['font'] = 'TkFixedFont' + self.cc = codecontext.CodeContext(self.editor) + + self.highlight_cfg = {"background": '#abcdef', + "foreground": '#123456'} + orig_idleConf_GetHighlight = codecontext.idleConf.GetHighlight + def mock_idleconf_GetHighlight(theme, element): + if element == 'context': + return self.highlight_cfg + return orig_idleConf_GetHighlight(theme, element) + GetHighlight_patcher = unittest.mock.patch.object( + codecontext.idleConf, 'GetHighlight', mock_idleconf_GetHighlight) + GetHighlight_patcher.start() + self.addCleanup(GetHighlight_patcher.stop) + + self.font_override = 'TkFixedFont' + def mock_idleconf_GetFont(root, configType, section): + return self.font_override + GetFont_patcher = unittest.mock.patch.object( + codecontext.idleConf, 'GetFont', mock_idleconf_GetFont) + GetFont_patcher.start() + self.addCleanup(GetFont_patcher.stop) + + def tearDown(self): + if self.cc.context: + self.cc.context.destroy() + # Explicitly call __del__ to remove scheduled scripts. + self.cc.__del__() + del self.cc.context, self.cc + + def test_init(self): + eq = self.assertEqual + ed = self.editor + cc = self.cc + + eq(cc.editwin, ed) + eq(cc.text, ed.text) + eq(cc.text['font'], ed.text['font']) + self.assertIsNone(cc.context) + eq(cc.info, [(0, -1, '', False)]) + eq(cc.topvisible, 1) + self.assertIsNone(self.cc.t1) + + def test_del(self): + self.cc.__del__() + + def test_del_with_timer(self): + timer = self.cc.t1 = self.text.after(10000, lambda: None) + self.cc.__del__() + with self.assertRaises(TclError) as cm: + self.root.tk.call('after', 'info', timer) + self.assertIn("doesn't exist", str(cm.exception)) + + def test_reload(self): + codecontext.CodeContext.reload() + self.assertEqual(self.cc.context_depth, 15) + + def test_toggle_code_context_event(self): + eq = self.assertEqual + cc = self.cc + toggle = cc.toggle_code_context_event + + # Make sure code context is off. + if cc.context: + toggle() + + # Toggle on. + toggle() + self.assertIsNotNone(cc.context) + eq(cc.context['font'], self.text['font']) + eq(cc.context['fg'], self.highlight_cfg['foreground']) + eq(cc.context['bg'], self.highlight_cfg['background']) + eq(cc.context.get('1.0', 'end-1c'), '') + eq(cc.editwin.label, 'Hide Code Context') + eq(self.root.tk.call('after', 'info', self.cc.t1)[1], 'timer') + + # Toggle off. + toggle() + self.assertIsNone(cc.context) + eq(cc.editwin.label, 'Show Code Context') + self.assertIsNone(self.cc.t1) + + # Scroll down and toggle back on. + line11_context = '\n'.join(x[2] for x in cc.get_context(11)[0]) + cc.text.yview(11) + toggle() + eq(cc.context.get('1.0', 'end-1c'), line11_context) + + # Toggle off and on again. + toggle() + toggle() + eq(cc.context.get('1.0', 'end-1c'), line11_context) + + def test_get_context(self): + eq = self.assertEqual + gc = self.cc.get_context + + # stopline must be greater than 0. + with self.assertRaises(AssertionError): + gc(1, stopline=0) + + eq(gc(3), ([(2, 0, 'class C1:', 'class')], 0)) + + # Don't return comment. + eq(gc(4), ([(2, 0, 'class C1:', 'class')], 0)) + + # Two indentation levels and no comment. + eq(gc(5), ([(2, 0, 'class C1:', 'class'), + (4, 4, ' def __init__(self, a, b):', 'def')], 0)) + + # Only one 'def' is returned, not both at the same indent level. + eq(gc(10), ([(2, 0, 'class C1:', 'class'), + (7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if')], 0)) + + # With 'elif', also show the 'if' even though it's at the same level. + eq(gc(11), ([(2, 0, 'class C1:', 'class'), + (7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 0)) + + # Set stop_line to not go back to first line in source code. + # Return includes stop_line. + eq(gc(11, stopline=2), ([(2, 0, 'class C1:', 'class'), + (7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 0)) + eq(gc(11, stopline=3), ([(7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 4)) + eq(gc(11, stopline=8), ([(8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 8)) + + # Set stop_indent to test indent level to stop at. + eq(gc(11, stopindent=4), ([(7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 4)) + # Check that the 'if' is included. + eq(gc(11, stopindent=8), ([(8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')], 8)) + + def test_update_code_context(self): + eq = self.assertEqual + cc = self.cc + # Ensure code context is active. + if not cc.context: + cc.toggle_code_context_event() + + # Invoke update_code_context without scrolling - nothing happens. + self.assertIsNone(cc.update_code_context()) + eq(cc.info, [(0, -1, '', False)]) + eq(cc.topvisible, 1) + + # Scroll down to line 1. + cc.text.yview(1) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False)]) + eq(cc.topvisible, 2) + eq(cc.context.get('1.0', 'end-1c'), '') + + # Scroll down to line 2. + cc.text.yview(2) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1:', 'class')]) + eq(cc.topvisible, 3) + eq(cc.context.get('1.0', 'end-1c'), 'class C1:') + + # Scroll down to line 3. Since it's a comment, nothing changes. + cc.text.yview(3) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1:', 'class')]) + eq(cc.topvisible, 4) + eq(cc.context.get('1.0', 'end-1c'), 'class C1:') + + # Scroll down to line 4. + cc.text.yview(4) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False), + (2, 0, 'class C1:', 'class'), + (4, 4, ' def __init__(self, a, b):', 'def')]) + eq(cc.topvisible, 5) + eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n' + ' def __init__(self, a, b):') + + # Scroll down to line 11. Last 'def' is removed. + cc.text.yview(11) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False), + (2, 0, 'class C1:', 'class'), + (7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')]) + eq(cc.topvisible, 12) + eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n' + ' def compare(self):\n' + ' if a > b:\n' + ' elif a < b:') + + # No scroll. No update, even though context_depth changed. + cc.update_code_context() + cc.context_depth = 1 + eq(cc.info, [(0, -1, '', False), + (2, 0, 'class C1:', 'class'), + (7, 4, ' def compare(self):', 'def'), + (8, 8, ' if a > b:', 'if'), + (10, 8, ' elif a < b:', 'elif')]) + eq(cc.topvisible, 12) + eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n' + ' def compare(self):\n' + ' if a > b:\n' + ' elif a < b:') + + # Scroll up. + cc.text.yview(5) + cc.update_code_context() + eq(cc.info, [(0, -1, '', False), + (2, 0, 'class C1:', 'class'), + (4, 4, ' def __init__(self, a, b):', 'def')]) + eq(cc.topvisible, 6) + # context_depth is 1. + eq(cc.context.get('1.0', 'end-1c'), ' def __init__(self, a, b):') + + def test_jumptoline(self): + eq = self.assertEqual + cc = self.cc + jump = cc.jumptoline + + if not cc.context: + cc.toggle_code_context_event() + + # Empty context. + cc.text.yview('2.0') + cc.update_code_context() + eq(cc.topvisible, 2) + cc.context.mark_set('insert', '1.5') + jump() + eq(cc.topvisible, 1) + + # 4 lines of context showing. + cc.text.yview('12.0') + cc.update_code_context() + eq(cc.topvisible, 12) + cc.context.mark_set('insert', '3.0') + jump() + eq(cc.topvisible, 8) + + # More context lines than limit. + cc.context_depth = 2 + cc.text.yview('12.0') + cc.update_code_context() + eq(cc.topvisible, 12) + cc.context.mark_set('insert', '1.0') + jump() + eq(cc.topvisible, 8) + + # Context selection stops jump. + cc.text.yview('5.0') + cc.update_code_context() + cc.context.tag_add('sel', '1.0', '2.0') + cc.context.mark_set('insert', '1.0') + jump() # Without selection, to line 2. + eq(cc.topvisible, 5) + + @mock.patch.object(codecontext.CodeContext, 'update_code_context') + def test_timer_event(self, mock_update): + # Ensure code context is not active. + if self.cc.context: + self.cc.toggle_code_context_event() + self.cc.timer_event() + mock_update.assert_not_called() + + # Activate code context. + self.cc.toggle_code_context_event() + self.cc.timer_event() + mock_update.assert_called() + + def test_font(self): + eq = self.assertEqual + cc = self.cc + + orig_font = cc.text['font'] + test_font = 'TkTextFont' + self.assertNotEqual(orig_font, test_font) + + # Ensure code context is not active. + if cc.context is not None: + cc.toggle_code_context_event() + + self.font_override = test_font + # Nothing breaks or changes with inactive code context. + cc.update_font() + + # Activate code context, previous font change is immediately effective. + cc.toggle_code_context_event() + eq(cc.context['font'], test_font) + + # Call the font update, change is picked up. + self.font_override = orig_font + cc.update_font() + eq(cc.context['font'], orig_font) + + def test_highlight_colors(self): + eq = self.assertEqual + cc = self.cc + + orig_colors = dict(self.highlight_cfg) + test_colors = {'background': '#222222', 'foreground': '#ffff00'} + + def assert_colors_are_equal(colors): + eq(cc.context['background'], colors['background']) + eq(cc.context['foreground'], colors['foreground']) + + # Ensure code context is not active. + if cc.context: + cc.toggle_code_context_event() + + self.highlight_cfg = test_colors + # Nothing breaks with inactive code context. + cc.update_highlight_colors() + + # Activate code context, previous colors change is immediately effective. + cc.toggle_code_context_event() + assert_colors_are_equal(test_colors) + + # Call colors update with no change to the configured colors. + cc.update_highlight_colors() + assert_colors_are_equal(test_colors) + + # Call the colors update with code context active, change is picked up. + self.highlight_cfg = orig_colors + cc.update_highlight_colors() + assert_colors_are_equal(orig_colors) + + +class HelperFunctionText(unittest.TestCase): + + def test_get_spaces_firstword(self): + get = codecontext.get_spaces_firstword + test_lines = ( + (' first word', (' ', 'first')), + ('\tfirst word', ('\t', 'first')), + (' \u19D4\u19D2: ', (' ', '\u19D4\u19D2')), + ('no spaces', ('', 'no')), + ('', ('', '')), + ('# TEST COMMENT', ('', '')), + (' (continuation)', (' ', '')) + ) + for line, expected_output in test_lines: + self.assertEqual(get(line), expected_output) + + # Send the pattern in the call. + self.assertEqual(get(' (continuation)', + c=re.compile(r'^(\s*)([^\s]*)')), + (' ', '(continuation)')) + + def test_get_line_info(self): + eq = self.assertEqual + gli = codecontext.get_line_info + lines = code_sample.splitlines() + + # Line 1 is not a BLOCKOPENER. + eq(gli(lines[0]), (codecontext.INFINITY, '', False)) + # Line 2 is a BLOCKOPENER without an indent. + eq(gli(lines[1]), (0, 'class C1:', 'class')) + # Line 3 is not a BLOCKOPENER and does not return the indent level. + eq(gli(lines[2]), (codecontext.INFINITY, ' # Class comment.', False)) + # Line 4 is a BLOCKOPENER and is indented. + eq(gli(lines[3]), (4, ' def __init__(self, a, b):', 'def')) + # Line 8 is a different BLOCKOPENER and is indented. + eq(gli(lines[7]), (8, ' if a > b:', 'if')) + # Test tab. + eq(gli('\tif a == b:'), (1, '\tif a == b:', 'if')) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_colorizer.py b/micromamba_root/Lib/idlelib/idle_test/test_colorizer.py new file mode 100644 index 0000000000000000000000000000000000000000..40800df97b0bd38e6dfcb1b06d80cacb3ff73916 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_colorizer.py @@ -0,0 +1,623 @@ +"Test colorizer, coverage 99%." +from idlelib import colorizer +from test.support import requires +import unittest +from unittest import mock +from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop + +from functools import partial +import textwrap +from tkinter import Tk, Text +from idlelib import config +from idlelib.percolator import Percolator + + +usercfg = colorizer.idleConf.userCfg +testcfg = { + 'main': config.IdleUserConfParser(''), + 'highlight': config.IdleUserConfParser(''), + 'keys': config.IdleUserConfParser(''), + 'extensions': config.IdleUserConfParser(''), +} + +source = textwrap.dedent("""\ + if True: int ('1') # keyword, builtin, string, comment + elif False: print(0) # 'string' in comment + else: float(None) # if in comment + if iF + If + IF: 'keyword matching must respect case' + if'': x or'' # valid keyword-string no-space combinations + async def f(): await g() + # Strings should be entirely colored, including quotes. + 'x', '''x''', "x", \"""x\""" + 'abc\\ + def' + '''abc\\ + def''' + # All valid prefixes for unicode and byte strings should be colored. + r'x', u'x', R'x', U'x', f'x', F'x' + fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x' + tr'x', Tr'x', tR'x', TR'x', rt'x', rT'x', Rt'x', RT'x' + b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x' + # Invalid combinations of legal characters should be half colored. + ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x' + match point: + case (x, 0) as _: + print(f"X={x}") + case [_, [_], "_", + _]: + pass + case _ if ("a" if _ else set()): pass + case _: + raise ValueError("Not a point _") + ''' + case _:''' + "match x:" + """) + + +def setUpModule(): + colorizer.idleConf.userCfg = testcfg + + +def tearDownModule(): + colorizer.idleConf.userCfg = usercfg + + +class FunctionTest(unittest.TestCase): + + def test_any(self): + self.assertEqual(colorizer.any('test', ('a', 'b', 'cd')), + '(?Pa|b|cd)') + + def test_make_pat(self): + # Tested in more detail by testing prog. + self.assertTrue(colorizer.make_pat()) + + def test_prog(self): + prog = colorizer.prog + eq = self.assertEqual + line = 'def f():\n print("hello")\n' + m = prog.search(line) + eq(m.groupdict()['KEYWORD'], 'def') + m = prog.search(line, m.end()) + eq(m.groupdict()['SYNC'], '\n') + m = prog.search(line, m.end()) + eq(m.groupdict()['BUILTIN'], 'print') + m = prog.search(line, m.end()) + eq(m.groupdict()['STRING'], '"hello"') + m = prog.search(line, m.end()) + eq(m.groupdict()['SYNC'], '\n') + + def test_idprog(self): + idprog = colorizer.idprog + m = idprog.match('nospace') + self.assertIsNone(m) + m = idprog.match(' space') + self.assertEqual(m.group(0), ' space') + + +class ColorConfigTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + cls.text = Text(root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_color_config(self): + text = self.text + eq = self.assertEqual + colorizer.color_config(text) + # Uses IDLE Classic theme as default. + eq(text['background'], '#ffffff') + eq(text['foreground'], '#000000') + eq(text['selectbackground'], 'gray') + eq(text['selectforeground'], '#000000') + eq(text['insertbackground'], 'black') + eq(text['inactiveselectbackground'], 'gray') + + +class ColorDelegatorInstantiationTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + cls.text = Text(root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.color = colorizer.ColorDelegator() + + def tearDown(self): + self.color.close() + self.text.delete('1.0', 'end') + self.color.resetcache() + del self.color + + def test_init(self): + color = self.color + self.assertIsInstance(color, colorizer.ColorDelegator) + + def test_init_state(self): + # init_state() is called during the instantiation of + # ColorDelegator in setUp(). + color = self.color + self.assertIsNone(color.after_id) + self.assertTrue(color.allow_colorizing) + self.assertFalse(color.colorizing) + self.assertFalse(color.stop_colorizing) + + +class ColorDelegatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + text = cls.text = Text(root) + cls.percolator = Percolator(text) + # Delegator stack = [Delegator(text)] + + @classmethod + def tearDownClass(cls): + cls.percolator.close() + del cls.percolator, cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.color = colorizer.ColorDelegator() + self.percolator.insertfilter(self.color) + # Calls color.setdelegate(Delegator(text)). + + def tearDown(self): + self.color.close() + self.percolator.removefilter(self.color) + self.text.delete('1.0', 'end') + self.color.resetcache() + del self.color + + def test_setdelegate(self): + # Called in setUp when filter is attached to percolator. + color = self.color + self.assertIsInstance(color.delegate, colorizer.Delegator) + # It is too late to mock notify_range, so test side effect. + self.assertEqual(self.root.tk.call( + 'after', 'info', color.after_id)[1], 'timer') + + def test_LoadTagDefs(self): + highlight = partial(config.idleConf.GetHighlight, theme='IDLE Classic') + for tag, colors in self.color.tagdefs.items(): + with self.subTest(tag=tag): + self.assertIn('background', colors) + self.assertIn('foreground', colors) + if tag not in ('SYNC', 'TODO'): + self.assertEqual(colors, highlight(element=tag.lower())) + + def test_config_colors(self): + text = self.text + highlight = partial(config.idleConf.GetHighlight, theme='IDLE Classic') + for tag in self.color.tagdefs: + for plane in ('background', 'foreground'): + with self.subTest(tag=tag, plane=plane): + if tag in ('SYNC', 'TODO'): + self.assertEqual(text.tag_cget(tag, plane), '') + else: + self.assertEqual(text.tag_cget(tag, plane), + highlight(element=tag.lower())[plane]) + # 'sel' is marked as the highest priority. + self.assertEqual(text.tag_names()[-1], 'sel') + + @mock.patch.object(colorizer.ColorDelegator, 'notify_range') + def test_insert(self, mock_notify): + text = self.text + # Initial text. + text.insert('insert', 'foo') + self.assertEqual(text.get('1.0', 'end'), 'foo\n') + mock_notify.assert_called_with('1.0', '1.0+3c') + # Additional text. + text.insert('insert', 'barbaz') + self.assertEqual(text.get('1.0', 'end'), 'foobarbaz\n') + mock_notify.assert_called_with('1.3', '1.3+6c') + + @mock.patch.object(colorizer.ColorDelegator, 'notify_range') + def test_delete(self, mock_notify): + text = self.text + # Initialize text. + text.insert('insert', 'abcdefghi') + self.assertEqual(text.get('1.0', 'end'), 'abcdefghi\n') + # Delete single character. + text.delete('1.7') + self.assertEqual(text.get('1.0', 'end'), 'abcdefgi\n') + mock_notify.assert_called_with('1.7') + # Delete multiple characters. + text.delete('1.3', '1.6') + self.assertEqual(text.get('1.0', 'end'), 'abcgi\n') + mock_notify.assert_called_with('1.3') + + def test_notify_range(self): + text = self.text + color = self.color + eq = self.assertEqual + + # Colorizing already scheduled. + save_id = color.after_id + eq(self.root.tk.call('after', 'info', save_id)[1], 'timer') + self.assertFalse(color.colorizing) + self.assertFalse(color.stop_colorizing) + self.assertTrue(color.allow_colorizing) + + # Coloring scheduled and colorizing in progress. + color.colorizing = True + color.notify_range('1.0', 'end') + self.assertFalse(color.stop_colorizing) + eq(color.after_id, save_id) + + # No colorizing scheduled and colorizing in progress. + text.after_cancel(save_id) + color.after_id = None + color.notify_range('1.0', '1.0+3c') + self.assertTrue(color.stop_colorizing) + self.assertIsNotNone(color.after_id) + eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer') + # New event scheduled. + self.assertNotEqual(color.after_id, save_id) + + # No colorizing scheduled and colorizing off. + text.after_cancel(color.after_id) + color.after_id = None + color.allow_colorizing = False + color.notify_range('1.4', '1.4+10c') + # Nothing scheduled when colorizing is off. + self.assertIsNone(color.after_id) + + def test_toggle_colorize_event(self): + color = self.color + eq = self.assertEqual + + # Starts with colorizing allowed and scheduled. + self.assertFalse(color.colorizing) + self.assertFalse(color.stop_colorizing) + self.assertTrue(color.allow_colorizing) + eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer') + + # Toggle colorizing off. + color.toggle_colorize_event() + self.assertIsNone(color.after_id) + self.assertFalse(color.colorizing) + self.assertFalse(color.stop_colorizing) + self.assertFalse(color.allow_colorizing) + + # Toggle on while colorizing in progress (doesn't add timer). + color.colorizing = True + color.toggle_colorize_event() + self.assertIsNone(color.after_id) + self.assertTrue(color.colorizing) + self.assertFalse(color.stop_colorizing) + self.assertTrue(color.allow_colorizing) + + # Toggle off while colorizing in progress. + color.toggle_colorize_event() + self.assertIsNone(color.after_id) + self.assertTrue(color.colorizing) + self.assertTrue(color.stop_colorizing) + self.assertFalse(color.allow_colorizing) + + # Toggle on while colorizing not in progress. + color.colorizing = False + color.toggle_colorize_event() + eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer') + self.assertFalse(color.colorizing) + self.assertTrue(color.stop_colorizing) + self.assertTrue(color.allow_colorizing) + + @mock.patch.object(colorizer.ColorDelegator, 'recolorize_main') + def test_recolorize(self, mock_recmain): + text = self.text + color = self.color + eq = self.assertEqual + # Call recolorize manually and not scheduled. + text.after_cancel(color.after_id) + + # No delegate. + save_delegate = color.delegate + color.delegate = None + color.recolorize() + mock_recmain.assert_not_called() + color.delegate = save_delegate + + # Toggle off colorizing. + color.allow_colorizing = False + color.recolorize() + mock_recmain.assert_not_called() + color.allow_colorizing = True + + # Colorizing in progress. + color.colorizing = True + color.recolorize() + mock_recmain.assert_not_called() + color.colorizing = False + + # Colorizing is done, but not completed, so rescheduled. + color.recolorize() + self.assertFalse(color.stop_colorizing) + self.assertFalse(color.colorizing) + mock_recmain.assert_called() + eq(mock_recmain.call_count, 1) + # Rescheduled when TODO tag still exists. + eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer') + + # No changes to text, so no scheduling added. + text.tag_remove('TODO', '1.0', 'end') + color.recolorize() + self.assertFalse(color.stop_colorizing) + self.assertFalse(color.colorizing) + mock_recmain.assert_called() + eq(mock_recmain.call_count, 2) + self.assertIsNone(color.after_id) + + @mock.patch.object(colorizer.ColorDelegator, 'notify_range') + def test_recolorize_main(self, mock_notify): + text = self.text + color = self.color + eq = self.assertEqual + + text.insert('insert', source) + expected = (('1.0', ('KEYWORD',)), ('1.2', ()), ('1.3', ('KEYWORD',)), + ('1.7', ()), ('1.9', ('BUILTIN',)), ('1.14', ('STRING',)), + ('1.19', ('COMMENT',)), + ('2.1', ('KEYWORD',)), ('2.18', ()), ('2.25', ('COMMENT',)), + ('3.6', ('BUILTIN',)), ('3.12', ('KEYWORD',)), ('3.21', ('COMMENT',)), + ('4.0', ('KEYWORD',)), ('4.3', ()), ('4.6', ()), + ('5.2', ('STRING',)), ('5.8', ('KEYWORD',)), ('5.10', ('STRING',)), + ('6.0', ('KEYWORD',)), ('6.10', ('DEFINITION',)), ('6.11', ()), + ('8.0', ('STRING',)), ('8.4', ()), ('8.5', ('STRING',)), + ('8.12', ()), ('8.14', ('STRING',)), + ('20.0', ('KEYWORD',)), + ('21.4', ('KEYWORD',)), ('21.16', ('KEYWORD',)),# ('21.19', ('KEYWORD',)), + #('23.4', ('KEYWORD',)), ('23.10', ('KEYWORD',)), ('23.14', ('KEYWORD',)), ('23.19', ('STRING',)), + #('24.12', ('KEYWORD',)), + ('25.8', ('KEYWORD',)), + ('26.4', ('KEYWORD',)), ('26.9', ('KEYWORD',)), + ('26.11', ('KEYWORD',)), ('26.15', ('STRING',)), + ('26.19', ('KEYWORD',)), ('26.22', ()), + ('26.24', ('KEYWORD',)), ('26.29', ('BUILTIN',)), ('26.37', ('KEYWORD',)), + ('27.4', ('KEYWORD',)), ('27.9', ('KEYWORD',)),# ('27.11', ('KEYWORD',)), ('27.14', (),), + ('28.25', ('STRING',)), ('28.38', ('STRING',)), + ('30.0', ('STRING',)), + ('31.1', ('STRING',)), + # SYNC at the end of every line. + ('1.55', ('SYNC',)), ('2.50', ('SYNC',)), ('3.34', ('SYNC',)), + ) + + # Nothing marked to do therefore no tags in text. + text.tag_remove('TODO', '1.0', 'end') + color.recolorize_main() + for tag in text.tag_names(): + with self.subTest(tag=tag): + eq(text.tag_ranges(tag), ()) + + # Source marked for processing. + text.tag_add('TODO', '1.0', 'end') + # Check some indexes. + color.recolorize_main() + for index, expected_tags in expected: + with self.subTest(index=index): + eq(text.tag_names(index), expected_tags) + + # Check for some tags for ranges. + eq(text.tag_nextrange('TODO', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ('1.0', '1.2')) + eq(text.tag_nextrange('COMMENT', '2.0'), ('2.22', '2.43')) + eq(text.tag_nextrange('SYNC', '2.0'), ('2.43', '3.0')) + eq(text.tag_nextrange('STRING', '2.0'), ('4.17', '4.53')) + eq(text.tag_nextrange('STRING', '8.0'), ('8.0', '8.3')) + eq(text.tag_nextrange('STRING', '8.3'), ('8.5', '8.12')) + eq(text.tag_nextrange('STRING', '8.12'), ('8.14', '8.17')) + eq(text.tag_nextrange('STRING', '8.17'), ('8.19', '8.26')) + eq(text.tag_nextrange('SYNC', '8.0'), ('8.26', '9.0')) + eq(text.tag_nextrange('SYNC', '31.0'), ('31.10', '33.0')) + + def _assert_highlighting(self, source, tag_ranges): + """Check highlighting of a given piece of code. + + This inserts just this code into the Text widget. It will then + check that the resulting highlighting tag ranges exactly match + those described in the given `tag_ranges` dict. + + Note that the irrelevant tags 'sel', 'TODO' and 'SYNC' are + ignored. + """ + text = self.text + + with mock.patch.object(colorizer.ColorDelegator, 'notify_range'): + text.delete('1.0', 'end-1c') + text.insert('insert', source) + text.tag_add('TODO', '1.0', 'end-1c') + self.color.recolorize_main() + + # Make a dict with highlighting tag ranges in the Text widget. + text_tag_ranges = {} + for tag in set(text.tag_names()) - {'sel', 'TODO', 'SYNC'}: + indexes = [rng.string for rng in text.tag_ranges(tag)] + for index_pair in zip(indexes[::2], indexes[1::2]): + text_tag_ranges.setdefault(tag, []).append(index_pair) + + self.assertEqual(text_tag_ranges, tag_ranges) + + with mock.patch.object(colorizer.ColorDelegator, 'notify_range'): + text.delete('1.0', 'end-1c') + + def test_def_statement(self): + # empty def + self._assert_highlighting('def', {'KEYWORD': [('1.0', '1.3')]}) + + # def followed by identifier + self._assert_highlighting('def foo:', {'KEYWORD': [('1.0', '1.3')], + 'DEFINITION': [('1.4', '1.7')]}) + + # def followed by partial identifier + self._assert_highlighting('def fo', {'KEYWORD': [('1.0', '1.3')], + 'DEFINITION': [('1.4', '1.6')]}) + + # def followed by non-keyword + self._assert_highlighting('def ++', {'KEYWORD': [('1.0', '1.3')]}) + + def test_match_soft_keyword(self): + # empty match + self._assert_highlighting('match', {'KEYWORD': [('1.0', '1.5')]}) + + # match followed by partial identifier + self._assert_highlighting('match fo', {'KEYWORD': [('1.0', '1.5')]}) + + # match followed by identifier and colon + self._assert_highlighting('match foo:', {'KEYWORD': [('1.0', '1.5')]}) + + # match followed by keyword + self._assert_highlighting('match and', {'KEYWORD': [('1.6', '1.9')]}) + + # match followed by builtin with keyword prefix + self._assert_highlighting('match int:', {'KEYWORD': [('1.0', '1.5')], + 'BUILTIN': [('1.6', '1.9')]}) + + # match followed by non-text operator + self._assert_highlighting('match^', {}) + self._assert_highlighting('match @', {}) + + # match followed by colon + self._assert_highlighting('match :', {}) + + # match followed by comma + self._assert_highlighting('match\t,', {}) + + # match followed by a lone underscore + self._assert_highlighting('match _:', {'KEYWORD': [('1.0', '1.5')]}) + + def test_case_soft_keyword(self): + # empty case + self._assert_highlighting('case', {'KEYWORD': [('1.0', '1.4')]}) + + # case followed by partial identifier + self._assert_highlighting('case fo', {'KEYWORD': [('1.0', '1.4')]}) + + # case followed by identifier and colon + self._assert_highlighting('case foo:', {'KEYWORD': [('1.0', '1.4')]}) + + # case followed by keyword + self._assert_highlighting('case and', {'KEYWORD': [('1.5', '1.8')]}) + + # case followed by builtin with keyword prefix + self._assert_highlighting('case int:', {'KEYWORD': [('1.0', '1.4')], + 'BUILTIN': [('1.5', '1.8')]}) + + # case followed by non-text operator + self._assert_highlighting('case^', {}) + self._assert_highlighting('case @', {}) + + # case followed by colon + self._assert_highlighting('case :', {}) + + # case followed by comma + self._assert_highlighting('case\t,', {}) + + # case followed by a lone underscore + self._assert_highlighting('case _:', {'KEYWORD': [('1.0', '1.4'), + ('1.5', '1.6')]}) + + def test_long_multiline_string(self): + source = textwrap.dedent('''\ + """a + b + c + d + e""" + ''') + self._assert_highlighting(source, {'STRING': [('1.0', '5.4')]}) + + @run_in_tk_mainloop(delay=50) + def test_incremental_editing(self): + text = self.text + eq = self.assertEqual + + # Simulate typing 'inte'. During this, the highlighting should + # change from normal to keyword to builtin to normal. + text.insert('insert', 'i') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ()) + + text.insert('insert', 'n') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ('1.0', '1.2')) + + text.insert('insert', 't') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ('1.0', '1.3')) + eq(text.tag_nextrange('KEYWORD', '1.0'), ()) + + text.insert('insert', 'e') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ()) + + # Simulate deleting three characters from the end of 'inte'. + # During this, the highlighting should change from normal to + # builtin to keyword to normal. + text.delete('insert-1c', 'insert') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ('1.0', '1.3')) + eq(text.tag_nextrange('KEYWORD', '1.0'), ()) + + text.delete('insert-1c', 'insert') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ('1.0', '1.2')) + + text.delete('insert-1c', 'insert') + yield + eq(text.tag_nextrange('BUILTIN', '1.0'), ()) + eq(text.tag_nextrange('KEYWORD', '1.0'), ()) + + @mock.patch.object(colorizer.ColorDelegator, 'recolorize') + @mock.patch.object(colorizer.ColorDelegator, 'notify_range') + def test_removecolors(self, mock_notify, mock_recolorize): + text = self.text + color = self.color + text.insert('insert', source) + + color.recolorize_main() + # recolorize_main doesn't add these tags. + text.tag_add("ERROR", "1.0") + text.tag_add("TODO", "1.0") + text.tag_add("hit", "1.0") + for tag in color.tagdefs: + with self.subTest(tag=tag): + self.assertNotEqual(text.tag_ranges(tag), ()) + + color.removecolors() + for tag in color.tagdefs: + with self.subTest(tag=tag): + self.assertEqual(text.tag_ranges(tag), ()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_config.py b/micromamba_root/Lib/idlelib/idle_test/test_config.py new file mode 100644 index 0000000000000000000000000000000000000000..6d75cf7aa67dcce3b9bc49cc54cb4d5fd24cc103 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_config.py @@ -0,0 +1,805 @@ +"""Test config, coverage 93%. +(100% for IdleConfParser, IdleUserConfParser*, ConfigChanges). +* Exception is OSError clause in Save method. +Much of IdleConf is also exercised by ConfigDialog and test_configdialog. +""" +from idlelib import config +import sys +import os +import tempfile +from test.support import captured_stderr, findfile +import unittest +from unittest import mock +import idlelib +from idlelib.idle_test.mock_idle import Func + +# Tests should not depend on fortuitous user configurations. +# They must not affect actual user .cfg files. +# Replace user parsers with empty parsers that cannot be saved +# due to getting '' as the filename when created. + +idleConf = config.idleConf +usercfg = idleConf.userCfg +testcfg = {} +usermain = testcfg['main'] = config.IdleUserConfParser('') +userhigh = testcfg['highlight'] = config.IdleUserConfParser('') +userkeys = testcfg['keys'] = config.IdleUserConfParser('') +userextn = testcfg['extensions'] = config.IdleUserConfParser('') + +def setUpModule(): + idleConf.userCfg = testcfg + idlelib.testing = True + +def tearDownModule(): + idleConf.userCfg = usercfg + idlelib.testing = False + + +class IdleConfParserTest(unittest.TestCase): + """Test that IdleConfParser works""" + + config = """ + [one] + one = false + two = true + three = 10 + + [two] + one = a string + two = true + three = false + """ + + def test_get(self): + parser = config.IdleConfParser('') + parser.read_string(self.config) + eq = self.assertEqual + + # Test with type argument. + self.assertIs(parser.Get('one', 'one', type='bool'), False) + self.assertIs(parser.Get('one', 'two', type='bool'), True) + eq(parser.Get('one', 'three', type='int'), 10) + eq(parser.Get('two', 'one'), 'a string') + self.assertIs(parser.Get('two', 'two', type='bool'), True) + self.assertIs(parser.Get('two', 'three', type='bool'), False) + + # Test without type should fallback to string. + eq(parser.Get('two', 'two'), 'true') + eq(parser.Get('two', 'three'), 'false') + + # If option not exist, should return None, or default. + self.assertIsNone(parser.Get('not', 'exist')) + eq(parser.Get('not', 'exist', default='DEFAULT'), 'DEFAULT') + + def test_get_option_list(self): + parser = config.IdleConfParser('') + parser.read_string(self.config) + get_list = parser.GetOptionList + self.assertCountEqual(get_list('one'), ['one', 'two', 'three']) + self.assertCountEqual(get_list('two'), ['one', 'two', 'three']) + self.assertEqual(get_list('not exist'), []) + + def test_load_nothing(self): + parser = config.IdleConfParser('') + parser.Load() + self.assertEqual(parser.sections(), []) + + def test_load_file(self): + # Borrow test/configdata/cfgparser.1 from test_configparser. + config_path = findfile('cfgparser.1', subdir='configdata') + parser = config.IdleConfParser(config_path) + parser.Load() + + self.assertEqual(parser.Get('Foo Bar', 'foo'), 'newbar') + self.assertEqual(parser.GetOptionList('Foo Bar'), ['foo']) + + +class IdleUserConfParserTest(unittest.TestCase): + """Test that IdleUserConfParser works""" + + def new_parser(self, path=''): + return config.IdleUserConfParser(path) + + def test_set_option(self): + parser = self.new_parser() + parser.add_section('Foo') + # Setting new option in existing section should return True. + self.assertTrue(parser.SetOption('Foo', 'bar', 'true')) + # Setting existing option with same value should return False. + self.assertFalse(parser.SetOption('Foo', 'bar', 'true')) + # Setting exiting option with new value should return True. + self.assertTrue(parser.SetOption('Foo', 'bar', 'false')) + self.assertEqual(parser.Get('Foo', 'bar'), 'false') + + # Setting option in new section should create section and return True. + self.assertTrue(parser.SetOption('Bar', 'bar', 'true')) + self.assertCountEqual(parser.sections(), ['Bar', 'Foo']) + self.assertEqual(parser.Get('Bar', 'bar'), 'true') + + def test_remove_option(self): + parser = self.new_parser() + parser.AddSection('Foo') + parser.SetOption('Foo', 'bar', 'true') + + self.assertTrue(parser.RemoveOption('Foo', 'bar')) + self.assertFalse(parser.RemoveOption('Foo', 'bar')) + self.assertFalse(parser.RemoveOption('Not', 'Exist')) + + def test_add_section(self): + parser = self.new_parser() + self.assertEqual(parser.sections(), []) + + # Should not add duplicate section. + # Configparser raises DuplicateError, IdleParser not. + parser.AddSection('Foo') + parser.AddSection('Foo') + parser.AddSection('Bar') + self.assertCountEqual(parser.sections(), ['Bar', 'Foo']) + + def test_remove_empty_sections(self): + parser = self.new_parser() + + parser.AddSection('Foo') + parser.AddSection('Bar') + parser.SetOption('Idle', 'name', 'val') + self.assertCountEqual(parser.sections(), ['Bar', 'Foo', 'Idle']) + parser.RemoveEmptySections() + self.assertEqual(parser.sections(), ['Idle']) + + def test_is_empty(self): + parser = self.new_parser() + + parser.AddSection('Foo') + parser.AddSection('Bar') + self.assertTrue(parser.IsEmpty()) + self.assertEqual(parser.sections(), []) + + parser.SetOption('Foo', 'bar', 'false') + parser.AddSection('Bar') + self.assertFalse(parser.IsEmpty()) + self.assertCountEqual(parser.sections(), ['Foo']) + + def test_save(self): + with tempfile.TemporaryDirectory() as tdir: + path = os.path.join(tdir, 'test.cfg') + parser = self.new_parser(path) + parser.AddSection('Foo') + parser.SetOption('Foo', 'bar', 'true') + + # Should save to path when config is not empty. + self.assertFalse(os.path.exists(path)) + parser.Save() + self.assertTrue(os.path.exists(path)) + + # Should remove the file from disk when config is empty. + parser.remove_section('Foo') + parser.Save() + self.assertFalse(os.path.exists(path)) + + +class IdleConfTest(unittest.TestCase): + """Test for idleConf""" + + @classmethod + def setUpClass(cls): + cls.config_string = {} + + conf = config.IdleConf(_utest=True) + if __name__ != '__main__': + idle_dir = os.path.dirname(__file__) + else: + idle_dir = os.path.abspath(sys.path[0]) + for ctype in conf.config_types: + config_path = os.path.join(idle_dir, '../config-%s.def' % ctype) + with open(config_path) as f: + cls.config_string[ctype] = f.read() + + cls.orig_warn = config._warn + config._warn = Func() + + @classmethod + def tearDownClass(cls): + config._warn = cls.orig_warn + + def new_config(self, _utest=False): + return config.IdleConf(_utest=_utest) + + def mock_config(self): + """Return a mocked idleConf + + Both default and user config used the same config-*.def + """ + conf = config.IdleConf(_utest=True) + for ctype in conf.config_types: + conf.defaultCfg[ctype] = config.IdleConfParser('') + conf.defaultCfg[ctype].read_string(self.config_string[ctype]) + conf.userCfg[ctype] = config.IdleUserConfParser('') + conf.userCfg[ctype].read_string(self.config_string[ctype]) + + return conf + + @unittest.skipIf(sys.platform.startswith('win'), 'this is test for unix system') + def test_get_user_cfg_dir_unix(self): + # Test to get user config directory under unix. + conf = self.new_config(_utest=True) + + # Check normal way should success + with mock.patch('os.path.expanduser', return_value='/home/foo'): + with mock.patch('os.path.exists', return_value=True): + self.assertEqual(conf.GetUserCfgDir(), '/home/foo/.idlerc') + + # Check os.getcwd should success + with mock.patch('os.path.expanduser', return_value='~'): + with mock.patch('os.getcwd', return_value='/home/foo/cpython'): + with mock.patch('os.mkdir'): + self.assertEqual(conf.GetUserCfgDir(), + '/home/foo/cpython/.idlerc') + + # Check user dir not exists and created failed should raise SystemExit + with mock.patch('os.path.join', return_value='/path/not/exists'): + with self.assertRaises(SystemExit): + with self.assertRaises(FileNotFoundError): + conf.GetUserCfgDir() + + @unittest.skipIf(not sys.platform.startswith('win'), 'this is test for Windows system') + def test_get_user_cfg_dir_windows(self): + # Test to get user config directory under Windows. + conf = self.new_config(_utest=True) + + # Check normal way should success + with mock.patch('os.path.expanduser', return_value='C:\\foo'): + with mock.patch('os.path.exists', return_value=True): + self.assertEqual(conf.GetUserCfgDir(), 'C:\\foo\\.idlerc') + + # Check os.getcwd should success + with mock.patch('os.path.expanduser', return_value='~'): + with mock.patch('os.getcwd', return_value='C:\\foo\\cpython'): + with mock.patch('os.mkdir'): + self.assertEqual(conf.GetUserCfgDir(), + 'C:\\foo\\cpython\\.idlerc') + + # Check user dir not exists and created failed should raise SystemExit + with mock.patch('os.path.join', return_value='/path/not/exists'): + with self.assertRaises(SystemExit): + with self.assertRaises(FileNotFoundError): + conf.GetUserCfgDir() + + def test_create_config_handlers(self): + conf = self.new_config(_utest=True) + + # Mock out idle_dir + idle_dir = '/home/foo' + with mock.patch.dict({'__name__': '__foo__'}): + with mock.patch('os.path.dirname', return_value=idle_dir): + conf.CreateConfigHandlers() + + # Check keys are equal + self.assertCountEqual(conf.defaultCfg, conf.config_types) + self.assertCountEqual(conf.userCfg, conf.config_types) + + # Check conf parser are correct type + for default_parser in conf.defaultCfg.values(): + self.assertIsInstance(default_parser, config.IdleConfParser) + for user_parser in conf.userCfg.values(): + self.assertIsInstance(user_parser, config.IdleUserConfParser) + + # Check config path are correct + for cfg_type, parser in conf.defaultCfg.items(): + self.assertEqual(parser.file, + os.path.join(idle_dir, f'config-{cfg_type}.def')) + for cfg_type, parser in conf.userCfg.items(): + self.assertEqual(parser.file, + os.path.join(conf.userdir or '#', f'config-{cfg_type}.cfg')) + + def test_load_cfg_files(self): + conf = self.new_config(_utest=True) + + # Borrow test/configdata/cfgparser.1 from test_configparser. + config_path = findfile('cfgparser.1', subdir='configdata') + conf.defaultCfg['foo'] = config.IdleConfParser(config_path) + conf.userCfg['foo'] = config.IdleUserConfParser(config_path) + + # Load all config from path + conf.LoadCfgFiles() + + eq = self.assertEqual + + # Check defaultCfg is loaded + eq(conf.defaultCfg['foo'].Get('Foo Bar', 'foo'), 'newbar') + eq(conf.defaultCfg['foo'].GetOptionList('Foo Bar'), ['foo']) + + # Check userCfg is loaded + eq(conf.userCfg['foo'].Get('Foo Bar', 'foo'), 'newbar') + eq(conf.userCfg['foo'].GetOptionList('Foo Bar'), ['foo']) + + def test_save_user_cfg_files(self): + conf = self.mock_config() + + with mock.patch('idlelib.config.IdleUserConfParser.Save') as m: + conf.SaveUserCfgFiles() + self.assertEqual(m.call_count, len(conf.userCfg)) + + def test_get_option(self): + conf = self.mock_config() + + eq = self.assertEqual + eq(conf.GetOption('main', 'EditorWindow', 'width'), '80') + eq(conf.GetOption('main', 'EditorWindow', 'width', type='int'), 80) + with mock.patch('idlelib.config._warn') as _warn: + eq(conf.GetOption('main', 'EditorWindow', 'font', type='int'), None) + eq(conf.GetOption('main', 'EditorWindow', 'NotExists'), None) + eq(conf.GetOption('main', 'EditorWindow', 'NotExists', default='NE'), 'NE') + eq(_warn.call_count, 4) + + def test_set_option(self): + conf = self.mock_config() + + conf.SetOption('main', 'Foo', 'bar', 'newbar') + self.assertEqual(conf.GetOption('main', 'Foo', 'bar'), 'newbar') + + def test_get_section_list(self): + conf = self.mock_config() + + self.assertCountEqual( + conf.GetSectionList('default', 'main'), + ['General', 'EditorWindow', 'PyShell', 'Indent', 'Theme', + 'Keys', 'History', 'HelpFiles']) + self.assertCountEqual( + conf.GetSectionList('user', 'main'), + ['General', 'EditorWindow', 'PyShell', 'Indent', 'Theme', + 'Keys', 'History', 'HelpFiles']) + + with self.assertRaises(config.InvalidConfigSet): + conf.GetSectionList('foobar', 'main') + with self.assertRaises(config.InvalidConfigType): + conf.GetSectionList('default', 'notexists') + + def test_get_highlight(self): + conf = self.mock_config() + + eq = self.assertEqual + eq(conf.GetHighlight('IDLE Classic', 'normal'), {'foreground': '#000000', + 'background': '#ffffff'}) + + # Test cursor (this background should be normal-background) + eq(conf.GetHighlight('IDLE Classic', 'cursor'), {'foreground': 'black', + 'background': '#ffffff'}) + + # Test get user themes + conf.SetOption('highlight', 'Foobar', 'normal-foreground', '#747474') + conf.SetOption('highlight', 'Foobar', 'normal-background', '#171717') + with mock.patch('idlelib.config._warn'): + eq(conf.GetHighlight('Foobar', 'normal'), {'foreground': '#747474', + 'background': '#171717'}) + + def test_get_theme_dict(self): + # TODO: finish. + conf = self.mock_config() + + # These two should be the same + self.assertEqual( + conf.GetThemeDict('default', 'IDLE Classic'), + conf.GetThemeDict('user', 'IDLE Classic')) + + with self.assertRaises(config.InvalidTheme): + conf.GetThemeDict('bad', 'IDLE Classic') + + def test_get_current_theme_and_keys(self): + conf = self.mock_config() + + self.assertEqual(conf.CurrentTheme(), conf.current_colors_and_keys('Theme')) + self.assertEqual(conf.CurrentKeys(), conf.current_colors_and_keys('Keys')) + + def test_current_colors_and_keys(self): + conf = self.mock_config() + + self.assertEqual(conf.current_colors_and_keys('Theme'), 'IDLE Classic') + + def test_default_keys(self): + current_platform = sys.platform + conf = self.new_config(_utest=True) + + sys.platform = 'win32' + self.assertEqual(conf.default_keys(), 'IDLE Classic Windows') + + sys.platform = 'darwin' + self.assertEqual(conf.default_keys(), 'IDLE Classic OSX') + + sys.platform = 'some-linux' + self.assertEqual(conf.default_keys(), 'IDLE Modern Unix') + + # Restore platform + sys.platform = current_platform + + def test_get_extensions(self): + userextn.read_string(''' + [ZzDummy] + enable = True + [DISABLE] + enable = False + ''') + eq = self.assertEqual + iGE = idleConf.GetExtensions + eq(iGE(shell_only=True), []) + eq(iGE(), ['ZzDummy']) + eq(iGE(editor_only=True), ['ZzDummy']) + eq(iGE(active_only=False), ['ZzDummy', 'DISABLE']) + eq(iGE(active_only=False, editor_only=True), ['ZzDummy', 'DISABLE']) + userextn.remove_section('ZzDummy') + userextn.remove_section('DISABLE') + + + def test_remove_key_bind_names(self): + conf = self.mock_config() + + self.assertCountEqual( + conf.RemoveKeyBindNames(conf.GetSectionList('default', 'extensions')), + ['AutoComplete', 'CodeContext', 'FormatParagraph', 'ParenMatch', 'ZzDummy']) + + def test_get_extn_name_for_event(self): + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + eq = self.assertEqual + eq(idleConf.GetExtnNameForEvent('z-in'), 'ZzDummy') + eq(idleConf.GetExtnNameForEvent('z-out'), None) + userextn.remove_section('ZzDummy') + + def test_get_extension_keys(self): + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + self.assertEqual(idleConf.GetExtensionKeys('ZzDummy'), + {'<>': ['']}) + userextn.remove_section('ZzDummy') +# need option key test +## key = [''] if sys.platform == 'darwin' else [''] +## eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) + + def test_get_extension_bindings(self): + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + eq = self.assertEqual + iGEB = idleConf.GetExtensionBindings + eq(iGEB('NotExists'), {}) + expect = {'<>': [''], + '<>': ['']} + eq(iGEB('ZzDummy'), expect) + userextn.remove_section('ZzDummy') + + def test_get_keybinding(self): + conf = self.mock_config() + + eq = self.assertEqual + eq(conf.GetKeyBinding('IDLE Modern Unix', '<>'), + ['', '']) + eq(conf.GetKeyBinding('IDLE Classic Unix', '<>'), + ['', '']) + eq(conf.GetKeyBinding('IDLE Classic Windows', '<>'), + ['', '']) + eq(conf.GetKeyBinding('IDLE Classic Mac', '<>'), ['']) + eq(conf.GetKeyBinding('IDLE Classic OSX', '<>'), ['']) + + # Test keybinding not exists + eq(conf.GetKeyBinding('NOT EXISTS', '<>'), []) + eq(conf.GetKeyBinding('IDLE Modern Unix', 'NOT EXISTS'), []) + + def test_get_current_keyset(self): + current_platform = sys.platform + conf = self.mock_config() + + # Ensure that platform isn't darwin + sys.platform = 'some-linux' + self.assertEqual(conf.GetCurrentKeySet(), conf.GetKeySet(conf.CurrentKeys())) + + # This should not be the same, since replace ') + self.assertEqual(conf.GetKeySet('IDLE Modern Unix')['<>'], '') + + def test_is_core_binding(self): + # XXX: Should move out the core keys to config file or other place + conf = self.mock_config() + + self.assertTrue(conf.IsCoreBinding('copy')) + self.assertTrue(conf.IsCoreBinding('cut')) + self.assertTrue(conf.IsCoreBinding('del-word-right')) + self.assertFalse(conf.IsCoreBinding('not-exists')) + + def test_extra_help_source_list(self): + # Test GetExtraHelpSourceList and GetAllExtraHelpSourcesList in same + # place to prevent prepare input data twice. + conf = self.mock_config() + + # Test default with no extra help source + self.assertEqual(conf.GetExtraHelpSourceList('default'), []) + self.assertEqual(conf.GetExtraHelpSourceList('user'), []) + with self.assertRaises(config.InvalidConfigSet): + self.assertEqual(conf.GetExtraHelpSourceList('bad'), []) + self.assertCountEqual( + conf.GetAllExtraHelpSourcesList(), + conf.GetExtraHelpSourceList('default') + conf.GetExtraHelpSourceList('user')) + + # Add help source to user config + conf.userCfg['main'].SetOption('HelpFiles', '4', 'Python;https://python.org') # This is bad input + conf.userCfg['main'].SetOption('HelpFiles', '3', 'Python:https://python.org') # This is bad input + conf.userCfg['main'].SetOption('HelpFiles', '2', 'Pillow;https://pillow.readthedocs.io/en/latest/') + conf.userCfg['main'].SetOption('HelpFiles', '1', 'IDLE;C:/Programs/Python36/Lib/idlelib/help.html') + self.assertEqual(conf.GetExtraHelpSourceList('user'), + [('IDLE', 'C:/Programs/Python36/Lib/idlelib/help.html', '1'), + ('Pillow', 'https://pillow.readthedocs.io/en/latest/', '2'), + ('Python', 'https://python.org', '4')]) + self.assertCountEqual( + conf.GetAllExtraHelpSourcesList(), + conf.GetExtraHelpSourceList('default') + conf.GetExtraHelpSourceList('user')) + + def test_get_font(self): + from test.support import requires + from tkinter import Tk + from tkinter.font import Font + conf = self.mock_config() + + requires('gui') + root = Tk() + root.withdraw() + + f = Font.actual(Font(name='TkFixedFont', exists=True, root=root)) + self.assertEqual( + conf.GetFont(root, 'main', 'EditorWindow'), + (f['family'], 10 if f['size'] <= 0 else f['size'], f['weight'])) + + # Cleanup root + root.destroy() + del root + + def test_get_core_keys(self): + conf = self.mock_config() + + eq = self.assertEqual + eq(conf.GetCoreKeys()['<>'], ['']) + eq(conf.GetCoreKeys()['<>'], ['', '']) + eq(conf.GetCoreKeys()['<>'], ['']) + eq(conf.GetCoreKeys('IDLE Classic Windows')['<>'], + ['', '']) + eq(conf.GetCoreKeys('IDLE Classic OSX')['<>'], ['']) + eq(conf.GetCoreKeys('IDLE Classic Unix')['<>'], + ['', '']) + eq(conf.GetCoreKeys('IDLE Modern Unix')['<>'], + ['', '']) + + +class CurrentColorKeysTest(unittest.TestCase): + """ Test colorkeys function with user config [Theme] and [Keys] patterns. + + colorkeys = config.IdleConf.current_colors_and_keys + Test all patterns written by IDLE and some errors + Item 'default' should really be 'builtin' (versus 'custom). + """ + colorkeys = idleConf.current_colors_and_keys + default_theme = 'IDLE Classic' + default_keys = idleConf.default_keys() + + def test_old_builtin_theme(self): + # On initial installation, user main is blank. + self.assertEqual(self.colorkeys('Theme'), self.default_theme) + # For old default, name2 must be blank. + usermain.read_string(''' + [Theme] + default = True + ''') + # IDLE omits 'name' for default old builtin theme. + self.assertEqual(self.colorkeys('Theme'), self.default_theme) + # IDLE adds 'name' for non-default old builtin theme. + usermain['Theme']['name'] = 'IDLE New' + self.assertEqual(self.colorkeys('Theme'), 'IDLE New') + # Erroneous non-default old builtin reverts to default. + usermain['Theme']['name'] = 'non-existent' + self.assertEqual(self.colorkeys('Theme'), self.default_theme) + usermain.remove_section('Theme') + + def test_new_builtin_theme(self): + # IDLE writes name2 for new builtins. + usermain.read_string(''' + [Theme] + default = True + name2 = IDLE Dark + ''') + self.assertEqual(self.colorkeys('Theme'), 'IDLE Dark') + # Leftover 'name', not removed, is ignored. + usermain['Theme']['name'] = 'IDLE New' + self.assertEqual(self.colorkeys('Theme'), 'IDLE Dark') + # Erroneous non-default new builtin reverts to default. + usermain['Theme']['name2'] = 'non-existent' + self.assertEqual(self.colorkeys('Theme'), self.default_theme) + usermain.remove_section('Theme') + + def test_user_override_theme(self): + # Erroneous custom name (no definition) reverts to default. + usermain.read_string(''' + [Theme] + default = False + name = Custom Dark + ''') + self.assertEqual(self.colorkeys('Theme'), self.default_theme) + # Custom name is valid with matching Section name. + userhigh.read_string('[Custom Dark]\na=b') + self.assertEqual(self.colorkeys('Theme'), 'Custom Dark') + # Name2 is ignored. + usermain['Theme']['name2'] = 'non-existent' + self.assertEqual(self.colorkeys('Theme'), 'Custom Dark') + usermain.remove_section('Theme') + userhigh.remove_section('Custom Dark') + + def test_old_builtin_keys(self): + # On initial installation, user main is blank. + self.assertEqual(self.colorkeys('Keys'), self.default_keys) + # For old default, name2 must be blank, name is always used. + usermain.read_string(''' + [Keys] + default = True + name = IDLE Classic Unix + ''') + self.assertEqual(self.colorkeys('Keys'), 'IDLE Classic Unix') + # Erroneous non-default old builtin reverts to default. + usermain['Keys']['name'] = 'non-existent' + self.assertEqual(self.colorkeys('Keys'), self.default_keys) + usermain.remove_section('Keys') + + def test_new_builtin_keys(self): + # IDLE writes name2 for new builtins. + usermain.read_string(''' + [Keys] + default = True + name2 = IDLE Modern Unix + ''') + self.assertEqual(self.colorkeys('Keys'), 'IDLE Modern Unix') + # Leftover 'name', not removed, is ignored. + usermain['Keys']['name'] = 'IDLE Classic Unix' + self.assertEqual(self.colorkeys('Keys'), 'IDLE Modern Unix') + # Erroneous non-default new builtin reverts to default. + usermain['Keys']['name2'] = 'non-existent' + self.assertEqual(self.colorkeys('Keys'), self.default_keys) + usermain.remove_section('Keys') + + def test_user_override_keys(self): + # Erroneous custom name (no definition) reverts to default. + usermain.read_string(''' + [Keys] + default = False + name = Custom Keys + ''') + self.assertEqual(self.colorkeys('Keys'), self.default_keys) + # Custom name is valid with matching Section name. + userkeys.read_string('[Custom Keys]\na=b') + self.assertEqual(self.colorkeys('Keys'), 'Custom Keys') + # Name2 is ignored. + usermain['Keys']['name2'] = 'non-existent' + self.assertEqual(self.colorkeys('Keys'), 'Custom Keys') + usermain.remove_section('Keys') + userkeys.remove_section('Custom Keys') + + +class ChangesTest(unittest.TestCase): + + empty = {'main':{}, 'highlight':{}, 'keys':{}, 'extensions':{}} + + def load(self): # Test_add_option verifies that this works. + changes = self.changes + changes.add_option('main', 'Msec', 'mitem', 'mval') + changes.add_option('highlight', 'Hsec', 'hitem', 'hval') + changes.add_option('keys', 'Ksec', 'kitem', 'kval') + return changes + + loaded = {'main': {'Msec': {'mitem': 'mval'}}, + 'highlight': {'Hsec': {'hitem': 'hval'}}, + 'keys': {'Ksec': {'kitem':'kval'}}, + 'extensions': {}} + + def setUp(self): + self.changes = config.ConfigChanges() + + def test_init(self): + self.assertEqual(self.changes, self.empty) + + def test_add_option(self): + changes = self.load() + self.assertEqual(changes, self.loaded) + changes.add_option('main', 'Msec', 'mitem', 'mval') + self.assertEqual(changes, self.loaded) + + def test_save_option(self): # Static function does not touch changes. + save_option = self.changes.save_option + self.assertTrue(save_option('main', 'Indent', 'what', '0')) + self.assertFalse(save_option('main', 'Indent', 'what', '0')) + self.assertEqual(usermain['Indent']['what'], '0') + + self.assertTrue(save_option('main', 'Indent', 'use-spaces', '0')) + self.assertEqual(usermain['Indent']['use-spaces'], '0') + self.assertTrue(save_option('main', 'Indent', 'use-spaces', '1')) + self.assertFalse(usermain.has_option('Indent', 'use-spaces')) + usermain.remove_section('Indent') + + def test_save_added(self): + changes = self.load() + self.assertTrue(changes.save_all()) + self.assertEqual(usermain['Msec']['mitem'], 'mval') + self.assertEqual(userhigh['Hsec']['hitem'], 'hval') + self.assertEqual(userkeys['Ksec']['kitem'], 'kval') + changes.add_option('main', 'Msec', 'mitem', 'mval') + self.assertFalse(changes.save_all()) + usermain.remove_section('Msec') + userhigh.remove_section('Hsec') + userkeys.remove_section('Ksec') + + def test_save_help(self): + # Any change to HelpFiles overwrites entire section. + changes = self.changes + changes.save_option('main', 'HelpFiles', 'IDLE', 'idledoc') + changes.add_option('main', 'HelpFiles', 'ELDI', 'codeldi') + changes.save_all() + self.assertFalse(usermain.has_option('HelpFiles', 'IDLE')) + self.assertTrue(usermain.has_option('HelpFiles', 'ELDI')) + + def test_save_default(self): # Cover 2nd and 3rd false branches. + changes = self.changes + changes.add_option('main', 'Indent', 'use-spaces', '1') + # save_option returns False; cfg_type_changed remains False. + + # TODO: test that save_all calls usercfg Saves. + + def test_delete_section(self): + changes = self.load() + changes.delete_section('main', 'fake') # Test no exception. + self.assertEqual(changes, self.loaded) # Test nothing deleted. + for cfgtype, section in (('main', 'Msec'), ('keys', 'Ksec')): + testcfg[cfgtype].SetOption(section, 'name', 'value') + changes.delete_section(cfgtype, section) + with self.assertRaises(KeyError): + changes[cfgtype][section] # Test section gone from changes + testcfg[cfgtype][section] # and from mock userCfg. + # TODO test for save call. + + def test_clear(self): + changes = self.load() + changes.clear() + self.assertEqual(changes, self.empty) + + +class WarningTest(unittest.TestCase): + + def test_warn(self): + Equal = self.assertEqual + config._warned = set() + with captured_stderr() as stderr: + config._warn('warning', 'key') + Equal(config._warned, {('warning','key')}) + Equal(stderr.getvalue(), 'warning'+'\n') + with captured_stderr() as stderr: + config._warn('warning', 'key') + Equal(stderr.getvalue(), '') + with captured_stderr() as stderr: + config._warn('warn2', 'yek') + Equal(config._warned, {('warning','key'), ('warn2','yek')}) + Equal(stderr.getvalue(), 'warn2'+'\n') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_config_key.py b/micromamba_root/Lib/idlelib/idle_test/test_config_key.py new file mode 100644 index 0000000000000000000000000000000000000000..32f878b842b276dc892c0606503d4fb8abde2180 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_config_key.py @@ -0,0 +1,356 @@ +"""Test config_key, coverage 98%. + +Coverage is effectively 100%. Tkinter dialog is mocked, Mac-only line +may be skipped, and dummy function in bind test should not be called. +Not tested: exit with 'self.advanced or self.keys_ok(keys) ...' False. +""" + +from idlelib import config_key +from test.support import requires +import unittest +from unittest import mock +from tkinter import Tk, TclError +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox_func + + +class ValidationTest(unittest.TestCase): + "Test validation methods: ok, keys_ok, bind_ok." + + class Validator(config_key.GetKeysFrame): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + class list_keys_final: + get = Func() + self.list_keys_final = list_keys_final + get_modifiers = Func() + showerror = Mbox_func() + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + keylist = [[''], ['', '']] + cls.dialog = cls.Validator(cls.root, '<>', keylist) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.dialog.showerror.message = '' + # A test that needs a particular final key value should set it. + # A test that sets a non-blank modifier list should reset it to []. + + def test_ok_empty(self): + self.dialog.key_string.set(' ') + self.dialog.ok() + self.assertEqual(self.dialog.result, '') + self.assertEqual(self.dialog.showerror.message, 'No key specified.') + + def test_ok_good(self): + self.dialog.key_string.set('') + self.dialog.list_keys_final.get.result = 'F11' + self.dialog.ok() + self.assertEqual(self.dialog.result, '') + self.assertEqual(self.dialog.showerror.message, '') + + def test_keys_no_ending(self): + self.assertFalse(self.dialog.keys_ok('')) + self.assertIn('No modifier', self.dialog.showerror.message) + + def test_keys_no_modifier_ok(self): + self.dialog.list_keys_final.get.result = 'F11' + self.assertTrue(self.dialog.keys_ok('')) + self.assertEqual(self.dialog.showerror.message, '') + + def test_keys_shift_bad(self): + self.dialog.list_keys_final.get.result = 'a' + self.dialog.get_modifiers.result = ['Shift'] + self.assertFalse(self.dialog.keys_ok('')) + self.assertIn('shift modifier', self.dialog.showerror.message) + self.dialog.get_modifiers.result = [] + + def test_keys_dup(self): + for mods, final, seq in (([], 'F12', ''), + (['Control'], 'x', ''), + (['Control'], 'X', '')): + with self.subTest(m=mods, f=final, s=seq): + self.dialog.list_keys_final.get.result = final + self.dialog.get_modifiers.result = mods + self.assertFalse(self.dialog.keys_ok(seq)) + self.assertIn('already in use', self.dialog.showerror.message) + self.dialog.get_modifiers.result = [] + + def test_bind_ok(self): + self.assertTrue(self.dialog.bind_ok('')) + self.assertEqual(self.dialog.showerror.message, '') + + def test_bind_not_ok(self): + self.assertFalse(self.dialog.bind_ok('')) + self.assertIn('not accepted', self.dialog.showerror.message) + + +class ToggleLevelTest(unittest.TestCase): + "Test toggle between Basic and Advanced frames." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysFrame(cls.root, '<>', []) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_toggle_level(self): + dialog = self.dialog + + def stackorder(): + """Get the stack order of the children of the frame. + + winfo_children() stores the children in stack order, so + this can be used to check whether a frame is above or + below another one. + """ + for index, child in enumerate(dialog.winfo_children()): + if child._name == 'keyseq_basic': + basic = index + if child._name == 'keyseq_advanced': + advanced = index + return basic, advanced + + # New window starts at basic level. + self.assertFalse(dialog.advanced) + self.assertIn('Advanced', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(basic, advanced) + + # Toggle to advanced. + dialog.toggle_level() + self.assertTrue(dialog.advanced) + self.assertIn('Basic', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(advanced, basic) + + # Toggle to basic. + dialog.button_level.invoke() + self.assertFalse(dialog.advanced) + self.assertIn('Advanced', dialog.button_level['text']) + basic, advanced = stackorder() + self.assertGreater(basic, advanced) + + +class KeySelectionTest(unittest.TestCase): + "Test selecting key on Basic frames." + + class Basic(config_key.GetKeysFrame): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + class list_keys_final: + get = Func() + select_clear = Func() + yview = Func() + self.list_keys_final = list_keys_final + def set_modifiers_for_platform(self): + self.modifiers = ['foo', 'bar', 'BAZ'] + self.modifier_label = {'BAZ': 'ZZZ'} + showerror = Mbox_func() + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = cls.Basic(cls.root, '<>', []) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.dialog.clear_key_seq() + + def test_get_modifiers(self): + dialog = self.dialog + gm = dialog.get_modifiers + eq = self.assertEqual + + # Modifiers are set on/off by invoking the checkbutton. + dialog.modifier_checkbuttons['foo'].invoke() + eq(gm(), ['foo']) + + dialog.modifier_checkbuttons['BAZ'].invoke() + eq(gm(), ['foo', 'BAZ']) + + dialog.modifier_checkbuttons['foo'].invoke() + eq(gm(), ['BAZ']) + + @mock.patch.object(config_key.GetKeysFrame, 'get_modifiers') + def test_build_key_string(self, mock_modifiers): + dialog = self.dialog + key = dialog.list_keys_final + string = dialog.key_string.get + eq = self.assertEqual + + key.get.result = 'a' + mock_modifiers.return_value = [] + dialog.build_key_string() + eq(string(), '') + + mock_modifiers.return_value = ['mymod'] + dialog.build_key_string() + eq(string(), '') + + key.get.result = '' + mock_modifiers.return_value = ['mymod', 'test'] + dialog.build_key_string() + eq(string(), '') + + @mock.patch.object(config_key.GetKeysFrame, 'get_modifiers') + def test_final_key_selected(self, mock_modifiers): + dialog = self.dialog + key = dialog.list_keys_final + string = dialog.key_string.get + eq = self.assertEqual + + mock_modifiers.return_value = ['Shift'] + key.get.result = '{' + dialog.final_key_selected() + eq(string(), '') + + +class CancelWindowTest(unittest.TestCase): + "Simulate user clicking [Cancel] button." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + @mock.patch.object(config_key.GetKeysFrame, 'ok') + def test_cancel(self, mock_frame_ok): + self.assertEqual(self.dialog.winfo_class(), 'Toplevel') + self.dialog.button_cancel.invoke() + with self.assertRaises(TclError): + self.dialog.winfo_class() + self.assertEqual(self.dialog.result, '') + mock_frame_ok.assert_not_called() + + +class OKWindowTest(unittest.TestCase): + "Simulate user clicking [OK] button." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + @mock.patch.object(config_key.GetKeysFrame, 'ok') + def test_ok(self, mock_frame_ok): + self.assertEqual(self.dialog.winfo_class(), 'Toplevel') + self.dialog.button_ok.invoke() + with self.assertRaises(TclError): + self.dialog.winfo_class() + mock_frame_ok.assert_called() + + +class WindowResultTest(unittest.TestCase): + "Test window result get and set." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = config_key.GetKeysWindow( + cls.root, 'Title', '<>', [], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.dialog.cancel() + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_result(self): + dialog = self.dialog + eq = self.assertEqual + + dialog.result = '' + eq(dialog.result, '') + eq(dialog.frame.result,'') + + dialog.result = 'bar' + eq(dialog.result,'bar') + eq(dialog.frame.result,'bar') + + dialog.frame.result = 'foo' + eq(dialog.result, 'foo') + eq(dialog.frame.result,'foo') + + +class HelperTest(unittest.TestCase): + "Test module level helper functions." + + def test_translate_key(self): + tr = config_key.translate_key + eq = self.assertEqual + + # Letters return unchanged with no 'Shift'. + eq(tr('q', []), 'Key-q') + eq(tr('q', ['Control', 'Alt']), 'Key-q') + + # 'Shift' uppercases single lowercase letters. + eq(tr('q', ['Shift']), 'Key-Q') + eq(tr('q', ['Control', 'Shift']), 'Key-Q') + eq(tr('q', ['Control', 'Alt', 'Shift']), 'Key-Q') + + # Convert key name to keysym. + eq(tr('Page Up', []), 'Key-Prior') + # 'Shift' doesn't change case when it's not a single char. + eq(tr('*', ['Shift']), 'Key-asterisk') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_configdialog.py b/micromamba_root/Lib/idlelib/idle_test/test_configdialog.py new file mode 100644 index 0000000000000000000000000000000000000000..2773ed7ce614b55097c2d3811b902c145074da24 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_configdialog.py @@ -0,0 +1,1580 @@ +"""Test configdialog, coverage 94%. + +Half the class creates dialog, half works with user customizations. +""" +from idlelib import configdialog +from test.support import requires +requires('gui') +import unittest +from unittest import mock +from idlelib.idle_test.mock_idle import Func +from tkinter import (Tk, StringVar, IntVar, BooleanVar, DISABLED, NORMAL) +from idlelib import config +from idlelib.configdialog import idleConf, changes, tracers + +# Tests should not depend on fortuitous user configurations. +# They must not affect actual user .cfg files. +# Use solution from test_config: empty parsers with no filename. +usercfg = idleConf.userCfg +testcfg = { + 'main': config.IdleUserConfParser(''), + 'highlight': config.IdleUserConfParser(''), + 'keys': config.IdleUserConfParser(''), + 'extensions': config.IdleUserConfParser(''), +} + +root = None +dialog = None +mainpage = changes['main'] +highpage = changes['highlight'] +keyspage = changes['keys'] +extpage = changes['extensions'] + + +def setUpModule(): + global root, dialog + idleConf.userCfg = testcfg + root = Tk() + # root.withdraw() # Comment out, see issue 30870 + dialog = configdialog.ConfigDialog(root, 'Test', _utest=True) + + +def tearDownModule(): + global root, dialog + idleConf.userCfg = usercfg + tracers.detach() + tracers.clear() + changes.clear() + root.update_idletasks() + root.destroy() + root = dialog = None + + +class ConfigDialogTest(unittest.TestCase): + + def test_deactivate_current_config(self): + pass + + def activate_config_changes(self): + pass + + +class ButtonTest(unittest.TestCase): + + def test_click_ok(self): + d = dialog + apply = d.apply = mock.Mock() + destroy = d.destroy = mock.Mock() + d.buttons['Ok'].invoke() + apply.assert_called_once() + destroy.assert_called_once() + del d.destroy, d.apply + + def test_click_apply(self): + d = dialog + deactivate = d.deactivate_current_config = mock.Mock() + save_ext = d.extpage.save_all_changed_extensions = mock.Mock() + activate = d.activate_config_changes = mock.Mock() + d.buttons['Apply'].invoke() + deactivate.assert_called_once() + save_ext.assert_called_once() + activate.assert_called_once() + del d.extpage.save_all_changed_extensions + del d.activate_config_changes, d.deactivate_current_config + + def test_click_cancel(self): + d = dialog + d.destroy = Func() + changes['main']['something'] = 1 + d.buttons['Cancel'].invoke() + self.assertEqual(changes['main'], {}) + self.assertEqual(d.destroy.called, 1) + del d.destroy + + def test_click_help(self): + dialog.note.select(dialog.keyspage) + with mock.patch.object(configdialog, 'view_text', + new_callable=Func) as view: + dialog.buttons['Help'].invoke() + title, contents = view.kwds['title'], view.kwds['contents'] + self.assertEqual(title, 'Help for IDLE preferences') + self.assertStartsWith(contents, 'When you click') + self.assertEndsWith(contents,'a different name.\n') + + +class FontPageTest(unittest.TestCase): + """Test that font widgets enable users to make font changes. + + Test that widget actions set vars, that var changes add three + options to changes and call set_samples, and that set_samples + changes the font of both sample boxes. + """ + @classmethod + def setUpClass(cls): + page = cls.page = dialog.fontpage + dialog.note.select(page) + page.set_samples = Func() # Mask instance method. + page.update() + + @classmethod + def tearDownClass(cls): + del cls.page.set_samples # Unmask instance method. + + def setUp(self): + changes.clear() + + def test_load_font_cfg(self): + # Leave widget load test to human visual check. + # TODO Improve checks when add IdleConf.get_font_values. + tracers.detach() + d = self.page + d.font_name.set('Fake') + d.font_size.set('1') + d.font_bold.set(True) + d.set_samples.called = 0 + d.load_font_cfg() + self.assertNotEqual(d.font_name.get(), 'Fake') + self.assertNotEqual(d.font_size.get(), '1') + self.assertFalse(d.font_bold.get()) + self.assertEqual(d.set_samples.called, 1) + tracers.attach() + + def test_fontlist_key(self): + # Up and Down keys should select a new font. + d = self.page + if d.fontlist.size() < 2: + self.skipTest('need at least 2 fonts') + fontlist = d.fontlist + fontlist.activate(0) + font = d.fontlist.get('active') + + # Test Down key. + fontlist.focus_force() + fontlist.update() + fontlist.event_generate('') + fontlist.event_generate('') + + down_font = fontlist.get('active') + self.assertNotEqual(down_font, font) + self.assertIn(d.font_name.get(), down_font.lower()) + + # Test Up key. + fontlist.focus_force() + fontlist.update() + fontlist.event_generate('') + fontlist.event_generate('') + + up_font = fontlist.get('active') + self.assertEqual(up_font, font) + self.assertIn(d.font_name.get(), up_font.lower()) + + def test_fontlist_mouse(self): + # Click on item should select that item. + d = self.page + if d.fontlist.size() < 2: + self.skipTest('need at least 2 fonts') + fontlist = d.fontlist + fontlist.activate(0) + + # Select next item in listbox + fontlist.focus_force() + fontlist.see(1) + fontlist.update() + x, y, dx, dy = fontlist.bbox(1) + x += dx // 2 + y += dy // 2 + fontlist.event_generate('', x=x, y=y) + fontlist.event_generate('', x=x, y=y) + + font1 = fontlist.get(1) + select_font = fontlist.get('anchor') + self.assertEqual(select_font, font1) + self.assertIn(d.font_name.get(), font1.lower()) + + def test_sizelist(self): + # Click on number should select that number + d = self.page + d.sizelist.variable.set(40) + self.assertEqual(d.font_size.get(), '40') + + def test_bold_toggle(self): + # Click on checkbutton should invert it. + d = self.page + d.font_bold.set(False) + d.bold_toggle.invoke() + self.assertTrue(d.font_bold.get()) + d.bold_toggle.invoke() + self.assertFalse(d.font_bold.get()) + + def test_font_set(self): + # Test that setting a font Variable results in 3 provisional + # change entries and a call to set_samples. Use values sure to + # not be defaults. + + default_font = idleConf.GetFont(root, 'main', 'EditorWindow') + default_size = str(default_font[1]) + default_bold = default_font[2] == 'bold' + d = self.page + d.font_size.set(default_size) + d.font_bold.set(default_bold) + d.set_samples.called = 0 + + d.font_name.set('Test Font') + expected = {'EditorWindow': {'font': 'Test Font', + 'font-size': default_size, + 'font-bold': str(default_bold)}} + self.assertEqual(mainpage, expected) + self.assertEqual(d.set_samples.called, 1) + changes.clear() + + d.font_size.set('20') + expected = {'EditorWindow': {'font': 'Test Font', + 'font-size': '20', + 'font-bold': str(default_bold)}} + self.assertEqual(mainpage, expected) + self.assertEqual(d.set_samples.called, 2) + changes.clear() + + d.font_bold.set(not default_bold) + expected = {'EditorWindow': {'font': 'Test Font', + 'font-size': '20', + 'font-bold': str(not default_bold)}} + self.assertEqual(mainpage, expected) + self.assertEqual(d.set_samples.called, 3) + + def test_set_samples(self): + d = self.page + del d.set_samples # Unmask method for test + orig_samples = d.font_sample, d.highlight_sample + d.font_sample, d.highlight_sample = {}, {} + d.font_name.set('test') + d.font_size.set('5') + d.font_bold.set(1) + expected = {'font': ('test', '5', 'bold')} + + # Test set_samples. + d.set_samples() + self.assertTrue(d.font_sample == d.highlight_sample == expected) + + d.font_sample, d.highlight_sample = orig_samples + d.set_samples = Func() # Re-mask for other tests. + + +class HighPageTest(unittest.TestCase): + """Test that highlight tab widgets enable users to make changes. + + Test that widget actions set vars, that var changes add + options to changes and that themes work correctly. + """ + + @classmethod + def setUpClass(cls): + page = cls.page = dialog.highpage + dialog.note.select(page) + page.set_theme_type = Func() + page.paint_theme_sample = Func() + page.set_highlight_target = Func() + page.set_color_sample = Func() + page.update() + + @classmethod + def tearDownClass(cls): + d = cls.page + del d.set_theme_type, d.paint_theme_sample + del d.set_highlight_target, d.set_color_sample + + def setUp(self): + d = self.page + # The following is needed for test_load_key_cfg, _delete_custom_keys. + # This may indicate a defect in some test or function. + for section in idleConf.GetSectionList('user', 'highlight'): + idleConf.userCfg['highlight'].remove_section(section) + changes.clear() + d.set_theme_type.called = 0 + d.paint_theme_sample.called = 0 + d.set_highlight_target.called = 0 + d.set_color_sample.called = 0 + + def test_load_theme_cfg(self): + tracers.detach() + d = self.page + eq = self.assertEqual + + # Use builtin theme with no user themes created. + idleConf.CurrentTheme = mock.Mock(return_value='IDLE Classic') + d.load_theme_cfg() + self.assertTrue(d.theme_source.get()) + # builtinlist sets variable builtin_name to the CurrentTheme default. + eq(d.builtin_name.get(), 'IDLE Classic') + eq(d.custom_name.get(), '- no custom themes -') + eq(d.custom_theme_on.state(), ('disabled',)) + eq(d.set_theme_type.called, 1) + eq(d.paint_theme_sample.called, 1) + eq(d.set_highlight_target.called, 1) + + # Builtin theme with non-empty user theme list. + idleConf.SetOption('highlight', 'test1', 'option', 'value') + idleConf.SetOption('highlight', 'test2', 'option2', 'value2') + d.load_theme_cfg() + eq(d.builtin_name.get(), 'IDLE Classic') + eq(d.custom_name.get(), 'test1') + eq(d.set_theme_type.called, 2) + eq(d.paint_theme_sample.called, 2) + eq(d.set_highlight_target.called, 2) + + # Use custom theme. + idleConf.CurrentTheme = mock.Mock(return_value='test2') + idleConf.SetOption('main', 'Theme', 'default', '0') + d.load_theme_cfg() + self.assertFalse(d.theme_source.get()) + eq(d.builtin_name.get(), 'IDLE Classic') + eq(d.custom_name.get(), 'test2') + eq(d.set_theme_type.called, 3) + eq(d.paint_theme_sample.called, 3) + eq(d.set_highlight_target.called, 3) + + del idleConf.CurrentTheme + tracers.attach() + + def test_theme_source(self): + eq = self.assertEqual + d = self.page + # Test these separately. + d.var_changed_builtin_name = Func() + d.var_changed_custom_name = Func() + # Builtin selected. + d.builtin_theme_on.invoke() + eq(mainpage, {'Theme': {'default': 'True'}}) + eq(d.var_changed_builtin_name.called, 1) + eq(d.var_changed_custom_name.called, 0) + changes.clear() + + # Custom selected. + d.custom_theme_on.state(('!disabled',)) + d.custom_theme_on.invoke() + self.assertEqual(mainpage, {'Theme': {'default': 'False'}}) + eq(d.var_changed_builtin_name.called, 1) + eq(d.var_changed_custom_name.called, 1) + del d.var_changed_builtin_name, d.var_changed_custom_name + + def test_builtin_name(self): + eq = self.assertEqual + d = self.page + item_list = ['IDLE Classic', 'IDLE Dark', 'IDLE New'] + + # Not in old_themes, defaults name to first item. + idleConf.SetOption('main', 'Theme', 'name', 'spam') + d.builtinlist.SetMenu(item_list, 'IDLE Dark') + eq(mainpage, {'Theme': {'name': 'IDLE Classic', + 'name2': 'IDLE Dark'}}) + eq(d.theme_message['text'], 'New theme, see Help') + eq(d.paint_theme_sample.called, 1) + + # Not in old themes - uses name2. + changes.clear() + idleConf.SetOption('main', 'Theme', 'name', 'IDLE New') + d.builtinlist.SetMenu(item_list, 'IDLE Dark') + eq(mainpage, {'Theme': {'name2': 'IDLE Dark'}}) + eq(d.theme_message['text'], 'New theme, see Help') + eq(d.paint_theme_sample.called, 2) + + # Builtin name in old_themes. + changes.clear() + d.builtinlist.SetMenu(item_list, 'IDLE Classic') + eq(mainpage, {'Theme': {'name': 'IDLE Classic', 'name2': ''}}) + eq(d.theme_message['text'], '') + eq(d.paint_theme_sample.called, 3) + + def test_custom_name(self): + d = self.page + + # If no selections, doesn't get added. + d.customlist.SetMenu([], '- no custom themes -') + self.assertNotIn('Theme', mainpage) + self.assertEqual(d.paint_theme_sample.called, 0) + + # Custom name selected. + changes.clear() + d.customlist.SetMenu(['a', 'b', 'c'], 'c') + self.assertEqual(mainpage, {'Theme': {'name': 'c'}}) + self.assertEqual(d.paint_theme_sample.called, 1) + + def test_color(self): + d = self.page + d.on_new_color_set = Func() + # self.color is only set in get_color through colorchooser. + d.color.set('green') + self.assertEqual(d.on_new_color_set.called, 1) + del d.on_new_color_set + + def test_highlight_target_list_mouse(self): + # Set highlight_target through targetlist. + eq = self.assertEqual + d = self.page + + d.targetlist.SetMenu(['a', 'b', 'c'], 'c') + eq(d.highlight_target.get(), 'c') + eq(d.set_highlight_target.called, 1) + + def test_highlight_target_text_mouse(self): + # Set highlight_target through clicking highlight_sample. + eq = self.assertEqual + d = self.page + hs = d.highlight_sample + hs.focus_force() + + def click_char(index): + "Simulate click on character at *index*." + hs.see(index) + hs.update_idletasks() + x, y, dx, dy = hs.bbox(index) + x += dx // 2 + y += dy // 2 + hs.event_generate('', x=0, y=0) + hs.event_generate('', x=x, y=y) + hs.event_generate('', x=x, y=y) + hs.event_generate('', x=x, y=y) + + # Reverse theme_elements to make the tag the key. + elem = {tag: element for element, tag in d.theme_elements.items()} + + # If highlight_sample has a tag that isn't in theme_elements, there + # will be a KeyError in the test run. + count = 0 + for tag in hs.tag_names(): + try: + click_char(hs.tag_nextrange(tag, "1.0")[0]) + eq(d.highlight_target.get(), elem[tag]) + count += 1 + eq(d.set_highlight_target.called, count) + except IndexError: + pass # Skip unused theme_elements tag, like 'sel'. + + def test_highlight_sample_double_click(self): + # Test double click on highlight_sample. + eq = self.assertEqual + d = self.page + + hs = d.highlight_sample + hs.focus_force() + hs.see(1.0) + hs.update_idletasks() + + # Test binding from configdialog. + hs.event_generate('', x=0, y=0) + hs.event_generate('', x=0, y=0) + # Double click is a sequence of two clicks in a row. + for _ in range(2): + hs.event_generate('', x=0, y=0) + hs.event_generate('', x=0, y=0) + + eq(hs.tag_ranges('sel'), ()) + + def test_highlight_sample_b1_motion(self): + # Test button motion on highlight_sample. + eq = self.assertEqual + d = self.page + + hs = d.highlight_sample + hs.focus_force() + hs.see(1.0) + hs.update_idletasks() + + x, y, dx, dy, offset = hs.dlineinfo('1.0') + + # Test binding from configdialog. + hs.event_generate('') + hs.event_generate('') + hs.event_generate('', x=x, y=y) + hs.event_generate('', x=x, y=y) + hs.event_generate('', x=dx, y=dy) + hs.event_generate('', x=dx, y=dy) + + eq(hs.tag_ranges('sel'), ()) + + def test_set_theme_type(self): + eq = self.assertEqual + d = self.page + del d.set_theme_type + + # Builtin theme selected. + d.theme_source.set(True) + d.set_theme_type() + eq(d.builtinlist['state'], NORMAL) + eq(d.customlist['state'], DISABLED) + eq(d.button_delete_custom.state(), ('disabled',)) + + # Custom theme selected. + d.theme_source.set(False) + d.set_theme_type() + eq(d.builtinlist['state'], DISABLED) + eq(d.custom_theme_on.state(), ('selected',)) + eq(d.customlist['state'], NORMAL) + eq(d.button_delete_custom.state(), ()) + d.set_theme_type = Func() + + def test_get_color(self): + eq = self.assertEqual + d = self.page + orig_chooser = configdialog.colorchooser.askcolor + chooser = configdialog.colorchooser.askcolor = Func() + gntn = d.get_new_theme_name = Func() + + d.highlight_target.set('Editor Breakpoint') + d.color.set('#ffffff') + + # Nothing selected. + chooser.result = (None, None) + d.button_set_color.invoke() + eq(d.color.get(), '#ffffff') + + # Selection same as previous color. + chooser.result = ('', d.style.lookup(d.frame_color_set['style'], 'background')) + d.button_set_color.invoke() + eq(d.color.get(), '#ffffff') + + # Select different color. + chooser.result = ((222.8671875, 0.0, 0.0), '#de0000') + + # Default theme. + d.color.set('#ffffff') + d.theme_source.set(True) + + # No theme name selected therefore color not saved. + gntn.result = '' + d.button_set_color.invoke() + eq(gntn.called, 1) + eq(d.color.get(), '#ffffff') + # Theme name selected. + gntn.result = 'My New Theme' + d.button_set_color.invoke() + eq(d.custom_name.get(), gntn.result) + eq(d.color.get(), '#de0000') + + # Custom theme. + d.color.set('#ffffff') + d.theme_source.set(False) + d.button_set_color.invoke() + eq(d.color.get(), '#de0000') + + del d.get_new_theme_name + configdialog.colorchooser.askcolor = orig_chooser + + def test_on_new_color_set(self): + d = self.page + color = '#3f7cae' + d.custom_name.set('Python') + d.highlight_target.set('Selected Text') + d.fg_bg_toggle.set(True) + + d.color.set(color) + self.assertEqual(d.style.lookup(d.frame_color_set['style'], 'background'), color) + self.assertEqual(d.highlight_sample.tag_cget('hilite', 'foreground'), color) + self.assertEqual(highpage, + {'Python': {'hilite-foreground': color}}) + + def test_get_new_theme_name(self): + orig_sectionname = configdialog.SectionName + sn = configdialog.SectionName = Func(return_self=True) + d = self.page + + sn.result = 'New Theme' + self.assertEqual(d.get_new_theme_name(''), 'New Theme') + + configdialog.SectionName = orig_sectionname + + def test_save_as_new_theme(self): + d = self.page + gntn = d.get_new_theme_name = Func() + d.theme_source.set(True) + + # No name entered. + gntn.result = '' + d.button_save_custom.invoke() + self.assertNotIn(gntn.result, idleConf.userCfg['highlight']) + + # Name entered. + gntn.result = 'my new theme' + gntn.called = 0 + self.assertNotIn(gntn.result, idleConf.userCfg['highlight']) + d.button_save_custom.invoke() + self.assertIn(gntn.result, idleConf.userCfg['highlight']) + + del d.get_new_theme_name + + def test_create_new_and_save_new(self): + eq = self.assertEqual + d = self.page + + # Use default as previously active theme. + d.theme_source.set(True) + d.builtin_name.set('IDLE Classic') + first_new = 'my new custom theme' + second_new = 'my second custom theme' + + # No changes, so themes are an exact copy. + self.assertNotIn(first_new, idleConf.userCfg) + d.create_new(first_new) + eq(idleConf.GetSectionList('user', 'highlight'), [first_new]) + eq(idleConf.GetThemeDict('default', 'IDLE Classic'), + idleConf.GetThemeDict('user', first_new)) + eq(d.custom_name.get(), first_new) + self.assertFalse(d.theme_source.get()) # Use custom set. + eq(d.set_theme_type.called, 1) + + # Test that changed targets are in new theme. + changes.add_option('highlight', first_new, 'hit-background', 'yellow') + self.assertNotIn(second_new, idleConf.userCfg) + d.create_new(second_new) + eq(idleConf.GetSectionList('user', 'highlight'), [first_new, second_new]) + self.assertNotEqual(idleConf.GetThemeDict('user', first_new), + idleConf.GetThemeDict('user', second_new)) + # Check that difference in themes was in `hit-background` from `changes`. + idleConf.SetOption('highlight', first_new, 'hit-background', 'yellow') + eq(idleConf.GetThemeDict('user', first_new), + idleConf.GetThemeDict('user', second_new)) + + def test_set_highlight_target(self): + eq = self.assertEqual + d = self.page + del d.set_highlight_target + + # Target is cursor. + d.highlight_target.set('Cursor') + eq(d.fg_on.state(), ('disabled', 'selected')) + eq(d.bg_on.state(), ('disabled',)) + self.assertTrue(d.fg_bg_toggle) + eq(d.set_color_sample.called, 1) + + # Target is not cursor. + d.highlight_target.set('Comment') + eq(d.fg_on.state(), ('selected',)) + eq(d.bg_on.state(), ()) + self.assertTrue(d.fg_bg_toggle) + eq(d.set_color_sample.called, 2) + + d.set_highlight_target = Func() + + def test_set_color_sample_binding(self): + d = self.page + scs = d.set_color_sample + + d.fg_on.invoke() + self.assertEqual(scs.called, 1) + + d.bg_on.invoke() + self.assertEqual(scs.called, 2) + + def test_set_color_sample(self): + d = self.page + del d.set_color_sample + d.highlight_target.set('Selected Text') + d.fg_bg_toggle.set(True) + d.set_color_sample() + self.assertEqual( + d.style.lookup(d.frame_color_set['style'], 'background'), + d.highlight_sample.tag_cget('hilite', 'foreground')) + d.set_color_sample = Func() + + def test_paint_theme_sample(self): + eq = self.assertEqual + page = self.page + del page.paint_theme_sample # Delete masking mock. + hs_tag = page.highlight_sample.tag_cget + gh = idleConf.GetHighlight + + # Create custom theme based on IDLE Dark. + page.theme_source.set(True) + page.builtin_name.set('IDLE Dark') + theme = 'IDLE Test' + page.create_new(theme) + page.set_color_sample.called = 0 + + # Base theme with nothing in `changes`. + page.paint_theme_sample() + new_console = {'foreground': 'blue', + 'background': 'yellow',} + for key, value in new_console.items(): + self.assertNotEqual(hs_tag('console', key), value) + eq(page.set_color_sample.called, 1) + + # Apply changes. + for key, value in new_console.items(): + changes.add_option('highlight', theme, 'console-'+key, value) + page.paint_theme_sample() + for key, value in new_console.items(): + eq(hs_tag('console', key), value) + eq(page.set_color_sample.called, 2) + + page.paint_theme_sample = Func() + + def test_delete_custom(self): + eq = self.assertEqual + d = self.page + d.button_delete_custom.state(('!disabled',)) + yesno = d.askyesno = Func() + dialog.deactivate_current_config = Func() + dialog.activate_config_changes = Func() + + theme_name = 'spam theme' + idleConf.userCfg['highlight'].SetOption(theme_name, 'name', 'value') + highpage[theme_name] = {'option': 'True'} + + theme_name2 = 'other theme' + idleConf.userCfg['highlight'].SetOption(theme_name2, 'name', 'value') + highpage[theme_name2] = {'option': 'False'} + + # Force custom theme. + d.custom_theme_on.state(('!disabled',)) + d.custom_theme_on.invoke() + d.custom_name.set(theme_name) + + # Cancel deletion. + yesno.result = False + d.button_delete_custom.invoke() + eq(yesno.called, 1) + eq(highpage[theme_name], {'option': 'True'}) + eq(idleConf.GetSectionList('user', 'highlight'), [theme_name, theme_name2]) + eq(dialog.deactivate_current_config.called, 0) + eq(dialog.activate_config_changes.called, 0) + eq(d.set_theme_type.called, 0) + + # Confirm deletion. + yesno.result = True + d.button_delete_custom.invoke() + eq(yesno.called, 2) + self.assertNotIn(theme_name, highpage) + eq(idleConf.GetSectionList('user', 'highlight'), [theme_name2]) + eq(d.custom_theme_on.state(), ()) + eq(d.custom_name.get(), theme_name2) + eq(dialog.deactivate_current_config.called, 1) + eq(dialog.activate_config_changes.called, 1) + eq(d.set_theme_type.called, 1) + + # Confirm deletion of second theme - empties list. + d.custom_name.set(theme_name2) + yesno.result = True + d.button_delete_custom.invoke() + eq(yesno.called, 3) + self.assertNotIn(theme_name, highpage) + eq(idleConf.GetSectionList('user', 'highlight'), []) + eq(d.custom_theme_on.state(), ('disabled',)) + eq(d.custom_name.get(), '- no custom themes -') + eq(dialog.deactivate_current_config.called, 2) + eq(dialog.activate_config_changes.called, 2) + eq(d.set_theme_type.called, 2) + + del dialog.activate_config_changes, dialog.deactivate_current_config + del d.askyesno + + +class KeysPageTest(unittest.TestCase): + """Test that keys tab widgets enable users to make changes. + + Test that widget actions set vars, that var changes add + options to changes and that key sets works correctly. + """ + + @classmethod + def setUpClass(cls): + page = cls.page = dialog.keyspage + dialog.note.select(page) + page.set_keys_type = Func() + page.load_keys_list = Func() + + @classmethod + def tearDownClass(cls): + page = cls.page + del page.set_keys_type, page.load_keys_list + + def setUp(self): + d = self.page + # The following is needed for test_load_key_cfg, _delete_custom_keys. + # This may indicate a defect in some test or function. + for section in idleConf.GetSectionList('user', 'keys'): + idleConf.userCfg['keys'].remove_section(section) + changes.clear() + d.set_keys_type.called = 0 + d.load_keys_list.called = 0 + + def test_load_key_cfg(self): + tracers.detach() + d = self.page + eq = self.assertEqual + + # Use builtin keyset with no user keysets created. + idleConf.CurrentKeys = mock.Mock(return_value='IDLE Classic OSX') + d.load_key_cfg() + self.assertTrue(d.keyset_source.get()) + # builtinlist sets variable builtin_name to the CurrentKeys default. + eq(d.builtin_name.get(), 'IDLE Classic OSX') + eq(d.custom_name.get(), '- no custom keys -') + eq(d.custom_keyset_on.state(), ('disabled',)) + eq(d.set_keys_type.called, 1) + eq(d.load_keys_list.called, 1) + eq(d.load_keys_list.args, ('IDLE Classic OSX', )) + + # Builtin keyset with non-empty user keyset list. + idleConf.SetOption('keys', 'test1', 'option', 'value') + idleConf.SetOption('keys', 'test2', 'option2', 'value2') + d.load_key_cfg() + eq(d.builtin_name.get(), 'IDLE Classic OSX') + eq(d.custom_name.get(), 'test1') + eq(d.set_keys_type.called, 2) + eq(d.load_keys_list.called, 2) + eq(d.load_keys_list.args, ('IDLE Classic OSX', )) + + # Use custom keyset. + idleConf.CurrentKeys = mock.Mock(return_value='test2') + idleConf.default_keys = mock.Mock(return_value='IDLE Modern Unix') + idleConf.SetOption('main', 'Keys', 'default', '0') + d.load_key_cfg() + self.assertFalse(d.keyset_source.get()) + eq(d.builtin_name.get(), 'IDLE Modern Unix') + eq(d.custom_name.get(), 'test2') + eq(d.set_keys_type.called, 3) + eq(d.load_keys_list.called, 3) + eq(d.load_keys_list.args, ('test2', )) + + del idleConf.CurrentKeys, idleConf.default_keys + tracers.attach() + + def test_keyset_source(self): + eq = self.assertEqual + d = self.page + # Test these separately. + d.var_changed_builtin_name = Func() + d.var_changed_custom_name = Func() + # Builtin selected. + d.builtin_keyset_on.invoke() + eq(mainpage, {'Keys': {'default': 'True'}}) + eq(d.var_changed_builtin_name.called, 1) + eq(d.var_changed_custom_name.called, 0) + changes.clear() + + # Custom selected. + d.custom_keyset_on.state(('!disabled',)) + d.custom_keyset_on.invoke() + self.assertEqual(mainpage, {'Keys': {'default': 'False'}}) + eq(d.var_changed_builtin_name.called, 1) + eq(d.var_changed_custom_name.called, 1) + del d.var_changed_builtin_name, d.var_changed_custom_name + + def test_builtin_name(self): + eq = self.assertEqual + d = self.page + idleConf.userCfg['main'].remove_section('Keys') + item_list = ['IDLE Classic Windows', 'IDLE Classic OSX', + 'IDLE Modern UNIX'] + + # Not in old_keys, defaults name to first item. + d.builtinlist.SetMenu(item_list, 'IDLE Modern UNIX') + eq(mainpage, {'Keys': {'name': 'IDLE Classic Windows', + 'name2': 'IDLE Modern UNIX'}}) + eq(d.keys_message['text'], 'New key set, see Help') + eq(d.load_keys_list.called, 1) + eq(d.load_keys_list.args, ('IDLE Modern UNIX', )) + + # Not in old keys - uses name2. + changes.clear() + idleConf.SetOption('main', 'Keys', 'name', 'IDLE Classic Unix') + d.builtinlist.SetMenu(item_list, 'IDLE Modern UNIX') + eq(mainpage, {'Keys': {'name2': 'IDLE Modern UNIX'}}) + eq(d.keys_message['text'], 'New key set, see Help') + eq(d.load_keys_list.called, 2) + eq(d.load_keys_list.args, ('IDLE Modern UNIX', )) + + # Builtin name in old_keys. + changes.clear() + d.builtinlist.SetMenu(item_list, 'IDLE Classic OSX') + eq(mainpage, {'Keys': {'name': 'IDLE Classic OSX', 'name2': ''}}) + eq(d.keys_message['text'], '') + eq(d.load_keys_list.called, 3) + eq(d.load_keys_list.args, ('IDLE Classic OSX', )) + + def test_custom_name(self): + d = self.page + + # If no selections, doesn't get added. + d.customlist.SetMenu([], '- no custom keys -') + self.assertNotIn('Keys', mainpage) + self.assertEqual(d.load_keys_list.called, 0) + + # Custom name selected. + changes.clear() + d.customlist.SetMenu(['a', 'b', 'c'], 'c') + self.assertEqual(mainpage, {'Keys': {'name': 'c'}}) + self.assertEqual(d.load_keys_list.called, 1) + + def test_keybinding(self): + idleConf.SetOption('extensions', 'ZzDummy', 'enable', 'True') + d = self.page + d.custom_name.set('my custom keys') + d.bindingslist.delete(0, 'end') + d.bindingslist.insert(0, 'copy') + d.bindingslist.insert(1, 'z-in') + d.bindingslist.selection_set(0) + d.bindingslist.selection_anchor(0) + # Core binding - adds to keys. + d.keybinding.set('') + self.assertEqual(keyspage, + {'my custom keys': {'copy': ''}}) + + # Not a core binding - adds to extensions. + d.bindingslist.selection_set(1) + d.bindingslist.selection_anchor(1) + d.keybinding.set('') + self.assertEqual(extpage, + {'ZzDummy_cfgBindings': {'z-in': ''}}) + + def test_set_keys_type(self): + eq = self.assertEqual + d = self.page + del d.set_keys_type + + # Builtin keyset selected. + d.keyset_source.set(True) + d.set_keys_type() + eq(d.builtinlist['state'], NORMAL) + eq(d.customlist['state'], DISABLED) + eq(d.button_delete_custom_keys.state(), ('disabled',)) + + # Custom keyset selected. + d.keyset_source.set(False) + d.set_keys_type() + eq(d.builtinlist['state'], DISABLED) + eq(d.custom_keyset_on.state(), ('selected',)) + eq(d.customlist['state'], NORMAL) + eq(d.button_delete_custom_keys.state(), ()) + d.set_keys_type = Func() + + def test_get_new_keys(self): + eq = self.assertEqual + d = self.page + orig_getkeysdialog = configdialog.GetKeysWindow + gkd = configdialog.GetKeysWindow = Func(return_self=True) + gnkn = d.get_new_keys_name = Func() + + d.button_new_keys.state(('!disabled',)) + d.bindingslist.delete(0, 'end') + d.bindingslist.insert(0, 'copy - ') + d.bindingslist.selection_set(0) + d.bindingslist.selection_anchor(0) + d.keybinding.set('Key-a') + d.keyset_source.set(True) # Default keyset. + + # Default keyset; no change to binding. + gkd.result = '' + d.button_new_keys.invoke() + eq(d.bindingslist.get('anchor'), 'copy - ') + # Keybinding isn't changed when there isn't a change entered. + eq(d.keybinding.get(), 'Key-a') + + # Default keyset; binding changed. + gkd.result = '' + # No keyset name selected therefore binding not saved. + gnkn.result = '' + d.button_new_keys.invoke() + eq(gnkn.called, 1) + eq(d.bindingslist.get('anchor'), 'copy - ') + # Keyset name selected. + gnkn.result = 'My New Key Set' + d.button_new_keys.invoke() + eq(d.custom_name.get(), gnkn.result) + eq(d.bindingslist.get('anchor'), 'copy - ') + eq(d.keybinding.get(), '') + + # User keyset; binding changed. + d.keyset_source.set(False) # Custom keyset. + gnkn.called = 0 + gkd.result = '' + d.button_new_keys.invoke() + eq(gnkn.called, 0) + eq(d.bindingslist.get('anchor'), 'copy - ') + eq(d.keybinding.get(), '') + + del d.get_new_keys_name + configdialog.GetKeysWindow = orig_getkeysdialog + + def test_get_new_keys_name(self): + orig_sectionname = configdialog.SectionName + sn = configdialog.SectionName = Func(return_self=True) + d = self.page + + sn.result = 'New Keys' + self.assertEqual(d.get_new_keys_name(''), 'New Keys') + + configdialog.SectionName = orig_sectionname + + def test_save_as_new_key_set(self): + d = self.page + gnkn = d.get_new_keys_name = Func() + d.keyset_source.set(True) + + # No name entered. + gnkn.result = '' + d.button_save_custom_keys.invoke() + + # Name entered. + gnkn.result = 'my new key set' + gnkn.called = 0 + self.assertNotIn(gnkn.result, idleConf.userCfg['keys']) + d.button_save_custom_keys.invoke() + self.assertIn(gnkn.result, idleConf.userCfg['keys']) + + del d.get_new_keys_name + + def test_on_bindingslist_select(self): + d = self.page + b = d.bindingslist + b.delete(0, 'end') + b.insert(0, 'copy') + b.insert(1, 'find') + b.activate(0) + + b.focus_force() + b.see(1) + b.update() + x, y, dx, dy = b.bbox(1) + x += dx // 2 + y += dy // 2 + b.event_generate('', x=0, y=0) + b.event_generate('', x=x, y=y) + b.event_generate('', x=x, y=y) + b.event_generate('', x=x, y=y) + self.assertEqual(b.get('anchor'), 'find') + self.assertEqual(d.button_new_keys.state(), ()) + + def test_create_new_key_set_and_save_new_key_set(self): + eq = self.assertEqual + d = self.page + + # Use default as previously active keyset. + d.keyset_source.set(True) + d.builtin_name.set('IDLE Classic Windows') + first_new = 'my new custom key set' + second_new = 'my second custom keyset' + + # No changes, so keysets are an exact copy. + self.assertNotIn(first_new, idleConf.userCfg) + d.create_new_key_set(first_new) + eq(idleConf.GetSectionList('user', 'keys'), [first_new]) + eq(idleConf.GetKeySet('IDLE Classic Windows'), + idleConf.GetKeySet(first_new)) + eq(d.custom_name.get(), first_new) + self.assertFalse(d.keyset_source.get()) # Use custom set. + eq(d.set_keys_type.called, 1) + + # Test that changed keybindings are in new keyset. + changes.add_option('keys', first_new, 'copy', '') + self.assertNotIn(second_new, idleConf.userCfg) + d.create_new_key_set(second_new) + eq(idleConf.GetSectionList('user', 'keys'), [first_new, second_new]) + self.assertNotEqual(idleConf.GetKeySet(first_new), + idleConf.GetKeySet(second_new)) + # Check that difference in keysets was in option `copy` from `changes`. + idleConf.SetOption('keys', first_new, 'copy', '') + eq(idleConf.GetKeySet(first_new), idleConf.GetKeySet(second_new)) + + def test_load_keys_list(self): + eq = self.assertEqual + d = self.page + gks = idleConf.GetKeySet = Func() + del d.load_keys_list + b = d.bindingslist + + b.delete(0, 'end') + b.insert(0, '<>') + b.insert(1, '<>') + gks.result = {'<>': ['', ''], + '<>': [''], + '<>': ['']} + changes.add_option('keys', 'my keys', 'spam', '') + expected = ('copy - ', + 'force-open-completions - ', + 'spam - ') + + # No current selection. + d.load_keys_list('my keys') + eq(b.get(0, 'end'), expected) + eq(b.get('anchor'), '') + eq(b.curselection(), ()) + + # Check selection. + b.selection_set(1) + b.selection_anchor(1) + d.load_keys_list('my keys') + eq(b.get(0, 'end'), expected) + eq(b.get('anchor'), 'force-open-completions - ') + eq(b.curselection(), (1, )) + + # Change selection. + b.selection_set(2) + b.selection_anchor(2) + d.load_keys_list('my keys') + eq(b.get(0, 'end'), expected) + eq(b.get('anchor'), 'spam - ') + eq(b.curselection(), (2, )) + d.load_keys_list = Func() + + del idleConf.GetKeySet + + def test_delete_custom_keys(self): + eq = self.assertEqual + d = self.page + d.button_delete_custom_keys.state(('!disabled',)) + yesno = d.askyesno = Func() + dialog.deactivate_current_config = Func() + dialog.activate_config_changes = Func() + + keyset_name = 'spam key set' + idleConf.userCfg['keys'].SetOption(keyset_name, 'name', 'value') + keyspage[keyset_name] = {'option': 'True'} + + keyset_name2 = 'other key set' + idleConf.userCfg['keys'].SetOption(keyset_name2, 'name', 'value') + keyspage[keyset_name2] = {'option': 'False'} + + # Force custom keyset. + d.custom_keyset_on.state(('!disabled',)) + d.custom_keyset_on.invoke() + d.custom_name.set(keyset_name) + + # Cancel deletion. + yesno.result = False + d.button_delete_custom_keys.invoke() + eq(yesno.called, 1) + eq(keyspage[keyset_name], {'option': 'True'}) + eq(idleConf.GetSectionList('user', 'keys'), [keyset_name, keyset_name2]) + eq(dialog.deactivate_current_config.called, 0) + eq(dialog.activate_config_changes.called, 0) + eq(d.set_keys_type.called, 0) + + # Confirm deletion. + yesno.result = True + d.button_delete_custom_keys.invoke() + eq(yesno.called, 2) + self.assertNotIn(keyset_name, keyspage) + eq(idleConf.GetSectionList('user', 'keys'), [keyset_name2]) + eq(d.custom_keyset_on.state(), ()) + eq(d.custom_name.get(), keyset_name2) + eq(dialog.deactivate_current_config.called, 1) + eq(dialog.activate_config_changes.called, 1) + eq(d.set_keys_type.called, 1) + + # Confirm deletion of second keyset - empties list. + d.custom_name.set(keyset_name2) + yesno.result = True + d.button_delete_custom_keys.invoke() + eq(yesno.called, 3) + self.assertNotIn(keyset_name, keyspage) + eq(idleConf.GetSectionList('user', 'keys'), []) + eq(d.custom_keyset_on.state(), ('disabled',)) + eq(d.custom_name.get(), '- no custom keys -') + eq(dialog.deactivate_current_config.called, 2) + eq(dialog.activate_config_changes.called, 2) + eq(d.set_keys_type.called, 2) + + del dialog.activate_config_changes, dialog.deactivate_current_config + del d.askyesno + + +class WinPageTest(unittest.TestCase): + """Test that general tab widgets enable users to make changes. + + Test that widget actions set vars, that var changes add + options to changes. + """ + @classmethod + def setUpClass(cls): + page = cls.page = dialog.winpage + dialog.note.select(page) + page.update() + + def setUp(self): + changes.clear() + + def test_load_windows_cfg(self): + # Set to wrong values, load, check right values. + eq = self.assertEqual + d = self.page + d.startup_edit.set(1) + d.win_width.set(1) + d.win_height.set(1) + d.load_windows_cfg() + eq(d.startup_edit.get(), 0) + eq(d.win_width.get(), '80') + eq(d.win_height.get(), '40') + + def test_startup(self): + d = self.page + d.startup_editor_on.invoke() + self.assertEqual(mainpage, + {'General': {'editor-on-startup': '1'}}) + changes.clear() + d.startup_shell_on.invoke() + self.assertEqual(mainpage, + {'General': {'editor-on-startup': '0'}}) + + def test_editor_size(self): + d = self.page + d.win_height_int.delete(0, 'end') + d.win_height_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'height': '11'}}) + changes.clear() + d.win_width_int.delete(0, 'end') + d.win_width_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'width': '11'}}) + + def test_indent_spaces(self): + d = self.page + d.indent_chooser.set(6) + self.assertEqual(d.indent_spaces.get(), '6') + self.assertEqual(mainpage, {'Indent': {'num-spaces': '6'}}) + + def test_cursor_blink(self): + self.page.cursor_blink_bool.invoke() + self.assertEqual(mainpage, {'EditorWindow': {'cursor-blink': 'False'}}) + + def test_autocomplete_wait(self): + self.page.auto_wait_int.delete(0, 'end') + self.page.auto_wait_int.insert(0, '11') + self.assertEqual(extpage, {'AutoComplete': {'popupwait': '11'}}) + + def test_parenmatch(self): + d = self.page + eq = self.assertEqual + d.paren_style_type['menu'].invoke(0) + eq(extpage, {'ParenMatch': {'style': 'opener'}}) + changes.clear() + d.paren_flash_time.delete(0, 'end') + d.paren_flash_time.insert(0, '11') + eq(extpage, {'ParenMatch': {'flash-delay': '11'}}) + changes.clear() + d.bell_on.invoke() + eq(extpage, {'ParenMatch': {'bell': 'False'}}) + + def test_paragraph(self): + self.page.format_width_int.delete(0, 'end') + self.page.format_width_int.insert(0, '11') + self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}}) + + +class ShedPageTest(unittest.TestCase): + """Test that shed tab widgets enable users to make changes. + + Test that widget actions set vars, that var changes add + options to changes. + """ + @classmethod + def setUpClass(cls): + page = cls.page = dialog.shedpage + dialog.note.select(page) + page.update() + + def setUp(self): + changes.clear() + + def test_load_shelled_cfg(self): + # Set to wrong values, load, check right values. + eq = self.assertEqual + d = self.page + d.autosave.set(1) + d.load_shelled_cfg() + eq(d.autosave.get(), 0) + + def test_autosave(self): + d = self.page + d.save_auto_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '1'}}) + d.save_ask_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '0'}}) + + def test_context(self): + self.page.context_int.delete(0, 'end') + self.page.context_int.insert(0, '1') + self.assertEqual(extpage, {'CodeContext': {'maxlines': '1'}}) + + +#unittest.skip("Nothing here yet TODO") +class ExtPageTest(unittest.TestCase): + """Test that the help source list works correctly.""" + @classmethod + def setUpClass(cls): + page = dialog.extpage + dialog.note.select(page) + + +class HelpSourceTest(unittest.TestCase): + """Test that the help source list works correctly.""" + @classmethod + def setUpClass(cls): + page = dialog.extpage + dialog.note.select(page) + frame = cls.frame = page.frame_help + frame.set = frame.set_add_delete_state = Func() + frame.upc = frame.update_help_changes = Func() + frame.update() + + @classmethod + def tearDownClass(cls): + frame = cls.frame + del frame.set, frame.set_add_delete_state + del frame.upc, frame.update_help_changes + frame.helplist.delete(0, 'end') + frame.user_helplist.clear() + + def setUp(self): + changes.clear() + + def test_load_helplist(self): + eq = self.assertEqual + fr = self.frame + fr.helplist.insert('end', 'bad') + fr.user_helplist = ['bad', 'worse'] + idleConf.SetOption('main', 'HelpFiles', '1', 'name;file') + fr.load_helplist() + eq(fr.helplist.get(0, 'end'), ('name',)) + eq(fr.user_helplist, [('name', 'file', '1')]) + + def test_source_selected(self): + fr = self.frame + fr.set = fr.set_add_delete_state + fr.upc = fr.update_help_changes + helplist = fr.helplist + dex = 'end' + helplist.insert(dex, 'source') + helplist.activate(dex) + + helplist.focus_force() + helplist.see(dex) + helplist.update() + x, y, dx, dy = helplist.bbox(dex) + x += dx // 2 + y += dy // 2 + fr.set.called = fr.upc.called = 0 + helplist.event_generate('', x=0, y=0) + helplist.event_generate('', x=x, y=y) + helplist.event_generate('', x=x, y=y) + helplist.event_generate('', x=x, y=y) + self.assertEqual(helplist.get('anchor'), 'source') + self.assertTrue(fr.set.called) + self.assertFalse(fr.upc.called) + + def test_set_add_delete_state(self): + # Call with 0 items, 1 unselected item, 1 selected item. + eq = self.assertEqual + fr = self.frame + del fr.set_add_delete_state # Unmask method. + sad = fr.set_add_delete_state + h = fr.helplist + + h.delete(0, 'end') + sad() + eq(fr.button_helplist_edit.state(), ('disabled',)) + eq(fr.button_helplist_remove.state(), ('disabled',)) + + h.insert(0, 'source') + sad() + eq(fr.button_helplist_edit.state(), ('disabled',)) + eq(fr.button_helplist_remove.state(), ('disabled',)) + + h.selection_set(0) + sad() + eq(fr.button_helplist_edit.state(), ()) + eq(fr.button_helplist_remove.state(), ()) + fr.set_add_delete_state = Func() # Mask method. + + def test_helplist_item_add(self): + # Call without and twice with HelpSource result. + # Double call enables check on order. + eq = self.assertEqual + orig_helpsource = configdialog.HelpSource + hs = configdialog.HelpSource = Func(return_self=True) + fr = self.frame + fr.helplist.delete(0, 'end') + fr.user_helplist.clear() + fr.set.called = fr.upc.called = 0 + + hs.result = '' + fr.helplist_item_add() + self.assertTrue(list(fr.helplist.get(0, 'end')) == + fr.user_helplist == []) + self.assertFalse(fr.upc.called) + + hs.result = ('name1', 'file1') + fr.helplist_item_add() + hs.result = ('name2', 'file2') + fr.helplist_item_add() + eq(fr.helplist.get(0, 'end'), ('name1', 'name2')) + eq(fr.user_helplist, [('name1', 'file1'), ('name2', 'file2')]) + eq(fr.upc.called, 2) + self.assertFalse(fr.set.called) + + configdialog.HelpSource = orig_helpsource + + def test_helplist_item_edit(self): + # Call without and with HelpSource change. + eq = self.assertEqual + orig_helpsource = configdialog.HelpSource + hs = configdialog.HelpSource = Func(return_self=True) + fr = self.frame + fr.helplist.delete(0, 'end') + fr.helplist.insert(0, 'name1') + fr.helplist.selection_set(0) + fr.helplist.selection_anchor(0) + fr.user_helplist.clear() + fr.user_helplist.append(('name1', 'file1')) + fr.set.called = fr.upc.called = 0 + + hs.result = '' + fr.helplist_item_edit() + hs.result = ('name1', 'file1') + fr.helplist_item_edit() + eq(fr.helplist.get(0, 'end'), ('name1',)) + eq(fr.user_helplist, [('name1', 'file1')]) + self.assertFalse(fr.upc.called) + + hs.result = ('name2', 'file2') + fr.helplist_item_edit() + eq(fr.helplist.get(0, 'end'), ('name2',)) + eq(fr.user_helplist, [('name2', 'file2')]) + self.assertTrue(fr.upc.called == fr.set.called == 1) + + configdialog.HelpSource = orig_helpsource + + def test_helplist_item_remove(self): + eq = self.assertEqual + fr = self.frame + fr.helplist.delete(0, 'end') + fr.helplist.insert(0, 'name1') + fr.helplist.selection_set(0) + fr.helplist.selection_anchor(0) + fr.user_helplist.clear() + fr.user_helplist.append(('name1', 'file1')) + fr.set.called = fr.upc.called = 0 + + fr.helplist_item_remove() + eq(fr.helplist.get(0, 'end'), ()) + eq(fr.user_helplist, []) + self.assertTrue(fr.upc.called == fr.set.called == 1) + + def test_update_help_changes(self): + fr = self.frame + del fr.update_help_changes + fr.user_helplist.clear() + fr.user_helplist.append(('name1', 'file1')) + fr.user_helplist.append(('name2', 'file2')) + + fr.update_help_changes() + self.assertEqual(mainpage['HelpFiles'], + {'1': 'name1;file1', '2': 'name2;file2'}) + fr.update_help_changes = Func() + + +class VarTraceTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.tracers = configdialog.VarTrace() + cls.iv = IntVar(root) + cls.bv = BooleanVar(root) + + @classmethod + def tearDownClass(cls): + del cls.tracers, cls.iv, cls.bv + + def setUp(self): + self.tracers.clear() + self.called = 0 + + def var_changed_increment(self, *params): + self.called += 13 + + def var_changed_boolean(self, *params): + pass + + def test_init(self): + tr = self.tracers + tr.__init__() + self.assertEqual(tr.untraced, []) + self.assertEqual(tr.traced, []) + + def test_clear(self): + tr = self.tracers + tr.untraced.append(0) + tr.traced.append(1) + tr.clear() + self.assertEqual(tr.untraced, []) + self.assertEqual(tr.traced, []) + + def test_add(self): + tr = self.tracers + func = Func() + cb = tr.make_callback = mock.Mock(return_value=func) + + iv = tr.add(self.iv, self.var_changed_increment) + self.assertIs(iv, self.iv) + bv = tr.add(self.bv, self.var_changed_boolean) + self.assertIs(bv, self.bv) + + sv = StringVar(root) + sv2 = tr.add(sv, ('main', 'section', 'option')) + self.assertIs(sv2, sv) + cb.assert_called_once() + cb.assert_called_with(sv, ('main', 'section', 'option')) + + expected = [(iv, self.var_changed_increment), + (bv, self.var_changed_boolean), + (sv, func)] + self.assertEqual(tr.traced, []) + self.assertEqual(tr.untraced, expected) + + del tr.make_callback + + def test_make_callback(self): + cb = self.tracers.make_callback(self.iv, ('main', 'section', 'option')) + self.assertTrue(callable(cb)) + self.iv.set(42) + # Not attached, so set didn't invoke the callback. + self.assertNotIn('section', changes['main']) + # Invoke callback manually. + cb() + self.assertIn('section', changes['main']) + self.assertEqual(changes['main']['section']['option'], '42') + changes.clear() + + def test_attach_detach(self): + tr = self.tracers + iv = tr.add(self.iv, self.var_changed_increment) + bv = tr.add(self.bv, self.var_changed_boolean) + expected = [(iv, self.var_changed_increment), + (bv, self.var_changed_boolean)] + + # Attach callbacks and test call increment. + tr.attach() + self.assertEqual(tr.untraced, []) + self.assertCountEqual(tr.traced, expected) + iv.set(1) + self.assertEqual(iv.get(), 1) + self.assertEqual(self.called, 13) + + # Check that only one callback is attached to a variable. + # If more than one callback were attached, then var_changed_increment + # would be called twice and the counter would be 2. + self.called = 0 + tr.attach() + iv.set(1) + self.assertEqual(self.called, 13) + + # Detach callbacks. + self.called = 0 + tr.detach() + self.assertEqual(tr.traced, []) + self.assertCountEqual(tr.untraced, expected) + iv.set(1) + self.assertEqual(self.called, 0) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_debugger.py b/micromamba_root/Lib/idlelib/idle_test/test_debugger.py new file mode 100644 index 0000000000000000000000000000000000000000..9ca3b332648b31185592128e684183d629c51511 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_debugger.py @@ -0,0 +1,297 @@ +"""Test debugger, coverage 66% + +Try to make tests pass with draft bdbx, which may replace bdb in 3.13+. +""" + +from idlelib import debugger +from collections import namedtuple +from textwrap import dedent +from tkinter import Tk + +from test.support import requires +import unittest +from unittest import mock +from unittest.mock import Mock, patch + +"""A test python script for the debug tests.""" +TEST_CODE = dedent(""" + i = 1 + i += 2 + if i == 3: + print(i) + """) + + +class MockFrame: + "Minimal mock frame." + + def __init__(self, code, lineno): + self.f_code = code + self.f_lineno = lineno + + +class IdbTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.gui = Mock() + cls.idb = debugger.Idb(cls.gui) + + # Create test and code objects to simulate a debug session. + code_obj = compile(TEST_CODE, 'idlelib/file.py', mode='exec') + frame1 = MockFrame(code_obj, 1) + frame1.f_back = None + frame2 = MockFrame(code_obj, 2) + frame2.f_back = frame1 + cls.frame = frame2 + cls.msg = 'file.py:2: ()' + + def test_init(self): + self.assertIs(self.idb.gui, self.gui) + # Won't test super call since two Bdbs are very different. + + def test_user_line(self): + # Test that .user_line() creates a string message for a frame. + self.gui.interaction = Mock() + self.idb.user_line(self.frame) + self.gui.interaction.assert_called_once_with(self.msg, self.frame) + + def test_user_exception(self): + # Test that .user_exception() creates a string message for a frame. + exc_info = (type(ValueError), ValueError(), None) + self.gui.interaction = Mock() + self.idb.user_exception(self.frame, exc_info) + self.gui.interaction.assert_called_once_with( + self.msg, self.frame, exc_info) + + +class FunctionTest(unittest.TestCase): + # Test module functions together. + + def test_functions(self): + rpc_obj = compile(TEST_CODE,'rpc.py', mode='exec') + rpc_frame = MockFrame(rpc_obj, 2) + rpc_frame.f_back = rpc_frame + self.assertTrue(debugger._in_rpc_code(rpc_frame)) + self.assertEqual(debugger._frame2message(rpc_frame), + 'rpc.py:2: ()') + + code_obj = compile(TEST_CODE, 'idlelib/debugger.py', mode='exec') + code_frame = MockFrame(code_obj, 1) + code_frame.f_back = None + self.assertFalse(debugger._in_rpc_code(code_frame)) + self.assertEqual(debugger._frame2message(code_frame), + 'debugger.py:1: ()') + + code_frame.f_back = code_frame + self.assertFalse(debugger._in_rpc_code(code_frame)) + code_frame.f_back = rpc_frame + self.assertTrue(debugger._in_rpc_code(code_frame)) + + +class DebuggerTest(unittest.TestCase): + "Tests for Debugger that do not need a real root." + + @classmethod + def setUpClass(cls): + cls.pyshell = Mock() + cls.pyshell.root = Mock() + cls.idb = Mock() + with patch.object(debugger.Debugger, 'make_gui'): + cls.debugger = debugger.Debugger(cls.pyshell, cls.idb) + cls.debugger.root = Mock() + + def test_cont(self): + self.debugger.cont() + self.idb.set_continue.assert_called_once() + + def test_step(self): + self.debugger.step() + self.idb.set_step.assert_called_once() + + def test_quit(self): + self.debugger.quit() + self.idb.set_quit.assert_called_once() + + def test_next(self): + with patch.object(self.debugger, 'frame') as frame: + self.debugger.next() + self.idb.set_next.assert_called_once_with(frame) + + def test_ret(self): + with patch.object(self.debugger, 'frame') as frame: + self.debugger.ret() + self.idb.set_return.assert_called_once_with(frame) + + def test_clear_breakpoint(self): + self.debugger.clear_breakpoint('test.py', 4) + self.idb.clear_break.assert_called_once_with('test.py', 4) + + def test_clear_file_breaks(self): + self.debugger.clear_file_breaks('test.py') + self.idb.clear_all_file_breaks.assert_called_once_with('test.py') + + def test_set_load_breakpoints(self): + # Test the .load_breakpoints() method calls idb. + FileIO = namedtuple('FileIO', 'filename') + + class MockEditWindow(object): + def __init__(self, fn, breakpoints): + self.io = FileIO(fn) + self.breakpoints = breakpoints + + self.pyshell.flist = Mock() + self.pyshell.flist.inversedict = ( + MockEditWindow('test1.py', [4, 4]), + MockEditWindow('test2.py', [13, 44, 45]), + ) + self.debugger.set_breakpoint('test0.py', 1) + self.idb.set_break.assert_called_once_with('test0.py', 1) + self.debugger.load_breakpoints() # Call set_breakpoint 5 times. + self.idb.set_break.assert_has_calls( + [mock.call('test0.py', 1), + mock.call('test1.py', 4), + mock.call('test1.py', 4), + mock.call('test2.py', 13), + mock.call('test2.py', 44), + mock.call('test2.py', 45)]) + + def test_sync_source_line(self): + # Test that .sync_source_line() will set the flist.gotofileline with fixed frame. + test_code = compile(TEST_CODE, 'test_sync.py', 'exec') + test_frame = MockFrame(test_code, 1) + self.debugger.frame = test_frame + + self.debugger.flist = Mock() + with patch('idlelib.debugger.os.path.exists', return_value=True): + self.debugger.sync_source_line() + self.debugger.flist.gotofileline.assert_called_once_with('test_sync.py', 1) + + +class DebuggerGuiTest(unittest.TestCase): + """Tests for debugger.Debugger that need tk root. + + close needs debugger.top set in make_gui. + """ + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = root = Tk() + root.withdraw() + cls.pyshell = Mock() + cls.pyshell.root = root + cls.idb = Mock() +# stack tests fail with debugger here. +## cls.debugger = debugger.Debugger(cls.pyshell, cls.idb) +## cls.debugger.root = root +## # real root needed for real make_gui +## # run, interacting, abort_loop + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def setUp(self): + self.debugger = debugger.Debugger(self.pyshell, self.idb) + self.debugger.root = self.root + # real root needed for real make_gui + # run, interacting, abort_loop + + def test_run_debugger(self): + self.debugger.run(1, 'two') + self.idb.run.assert_called_once_with(1, 'two') + self.assertEqual(self.debugger.interacting, 0) + + def test_close(self): + # Test closing the window in an idle state. + self.debugger.close() + self.pyshell.close_debugger.assert_called_once() + + def test_show_stack(self): + self.debugger.show_stack() + self.assertEqual(self.debugger.stackviewer.gui, self.debugger) + + def test_show_stack_with_frame(self): + test_frame = MockFrame(None, None) + self.debugger.frame = test_frame + + # Reset the stackviewer to force it to be recreated. + self.debugger.stackviewer = None + self.idb.get_stack.return_value = ([], 0) + self.debugger.show_stack() + + # Check that the newly created stackviewer has the test gui as a field. + self.assertEqual(self.debugger.stackviewer.gui, self.debugger) + self.idb.get_stack.assert_called_once_with(test_frame, None) + + +class StackViewerTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def setUp(self): + self.code = compile(TEST_CODE, 'test_stackviewer.py', 'exec') + self.stack = [ + (MockFrame(self.code, 1), 1), + (MockFrame(self.code, 2), 2) + ] + # Create a stackviewer and load the test stack. + self.sv = debugger.StackViewer(self.root, None, None) + self.sv.load_stack(self.stack) + + def test_init(self): + # Test creation of StackViewer. + gui = None + flist = None + master_window = self.root + sv = debugger.StackViewer(master_window, flist, gui) + self.assertHasAttr(sv, 'stack') + + def test_load_stack(self): + # Test the .load_stack() method against a fixed test stack. + # Check the test stack is assigned and the list contains the repr of them. + self.assertEqual(self.sv.stack, self.stack) + self.assertTrue('?.(), line 1:' in self.sv.get(0)) + self.assertEqual(self.sv.get(1), '?.(), line 2: ') + + def test_show_source(self): + # Test the .show_source() method against a fixed test stack. + # Patch out the file list to monitor it + self.sv.flist = Mock() + # Patch out isfile to pretend file exists. + with patch('idlelib.debugger.os.path.isfile', return_value=True) as isfile: + self.sv.show_source(1) + isfile.assert_called_once_with('test_stackviewer.py') + self.sv.flist.open.assert_called_once_with('test_stackviewer.py') + + +class NameSpaceTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_init(self): + debugger.NamespaceViewer(self.root, 'Test') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_debugger_r.py b/micromamba_root/Lib/idlelib/idle_test/test_debugger_r.py new file mode 100644 index 0000000000000000000000000000000000000000..cf8af05fe27e77b7a4ec17c2bd9dfcd163a4750e --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_debugger_r.py @@ -0,0 +1,36 @@ +"Test debugger_r, coverage 30%." + +from idlelib import debugger_r +import unittest + +# Boilerplate likely to be needed for future test classes. +##from test.support import requires +##from tkinter import Tk +##class Test(unittest.TestCase): +## @classmethod +## def setUpClass(cls): +## requires('gui') +## cls.root = Tk() +## @classmethod +## def tearDownClass(cls): +## cls.root.destroy() + +# GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy, +# GUIAdapter, IdbProxy, and 7 functions still need tests. + +class IdbAdapterTest(unittest.TestCase): + + def test_dict_item_noattr(self): # Issue 33065. + + class BinData: + def __repr__(self): + return self.length + + debugger_r.dicttable[0] = {'BinData': BinData()} + idb = debugger_r.IdbAdapter(None) + self.assertTrue(idb.dict_item(0, 'BinData')) + debugger_r.dicttable.clear() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_debugobj.py b/micromamba_root/Lib/idlelib/idle_test/test_debugobj.py new file mode 100644 index 0000000000000000000000000000000000000000..90ace4e1bc4f9ef8ca24028c4c01b985412fdc6d --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_debugobj.py @@ -0,0 +1,57 @@ +"Test debugobj, coverage 40%." + +from idlelib import debugobj +import unittest + + +class ObjectTreeItemTest(unittest.TestCase): + + def test_init(self): + ti = debugobj.ObjectTreeItem('label', 22) + self.assertEqual(ti.labeltext, 'label') + self.assertEqual(ti.object, 22) + self.assertEqual(ti.setfunction, None) + + +class ClassTreeItemTest(unittest.TestCase): + + def test_isexpandable(self): + ti = debugobj.ClassTreeItem('label', 0) + self.assertTrue(ti.IsExpandable()) + + +class AtomicObjectTreeItemTest(unittest.TestCase): + + def test_isexpandable(self): + ti = debugobj.AtomicObjectTreeItem('label', 0) + self.assertFalse(ti.IsExpandable()) + + +class SequenceTreeItemTest(unittest.TestCase): + + def test_isexpandable(self): + ti = debugobj.SequenceTreeItem('label', ()) + self.assertFalse(ti.IsExpandable()) + ti = debugobj.SequenceTreeItem('label', (1,)) + self.assertTrue(ti.IsExpandable()) + + def test_keys(self): + ti = debugobj.SequenceTreeItem('label', 'abc') + self.assertEqual(list(ti.keys()), [0, 1, 2]) # keys() is a range. + + +class DictTreeItemTest(unittest.TestCase): + + def test_isexpandable(self): + ti = debugobj.DictTreeItem('label', {}) + self.assertFalse(ti.IsExpandable()) + ti = debugobj.DictTreeItem('label', {1:1}) + self.assertTrue(ti.IsExpandable()) + + def test_keys(self): + ti = debugobj.DictTreeItem('label', {1:1, 0:0, 2:2}) + self.assertEqual(ti.keys(), [0, 1, 2]) # keys() is a sorted list. + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_debugobj_r.py b/micromamba_root/Lib/idlelib/idle_test/test_debugobj_r.py new file mode 100644 index 0000000000000000000000000000000000000000..86e51b6cb2cb22d31aa9c4a1d8cc5b713b8eec34 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_debugobj_r.py @@ -0,0 +1,22 @@ +"Test debugobj_r, coverage 56%." + +from idlelib import debugobj_r +import unittest + + +class WrappedObjectTreeItemTest(unittest.TestCase): + + def test_getattr(self): + ti = debugobj_r.WrappedObjectTreeItem(list) + self.assertEqual(ti.append, list.append) + +class StubObjectTreeItemTest(unittest.TestCase): + + def test_init(self): + ti = debugobj_r.StubObjectTreeItem('socket', 1111) + self.assertEqual(ti.sockio, 'socket') + self.assertEqual(ti.oid, 1111) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_delegator.py b/micromamba_root/Lib/idlelib/idle_test/test_delegator.py new file mode 100644 index 0000000000000000000000000000000000000000..922416297a42e028bc0db33fb1f5195190b29f6e --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_delegator.py @@ -0,0 +1,44 @@ +"Test delegator, coverage 100%." + +from idlelib.delegator import Delegator +import unittest + + +class DelegatorTest(unittest.TestCase): + + def test_mydel(self): + # Test a simple use scenario. + + # Initialize an int delegator. + mydel = Delegator(int) + self.assertIs(mydel.delegate, int) + self.assertEqual(mydel._Delegator__cache, set()) + # Trying to access a non-attribute of int fails. + self.assertRaises(AttributeError, mydel.__getattr__, 'xyz') + + # Add real int attribute 'bit_length' by accessing it. + bl = mydel.bit_length + self.assertIs(bl, int.bit_length) + self.assertIs(mydel.__dict__['bit_length'], int.bit_length) + self.assertEqual(mydel._Delegator__cache, {'bit_length'}) + + # Add attribute 'numerator'. + mydel.numerator + self.assertEqual(mydel._Delegator__cache, {'bit_length', 'numerator'}) + + # Delete 'numerator'. + del mydel.numerator + self.assertNotIn('numerator', mydel.__dict__) + # The current implementation leaves it in the name cache. + # self.assertIn('numerator', mydel._Delegator__cache) + # However, this is not required and not part of the specification + + # Change delegate to float, first resetting the attributes. + mydel.setdelegate(float) # calls resetcache + self.assertNotIn('bit_length', mydel.__dict__) + self.assertEqual(mydel._Delegator__cache, set()) + self.assertIs(mydel.delegate, float) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_editmenu.py b/micromamba_root/Lib/idlelib/idle_test/test_editmenu.py new file mode 100644 index 0000000000000000000000000000000000000000..17478473a3d1b2711fd8e1ffa7f6076c540c4386 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_editmenu.py @@ -0,0 +1,74 @@ +'''Test (selected) IDLE Edit menu items. + +Edit modules have their own test files +''' +from test.support import requires +requires('gui') +import tkinter as tk +from tkinter import ttk +import unittest +from idlelib import pyshell + +class PasteTest(unittest.TestCase): + '''Test pasting into widgets that allow pasting. + + On X11, replacing selections requires tk fix. + ''' + @classmethod + def setUpClass(cls): + cls.root = root = tk.Tk() + cls.root.withdraw() + pyshell.fix_x11_paste(root) + cls.text = tk.Text(root) + cls.entry = tk.Entry(root) + cls.tentry = ttk.Entry(root) + cls.spin = tk.Spinbox(root) + root.clipboard_clear() + root.clipboard_append('two') + + @classmethod + def tearDownClass(cls): + del cls.text, cls.entry, cls.tentry + cls.root.clipboard_clear() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_paste_text(self): + "Test pasting into text with and without a selection." + text = self.text + for tag, ans in ('', 'onetwo\n'), ('sel', 'two\n'): + with self.subTest(tag=tag, ans=ans): + text.delete('1.0', 'end') + text.insert('1.0', 'one', tag) + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), ans) + + def test_paste_entry(self): + "Test pasting into an entry with and without a selection." + # Generated <> fails for tk entry without empty select + # range for 'no selection'. Live widget works fine. + for entry in self.entry, self.tentry: + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(entry=entry, end=end, ans=ans): + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) + + def test_paste_spin(self): + "Test pasting into a spinbox with and without a selection." + # See note above for entry. + spin = self.spin + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(end=end, ans=ans): + spin.delete(0, 'end') + spin.insert(0, 'one') + spin.selection('range', 0, end) # see note + spin.event_generate('<>') + self.assertEqual(spin.get(), ans) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_editor.py b/micromamba_root/Lib/idlelib/idle_test/test_editor.py new file mode 100644 index 0000000000000000000000000000000000000000..0dfe2f3c58befadd0e85765cac1c1f29083d26fc --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_editor.py @@ -0,0 +1,241 @@ +"Test editor, coverage 53%." + +from idlelib import editor +import unittest +from collections import namedtuple +from test.support import requires +from tkinter import Tk, Text + +Editor = editor.EditorWindow + + +class EditorWindowTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) + cls.root.destroy() + del cls.root + + def test_init(self): + e = Editor(root=self.root) + self.assertEqual(e.root, self.root) + e._close() + + +class GetLineIndentTest(unittest.TestCase): + def test_empty_lines(self): + for tabwidth in [1, 2, 4, 6, 8]: + for line in ['', '\n']: + with self.subTest(line=line, tabwidth=tabwidth): + self.assertEqual( + editor.get_line_indent(line, tabwidth=tabwidth), + (0, 0), + ) + + def test_tabwidth_4(self): + # (line, (raw, effective)) + tests = (('no spaces', (0, 0)), + # Internal space isn't counted. + (' space test', (4, 4)), + ('\ttab test', (1, 4)), + ('\t\tdouble tabs test', (2, 8)), + # Different results when mixing tabs and spaces. + (' \tmixed test', (5, 8)), + (' \t mixed test', (5, 6)), + ('\t mixed test', (5, 8)), + # Spaces not divisible by tabwidth. + (' \tmixed test', (3, 4)), + (' \t mixed test', (3, 5)), + ('\t mixed test', (3, 6)), + # Only checks spaces and tabs. + ('\nnewline test', (0, 0))) + + for line, expected in tests: + with self.subTest(line=line): + self.assertEqual( + editor.get_line_indent(line, tabwidth=4), + expected, + ) + + def test_tabwidth_8(self): + # (line, (raw, effective)) + tests = (('no spaces', (0, 0)), + # Internal space isn't counted. + (' space test', (8, 8)), + ('\ttab test', (1, 8)), + ('\t\tdouble tabs test', (2, 16)), + # Different results when mixing tabs and spaces. + (' \tmixed test', (9, 16)), + (' \t mixed test', (9, 10)), + ('\t mixed test', (9, 16)), + # Spaces not divisible by tabwidth. + (' \tmixed test', (3, 8)), + (' \t mixed test', (3, 9)), + ('\t mixed test', (3, 10)), + # Only checks spaces and tabs. + ('\nnewline test', (0, 0))) + + for line, expected in tests: + with self.subTest(line=line): + self.assertEqual( + editor.get_line_indent(line, tabwidth=8), + expected, + ) + + +def insert(text, string): + text.delete('1.0', 'end') + text.insert('end', string) + text.update_idletasks() # Force update for colorizer to finish. + + +class IndentAndNewlineTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.window = Editor(root=cls.root) + cls.window.indentwidth = 2 + cls.window.tabwidth = 2 + + @classmethod + def tearDownClass(cls): + cls.window._close() + del cls.window + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) + cls.root.destroy() + del cls.root + + def test_indent_and_newline_event(self): + eq = self.assertEqual + w = self.window + text = w.text + get = text.get + nl = w.newline_and_indent_event + + TestInfo = namedtuple('Tests', ['label', 'text', 'expected', 'mark']) + + tests = (TestInfo('Empty line inserts with no indent.', + ' \n def __init__(self):', + '\n \n def __init__(self):\n', + '1.end'), + TestInfo('Inside bracket before space, deletes space.', + ' def f1(self, a, b):', + ' def f1(self,\n a, b):\n', + '1.14'), + TestInfo('Inside bracket after space, deletes space.', + ' def f1(self, a, b):', + ' def f1(self,\n a, b):\n', + '1.15'), + TestInfo('Inside string with one line - no indent.', + ' """Docstring."""', + ' """Docstring.\n"""\n', + '1.15'), + TestInfo('Inside string with more than one line.', + ' """Docstring.\n Docstring Line 2"""', + ' """Docstring.\n Docstring Line 2\n """\n', + '2.18'), + TestInfo('Backslash with one line.', + 'a =\\', + 'a =\\\n \n', + '1.end'), + TestInfo('Backslash with more than one line.', + 'a =\\\n multiline\\', + 'a =\\\n multiline\\\n \n', + '2.end'), + TestInfo('Block opener - indents +1 level.', + ' def f1(self):\n pass', + ' def f1(self):\n \n pass\n', + '1.end'), + TestInfo('Block closer - dedents -1 level.', + ' def f1(self):\n pass', + ' def f1(self):\n pass\n \n', + '2.end'), + ) + + for test in tests: + with self.subTest(label=test.label): + insert(text, test.text) + text.mark_set('insert', test.mark) + nl(event=None) + eq(get('1.0', 'end'), test.expected) + + # Selected text. + insert(text, ' def f1(self, a, b):\n return a + b') + text.tag_add('sel', '1.17', '1.end') + nl(None) + # Deletes selected text before adding new line. + eq(get('1.0', 'end'), ' def f1(self, a,\n \n return a + b\n') + + +class IndentSearcherTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_searcher(self): + text = self.text + searcher = (self.text) + test_info = (# text, (block, indent)) + ("", (None, None)), + ("[1,", (None, None)), # TokenError + ("if 1:\n", ('if 1:\n', None)), + ("if 1:\n 2\n 3\n", ('if 1:\n', ' 2\n')), + ) + for code, expected_pair in test_info: + with self.subTest(code=code): + insert(text, code) + actual_pair = editor.IndentSearcher(text).run() + self.assertEqual(actual_pair, expected_pair) + + +class RMenuTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.window = Editor(root=cls.root) + + @classmethod + def tearDownClass(cls): + cls.window._close() + del cls.window + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) + cls.root.destroy() + del cls.root + + class DummyRMenu: + def tk_popup(x, y): pass + + def test_rclick(self): + pass + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_filelist.py b/micromamba_root/Lib/idlelib/idle_test/test_filelist.py new file mode 100644 index 0000000000000000000000000000000000000000..731f1975e50e23907f60764c0c149f101c6fe898 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_filelist.py @@ -0,0 +1,33 @@ +"Test filelist, coverage 19%." + +from idlelib import filelist +import unittest +from test.support import requires +from tkinter import Tk + +class FileListTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) + cls.root.destroy() + del cls.root + + def test_new_empty(self): + flist = filelist.FileList(self.root) + self.assertEqual(flist.root, self.root) + e = flist.new() + self.assertEqual(type(e), flist.EditorWindow) + e._close() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_format.py b/micromamba_root/Lib/idlelib/idle_test/test_format.py new file mode 100644 index 0000000000000000000000000000000000000000..e5e903688597aa770452f15102f9ee7850ace49e --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_format.py @@ -0,0 +1,668 @@ +"Test format, coverage 99%." + +from idlelib import format as ft +import unittest +from unittest import mock +from test.support import requires +from tkinter import Tk, Text +from idlelib.editor import EditorWindow +from idlelib.idle_test.mock_idle import Editor as MockEditor + + +class Is_Get_Test(unittest.TestCase): + """Test the is_ and get_ functions""" + test_comment = '# This is a comment' + test_nocomment = 'This is not a comment' + trailingws_comment = '# This is a comment ' + leadingws_comment = ' # This is a comment' + leadingws_nocomment = ' This is not a comment' + + def test_is_all_white(self): + self.assertTrue(ft.is_all_white('')) + self.assertTrue(ft.is_all_white('\t\n\r\f\v')) + self.assertFalse(ft.is_all_white(self.test_comment)) + + def test_get_indent(self): + Equal = self.assertEqual + Equal(ft.get_indent(self.test_comment), '') + Equal(ft.get_indent(self.trailingws_comment), '') + Equal(ft.get_indent(self.leadingws_comment), ' ') + Equal(ft.get_indent(self.leadingws_nocomment), ' ') + + def test_get_comment_header(self): + Equal = self.assertEqual + # Test comment strings + Equal(ft.get_comment_header(self.test_comment), '#') + Equal(ft.get_comment_header(self.trailingws_comment), '#') + Equal(ft.get_comment_header(self.leadingws_comment), ' #') + # Test non-comment strings + Equal(ft.get_comment_header(self.leadingws_nocomment), ' ') + Equal(ft.get_comment_header(self.test_nocomment), '') + + +class FindTest(unittest.TestCase): + """Test the find_paragraph function in paragraph module. + + Using the runcase() function, find_paragraph() is called with 'mark' set at + multiple indexes before and inside the test paragraph. + + It appears that code with the same indentation as a quoted string is grouped + as part of the same paragraph, which is probably incorrect behavior. + """ + + @classmethod + def setUpClass(cls): + from idlelib.idle_test.mock_tk import Text + cls.text = Text() + + def runcase(self, inserttext, stopline, expected): + # Check that find_paragraph returns the expected paragraph when + # the mark index is set to beginning, middle, end of each line + # up to but not including the stop line + text = self.text + text.insert('1.0', inserttext) + for line in range(1, stopline): + linelength = int(text.index("%d.end" % line).split('.')[1]) + for col in (0, linelength//2, linelength): + tempindex = "%d.%d" % (line, col) + self.assertEqual(ft.find_paragraph(text, tempindex), expected) + text.delete('1.0', 'end') + + def test_find_comment(self): + comment = ( + "# Comment block with no blank lines before\n" + "# Comment line\n" + "\n") + self.runcase(comment, 3, ('1.0', '3.0', '#', comment[0:58])) + + comment = ( + "\n" + "# Comment block with whitespace line before and after\n" + "# Comment line\n" + "\n") + self.runcase(comment, 4, ('2.0', '4.0', '#', comment[1:70])) + + comment = ( + "\n" + " # Indented comment block with whitespace before and after\n" + " # Comment line\n" + "\n") + self.runcase(comment, 4, ('2.0', '4.0', ' #', comment[1:82])) + + comment = ( + "\n" + "# Single line comment\n" + "\n") + self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:23])) + + comment = ( + "\n" + " # Single line comment with leading whitespace\n" + "\n") + self.runcase(comment, 3, ('2.0', '3.0', ' #', comment[1:51])) + + comment = ( + "\n" + "# Comment immediately followed by code\n" + "x = 42\n" + "\n") + self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:40])) + + comment = ( + "\n" + " # Indented comment immediately followed by code\n" + "x = 42\n" + "\n") + self.runcase(comment, 3, ('2.0', '3.0', ' #', comment[1:53])) + + comment = ( + "\n" + "# Comment immediately followed by indented code\n" + " x = 42\n" + "\n") + self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:49])) + + def test_find_paragraph(self): + teststring = ( + '"""String with no blank lines before\n' + 'String line\n' + '"""\n' + '\n') + self.runcase(teststring, 4, ('1.0', '4.0', '', teststring[0:53])) + + teststring = ( + "\n" + '"""String with whitespace line before and after\n' + 'String line.\n' + '"""\n' + '\n') + self.runcase(teststring, 5, ('2.0', '5.0', '', teststring[1:66])) + + teststring = ( + '\n' + ' """Indented string with whitespace before and after\n' + ' Comment string.\n' + ' """\n' + '\n') + self.runcase(teststring, 5, ('2.0', '5.0', ' ', teststring[1:85])) + + teststring = ( + '\n' + '"""Single line string."""\n' + '\n') + self.runcase(teststring, 3, ('2.0', '3.0', '', teststring[1:27])) + + teststring = ( + '\n' + ' """Single line string with leading whitespace."""\n' + '\n') + self.runcase(teststring, 3, ('2.0', '3.0', ' ', teststring[1:55])) + + +class ReformatFunctionTest(unittest.TestCase): + """Test the reformat_paragraph function without the editor window.""" + + def test_reformat_paragraph(self): + Equal = self.assertEqual + reform = ft.reformat_paragraph + hw = "O hello world" + Equal(reform(' ', 1), ' ') + Equal(reform("Hello world", 20), "Hello world") + + # Test without leading newline + Equal(reform(hw, 1), "O\nhello\nworld") + Equal(reform(hw, 6), "O\nhello\nworld") + Equal(reform(hw, 7), "O hello\nworld") + Equal(reform(hw, 12), "O hello\nworld") + Equal(reform(hw, 13), "O hello world") + + # Test with leading newline + hw = "\nO hello world" + Equal(reform(hw, 1), "\nO\nhello\nworld") + Equal(reform(hw, 6), "\nO\nhello\nworld") + Equal(reform(hw, 7), "\nO hello\nworld") + Equal(reform(hw, 12), "\nO hello\nworld") + Equal(reform(hw, 13), "\nO hello world") + + +class ReformatCommentTest(unittest.TestCase): + """Test the reformat_comment function without the editor window.""" + + def test_reformat_comment(self): + Equal = self.assertEqual + + # reformat_comment formats to a minimum of 20 characters + test_string = ( + " \"\"\"this is a test of a reformat for a triple quoted string" + " will it reformat to less than 70 characters for me?\"\"\"") + result = ft.reformat_comment(test_string, 70, " ") + expected = ( + " \"\"\"this is a test of a reformat for a triple quoted string will it\n" + " reformat to less than 70 characters for me?\"\"\"") + Equal(result, expected) + + test_comment = ( + "# this is a test of a reformat for a triple quoted string will " + "it reformat to less than 70 characters for me?") + result = ft.reformat_comment(test_comment, 70, "#") + expected = ( + "# this is a test of a reformat for a triple quoted string will it\n" + "# reformat to less than 70 characters for me?") + Equal(result, expected) + + +class FormatClassTest(unittest.TestCase): + def test_init_close(self): + instance = ft.FormatParagraph('editor') + self.assertEqual(instance.editwin, 'editor') + instance.close() + self.assertEqual(instance.editwin, None) + + +# For testing format_paragraph_event, Initialize FormatParagraph with +# a mock Editor with .text and .get_selection_indices. The text must +# be a Text wrapper that adds two methods + +# A real EditorWindow creates unneeded, time-consuming baggage and +# sometimes emits shutdown warnings like this: +# "warning: callback failed in WindowList +# : invalid command name ".55131368.windows". +# Calling EditorWindow._close in tearDownClass prevents this but causes +# other problems (windows left open). + +class TextWrapper: + def __init__(self, master): + self.text = Text(master=master) + def __getattr__(self, name): + return getattr(self.text, name) + def undo_block_start(self): pass + def undo_block_stop(self): pass + +class Editor: + def __init__(self, root): + self.text = TextWrapper(root) + get_selection_indices = EditorWindow. get_selection_indices + +class FormatEventTest(unittest.TestCase): + """Test the formatting of text inside a Text widget. + + This is done with FormatParagraph.format.paragraph_event, + which calls functions in the module as appropriate. + """ + test_string = ( + " '''this is a test of a reformat for a triple " + "quoted string will it reformat to less than 70 " + "characters for me?'''\n") + multiline_test_string = ( + " '''The first line is under the max width.\n" + " The second line's length is way over the max width. It goes " + "on and on until it is over 100 characters long.\n" + " Same thing with the third line. It is also way over the max " + "width, but FormatParagraph will fix it.\n" + " '''\n") + multiline_test_comment = ( + "# The first line is under the max width.\n" + "# The second line's length is way over the max width. It goes on " + "and on until it is over 100 characters long.\n" + "# Same thing with the third line. It is also way over the max " + "width, but FormatParagraph will fix it.\n" + "# The fourth line is short like the first line.") + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + editor = Editor(root=cls.root) + cls.text = editor.text.text # Test code does not need the wrapper. + cls.formatter = ft.FormatParagraph(editor).format_paragraph_event + # Sets the insert mark just after the re-wrapped and inserted text. + + @classmethod + def tearDownClass(cls): + del cls.text, cls.formatter + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_short_line(self): + self.text.insert('1.0', "Short line\n") + self.formatter("Dummy") + self.assertEqual(self.text.get('1.0', 'insert'), "Short line\n" ) + self.text.delete('1.0', 'end') + + def test_long_line(self): + text = self.text + + # Set cursor ('insert' mark) to '1.0', within text. + text.insert('1.0', self.test_string) + text.mark_set('insert', '1.0') + self.formatter('ParameterDoesNothing', limit=70) + result = text.get('1.0', 'insert') + # find function includes \n + expected = ( +" '''this is a test of a reformat for a triple quoted string will it\n" +" reformat to less than 70 characters for me?'''\n") # yes + self.assertEqual(result, expected) + text.delete('1.0', 'end') + + # Select from 1.11 to line end. + text.insert('1.0', self.test_string) + text.tag_add('sel', '1.11', '1.end') + self.formatter('ParameterDoesNothing', limit=70) + result = text.get('1.0', 'insert') + # selection excludes \n + expected = ( +" '''this is a test of a reformat for a triple quoted string will it reformat\n" +" to less than 70 characters for me?'''") # no + self.assertEqual(result, expected) + text.delete('1.0', 'end') + + def test_multiple_lines(self): + text = self.text + # Select 2 long lines. + text.insert('1.0', self.multiline_test_string) + text.tag_add('sel', '2.0', '4.0') + self.formatter('ParameterDoesNothing', limit=70) + result = text.get('2.0', 'insert') + expected = ( +" The second line's length is way over the max width. It goes on and\n" +" on until it is over 100 characters long. Same thing with the third\n" +" line. It is also way over the max width, but FormatParagraph will\n" +" fix it.\n") + self.assertEqual(result, expected) + text.delete('1.0', 'end') + + def test_comment_block(self): + text = self.text + + # Set cursor ('insert') to '1.0', within block. + text.insert('1.0', self.multiline_test_comment) + self.formatter('ParameterDoesNothing', limit=70) + result = text.get('1.0', 'insert') + expected = ( +"# The first line is under the max width. The second line's length is\n" +"# way over the max width. It goes on and on until it is over 100\n" +"# characters long. Same thing with the third line. It is also way over\n" +"# the max width, but FormatParagraph will fix it. The fourth line is\n" +"# short like the first line.\n") + self.assertEqual(result, expected) + text.delete('1.0', 'end') + + # Select line 2, verify line 1 unaffected. + text.insert('1.0', self.multiline_test_comment) + text.tag_add('sel', '2.0', '3.0') + self.formatter('ParameterDoesNothing', limit=70) + result = text.get('1.0', 'insert') + expected = ( +"# The first line is under the max width.\n" +"# The second line's length is way over the max width. It goes on and\n" +"# on until it is over 100 characters long.\n") + self.assertEqual(result, expected) + text.delete('1.0', 'end') + +# The following block worked with EditorWindow but fails with the mock. +# Lines 2 and 3 get pasted together even though the previous block left +# the previous line alone. More investigation is needed. +## # Select lines 3 and 4 +## text.insert('1.0', self.multiline_test_comment) +## text.tag_add('sel', '3.0', '5.0') +## self.formatter('ParameterDoesNothing') +## result = text.get('3.0', 'insert') +## expected = ( +##"# Same thing with the third line. It is also way over the max width,\n" +##"# but FormatParagraph will fix it. The fourth line is short like the\n" +##"# first line.\n") +## self.assertEqual(result, expected) +## text.delete('1.0', 'end') + + +class DummyEditwin: + def __init__(self, root, text): + self.root = root + self.text = text + self.indentwidth = 4 + self.tabwidth = 4 + self.usetabs = False + self.context_use_ps1 = True + + _make_blanks = EditorWindow._make_blanks + get_selection_indices = EditorWindow.get_selection_indices + + +class FormatRegionTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.text.undo_block_start = mock.Mock() + cls.text.undo_block_stop = mock.Mock() + cls.editor = DummyEditwin(cls.root, cls.text) + cls.formatter = ft.FormatRegion(cls.editor) + + @classmethod + def tearDownClass(cls): + del cls.text, cls.formatter, cls.editor + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.insert('1.0', self.code_sample) + + def tearDown(self): + self.text.delete('1.0', 'end') + + code_sample = """\ +# WS line needed for test. +class C1: + # Class comment. + def __init__(self, a, b): + self.a = a + self.b = b + + def compare(self): + if a > b: + return a + elif a < b: + return b + else: + return None +""" + + def test_get_region(self): + get = self.formatter.get_region + text = self.text + eq = self.assertEqual + + # Add selection. + text.tag_add('sel', '7.0', '10.0') + expected_lines = ['', + ' def compare(self):', + ' if a > b:', + ''] + eq(get(), ('7.0', '10.0', '\n'.join(expected_lines), expected_lines)) + + # Remove selection. + text.tag_remove('sel', '1.0', 'end') + eq(get(), ('15.0', '16.0', '\n', ['', ''])) + + def test_set_region(self): + set_ = self.formatter.set_region + text = self.text + eq = self.assertEqual + + save_bell = text.bell + text.bell = mock.Mock() + line6 = self.code_sample.splitlines()[5] + line10 = self.code_sample.splitlines()[9] + + text.tag_add('sel', '6.0', '11.0') + head, tail, chars, lines = self.formatter.get_region() + + # No changes. + set_(head, tail, chars, lines) + text.bell.assert_called_once() + eq(text.get('6.0', '11.0'), chars) + eq(text.get('sel.first', 'sel.last'), chars) + text.tag_remove('sel', '1.0', 'end') + + # Alter selected lines by changing lines and adding a newline. + newstring = 'added line 1\n\n\n\n' + newlines = newstring.split('\n') + set_('7.0', '10.0', chars, newlines) + # Selection changed. + eq(text.get('sel.first', 'sel.last'), newstring) + # Additional line added, so last index is changed. + eq(text.get('7.0', '11.0'), newstring) + # Before and after lines unchanged. + eq(text.get('6.0', '7.0-1c'), line6) + eq(text.get('11.0', '12.0-1c'), line10) + text.tag_remove('sel', '1.0', 'end') + + text.bell = save_bell + + def test_indent_region_event(self): + indent = self.formatter.indent_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + indent() + # Blank lines aren't affected by indent. + eq(text.get('7.0', '10.0'), ('\n def compare(self):\n if a > b:\n')) + + def test_dedent_region_event(self): + dedent = self.formatter.dedent_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + dedent() + # Blank lines aren't affected by dedent. + eq(text.get('7.0', '10.0'), ('\ndef compare(self):\n if a > b:\n')) + + def test_comment_region_event(self): + comment = self.formatter.comment_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + comment() + eq(text.get('7.0', '10.0'), ('##\n## def compare(self):\n## if a > b:\n')) + + def test_uncomment_region_event(self): + comment = self.formatter.comment_region_event + uncomment = self.formatter.uncomment_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + comment() + uncomment() + eq(text.get('7.0', '10.0'), ('\n def compare(self):\n if a > b:\n')) + + # Only remove comments at the beginning of a line. + text.tag_remove('sel', '1.0', 'end') + text.tag_add('sel', '3.0', '4.0') + uncomment() + eq(text.get('3.0', '3.end'), (' # Class comment.')) + + self.formatter.set_region('3.0', '4.0', '', ['# Class comment.', '']) + uncomment() + eq(text.get('3.0', '3.end'), (' Class comment.')) + + @mock.patch.object(ft.FormatRegion, "_asktabwidth") + def test_tabify_region_event(self, _asktabwidth): + tabify = self.formatter.tabify_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + # No tabwidth selected. + _asktabwidth.return_value = None + self.assertIsNone(tabify()) + + _asktabwidth.return_value = 3 + self.assertIsNotNone(tabify()) + eq(text.get('7.0', '10.0'), ('\n\t def compare(self):\n\t\t if a > b:\n')) + + @mock.patch.object(ft.FormatRegion, "_asktabwidth") + def test_untabify_region_event(self, _asktabwidth): + untabify = self.formatter.untabify_region_event + text = self.text + eq = self.assertEqual + + text.tag_add('sel', '7.0', '10.0') + # No tabwidth selected. + _asktabwidth.return_value = None + self.assertIsNone(untabify()) + + _asktabwidth.return_value = 2 + self.formatter.tabify_region_event() + _asktabwidth.return_value = 3 + self.assertIsNotNone(untabify()) + eq(text.get('7.0', '10.0'), ('\n def compare(self):\n if a > b:\n')) + + @mock.patch.object(ft, "askinteger") + def test_ask_tabwidth(self, askinteger): + ask = self.formatter._asktabwidth + askinteger.return_value = 10 + self.assertEqual(ask(), 10) + + +class IndentsTest(unittest.TestCase): + + @mock.patch.object(ft, "askyesno") + def test_toggle_tabs(self, askyesno): + editor = DummyEditwin(None, None) # usetabs == False. + indents = ft.Indents(editor) + askyesno.return_value = True + + indents.toggle_tabs_event(None) + self.assertEqual(editor.usetabs, True) + self.assertEqual(editor.indentwidth, 8) + + indents.toggle_tabs_event(None) + self.assertEqual(editor.usetabs, False) + self.assertEqual(editor.indentwidth, 8) + + @mock.patch.object(ft, "askinteger") + def test_change_indentwidth(self, askinteger): + editor = DummyEditwin(None, None) # indentwidth == 4. + indents = ft.Indents(editor) + + askinteger.return_value = None + indents.change_indentwidth_event(None) + self.assertEqual(editor.indentwidth, 4) + + askinteger.return_value = 3 + indents.change_indentwidth_event(None) + self.assertEqual(editor.indentwidth, 3) + + askinteger.return_value = 5 + editor.usetabs = True + indents.change_indentwidth_event(None) + self.assertEqual(editor.indentwidth, 3) + + +class RstripTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.editor = MockEditor(text=cls.text) + cls.do_rstrip = ft.Rstrip(cls.editor).do_rstrip + + @classmethod + def tearDownClass(cls): + del cls.text, cls.do_rstrip, cls.editor + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def tearDown(self): + self.text.delete('1.0', 'end-1c') + + def test_rstrip_lines(self): + original = ( + "Line with an ending tab \n" + "Line ending in 5 spaces \n" + "Linewithnospaces\n" + " indented line\n" + " indented line with trailing space \n" + " \n") + stripped = ( + "Line with an ending tab\n" + "Line ending in 5 spaces\n" + "Linewithnospaces\n" + " indented line\n" + " indented line with trailing space\n") + + self.text.insert('1.0', original) + self.do_rstrip() + self.assertEqual(self.text.get('1.0', 'insert'), stripped) + + def test_rstrip_end(self): + text = self.text + for code in ('', '\n', '\n\n\n'): + with self.subTest(code=code): + text.insert('1.0', code) + self.do_rstrip() + self.assertEqual(text.get('1.0','end-1c'), '') + for code in ('a\n', 'a\n\n', 'a\n\n\n'): + with self.subTest(code=code): + text.delete('1.0', 'end-1c') + text.insert('1.0', code) + self.do_rstrip() + self.assertEqual(text.get('1.0','end-1c'), 'a\n') + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_grep.py b/micromamba_root/Lib/idlelib/idle_test/test_grep.py new file mode 100644 index 0000000000000000000000000000000000000000..d67dba76911fcfa96bc8826d1cfbf38135a6cce2 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_grep.py @@ -0,0 +1,156 @@ +""" !Changing this line will break Test_findfile.test_found! +Non-gui unit tests for grep.GrepDialog methods. +dummy_command calls grep_it calls findfiles. +An exception raised in one method will fail callers. +Otherwise, tests are mostly independent. +Currently only test grep_it, coverage 51%. +""" +from idlelib import grep +import unittest +from test.support import captured_stdout +from idlelib.idle_test.mock_tk import Var +import os +import re + + +class Dummy_searchengine: + '''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the + passed in SearchEngine instance as attribute 'engine'. Only a few of the + many possible self.engine.x attributes are needed here. + ''' + def getpat(self): + return self._pat + +searchengine = Dummy_searchengine() + + +class Dummy_grep: + # Methods tested + #default_command = GrepDialog.default_command + grep_it = grep.GrepDialog.grep_it + # Other stuff needed + recvar = Var(False) + engine = searchengine + def close(self): # gui method + pass + +_grep = Dummy_grep() + + +class FindfilesTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.realpath = os.path.realpath(__file__) + cls.path = os.path.dirname(cls.realpath) + + @classmethod + def tearDownClass(cls): + del cls.realpath, cls.path + + def test_invaliddir(self): + with captured_stdout() as s: + filelist = list(grep.findfiles('invaliddir', '*.*', False)) + self.assertEqual(filelist, []) + self.assertIn('invalid', s.getvalue()) + + def test_curdir(self): + # Test os.curdir. + ff = grep.findfiles + save_cwd = os.getcwd() + os.chdir(self.path) + filename = 'test_grep.py' + filelist = list(ff(os.curdir, filename, False)) + self.assertIn(os.path.join(os.curdir, filename), filelist) + os.chdir(save_cwd) + + def test_base(self): + ff = grep.findfiles + readme = os.path.join(self.path, 'README.txt') + + # Check for Python files in path where this file lives. + filelist = list(ff(self.path, '*.py', False)) + # This directory has many Python files. + self.assertGreater(len(filelist), 10) + self.assertIn(self.realpath, filelist) + self.assertNotIn(readme, filelist) + + # Look for .txt files in path where this file lives. + filelist = list(ff(self.path, '*.txt', False)) + self.assertNotEqual(len(filelist), 0) + self.assertNotIn(self.realpath, filelist) + self.assertIn(readme, filelist) + + # Look for non-matching pattern. + filelist = list(ff(self.path, 'grep.*', False)) + self.assertEqual(len(filelist), 0) + self.assertNotIn(self.realpath, filelist) + + def test_recurse(self): + ff = grep.findfiles + parent = os.path.dirname(self.path) + grepfile = os.path.join(parent, 'grep.py') + pat = '*.py' + + # Get Python files only in parent directory. + filelist = list(ff(parent, pat, False)) + parent_size = len(filelist) + # Lots of Python files in idlelib. + self.assertGreater(parent_size, 20) + self.assertIn(grepfile, filelist) + # Without subdirectories, this file isn't returned. + self.assertNotIn(self.realpath, filelist) + + # Include subdirectories. + filelist = list(ff(parent, pat, True)) + # More files found now. + self.assertGreater(len(filelist), parent_size) + self.assertIn(grepfile, filelist) + # This file exists in list now. + self.assertIn(self.realpath, filelist) + + # Check another level up the tree. + parent = os.path.dirname(parent) + filelist = list(ff(parent, '*.py', True)) + self.assertIn(self.realpath, filelist) + + +class Grep_itTest(unittest.TestCase): + # Test captured reports with 0 and some hits. + # Should test file names, but Windows reports have mixed / and \ separators + # from incomplete replacement, so 'later'. + + def report(self, pat): + _grep.engine._pat = pat + with captured_stdout() as s: + _grep.grep_it(re.compile(pat), __file__) + lines = s.getvalue().split('\n') + lines.pop() # remove bogus '' after last \n + return lines + + def test_unfound(self): + pat = 'xyz*'*7 + lines = self.report(pat) + self.assertEqual(len(lines), 2) + self.assertIn(pat, lines[0]) + self.assertEqual(lines[1], 'No hits.') + + def test_found(self): + + pat = '""" !Changing this line will break Test_findfile.test_found!' + lines = self.report(pat) + self.assertEqual(len(lines), 5) + self.assertIn(pat, lines[0]) + self.assertIn('py: 1:', lines[1]) # line number 1 + self.assertIn('2', lines[3]) # hits found 2 + self.assertStartsWith(lines[4], '(Hint:') + + +class Default_commandTest(unittest.TestCase): + # To write this, move outwin import to top of GrepDialog + # so it can be replaced by captured_stdout in class setup/teardown. + pass + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_help.py b/micromamba_root/Lib/idlelib/idle_test/test_help.py new file mode 100644 index 0000000000000000000000000000000000000000..ebb02b5c0d8356a89c70acc64de226064ef7e63d --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_help.py @@ -0,0 +1,36 @@ +"Test help, coverage 94%." + +from idlelib import help +import unittest +from test.support import requires +requires('gui') +from os.path import abspath, dirname, join +from tkinter import Tk + + +class IdleDocTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + "By itself, this tests that file parsed without exception." + cls.root = root = Tk() + root.withdraw() + cls.window = help.show_idlehelp(root) + + @classmethod + def tearDownClass(cls): + del cls.window + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_1window(self): + self.assertIn('IDLE Doc', self.window.wm_title()) + + def test_4text(self): + text = self.window.frame.text + self.assertEqual(text.get('1.0', '1.end'), ' IDLE — Python editor and shell ') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_help_about.py b/micromamba_root/Lib/idlelib/idle_test/test_help_about.py new file mode 100644 index 0000000000000000000000000000000000000000..7e16abdb7c9f96f1a939ec0d27f0cb426922f6d9 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_help_about.py @@ -0,0 +1,182 @@ +"""Test help_about, coverage 100%. +help_about.build_bits branches on sys.platform='darwin'. +'100% combines coverage on Mac and others. +""" + +from idlelib import help_about +import unittest +from test.support import requires, findfile +from tkinter import Tk, TclError +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox_func +from idlelib import textview +import os.path +from platform import python_version + +About = help_about.AboutDialog + + +class LiveDialogTest(unittest.TestCase): + """Simulate user clicking buttons other than [Close]. + + Test that invoked textview has text from source. + """ + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = About(cls.root, 'About IDLE', _utest=True) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_build_bits(self): + self.assertIn(help_about.bits, ('32', '64')) + + def test_dialog_title(self): + """Test about dialog title""" + self.assertEqual(self.dialog.title(), 'About IDLE') + + def test_dialog_logo(self): + """Test about dialog logo.""" + path, file = os.path.split(self.dialog.icon_image['file']) + fn, ext = os.path.splitext(file) + self.assertEqual(fn, 'idle_48') + + def test_printer_buttons(self): + """Test buttons whose commands use printer function.""" + dialog = self.dialog + button_sources = [(dialog.py_license, license, 'license'), + (dialog.py_copyright, copyright, 'copyright'), + (dialog.py_credits, credits, 'credits')] + + for button, printer, name in button_sources: + with self.subTest(name=name): + printer._Printer__setup() + button.invoke() + get = dialog._current_textview.viewframe.textframe.text.get + lines = printer._Printer__lines + if len(lines) < 2: + self.fail(name + ' full text was not found') + self.assertEqual(lines[0], get('1.0', '1.end')) + self.assertEqual(lines[1], get('2.0', '2.end')) + dialog._current_textview.destroy() + + def test_file_buttons(self): + """Test buttons that display files.""" + dialog = self.dialog + button_sources = [(self.dialog.readme, 'README.txt', 'readme'), + (self.dialog.idle_news, 'News3.txt', 'news'), + (self.dialog.idle_credits, 'CREDITS.txt', 'credits')] + + for button, filename, name in button_sources: + with self.subTest(name=name): + button.invoke() + fn = findfile(filename, subdir='idlelib') + get = dialog._current_textview.viewframe.textframe.text.get + with open(fn, encoding='utf-8') as f: + self.assertEqual(f.readline().strip(), get('1.0', '1.end')) + f.readline() + self.assertEqual(f.readline().strip(), get('3.0', '3.end')) + dialog._current_textview.destroy() + + +class DefaultTitleTest(unittest.TestCase): + "Test default title." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = About(cls.root, _utest=True) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_dialog_title(self): + """Test about dialog title""" + self.assertEqual(self.dialog.title(), + f'About IDLE {python_version()}' + f' ({help_about.bits} bit)') + + +class CloseTest(unittest.TestCase): + """Simulate user clicking [Close] button""" + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.dialog = About(cls.root, 'About IDLE', _utest=True) + + @classmethod + def tearDownClass(cls): + del cls.dialog + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_close(self): + self.assertEqual(self.dialog.winfo_class(), 'Toplevel') + self.dialog.button_ok.invoke() + with self.assertRaises(TclError): + self.dialog.winfo_class() + + +class Dummy_about_dialog: + # Dummy class for testing file display functions. + idle_credits = About.show_idle_credits + idle_readme = About.show_readme + idle_news = About.show_idle_news + # Called by the above + display_file_text = About.display_file_text + _utest = True + + +class DisplayFileTest(unittest.TestCase): + """Test functions that display files. + + While somewhat redundant with gui-based test_file_dialog, + these unit tests run on all buildbots, not just a few. + """ + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_error = textview.showerror + cls.orig_view = textview.view_text + cls.error = Mbox_func() + cls.view = Func() + textview.showerror = cls.error + textview.view_text = cls.view + + @classmethod + def tearDownClass(cls): + textview.showerror = cls.orig_error + textview.view_text = cls.orig_view + + def test_file_display(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.error.message = '' + self.view.called = False + with self.subTest(handler=handler): + handler() + self.assertEqual(self.error.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_history.py b/micromamba_root/Lib/idlelib/idle_test/test_history.py new file mode 100644 index 0000000000000000000000000000000000000000..675396514447514ff9c6811d095fe054fef589b0 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_history.py @@ -0,0 +1,172 @@ +" Test history, coverage 100%." + +from idlelib.history import History +import unittest +from test.support import requires + +import tkinter as tk +from tkinter import Text as tkText +from idlelib.idle_test.mock_tk import Text as mkText +from idlelib.config import idleConf + +line1 = 'a = 7' +line2 = 'b = a' + + +class StoreTest(unittest.TestCase): + '''Tests History.__init__ and History.store with mock Text''' + + @classmethod + def setUpClass(cls): + cls.text = mkText() + cls.history = History(cls.text) + + def tearDown(self): + self.text.delete('1.0', 'end') + self.history.history = [] + + def test_init(self): + self.assertIs(self.history.text, self.text) + self.assertEqual(self.history.history, []) + self.assertIsNone(self.history.prefix) + self.assertIsNone(self.history.pointer) + self.assertEqual(self.history.cyclic, + idleConf.GetOption("main", "History", "cyclic", 1, "bool")) + + def test_store_short(self): + self.history.store('a') + self.assertEqual(self.history.history, []) + self.history.store(' a ') + self.assertEqual(self.history.history, []) + + def test_store_dup(self): + self.history.store(line1) + self.assertEqual(self.history.history, [line1]) + self.history.store(line2) + self.assertEqual(self.history.history, [line1, line2]) + self.history.store(line1) + self.assertEqual(self.history.history, [line2, line1]) + + def test_store_reset(self): + self.history.prefix = line1 + self.history.pointer = 0 + self.history.store(line2) + self.assertIsNone(self.history.prefix) + self.assertIsNone(self.history.pointer) + + +class TextWrapper: + def __init__(self, master): + self.text = tkText(master=master) + self._bell = False + def __getattr__(self, name): + return getattr(self.text, name) + def bell(self): + self._bell = True + + +class FetchTest(unittest.TestCase): + '''Test History.fetch with wrapped tk.Text. + ''' + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.root.withdraw() + + def setUp(self): + self.text = text = TextWrapper(self.root) + text.insert('1.0', ">>> ") + text.mark_set('iomark', '1.4') + text.mark_gravity('iomark', 'left') + self.history = History(text) + self.history.history = [line1, line2] + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def fetch_test(self, reverse, line, prefix, index, *, bell=False): + # Perform one fetch as invoked by Alt-N or Alt-P + # Test the result. The line test is the most important. + # The last two are diagnostic of fetch internals. + History = self.history + History.fetch(reverse) + + Equal = self.assertEqual + Equal(self.text.get('iomark', 'end-1c'), line) + Equal(self.text._bell, bell) + if bell: + self.text._bell = False + Equal(History.prefix, prefix) + Equal(History.pointer, index) + Equal(self.text.compare("insert", '==', "end-1c"), 1) + + def test_fetch_prev_cyclic(self): + prefix = '' + test = self.fetch_test + test(True, line2, prefix, 1) + test(True, line1, prefix, 0) + test(True, prefix, None, None, bell=True) + + def test_fetch_next_cyclic(self): + prefix = '' + test = self.fetch_test + test(False, line1, prefix, 0) + test(False, line2, prefix, 1) + test(False, prefix, None, None, bell=True) + + # Prefix 'a' tests skip line2, which starts with 'b' + def test_fetch_prev_prefix(self): + prefix = 'a' + self.text.insert('iomark', prefix) + self.fetch_test(True, line1, prefix, 0) + self.fetch_test(True, prefix, None, None, bell=True) + + def test_fetch_next_prefix(self): + prefix = 'a' + self.text.insert('iomark', prefix) + self.fetch_test(False, line1, prefix, 0) + self.fetch_test(False, prefix, None, None, bell=True) + + def test_fetch_prev_noncyclic(self): + prefix = '' + self.history.cyclic = False + test = self.fetch_test + test(True, line2, prefix, 1) + test(True, line1, prefix, 0) + test(True, line1, prefix, 0, bell=True) + + def test_fetch_next_noncyclic(self): + prefix = '' + self.history.cyclic = False + test = self.fetch_test + test(False, prefix, None, None, bell=True) + test(True, line2, prefix, 1) + test(False, prefix, None, None, bell=True) + test(False, prefix, None, None, bell=True) + + def test_fetch_cursor_move(self): + # Move cursor after fetch + self.history.fetch(reverse=True) # initialization + self.text.mark_set('insert', 'iomark') + self.fetch_test(True, line2, None, None, bell=True) + + def test_fetch_edit(self): + # Edit after fetch + self.history.fetch(reverse=True) # initialization + self.text.delete('iomark', 'insert', ) + self.text.insert('iomark', 'a =') + self.fetch_test(True, line1, 'a =', 0) # prefix is reset + + def test_history_prev_next(self): + # Minimally test functions bound to events + self.history.history_prev('dummy event') + self.assertEqual(self.history.pointer, 1) + self.history.history_next('dummy event') + self.assertEqual(self.history.pointer, None) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_hyperparser.py b/micromamba_root/Lib/idlelib/idle_test/test_hyperparser.py new file mode 100644 index 0000000000000000000000000000000000000000..343843c4166e97dcab123c4b9835341e15f65739 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_hyperparser.py @@ -0,0 +1,276 @@ +"Test hyperparser, coverage 98%." + +from idlelib.hyperparser import HyperParser +import unittest +from test.support import requires +from tkinter import Tk, Text +from idlelib.editor import EditorWindow + +class DummyEditwin: + def __init__(self, text): + self.text = text + self.indentwidth = 8 + self.tabwidth = 8 + self.prompt_last_line = '>>>' + self.num_context_lines = 50, 500, 1000 + + _build_char_in_string_func = EditorWindow._build_char_in_string_func + is_char_in_string = EditorWindow.is_char_in_string + + +class HyperParserTest(unittest.TestCase): + code = ( + '"""This is a module docstring"""\n' + '# this line is a comment\n' + 'x = "this is a string"\n' + "y = 'this is also a string'\n" + 'l = [i for i in range(10)]\n' + 'm = [py*py for # comment\n' + ' py in l]\n' + 'x.__len__\n' + "z = ((r'asdf')+('a')))\n" + '[x for x in\n' + 'for = False\n' + 'cliché = "this is a string with unicode, what a cliché"' + ) + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.editwin = DummyEditwin(cls.text) + + @classmethod + def tearDownClass(cls): + del cls.text, cls.editwin + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.insert('insert', self.code) + + def tearDown(self): + self.text.delete('1.0', 'end') + self.editwin.prompt_last_line = '>>>' + + def get_parser(self, index): + """ + Return a parser object with index at 'index' + """ + return HyperParser(self.editwin, index) + + def test_init(self): + """ + test corner cases in the init method + """ + with self.assertRaises(ValueError) as ve: + self.text.tag_add('console', '1.0', '1.end') + p = self.get_parser('1.5') + self.assertIn('precedes', str(ve.exception)) + + # test without ps1 + self.editwin.prompt_last_line = '' + + # number of lines lesser than 50 + p = self.get_parser('end') + self.assertEqual(p.rawtext, self.text.get('1.0', 'end')) + + # number of lines greater than 50 + self.text.insert('end', self.text.get('1.0', 'end')*4) + p = self.get_parser('54.5') + + def test_is_in_string(self): + get = self.get_parser + + p = get('1.0') + self.assertFalse(p.is_in_string()) + p = get('1.4') + self.assertTrue(p.is_in_string()) + p = get('2.3') + self.assertFalse(p.is_in_string()) + p = get('3.3') + self.assertFalse(p.is_in_string()) + p = get('3.7') + self.assertTrue(p.is_in_string()) + p = get('4.6') + self.assertTrue(p.is_in_string()) + p = get('12.54') + self.assertTrue(p.is_in_string()) + + def test_is_in_code(self): + get = self.get_parser + + p = get('1.0') + self.assertTrue(p.is_in_code()) + p = get('1.1') + self.assertFalse(p.is_in_code()) + p = get('2.5') + self.assertFalse(p.is_in_code()) + p = get('3.4') + self.assertTrue(p.is_in_code()) + p = get('3.6') + self.assertFalse(p.is_in_code()) + p = get('4.14') + self.assertFalse(p.is_in_code()) + + def test_get_surrounding_bracket(self): + get = self.get_parser + + def without_mustclose(parser): + # a utility function to get surrounding bracket + # with mustclose=False + return parser.get_surrounding_brackets(mustclose=False) + + def with_mustclose(parser): + # a utility function to get surrounding bracket + # with mustclose=True + return parser.get_surrounding_brackets(mustclose=True) + + p = get('3.2') + self.assertIsNone(with_mustclose(p)) + self.assertIsNone(without_mustclose(p)) + + p = get('5.6') + self.assertTupleEqual(without_mustclose(p), ('5.4', '5.25')) + self.assertTupleEqual(without_mustclose(p), with_mustclose(p)) + + p = get('5.23') + self.assertTupleEqual(without_mustclose(p), ('5.21', '5.24')) + self.assertTupleEqual(without_mustclose(p), with_mustclose(p)) + + p = get('6.15') + self.assertTupleEqual(without_mustclose(p), ('6.4', '6.end')) + self.assertIsNone(with_mustclose(p)) + + p = get('9.end') + self.assertIsNone(with_mustclose(p)) + self.assertIsNone(without_mustclose(p)) + + def test_get_expression(self): + get = self.get_parser + + p = get('4.2') + self.assertEqual(p.get_expression(), 'y ') + + p = get('4.7') + with self.assertRaises(ValueError) as ve: + p.get_expression() + self.assertIn('is inside a code', str(ve.exception)) + + p = get('5.25') + self.assertEqual(p.get_expression(), 'range(10)') + + p = get('6.7') + self.assertEqual(p.get_expression(), 'py') + + p = get('6.8') + self.assertEqual(p.get_expression(), '') + + p = get('7.9') + self.assertEqual(p.get_expression(), 'py') + + p = get('8.end') + self.assertEqual(p.get_expression(), 'x.__len__') + + p = get('9.13') + self.assertEqual(p.get_expression(), "r'asdf'") + + p = get('9.17') + with self.assertRaises(ValueError) as ve: + p.get_expression() + self.assertIn('is inside a code', str(ve.exception)) + + p = get('10.0') + self.assertEqual(p.get_expression(), '') + + p = get('10.6') + self.assertEqual(p.get_expression(), '') + + p = get('10.11') + self.assertEqual(p.get_expression(), '') + + p = get('11.3') + self.assertEqual(p.get_expression(), '') + + p = get('11.11') + self.assertEqual(p.get_expression(), 'False') + + p = get('12.6') + self.assertEqual(p.get_expression(), 'cliché') + + def test_eat_identifier(self): + def is_valid_id(candidate): + result = HyperParser._eat_identifier(candidate, 0, len(candidate)) + if result == len(candidate): + return True + elif result == 0: + return False + else: + err_msg = "Unexpected result: {} (expected 0 or {}".format( + result, len(candidate) + ) + raise Exception(err_msg) + + # invalid first character which is valid elsewhere in an identifier + self.assertFalse(is_valid_id('2notid')) + + # ASCII-only valid identifiers + self.assertTrue(is_valid_id('valid_id')) + self.assertTrue(is_valid_id('_valid_id')) + self.assertTrue(is_valid_id('valid_id_')) + self.assertTrue(is_valid_id('_2valid_id')) + + # keywords which should be "eaten" + self.assertTrue(is_valid_id('True')) + self.assertTrue(is_valid_id('False')) + self.assertTrue(is_valid_id('None')) + + # keywords which should not be "eaten" + self.assertFalse(is_valid_id('for')) + self.assertFalse(is_valid_id('import')) + self.assertFalse(is_valid_id('return')) + + # valid unicode identifiers + self.assertTrue(is_valid_id('cliche')) + self.assertTrue(is_valid_id('cliché')) + self.assertTrue(is_valid_id('a٢')) + + # invalid unicode identifiers + self.assertFalse(is_valid_id('2a')) + self.assertFalse(is_valid_id('٢a')) + self.assertFalse(is_valid_id('a²')) + + # valid identifier after "punctuation" + self.assertEqual(HyperParser._eat_identifier('+ var', 0, 5), len('var')) + self.assertEqual(HyperParser._eat_identifier('+var', 0, 4), len('var')) + self.assertEqual(HyperParser._eat_identifier('.var', 0, 4), len('var')) + + # invalid identifiers + self.assertFalse(is_valid_id('+')) + self.assertFalse(is_valid_id(' ')) + self.assertFalse(is_valid_id(':')) + self.assertFalse(is_valid_id('?')) + self.assertFalse(is_valid_id('^')) + self.assertFalse(is_valid_id('\\')) + self.assertFalse(is_valid_id('"')) + self.assertFalse(is_valid_id('"a string"')) + + def test_eat_identifier_various_lengths(self): + eat_id = HyperParser._eat_identifier + + for length in range(1, 21): + self.assertEqual(eat_id('a' * length, 0, length), length) + self.assertEqual(eat_id('é' * length, 0, length), length) + self.assertEqual(eat_id('a' + '2' * (length - 1), 0, length), length) + self.assertEqual(eat_id('é' + '2' * (length - 1), 0, length), length) + self.assertEqual(eat_id('é' + 'a' * (length - 1), 0, length), length) + self.assertEqual(eat_id('é' * (length - 1) + 'a', 0, length), length) + self.assertEqual(eat_id('+' * length, 0, length), 0) + self.assertEqual(eat_id('2' + 'a' * (length - 1), 0, length), 0) + self.assertEqual(eat_id('2' + 'é' * (length - 1), 0, length), 0) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_iomenu.py b/micromamba_root/Lib/idlelib/idle_test/test_iomenu.py new file mode 100644 index 0000000000000000000000000000000000000000..e0642cf0cabef0470424d9e04cfc4aa68c4adb26 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_iomenu.py @@ -0,0 +1,84 @@ +"Test , coverage 17%." + +from idlelib import iomenu +import unittest +from test.support import requires +from tkinter import Tk +from idlelib.editor import EditorWindow +from idlelib import util +from idlelib.idle_test.mock_idle import Func + +# Fail if either tokenize.open and t.detect_encoding does not exist. +# These are used in loadfile and encode. +# Also used in pyshell.MI.execfile and runscript.tabnanny. +from tokenize import open, detect_encoding +# Remove when we have proper tests that use both. + + +class IOBindingTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.editwin = EditorWindow(root=cls.root) + cls.io = iomenu.IOBinding(cls.editwin) + + @classmethod + def tearDownClass(cls): + cls.io.close() + cls.editwin._close() + del cls.editwin + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + self.assertIs(self.io.editwin, self.editwin) + + def test_fixnewlines_end(self): + eq = self.assertEqual + io = self.io + fix = io.fixnewlines + text = io.editwin.text + + # Make the editor temporarily look like Shell. + self.editwin.interp = None + shelltext = '>>> if 1' + self.editwin.get_prompt_text = Func(result=shelltext) + eq(fix(), shelltext) # Get... call and '\n' not added. + del self.editwin.interp, self.editwin.get_prompt_text + + text.insert(1.0, 'a') + eq(fix(), 'a'+io.eol_convention) + eq(text.get('1.0', 'end-1c'), 'a\n') + eq(fix(), 'a'+io.eol_convention) + + +def _extension_in_filetypes(extension): + return any( + f'*{extension}' in filetype_tuple[1] + for filetype_tuple in iomenu.IOBinding.filetypes + ) + + +class FiletypesTest(unittest.TestCase): + def test_python_source_files(self): + for extension in util.py_extensions: + with self.subTest(extension=extension): + self.assertTrue( + _extension_in_filetypes(extension) + ) + + def test_text_files(self): + self.assertTrue(_extension_in_filetypes('.txt')) + + def test_all_files(self): + self.assertTrue(_extension_in_filetypes('')) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_macosx.py b/micromamba_root/Lib/idlelib/idle_test/test_macosx.py new file mode 100644 index 0000000000000000000000000000000000000000..86da8849e5ca00f55affd806b4b89e74f55fdcb5 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_macosx.py @@ -0,0 +1,113 @@ +"Test macosx, coverage 45% on Windows." + +from idlelib import macosx +import unittest +from test.support import requires +import tkinter as tk +import unittest.mock as mock +from idlelib.filelist import FileList + +mactypes = {'carbon', 'cocoa', 'xquartz'} +nontypes = {'other'} +alltypes = mactypes | nontypes + + +def setUpModule(): + global orig_tktype + orig_tktype = macosx._tk_type + + +def tearDownModule(): + macosx._tk_type = orig_tktype + + +class InitTktypeTest(unittest.TestCase): + "Test _init_tk_type." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.root.withdraw() + cls.orig_platform = macosx.platform + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + macosx.platform = cls.orig_platform + + def test_init_sets_tktype(self): + "Test that _init_tk_type sets _tk_type according to platform." + for platform, types in ('darwin', alltypes), ('other', nontypes): + with self.subTest(platform=platform): + macosx.platform = platform + macosx._tk_type = None + macosx._init_tk_type() + self.assertIn(macosx._tk_type, types) + + +class IsTypeTkTest(unittest.TestCase): + "Test each of the four isTypeTk predecates." + isfuncs = ((macosx.isAquaTk, ('carbon', 'cocoa')), + (macosx.isCarbonTk, ('carbon')), + (macosx.isCocoaTk, ('cocoa')), + (macosx.isXQuartz, ('xquartz')), + ) + + @mock.patch('idlelib.macosx._init_tk_type') + def test_is_calls_init(self, mockinit): + "Test that each isTypeTk calls _init_tk_type when _tk_type is None." + macosx._tk_type = None + for func, whentrue in self.isfuncs: + with self.subTest(func=func): + func() + self.assertTrue(mockinit.called) + mockinit.reset_mock() + + def test_isfuncs(self): + "Test that each isTypeTk return correct bool." + for func, whentrue in self.isfuncs: + for tktype in alltypes: + with self.subTest(func=func, whentrue=whentrue, tktype=tktype): + macosx._tk_type = tktype + (self.assertTrue if tktype in whentrue else self.assertFalse)\ + (func()) + + +class SetupTest(unittest.TestCase): + "Test setupApp." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.root.withdraw() + def cmd(tkpath, func): + assert isinstance(tkpath, str) + assert isinstance(func, type(cmd)) + cls.root.createcommand = cmd + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + @mock.patch('idlelib.macosx.overrideRootMenu') #27312 + def test_setupapp(self, overrideRootMenu): + "Call setupApp with each possible graphics type." + root = self.root + flist = FileList(root) + for tktype in alltypes: + with self.subTest(tktype=tktype): + macosx._tk_type = tktype + macosx.setupApp(root, flist) + if tktype in ('carbon', 'cocoa'): + self.assertTrue(overrideRootMenu.called) + overrideRootMenu.reset_mock() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_mainmenu.py b/micromamba_root/Lib/idlelib/idle_test/test_mainmenu.py new file mode 100644 index 0000000000000000000000000000000000000000..51d2accfe48a1c738b73509563d21bc59e5d3a12 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_mainmenu.py @@ -0,0 +1,42 @@ +"Test mainmenu, coverage 100%." +# Reported as 88%; mocking turtledemo absence would have no point. + +from idlelib import mainmenu +import re +import unittest + + +class MainMenuTest(unittest.TestCase): + + def test_menudefs(self): + actual = [item[0] for item in mainmenu.menudefs] + expect = ['file', 'edit', 'format', 'run', 'shell', + 'debug', 'options', 'window', 'help'] + self.assertEqual(actual, expect) + + def test_default_keydefs(self): + self.assertGreaterEqual(len(mainmenu.default_keydefs), 50) + + def test_tcl_indexes(self): + # Test tcl patterns used to find menuitem to alter. + # On failure, change pattern here and in function(s). + # Patterns here have '.*' for re instead of '*' for tcl. + for menu, pattern in ( + ('debug', '.*tack.*iewer'), # PyShell.debug_menu_postcommand + ('options', '.*ode.*ontext'), # EW.__init__, CodeContext.toggle... + ('options', '.*ine.*umbers'), # EW.__init__, EW.toggle...event. + ): + with self.subTest(menu=menu, pattern=pattern): + for menutup in mainmenu.menudefs: + if menutup[0] == menu: + break + else: + self.assertTrue(0, f"{menu} not in menudefs") + self.assertTrue(any(re.search(pattern, menuitem[0]) + for menuitem in menutup[1] + if menuitem is not None), # Separator. + f"{pattern} not in {menu}") + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_multicall.py b/micromamba_root/Lib/idlelib/idle_test/test_multicall.py new file mode 100644 index 0000000000000000000000000000000000000000..67f28db6b0875cf96328978d512ed940a189e4bc --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_multicall.py @@ -0,0 +1,48 @@ +"Test multicall, coverage 33%." + +from idlelib import multicall +import unittest +from test.support import requires +from tkinter import Tk, Text + + +class MultiCallTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.mc = multicall.MultiCallCreator(Text) + + @classmethod + def tearDownClass(cls): + del cls.mc + cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_creator(self): + mc = self.mc + self.assertIs(multicall._multicall_dict[Text], mc) + self.assertIsSubclass(mc, Text) + mc2 = multicall.MultiCallCreator(Text) + self.assertIs(mc, mc2) + + def test_init(self): + mctext = self.mc(self.root) + self.assertIsInstance(mctext._MultiCall__binders, list) + + def test_yview(self): + # Added for tree.wheel_event + # (it depends on yview to not be overridden) + mc = self.mc + self.assertIs(mc.yview, Text.yview) + mctext = self.mc(self.root) + self.assertIs(mctext.yview.__func__, Text.yview) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_outwin.py b/micromamba_root/Lib/idlelib/idle_test/test_outwin.py new file mode 100644 index 0000000000000000000000000000000000000000..0f13363f84f36107283d074ba7ed208f288e5eea --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_outwin.py @@ -0,0 +1,172 @@ +"Test outwin, coverage 76%." + +from idlelib import outwin +import platform +import sys +import unittest +from test.support import requires +from tkinter import Tk, Text +from idlelib.idle_test.mock_tk import Mbox_func +from idlelib.idle_test.mock_idle import Func +from unittest import mock + + +class OutputWindowTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + w = cls.window = outwin.OutputWindow(None, None, None, root) + cls.text = w.text = Text(root) + if sys.platform == 'darwin': # Issue 112938 + cls.text.update = cls.text.update_idletasks + # Without this, test write, writelines, and goto... fail. + # The reasons and why macOS-specific are unclear. + + @classmethod + def tearDownClass(cls): + cls.window.close() + del cls.text, cls.window + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.delete('1.0', 'end') + + def test_ispythonsource(self): + # OutputWindow overrides ispythonsource to always return False. + w = self.window + self.assertFalse(w.ispythonsource('test.txt')) + self.assertFalse(w.ispythonsource(__file__)) + + def test_window_title(self): + self.assertEqual(self.window.top.title(), 'Output' + ' (%s)' % platform.python_version()) + + def test_maybesave(self): + w = self.window + eq = self.assertEqual + w.get_saved = Func() + + w.get_saved.result = False + eq(w.maybesave(), 'no') + eq(w.get_saved.called, 1) + + w.get_saved.result = True + eq(w.maybesave(), 'yes') + eq(w.get_saved.called, 2) + del w.get_saved + + def test_write(self): + eq = self.assertEqual + delete = self.text.delete + get = self.text.get + write = self.window.write + + # No new line - insert stays on same line. + delete('1.0', 'end') + test_text = 'test text' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('insert linestart', 'insert lineend'), 'test text') + + # New line - insert moves to next line. + delete('1.0', 'end') + test_text = 'test text\n' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('insert linestart', 'insert lineend'), '') + + # Text after new line is tagged for second line of Text widget. + delete('1.0', 'end') + test_text = 'test text\nLine 2' + eq(write(test_text), len(test_text)) + eq(get('1.0', '1.end'), 'test text') + eq(get('2.0', '2.end'), 'Line 2') + eq(get('insert linestart', 'insert lineend'), 'Line 2') + + # Test tags. + delete('1.0', 'end') + test_text = 'test text\n' + test_text2 = 'Line 2\n' + eq(write(test_text, tags='mytag'), len(test_text)) + eq(write(test_text2, tags='secondtag'), len(test_text2)) + eq(get('mytag.first', 'mytag.last'), test_text) + eq(get('secondtag.first', 'secondtag.last'), test_text2) + eq(get('1.0', '1.end'), test_text.rstrip('\n')) + eq(get('2.0', '2.end'), test_text2.rstrip('\n')) + + def test_writelines(self): + eq = self.assertEqual + get = self.text.get + writelines = self.window.writelines + + writelines(('Line 1\n', 'Line 2\n', 'Line 3\n')) + eq(get('1.0', '1.end'), 'Line 1') + eq(get('2.0', '2.end'), 'Line 2') + eq(get('3.0', '3.end'), 'Line 3') + eq(get('insert linestart', 'insert lineend'), '') + + def test_goto_file_line(self): + eq = self.assertEqual + w = self.window + text = self.text + + w.flist = mock.Mock() + gfl = w.flist.gotofileline = Func() + showerror = w.showerror = Mbox_func() + + # No file/line number. + w.write('Not a file line') + self.assertIsNone(w.goto_file_line()) + eq(gfl.called, 0) + eq(showerror.title, 'No special line') + + # Current file/line number. + w.write(f'{str(__file__)}: 42: spam\n') + w.write(f'{str(__file__)}: 21: spam') + self.assertIsNone(w.goto_file_line()) + eq(gfl.args, (str(__file__), 21)) + + # Previous line has file/line number. + text.delete('1.0', 'end') + w.write(f'{str(__file__)}: 42: spam\n') + w.write('Not a file line') + self.assertIsNone(w.goto_file_line()) + eq(gfl.args, (str(__file__), 42)) + + del w.flist.gotofileline, w.showerror + + +class ModuleFunctionTest(unittest.TestCase): + + @classmethod + def setUp(cls): + outwin.file_line_progs = None + + def test_compile_progs(self): + outwin.compile_progs() + for pat, regex in zip(outwin.file_line_pats, outwin.file_line_progs): + self.assertEqual(regex.pattern, pat) + + @mock.patch('builtins.open') + def test_file_line_helper(self, mock_open): + flh = outwin.file_line_helper + test_lines = ( + (r'foo file "testfile1", line 42, bar', ('testfile1', 42)), + (r'foo testfile2(21) bar', ('testfile2', 21)), + (r' testfile3 : 42: foo bar\n', (' testfile3 ', 42)), + (r'foo testfile4.py :1: ', ('foo testfile4.py ', 1)), + ('testfile5: \u19D4\u19D2: ', ('testfile5', 42)), + (r'testfile6: 42', None), # only one `:` + (r'testfile7 42 text', None) # no separators + ) + for line, expected_output in test_lines: + self.assertEqual(flh(line), expected_output) + if expected_output: + mock_open.assert_called_with(expected_output[0]) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_parenmatch.py b/micromamba_root/Lib/idlelib/idle_test/test_parenmatch.py new file mode 100644 index 0000000000000000000000000000000000000000..2e10d7cd36760ff66f33c4b22ab62e5ac3f7d46c --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_parenmatch.py @@ -0,0 +1,112 @@ +"""Test parenmatch, coverage 91%. + +This must currently be a gui test because ParenMatch methods use +several text methods not defined on idlelib.idle_test.mock_tk.Text. +""" +from idlelib.parenmatch import ParenMatch +from test.support import requires +requires('gui') + +import unittest +from unittest.mock import Mock +from tkinter import Tk, Text + + +class DummyEditwin: + def __init__(self, text): + self.text = text + self.indentwidth = 8 + self.tabwidth = 8 + self.prompt_last_line = '>>>' # Currently not used by parenmatch. + + +class ParenMatchTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + cls.editwin = DummyEditwin(cls.text) + cls.editwin.text_frame = Mock() + + @classmethod + def tearDownClass(cls): + del cls.text, cls.editwin + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def tearDown(self): + self.text.delete('1.0', 'end') + + def get_parenmatch(self): + pm = ParenMatch(self.editwin) + pm.bell = lambda: None + return pm + + def test_paren_styles(self): + """ + Test ParenMatch with each style. + """ + text = self.text + pm = self.get_parenmatch() + for style, range1, range2 in ( + ('opener', ('1.10', '1.11'), ('1.10', '1.11')), + ('default',('1.10', '1.11'),('1.10', '1.11')), + ('parens', ('1.14', '1.15'), ('1.15', '1.16')), + ('expression', ('1.10', '1.15'), ('1.10', '1.16'))): + with self.subTest(style=style): + text.delete('1.0', 'end') + pm.STYLE = style + text.insert('insert', 'def foobar(a, b') + + pm.flash_paren_event('event') + self.assertIn('<>', text.event_info()) + if style == 'parens': + self.assertTupleEqual(text.tag_nextrange('paren', '1.0'), + ('1.10', '1.11')) + self.assertTupleEqual( + text.tag_prevrange('paren', 'end'), range1) + + text.insert('insert', ')') + pm.restore_event() + self.assertNotIn('<>', + text.event_info()) + self.assertEqual(text.tag_prevrange('paren', 'end'), ()) + + pm.paren_closed_event('event') + self.assertTupleEqual( + text.tag_prevrange('paren', 'end'), range2) + + def test_paren_corner(self): + """ + Test corner cases in flash_paren_event and paren_closed_event. + + Force execution of conditional expressions and alternate paths. + """ + text = self.text + pm = self.get_parenmatch() + + text.insert('insert', '# Comment.)') + pm.paren_closed_event('event') + + text.insert('insert', '\ndef') + pm.flash_paren_event('event') + pm.paren_closed_event('event') + + text.insert('insert', ' a, *arg)') + pm.paren_closed_event('event') + + def test_handle_restore_timer(self): + pm = self.get_parenmatch() + pm.restore_event = Mock() + pm.handle_restore_timer(0) + self.assertTrue(pm.restore_event.called) + pm.restore_event.reset_mock() + pm.handle_restore_timer(1) + self.assertFalse(pm.restore_event.called) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_pathbrowser.py b/micromamba_root/Lib/idlelib/idle_test/test_pathbrowser.py new file mode 100644 index 0000000000000000000000000000000000000000..13d8b9e1ba9572afeefc20b2bf0f6b7bf3a50716 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_pathbrowser.py @@ -0,0 +1,86 @@ +"Test pathbrowser, coverage 95%." + +from idlelib import pathbrowser +import unittest +from test.support import requires +from tkinter import Tk + +import os.path +import pyclbr # for _modules +import sys # for sys.path + +from idlelib.idle_test.mock_idle import Func +import idlelib # for __file__ +from idlelib import browser +from idlelib.tree import TreeNode + + +class PathBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.pb = pathbrowser.PathBrowser(cls.root, _utest=True) + + @classmethod + def tearDownClass(cls): + cls.pb.close() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root, cls.pb + + def test_init(self): + pb = self.pb + eq = self.assertEqual + eq(pb.master, self.root) + eq(pyclbr._modules, {}) + self.assertIsInstance(pb.node, TreeNode) + self.assertIsNotNone(browser.file_open) + + def test_settitle(self): + pb = self.pb + self.assertEqual(pb.top.title(), 'Path Browser') + self.assertEqual(pb.top.iconname(), 'Path Browser') + + def test_rootnode(self): + pb = self.pb + rn = pb.rootnode() + self.assertIsInstance(rn, pathbrowser.PathBrowserTreeItem) + + def test_close(self): + pb = self.pb + pb.top.destroy = Func() + pb.node.destroy = Func() + pb.close() + self.assertTrue(pb.top.destroy.called) + self.assertTrue(pb.node.destroy.called) + del pb.top.destroy, pb.node.destroy + + +class DirBrowserTreeItemTest(unittest.TestCase): + + def test_DirBrowserTreeItem(self): + # Issue16226 - make sure that getting a sublist works + d = pathbrowser.DirBrowserTreeItem('') + d.GetSubList() + self.assertEqual('', d.GetText()) + + dir = os.path.split(os.path.abspath(idlelib.__file__))[0] + self.assertEqual(d.ispackagedir(dir), True) + self.assertEqual(d.ispackagedir(dir + '/Icons'), False) + + +class PathBrowserTreeItemTest(unittest.TestCase): + + def test_PathBrowserTreeItem(self): + p = pathbrowser.PathBrowserTreeItem() + self.assertEqual(p.GetText(), 'sys.path') + sub = p.GetSubList() + self.assertEqual(len(sub), len(sys.path)) + self.assertEqual(type(sub[0]), pathbrowser.DirBrowserTreeItem) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_percolator.py b/micromamba_root/Lib/idlelib/idle_test/test_percolator.py new file mode 100644 index 0000000000000000000000000000000000000000..17668ccd1227b7834cdf374287c812f23f048337 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_percolator.py @@ -0,0 +1,118 @@ +"Test percolator, coverage 100%." + +from idlelib.percolator import Percolator, Delegator +import unittest +from test.support import requires +requires('gui') +from tkinter import Text, Tk, END + + +class MyFilter(Delegator): + def __init__(self): + Delegator.__init__(self, None) + + def insert(self, *args): + self.insert_called_with = args + self.delegate.insert(*args) + + def delete(self, *args): + self.delete_called_with = args + self.delegate.delete(*args) + + def uppercase_insert(self, index, chars, tags=None): + chars = chars.upper() + self.delegate.insert(index, chars) + + def lowercase_insert(self, index, chars, tags=None): + chars = chars.lower() + self.delegate.insert(index, chars) + + def dont_insert(self, index, chars, tags=None): + pass + + +class PercolatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.destroy() + del cls.root + + def setUp(self): + self.percolator = Percolator(self.text) + self.filter_one = MyFilter() + self.filter_two = MyFilter() + self.percolator.insertfilter(self.filter_one) + self.percolator.insertfilter(self.filter_two) + + def tearDown(self): + self.percolator.close() + self.text.delete('1.0', END) + + def test_insertfilter(self): + self.assertIsNotNone(self.filter_one.delegate) + self.assertEqual(self.percolator.top, self.filter_two) + self.assertEqual(self.filter_two.delegate, self.filter_one) + self.assertEqual(self.filter_one.delegate, self.percolator.bottom) + + def test_removefilter(self): + filter_three = MyFilter() + self.percolator.removefilter(self.filter_two) + self.assertEqual(self.percolator.top, self.filter_one) + self.assertIsNone(self.filter_two.delegate) + + filter_three = MyFilter() + self.percolator.insertfilter(self.filter_two) + self.percolator.insertfilter(filter_three) + self.percolator.removefilter(self.filter_one) + self.assertEqual(self.percolator.top, filter_three) + self.assertEqual(filter_three.delegate, self.filter_two) + self.assertEqual(self.filter_two.delegate, self.percolator.bottom) + self.assertIsNone(self.filter_one.delegate) + + def test_insert(self): + self.text.insert('insert', 'foo') + self.assertEqual(self.text.get('1.0', END), 'foo\n') + self.assertTupleEqual(self.filter_one.insert_called_with, + ('insert', 'foo', None)) + + def test_modify_insert(self): + self.filter_one.insert = self.filter_one.uppercase_insert + self.text.insert('insert', 'bAr') + self.assertEqual(self.text.get('1.0', END), 'BAR\n') + + def test_modify_chain_insert(self): + filter_three = MyFilter() + self.percolator.insertfilter(filter_three) + self.filter_two.insert = self.filter_two.uppercase_insert + self.filter_one.insert = self.filter_one.lowercase_insert + self.text.insert('insert', 'BaR') + self.assertEqual(self.text.get('1.0', END), 'bar\n') + + def test_dont_insert(self): + self.filter_one.insert = self.filter_one.dont_insert + self.text.insert('insert', 'foo bar') + self.assertEqual(self.text.get('1.0', END), '\n') + self.filter_one.insert = self.filter_one.dont_insert + self.text.insert('insert', 'foo bar') + self.assertEqual(self.text.get('1.0', END), '\n') + + def test_without_filter(self): + self.text.insert('insert', 'hello') + self.assertEqual(self.text.get('1.0', 'end'), 'hello\n') + + def test_delete(self): + self.text.insert('insert', 'foo') + self.text.delete('1.0', '1.2') + self.assertEqual(self.text.get('1.0', END), 'o\n') + self.assertTupleEqual(self.filter_one.delete_called_with, + ('1.0', '1.2')) + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_pyparse.py b/micromamba_root/Lib/idlelib/idle_test/test_pyparse.py new file mode 100644 index 0000000000000000000000000000000000000000..384db566ac76cdb44fb3c2998a989e848d56cd6c --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_pyparse.py @@ -0,0 +1,483 @@ +"Test pyparse, coverage 96%." + +from idlelib import pyparse +import unittest +from collections import namedtuple + + +class ParseMapTest(unittest.TestCase): + + def test_parsemap(self): + keepwhite = {ord(c): ord(c) for c in ' \t\n\r'} + mapping = pyparse.ParseMap(keepwhite) + self.assertEqual(mapping[ord('\t')], ord('\t')) + self.assertEqual(mapping[ord('a')], ord('x')) + self.assertEqual(mapping[1000], ord('x')) + + def test_trans(self): + # trans is the production instance of ParseMap, used in _study1 + parser = pyparse.Parser(4, 4) + self.assertEqual('\t a([{b}])b"c\'d\n'.translate(pyparse.trans), + 'xxx(((x)))x"x\'x\n') + + +class PyParseTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.parser = pyparse.Parser(indentwidth=4, tabwidth=4) + + @classmethod + def tearDownClass(cls): + del cls.parser + + def test_init(self): + self.assertEqual(self.parser.indentwidth, 4) + self.assertEqual(self.parser.tabwidth, 4) + + def test_set_code(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + + # Not empty and doesn't end with newline. + with self.assertRaises(AssertionError): + setcode('a') + + tests = ('', + 'a\n') + + for string in tests: + with self.subTest(string=string): + setcode(string) + eq(p.code, string) + eq(p.study_level, 0) + + def test_find_good_parse_start(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + start = p.find_good_parse_start + def char_in_string_false(index): return False + + # First line starts with 'def' and ends with ':', then 0 is the pos. + setcode('def spam():\n') + eq(start(char_in_string_false), 0) + + # First line begins with a keyword in the list and ends + # with an open brace, then 0 is the pos. This is how + # hyperparser calls this function as the newline is not added + # in the editor, but rather on the call to setcode. + setcode('class spam( ' + ' \n') + eq(start(char_in_string_false), 0) + + # Split def across lines. + setcode('"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a,\n' + ' b=True):\n' + ' pass\n' + ) + pos0, pos = 33, 42 # Start of 'class...', ' def' lines. + + # Passing no value or non-callable should fail (issue 32989). + with self.assertRaises(TypeError): + start() + with self.assertRaises(TypeError): + start(False) + + # Make text look like a string. This returns pos as the start + # position, but it's set to None. + self.assertIsNone(start(is_char_in_string=lambda index: True)) + + # Make all text look like it's not in a string. This means that it + # found a good start position. + eq(start(char_in_string_false), pos) + + # If the beginning of the def line is not in a string, then it + # returns that as the index. + eq(start(is_char_in_string=lambda index: index > pos), pos) + # If the beginning of the def line is in a string, then it + # looks for a previous index. + eq(start(is_char_in_string=lambda index: index >= pos), pos0) + # If everything before the 'def' is in a string, then returns None. + # The non-continuation def line returns 44 (see below). + eq(start(is_char_in_string=lambda index: index < pos), None) + + # Code without extra line break in def line - mostly returns the same + # values. + setcode('"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a, b=True):\n' + ' pass\n' + ) # Does not affect class, def positions. + eq(start(char_in_string_false), pos) + eq(start(is_char_in_string=lambda index: index > pos), pos) + eq(start(is_char_in_string=lambda index: index >= pos), pos0) + # When the def line isn't split, this returns which doesn't match the + # split line test. + eq(start(is_char_in_string=lambda index: index < pos), pos) + + def test_set_lo(self): + code = ( + '"""This is a module docstring"""\n' + 'class C:\n' + ' def __init__(self, a,\n' + ' b=True):\n' + ' pass\n' + ) + pos = 42 + p = self.parser + p.set_code(code) + + # Previous character is not a newline. + with self.assertRaises(AssertionError): + p.set_lo(5) + + # A value of 0 doesn't change self.code. + p.set_lo(0) + self.assertEqual(p.code, code) + + # An index that is preceded by a newline. + p.set_lo(pos) + self.assertEqual(p.code, code[pos:]) + + def test_study1(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + study = p._study1 + + (NONE, BACKSLASH, FIRST, NEXT, BRACKET) = range(5) + TestInfo = namedtuple('TestInfo', ['string', 'goodlines', + 'continuation']) + tests = ( + TestInfo('', [0], NONE), + # Docstrings. + TestInfo('"""This is a complete docstring."""\n', [0, 1], NONE), + TestInfo("'''This is a complete docstring.'''\n", [0, 1], NONE), + TestInfo('"""This is a continued docstring.\n', [0, 1], FIRST), + TestInfo("'''This is a continued docstring.\n", [0, 1], FIRST), + TestInfo('"""Closing quote does not match."\n', [0, 1], FIRST), + TestInfo('"""Bracket in docstring [\n', [0, 1], FIRST), + TestInfo("'''Incomplete two line docstring.\n\n", [0, 2], NEXT), + # Single-quoted strings. + TestInfo('"This is a complete string."\n', [0, 1], NONE), + TestInfo('"This is an incomplete string.\n', [0, 1], NONE), + TestInfo("'This is more incomplete.\n\n", [0, 1, 2], NONE), + # Comment (backslash does not continue comments). + TestInfo('# Comment\\\n', [0, 1], NONE), + # Brackets. + TestInfo('("""Complete string in bracket"""\n', [0, 1], BRACKET), + TestInfo('("""Open string in bracket\n', [0, 1], FIRST), + TestInfo('a = (1 + 2) - 5 *\\\n', [0, 1], BACKSLASH), # No bracket. + TestInfo('\n def function1(self, a,\n b):\n', + [0, 1, 3], NONE), + TestInfo('\n def function1(self, a,\\\n', [0, 1, 2], BRACKET), + TestInfo('\n def function1(self, a,\n', [0, 1, 2], BRACKET), + TestInfo('())\n', [0, 1], NONE), # Extra closer. + TestInfo(')(\n', [0, 1], BRACKET), # Extra closer. + # For the mismatched example, it doesn't look like continuation. + TestInfo('{)(]\n', [0, 1], NONE), # Mismatched. + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) # resets study_level + study() + eq(p.study_level, 1) + eq(p.goodlines, test.goodlines) + eq(p.continuation, test.continuation) + + # Called again, just returns without reprocessing. + self.assertIsNone(study()) + + def test_get_continuation_type(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + gettype = p.get_continuation_type + + (NONE, BACKSLASH, FIRST, NEXT, BRACKET) = range(5) + TestInfo = namedtuple('TestInfo', ['string', 'continuation']) + tests = ( + TestInfo('', NONE), + TestInfo('"""This is a continuation docstring.\n', FIRST), + TestInfo("'''This is a multiline-continued docstring.\n\n", NEXT), + TestInfo('a = (1 + 2) - 5 *\\\n', BACKSLASH), + TestInfo('\n def function1(self, a,\\\n', BRACKET) + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(gettype(), test.continuation) + + def test_study2(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + study = p._study2 + + TestInfo = namedtuple('TestInfo', ['string', 'start', 'end', 'lastch', + 'openbracket', 'bracketing']) + tests = ( + TestInfo('', 0, 0, '', None, ((0, 0),)), + TestInfo("'''This is a multiline continuation docstring.\n\n", + 0, 48, "'", None, ((0, 0), (0, 1), (48, 0))), + TestInfo(' # Comment\\\n', + 0, 12, '', None, ((0, 0), (1, 1), (12, 0))), + # A comment without a space is a special case + TestInfo(' #Comment\\\n', + 0, 0, '', None, ((0, 0),)), + # Backslash continuation. + TestInfo('a = (1 + 2) - 5 *\\\n', + 0, 19, '*', None, ((0, 0), (4, 1), (11, 0))), + # Bracket continuation with close. + TestInfo('\n def function1(self, a,\n b):\n', + 1, 48, ':', None, ((1, 0), (17, 1), (46, 0))), + # Bracket continuation with unneeded backslash. + TestInfo('\n def function1(self, a,\\\n', + 1, 28, ',', 17, ((1, 0), (17, 1))), + # Bracket continuation. + TestInfo('\n def function1(self, a,\n', + 1, 27, ',', 17, ((1, 0), (17, 1))), + # Bracket continuation with comment at end of line with text. + TestInfo('\n def function1(self, a, # End of line comment.\n', + 1, 51, ',', 17, ((1, 0), (17, 1), (28, 2), (51, 1))), + # Multi-line statement with comment line in between code lines. + TestInfo(' a = ["first item",\n # Comment line\n "next item",\n', + 0, 55, ',', 6, ((0, 0), (6, 1), (7, 2), (19, 1), + (23, 2), (38, 1), (42, 2), (53, 1))), + TestInfo('())\n', + 0, 4, ')', None, ((0, 0), (0, 1), (2, 0), (3, 0))), + TestInfo(')(\n', 0, 3, '(', 1, ((0, 0), (1, 0), (1, 1))), + # Wrong closers still decrement stack level. + TestInfo('{)(]\n', + 0, 5, ']', None, ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + # Character after backslash. + TestInfo(':\\a\n', 0, 4, '\\a', None, ((0, 0),)), + TestInfo('\n', 0, 0, '', None, ((0, 0),)), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + study() + eq(p.study_level, 2) + eq(p.stmt_start, test.start) + eq(p.stmt_end, test.end) + eq(p.lastch, test.lastch) + eq(p.lastopenbracketpos, test.openbracket) + eq(p.stmt_bracketing, test.bracketing) + + # Called again, just returns without reprocessing. + self.assertIsNone(study()) + + def test_get_num_lines_in_stmt(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + getlines = p.get_num_lines_in_stmt + + TestInfo = namedtuple('TestInfo', ['string', 'lines']) + tests = ( + TestInfo('[x for x in a]\n', 1), # Closed on one line. + TestInfo('[x\nfor x in a\n', 2), # Not closed. + TestInfo('[x\\\nfor x in a\\\n', 2), # "", unneeded backslashes. + TestInfo('[x\nfor x in a\n]\n', 3), # Closed on multi-line. + TestInfo('\n"""Docstring comment L1"""\nL2\nL3\nL4\n', 1), + TestInfo('\n"""Docstring comment L1\nL2"""\nL3\nL4\n', 1), + TestInfo('\n"""Docstring comment L1\\\nL2\\\nL3\\\nL4\\\n', 4), + TestInfo('\n\n"""Docstring comment L1\\\nL2\\\nL3\\\nL4\\\n"""\n', 5) + ) + + # Blank string doesn't have enough elements in goodlines. + setcode('') + with self.assertRaises(IndexError): + getlines() + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(getlines(), test.lines) + + def test_compute_bracket_indent(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + indent = p.compute_bracket_indent + + TestInfo = namedtuple('TestInfo', ['string', 'spaces']) + tests = ( + TestInfo('def function1(self, a,\n', 14), + # Characters after bracket. + TestInfo('\n def function1(self, a,\n', 18), + TestInfo('\n\tdef function1(self, a,\n', 18), + # No characters after bracket. + TestInfo('\n def function1(\n', 8), + TestInfo('\n\tdef function1(\n', 8), + TestInfo('\n def function1( \n', 8), # Ignore extra spaces. + TestInfo('[\n"first item",\n # Comment line\n "next item",\n', 0), + TestInfo('[\n "first item",\n # Comment line\n "next item",\n', 2), + TestInfo('["first item",\n # Comment line\n "next item",\n', 1), + TestInfo('(\n', 4), + TestInfo('(a\n', 1), + ) + + # Must be C_BRACKET continuation type. + setcode('def function1(self, a, b):\n') + with self.assertRaises(AssertionError): + indent() + + for test in tests: + setcode(test.string) + eq(indent(), test.spaces) + + def test_compute_backslash_indent(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + indent = p.compute_backslash_indent + + # Must be C_BACKSLASH continuation type. + errors = (('def function1(self, a, b\\\n'), # Bracket. + (' """ (\\\n'), # Docstring. + ('a = #\\\n'), # Inline comment. + ) + for string in errors: + with self.subTest(string=string): + setcode(string) + with self.assertRaises(AssertionError): + indent() + + TestInfo = namedtuple('TestInfo', ('string', 'spaces')) + tests = (TestInfo('a = (1 + 2) - 5 *\\\n', 4), + TestInfo('a = 1 + 2 - 5 *\\\n', 4), + TestInfo(' a = 1 + 2 - 5 *\\\n', 8), + TestInfo(' a = "spam"\\\n', 6), + TestInfo(' a = \\\n"a"\\\n', 4), + TestInfo(' a = #\\\n"a"\\\n', 5), + TestInfo('a == \\\n', 2), + TestInfo('a != \\\n', 2), + # Difference between containing = and those not. + TestInfo('\\\n', 2), + TestInfo(' \\\n', 6), + TestInfo('\t\\\n', 6), + TestInfo('a\\\n', 3), + TestInfo('{}\\\n', 4), + TestInfo('(1 + 2) - 5 *\\\n', 3), + ) + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(indent(), test.spaces) + + def test_get_base_indent_string(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + baseindent = p.get_base_indent_string + + TestInfo = namedtuple('TestInfo', ['string', 'indent']) + tests = (TestInfo('', ''), + TestInfo('def a():\n', ''), + TestInfo('\tdef a():\n', '\t'), + TestInfo(' def a():\n', ' '), + TestInfo(' def a(\n', ' '), + TestInfo('\t\n def a(\n', ' '), + TestInfo('\t\n # Comment.\n', ' '), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(baseindent(), test.indent) + + def test_is_block_opener(self): + yes = self.assertTrue + no = self.assertFalse + p = self.parser + setcode = p.set_code + opener = p.is_block_opener + + TestInfo = namedtuple('TestInfo', ['string', 'assert_']) + tests = ( + TestInfo('def a():\n', yes), + TestInfo('\n def function1(self, a,\n b):\n', yes), + TestInfo(':\n', yes), + TestInfo('a:\n', yes), + TestInfo('):\n', yes), + TestInfo('(:\n', yes), + TestInfo('":\n', no), + TestInfo('\n def function1(self, a,\n', no), + TestInfo('def function1(self, a):\n pass\n', no), + TestInfo('# A comment:\n', no), + TestInfo('"""A docstring:\n', no), + TestInfo('"""A docstring:\n', no), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + test.assert_(opener()) + + def test_is_block_closer(self): + yes = self.assertTrue + no = self.assertFalse + p = self.parser + setcode = p.set_code + closer = p.is_block_closer + + TestInfo = namedtuple('TestInfo', ['string', 'assert_']) + tests = ( + TestInfo('return\n', yes), + TestInfo('\tbreak\n', yes), + TestInfo(' continue\n', yes), + TestInfo(' raise\n', yes), + TestInfo('pass \n', yes), + TestInfo('pass\t\n', yes), + TestInfo('return #\n', yes), + TestInfo('raised\n', no), + TestInfo('returning\n', no), + TestInfo('# return\n', no), + TestInfo('"""break\n', no), + TestInfo('"continue\n', no), + TestInfo('def function1(self, a):\n pass\n', yes), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + test.assert_(closer()) + + def test_get_last_stmt_bracketing(self): + eq = self.assertEqual + p = self.parser + setcode = p.set_code + bracketing = p.get_last_stmt_bracketing + + TestInfo = namedtuple('TestInfo', ['string', 'bracket']) + tests = ( + TestInfo('', ((0, 0),)), + TestInfo('a\n', ((0, 0),)), + TestInfo('()()\n', ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + TestInfo('(\n)()\n', ((0, 0), (0, 1), (3, 0), (3, 1), (5, 0))), + TestInfo('()\n()\n', ((3, 0), (3, 1), (5, 0))), + TestInfo('()(\n)\n', ((0, 0), (0, 1), (2, 0), (2, 1), (5, 0))), + TestInfo('(())\n', ((0, 0), (0, 1), (1, 2), (3, 1), (4, 0))), + TestInfo('(\n())\n', ((0, 0), (0, 1), (2, 2), (4, 1), (5, 0))), + # Same as matched test. + TestInfo('{)(]\n', ((0, 0), (0, 1), (2, 0), (2, 1), (4, 0))), + TestInfo('(((())\n', + ((0, 0), (0, 1), (1, 2), (2, 3), (3, 4), (5, 3), (6, 2))), + ) + + for test in tests: + with self.subTest(string=test.string): + setcode(test.string) + eq(bracketing(), test.bracket) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_pyshell.py b/micromamba_root/Lib/idlelib/idle_test/test_pyshell.py new file mode 100644 index 0000000000000000000000000000000000000000..706703965bffd6f74d3b5916b4c21be8c897426b --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_pyshell.py @@ -0,0 +1,148 @@ +"Test pyshell, coverage 12%." +# Plus coverage of test_warning. Was 20% with test_openshell. + +from idlelib import pyshell +import unittest +from test.support import requires +from tkinter import Tk + + +class FunctionTest(unittest.TestCase): + # Test stand-alone module level non-gui functions. + + def test_restart_line_wide(self): + eq = self.assertEqual + for file, mul, extra in (('', 22, ''), ('finame', 21, '=')): + width = 60 + bar = mul * '=' + with self.subTest(file=file, bar=bar): + file = file or 'Shell' + line = pyshell.restart_line(width, file) + eq(len(line), width) + eq(line, f"{bar+extra} RESTART: {file} {bar}") + + def test_restart_line_narrow(self): + expect, taglen = "= RESTART: Shell", 16 + for width in (taglen-1, taglen, taglen+1): + with self.subTest(width=width): + self.assertEqual(pyshell.restart_line(width, ''), expect) + self.assertEqual(pyshell.restart_line(taglen+2, ''), expect+' =') + + +class PyShellFileListTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + #cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + psfl = pyshell.PyShellFileList(self.root) + self.assertEqual(psfl.EditorWindow, pyshell.PyShellEditorWindow) + self.assertIsNone(psfl.pyshell) + +# The following sometimes causes 'invalid command name "109734456recolorize"'. +# Uncommenting after_cancel above prevents this, but results in +# TclError: bad window path name ".!listedtoplevel.!frame.text" +# which is normally prevented by after_cancel. +## def test_openshell(self): +## pyshell.use_subprocess = False +## ps = pyshell.PyShellFileList(self.root).open_shell() +## self.assertIsInstance(ps, pyshell.PyShell) + + +class PyShellRemoveLastNewlineAndSurroundingWhitespaceTest(unittest.TestCase): + regexp = pyshell.PyShell._last_newline_re + + def all_removed(self, text): + self.assertEqual('', self.regexp.sub('', text)) + + def none_removed(self, text): + self.assertEqual(text, self.regexp.sub('', text)) + + def check_result(self, text, expected): + self.assertEqual(expected, self.regexp.sub('', text)) + + def test_empty(self): + self.all_removed('') + + def test_newline(self): + self.all_removed('\n') + + def test_whitespace_no_newline(self): + self.all_removed(' ') + self.all_removed(' ') + self.all_removed(' ') + self.all_removed(' ' * 20) + self.all_removed('\t') + self.all_removed('\t\t') + self.all_removed('\t\t\t') + self.all_removed('\t' * 20) + self.all_removed('\t ') + self.all_removed(' \t') + self.all_removed(' \t \t ') + self.all_removed('\t \t \t') + + def test_newline_with_whitespace(self): + self.all_removed(' \n') + self.all_removed('\t\n') + self.all_removed(' \t\n') + self.all_removed('\t \n') + self.all_removed('\n ') + self.all_removed('\n\t') + self.all_removed('\n \t') + self.all_removed('\n\t ') + self.all_removed(' \n ') + self.all_removed('\t\n ') + self.all_removed(' \n\t') + self.all_removed('\t\n\t') + self.all_removed('\t \t \t\n') + self.all_removed(' \t \t \n') + self.all_removed('\n\t \t \t') + self.all_removed('\n \t \t ') + + def test_multiple_newlines(self): + self.check_result('\n\n', '\n') + self.check_result('\n' * 5, '\n' * 4) + self.check_result('\n' * 5 + '\t', '\n' * 4) + self.check_result('\n' * 20, '\n' * 19) + self.check_result('\n' * 20 + ' ', '\n' * 19) + self.check_result(' \n \n ', ' \n') + self.check_result(' \n\n ', ' \n') + self.check_result(' \n\n', ' \n') + self.check_result('\t\n\n', '\t\n') + self.check_result('\n\n ', '\n') + self.check_result('\n\n\t', '\n') + self.check_result(' \n \n ', ' \n') + self.check_result('\t\n\t\n\t', '\t\n') + + def test_non_whitespace(self): + self.none_removed('a') + self.check_result('a\n', 'a') + self.check_result('a\n ', 'a') + self.check_result('a \n ', 'a') + self.check_result('a \n\t', 'a') + self.none_removed('-') + self.check_result('-\n', '-') + self.none_removed('.') + self.check_result('.\n', '.') + + def test_unsupported_whitespace(self): + self.none_removed('\v') + self.none_removed('\n\v') + self.check_result('\v\n', '\v') + self.none_removed(' \n\v') + self.check_result('\v\n ', '\v') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_query.py b/micromamba_root/Lib/idlelib/idle_test/test_query.py new file mode 100644 index 0000000000000000000000000000000000000000..a6ef858a8c954a23f734ad342900e6d15b7f171c --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_query.py @@ -0,0 +1,451 @@ +"""Test query, coverage 93%. + +Non-gui tests for Query, SectionName, ModuleName, and HelpSource use +dummy versions that extract the non-gui methods and add other needed +attributes. GUI tests create an instance of each class and simulate +entries and button clicks. Subclass tests only target the new code in +the subclass definition. + +The appearance of the widgets is checked by the Query and +HelpSource htests. These are run by running query.py. +""" +from idlelib import query +import unittest +from test.support import requires +from tkinter import Tk, END + +import sys +from unittest import mock +from idlelib.idle_test.mock_tk import Var + + +# NON-GUI TESTS + +class QueryTest(unittest.TestCase): + "Test Query base class." + + class Dummy_Query: + # Test the following Query methods. + entry_ok = query.Query.entry_ok + ok = query.Query.ok + cancel = query.Query.cancel + # Add attributes and initialization needed for tests. + def __init__(self, dummy_entry): + self.entry = Var(value=dummy_entry) + self.entry_error = {'text': ''} + self.result = None + self.destroyed = False + def showerror(self, message): + self.entry_error['text'] = message + def destroy(self): + self.destroyed = True + + def test_entry_ok_blank(self): + dialog = self.Dummy_Query(' ') + self.assertEqual(dialog.entry_ok(), None) + self.assertEqual((dialog.result, dialog.destroyed), (None, False)) + self.assertIn('blank line', dialog.entry_error['text']) + + def test_entry_ok_good(self): + dialog = self.Dummy_Query(' good ') + Equal = self.assertEqual + Equal(dialog.entry_ok(), 'good') + Equal((dialog.result, dialog.destroyed), (None, False)) + Equal(dialog.entry_error['text'], '') + + def test_ok_blank(self): + dialog = self.Dummy_Query('') + dialog.entry.focus_set = mock.Mock() + self.assertEqual(dialog.ok(), None) + self.assertTrue(dialog.entry.focus_set.called) + del dialog.entry.focus_set + self.assertEqual((dialog.result, dialog.destroyed), (None, False)) + + def test_ok_good(self): + dialog = self.Dummy_Query('good') + self.assertEqual(dialog.ok(), None) + self.assertEqual((dialog.result, dialog.destroyed), ('good', True)) + + def test_cancel(self): + dialog = self.Dummy_Query('does not matter') + self.assertEqual(dialog.cancel(), None) + self.assertEqual((dialog.result, dialog.destroyed), (None, True)) + + +class SectionNameTest(unittest.TestCase): + "Test SectionName subclass of Query." + + class Dummy_SectionName: + entry_ok = query.SectionName.entry_ok # Function being tested. + used_names = ['used'] + def __init__(self, dummy_entry): + self.entry = Var(value=dummy_entry) + self.entry_error = {'text': ''} + def showerror(self, message): + self.entry_error['text'] = message + + def test_blank_section_name(self): + dialog = self.Dummy_SectionName(' ') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('no name', dialog.entry_error['text']) + + def test_used_section_name(self): + dialog = self.Dummy_SectionName('used') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('use', dialog.entry_error['text']) + + def test_long_section_name(self): + dialog = self.Dummy_SectionName('good'*8) + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('longer than 30', dialog.entry_error['text']) + + def test_good_section_name(self): + dialog = self.Dummy_SectionName(' good ') + self.assertEqual(dialog.entry_ok(), 'good') + self.assertEqual(dialog.entry_error['text'], '') + + +class ModuleNameTest(unittest.TestCase): + "Test ModuleName subclass of Query." + + class Dummy_ModuleName: + entry_ok = query.ModuleName.entry_ok # Function being tested. + text0 = '' + def __init__(self, dummy_entry): + self.entry = Var(value=dummy_entry) + self.entry_error = {'text': ''} + def showerror(self, message): + self.entry_error['text'] = message + + def test_blank_module_name(self): + dialog = self.Dummy_ModuleName(' ') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('no name', dialog.entry_error['text']) + + def test_bogus_module_name(self): + dialog = self.Dummy_ModuleName('__name_xyz123_should_not_exist__') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('not found', dialog.entry_error['text']) + + def test_c_source_name(self): + dialog = self.Dummy_ModuleName('itertools') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('source-based', dialog.entry_error['text']) + + def test_good_module_name(self): + dialog = self.Dummy_ModuleName('idlelib') + self.assertEndsWith(dialog.entry_ok(), '__init__.py') + self.assertEqual(dialog.entry_error['text'], '') + dialog = self.Dummy_ModuleName('idlelib.idle') + self.assertEndsWith(dialog.entry_ok(), 'idle.py') + self.assertEqual(dialog.entry_error['text'], '') + + +class GotoTest(unittest.TestCase): + "Test Goto subclass of Query." + + class Dummy_ModuleName: + entry_ok = query.Goto.entry_ok # Function being tested. + def __init__(self, dummy_entry): + self.entry = Var(value=dummy_entry) + self.entry_error = {'text': ''} + def showerror(self, message): + self.entry_error['text'] = message + + def test_bogus_goto(self): + dialog = self.Dummy_ModuleName('a') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('not a base 10 integer', dialog.entry_error['text']) + + def test_bad_goto(self): + dialog = self.Dummy_ModuleName('0') + self.assertEqual(dialog.entry_ok(), None) + self.assertIn('not a positive integer', dialog.entry_error['text']) + + def test_good_goto(self): + dialog = self.Dummy_ModuleName('1') + self.assertEqual(dialog.entry_ok(), 1) + self.assertEqual(dialog.entry_error['text'], '') + + +# 3 HelpSource test classes each test one method. + +class HelpsourceBrowsefileTest(unittest.TestCase): + "Test browse_file method of ModuleName subclass of Query." + + class Dummy_HelpSource: + browse_file = query.HelpSource.browse_file + pathvar = Var() + + def test_file_replaces_path(self): + dialog = self.Dummy_HelpSource() + # Path is widget entry, either '' or something. + # Func return is file dialog return, either '' or something. + # Func return should override widget entry. + # We need all 4 combinations to test all (most) code paths. + for path, func, result in ( + ('', lambda a,b,c:'', ''), + ('', lambda a,b,c: __file__, __file__), + ('htest', lambda a,b,c:'', 'htest'), + ('htest', lambda a,b,c: __file__, __file__)): + with self.subTest(): + dialog.pathvar.set(path) + dialog.askfilename = func + dialog.browse_file() + self.assertEqual(dialog.pathvar.get(), result) + + +class HelpsourcePathokTest(unittest.TestCase): + "Test path_ok method of HelpSource subclass of Query." + + class Dummy_HelpSource: + path_ok = query.HelpSource.path_ok + def __init__(self, dummy_path): + self.path = Var(value=dummy_path) + self.path_error = {'text': ''} + def showerror(self, message, widget=None): + self.path_error['text'] = message + + orig_platform = query.platform # Set in test_path_ok_file. + @classmethod + def tearDownClass(cls): + query.platform = cls.orig_platform + + def test_path_ok_blank(self): + dialog = self.Dummy_HelpSource(' ') + self.assertEqual(dialog.path_ok(), None) + self.assertIn('no help file', dialog.path_error['text']) + + def test_path_ok_bad(self): + dialog = self.Dummy_HelpSource(__file__ + 'bad-bad-bad') + self.assertEqual(dialog.path_ok(), None) + self.assertIn('not exist', dialog.path_error['text']) + + def test_path_ok_web(self): + dialog = self.Dummy_HelpSource('') + Equal = self.assertEqual + for url in 'www.py.org', 'http://py.org': + with self.subTest(): + dialog.path.set(url) + self.assertEqual(dialog.path_ok(), url) + self.assertEqual(dialog.path_error['text'], '') + + def test_path_ok_file(self): + dialog = self.Dummy_HelpSource('') + for platform, prefix in ('darwin', 'file://'), ('other', ''): + with self.subTest(): + query.platform = platform + dialog.path.set(__file__) + self.assertEqual(dialog.path_ok(), prefix + __file__) + self.assertEqual(dialog.path_error['text'], '') + + +class HelpsourceEntryokTest(unittest.TestCase): + "Test entry_ok method of HelpSource subclass of Query." + + class Dummy_HelpSource: + entry_ok = query.HelpSource.entry_ok + entry_error = {} + path_error = {} + def item_ok(self): + return self.name + def path_ok(self): + return self.path + + def test_entry_ok_helpsource(self): + dialog = self.Dummy_HelpSource() + for name, path, result in ((None, None, None), + (None, 'doc.txt', None), + ('doc', None, None), + ('doc', 'doc.txt', ('doc', 'doc.txt'))): + with self.subTest(): + dialog.name, dialog.path = name, path + self.assertEqual(dialog.entry_ok(), result) + + +# 2 CustomRun test classes each test one method. + +class CustomRunCLIargsokTest(unittest.TestCase): + "Test cli_ok method of the CustomRun subclass of Query." + + class Dummy_CustomRun: + cli_args_ok = query.CustomRun.cli_args_ok + def __init__(self, dummy_entry): + self.entry = Var(value=dummy_entry) + self.entry_error = {'text': ''} + def showerror(self, message): + self.entry_error['text'] = message + + def test_blank_args(self): + dialog = self.Dummy_CustomRun(' ') + self.assertEqual(dialog.cli_args_ok(), []) + + def test_invalid_args(self): + dialog = self.Dummy_CustomRun("'no-closing-quote") + self.assertEqual(dialog.cli_args_ok(), None) + self.assertIn('No closing', dialog.entry_error['text']) + + def test_good_args(self): + args = ['-n', '10', '--verbose', '-p', '/path', '--name'] + dialog = self.Dummy_CustomRun(' '.join(args) + ' "my name"') + self.assertEqual(dialog.cli_args_ok(), args + ["my name"]) + self.assertEqual(dialog.entry_error['text'], '') + + +class CustomRunEntryokTest(unittest.TestCase): + "Test entry_ok method of the CustomRun subclass of Query." + + class Dummy_CustomRun: + entry_ok = query.CustomRun.entry_ok + entry_error = {} + restartvar = Var() + def cli_args_ok(self): + return self.cli_args + + def test_entry_ok_customrun(self): + dialog = self.Dummy_CustomRun() + for restart in {True, False}: + dialog.restartvar.set(restart) + for cli_args, result in ((None, None), + (['my arg'], (['my arg'], restart))): + with self.subTest(restart=restart, cli_args=cli_args): + dialog.cli_args = cli_args + self.assertEqual(dialog.entry_ok(), result) + + +# GUI TESTS + +class QueryGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = root = Tk() + cls.root.withdraw() + cls.dialog = query.Query(root, 'TEST', 'test', _utest=True) + cls.dialog.destroy = mock.Mock() + + @classmethod + def tearDownClass(cls): + del cls.dialog.destroy + del cls.dialog + cls.root.destroy() + del cls.root + + def setUp(self): + self.dialog.entry.delete(0, 'end') + self.dialog.result = None + self.dialog.destroy.reset_mock() + + def test_click_ok(self): + dialog = self.dialog + dialog.entry.insert(0, 'abc') + dialog.button_ok.invoke() + self.assertEqual(dialog.result, 'abc') + self.assertTrue(dialog.destroy.called) + + def test_click_blank(self): + dialog = self.dialog + dialog.button_ok.invoke() + self.assertEqual(dialog.result, None) + self.assertFalse(dialog.destroy.called) + + def test_click_cancel(self): + dialog = self.dialog + dialog.entry.insert(0, 'abc') + dialog.button_cancel.invoke() + self.assertEqual(dialog.result, None) + self.assertTrue(dialog.destroy.called) + + +class SectionnameGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + + def test_click_section_name(self): + root = Tk() + root.withdraw() + dialog = query.SectionName(root, 'T', 't', {'abc'}, _utest=True) + Equal = self.assertEqual + self.assertEqual(dialog.used_names, {'abc'}) + dialog.entry.insert(0, 'okay') + dialog.button_ok.invoke() + self.assertEqual(dialog.result, 'okay') + root.destroy() + + +class ModulenameGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + + def test_click_module_name(self): + root = Tk() + root.withdraw() + dialog = query.ModuleName(root, 'T', 't', 'idlelib', _utest=True) + self.assertEqual(dialog.text0, 'idlelib') + self.assertEqual(dialog.entry.get(), 'idlelib') + dialog.button_ok.invoke() + self.assertEndsWith(dialog.result, '__init__.py') + root.destroy() + + +class GotoGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + + def test_click_module_name(self): + root = Tk() + root.withdraw() + dialog = query.Goto(root, 'T', 't', _utest=True) + dialog.entry.insert(0, '22') + dialog.button_ok.invoke() + self.assertEqual(dialog.result, 22) + root.destroy() + + +class HelpsourceGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + + def test_click_help_source(self): + root = Tk() + root.withdraw() + dialog = query.HelpSource(root, 'T', menuitem='__test__', + filepath=__file__, _utest=True) + Equal = self.assertEqual + Equal(dialog.entry.get(), '__test__') + Equal(dialog.path.get(), __file__) + dialog.button_ok.invoke() + prefix = "file://" if sys.platform == 'darwin' else '' + Equal(dialog.result, ('__test__', prefix + __file__)) + root.destroy() + + +class CustomRunGuiTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + + def test_click_args(self): + root = Tk() + root.withdraw() + dialog = query.CustomRun(root, 'Title', + cli_args=['a', 'b=1'], _utest=True) + self.assertEqual(dialog.entry.get(), 'a b=1') + dialog.entry.insert(END, ' c') + dialog.button_ok.invoke() + self.assertEqual(dialog.result, (['a', 'b=1', 'c'], True)) + root.destroy() + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_redirector.py b/micromamba_root/Lib/idlelib/idle_test/test_redirector.py new file mode 100644 index 0000000000000000000000000000000000000000..bd486d7da66010815f46a1ad57da8fbe85f0073d --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_redirector.py @@ -0,0 +1,122 @@ +"Test redirector, coverage 100%." + +from idlelib.redirector import WidgetRedirector +import unittest +from test.support import requires +from tkinter import Tk, Text, TclError +from idlelib.idle_test.mock_idle import Func + + +class InitCloseTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.destroy() + del cls.root + + def test_init(self): + redir = WidgetRedirector(self.text) + self.assertEqual(redir.widget, self.text) + self.assertEqual(redir.tk, self.text.tk) + self.assertRaises(TclError, WidgetRedirector, self.text) + redir.close() # restore self.tk, self.text + + def test_close(self): + redir = WidgetRedirector(self.text) + redir.register('insert', Func) + redir.close() + self.assertEqual(redir._operations, {}) + self.assertNotHasAttr(self.text, 'widget') + + +class WidgetRedirectorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.redir = WidgetRedirector(self.text) + self.func = Func() + self.orig_insert = self.redir.register('insert', self.func) + self.text.insert('insert', 'asdf') # leaves self.text empty + + def tearDown(self): + self.text.delete('1.0', 'end') + self.redir.close() + + def test_repr(self): # partly for 100% coverage + self.assertIn('Redirector', repr(self.redir)) + self.assertIn('Original', repr(self.orig_insert)) + + def test_register(self): + self.assertEqual(self.text.get('1.0', 'end'), '\n') + self.assertEqual(self.func.args, ('insert', 'asdf')) + self.assertIn('insert', self.redir._operations) + self.assertIn('insert', self.text.__dict__) + self.assertEqual(self.text.insert, self.func) + + def test_original_command(self): + self.assertEqual(self.orig_insert.operation, 'insert') + self.assertEqual(self.orig_insert.tk_call, self.text.tk.call) + self.orig_insert('insert', 'asdf') + self.assertEqual(self.text.get('1.0', 'end'), 'asdf\n') + + def test_unregister(self): + self.assertIsNone(self.redir.unregister('invalid operation name')) + self.assertEqual(self.redir.unregister('insert'), self.func) + self.assertNotIn('insert', self.redir._operations) + self.assertNotIn('insert', self.text.__dict__) + + def test_unregister_no_attribute(self): + del self.text.insert + self.assertEqual(self.redir.unregister('insert'), self.func) + + def test_dispatch_intercept(self): + self.func.__init__(True) + self.assertTrue(self.redir.dispatch('insert', False)) + self.assertFalse(self.func.args[0]) + + def test_dispatch_bypass(self): + self.orig_insert('insert', 'asdf') + # tk.call returns '' where Python would return None + self.assertEqual(self.redir.dispatch('delete', '1.0', 'end'), '') + self.assertEqual(self.text.get('1.0', 'end'), '\n') + + def test_dispatch_error(self): + self.func.__init__(TclError()) + self.assertEqual(self.redir.dispatch('insert', False), '') + self.assertEqual(self.redir.dispatch('invalid'), '') + + def test_command_dispatch(self): + # Test that .__init__ causes redirection of tk calls + # through redir.dispatch + self.root.call(self.text._w, 'insert', 'hello') + self.assertEqual(self.func.args, ('hello',)) + self.assertEqual(self.text.get('1.0', 'end'), '\n') + # Ensure that called through redir .dispatch and not through + # self.text.insert by having mock raise TclError. + self.func.__init__(TclError()) + self.assertEqual(self.root.call(self.text._w, 'insert', 'boo'), '') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_replace.py b/micromamba_root/Lib/idlelib/idle_test/test_replace.py new file mode 100644 index 0000000000000000000000000000000000000000..6c07389b29ad4558077353dd65eccb32c722dcba --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_replace.py @@ -0,0 +1,294 @@ +"Test replace, coverage 78%." + +from idlelib.replace import ReplaceDialog +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk, Text + +from unittest.mock import Mock +from idlelib.idle_test.mock_tk import Mbox +import idlelib.searchengine as se + +orig_mbox = se.messagebox +showerror = Mbox.showerror + + +class ReplaceDialogTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + se.messagebox = Mbox + cls.engine = se.SearchEngine(cls.root) + cls.dialog = ReplaceDialog(cls.root, cls.engine) + cls.dialog.bell = lambda: None + cls.dialog.ok = Mock() + cls.text = Text(cls.root) + cls.text.undo_block_start = Mock() + cls.text.undo_block_stop = Mock() + cls.dialog.text = cls.text + + @classmethod + def tearDownClass(cls): + se.messagebox = orig_mbox + del cls.text, cls.dialog, cls.engine + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.insert('insert', 'This is a sample sTring') + + def tearDown(self): + self.engine.patvar.set('') + self.dialog.replvar.set('') + self.engine.wordvar.set(False) + self.engine.casevar.set(False) + self.engine.revar.set(False) + self.engine.wrapvar.set(True) + self.engine.backvar.set(False) + showerror.title = '' + showerror.message = '' + self.text.delete('1.0', 'end') + + def test_replace_simple(self): + # Test replace function with all options at default setting. + # Wrap around - True + # Regular Expression - False + # Match case - False + # Match word - False + # Direction - Forwards + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + + # test accessor method + self.engine.setpat('asdf') + equal(self.engine.getpat(), pv.get()) + + # text found and replaced + pv.set('a') + rv.set('asdf') + replace() + equal(text.get('1.8', '1.12'), 'asdf') + + # don't "match word" case + text.mark_set('insert', '1.0') + pv.set('is') + rv.set('hello') + replace() + equal(text.get('1.2', '1.7'), 'hello') + + # don't "match case" case + pv.set('string') + rv.set('world') + replace() + equal(text.get('1.23', '1.28'), 'world') + + # without "regular expression" case + text.mark_set('insert', 'end') + text.insert('insert', '\nline42:') + before_text = text.get('1.0', 'end') + pv.set(r'[a-z][\d]+') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # test with wrap around selected and complete a cycle + text.mark_set('insert', '1.9') + pv.set('i') + rv.set('j') + replace() + equal(text.get('1.8'), 'i') + equal(text.get('2.1'), 'j') + replace() + equal(text.get('2.1'), 'j') + equal(text.get('1.8'), 'j') + before_text = text.get('1.0', 'end') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # text not found + before_text = text.get('1.0', 'end') + pv.set('foobar') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # test access method + self.dialog.find_it(0) + + def test_replace_wrap_around(self): + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.wrapvar.set(False) + + # replace candidate found both after and before 'insert' + text.mark_set('insert', '1.4') + pv.set('i') + rv.set('j') + replace() + equal(text.get('1.2'), 'i') + equal(text.get('1.5'), 'j') + replace() + equal(text.get('1.2'), 'i') + equal(text.get('1.20'), 'j') + replace() + equal(text.get('1.2'), 'i') + + # replace candidate found only before 'insert' + text.mark_set('insert', '1.8') + pv.set('is') + before_text = text.get('1.0', 'end') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + def test_replace_whole_word(self): + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.wordvar.set(True) + + pv.set('is') + rv.set('hello') + replace() + equal(text.get('1.0', '1.4'), 'This') + equal(text.get('1.5', '1.10'), 'hello') + + def test_replace_match_case(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.casevar.set(True) + + before_text = self.text.get('1.0', 'end') + pv.set('this') + rv.set('that') + replace() + after_text = self.text.get('1.0', 'end') + equal(before_text, after_text) + + pv.set('This') + replace() + equal(text.get('1.0', '1.4'), 'that') + + def test_replace_regex(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.revar.set(True) + + before_text = text.get('1.0', 'end') + pv.set(r'[a-z][\d]+') + rv.set('hello') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + text.insert('insert', '\nline42') + replace() + equal(text.get('2.0', '2.8'), 'linhello') + + pv.set('') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Empty', showerror.message) + + pv.set(r'[\d') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Pattern', showerror.message) + + showerror.title = '' + showerror.message = '' + pv.set('[a]') + rv.set('test\\') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Invalid Replace Expression', showerror.message) + + # test access method + self.engine.setcookedpat("?") + equal(pv.get(), "\\?") + + def test_replace_backwards(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.backvar.set(True) + + text.insert('insert', '\nis as ') + + pv.set('is') + rv.set('was') + replace() + equal(text.get('1.2', '1.4'), 'is') + equal(text.get('2.0', '2.3'), 'was') + replace() + equal(text.get('1.5', '1.8'), 'was') + replace() + equal(text.get('1.2', '1.5'), 'was') + + def test_replace_all(self): + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace_all = self.dialog.replace_all + + text.insert('insert', '\n') + text.insert('insert', text.get('1.0', 'end')*100) + pv.set('is') + rv.set('was') + replace_all() + self.assertNotIn('is', text.get('1.0', 'end')) + + self.engine.revar.set(True) + pv.set('') + replace_all() + self.assertIn('error', showerror.title) + self.assertIn('Empty', showerror.message) + + pv.set('[s][T]') + rv.set('\\') + replace_all() + + self.engine.revar.set(False) + pv.set('text which is not present') + rv.set('foobar') + replace_all() + + def test_default_command(self): + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace_find = self.dialog.default_command + equal = self.assertEqual + + pv.set('This') + rv.set('was') + replace_find() + equal(text.get('sel.first', 'sel.last'), 'was') + + self.engine.revar.set(True) + pv.set('') + replace_find() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_rpc.py b/micromamba_root/Lib/idlelib/idle_test/test_rpc.py new file mode 100644 index 0000000000000000000000000000000000000000..81eff398c72f45b9cc25546513be2cb861e490b8 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_rpc.py @@ -0,0 +1,29 @@ +"Test rpc, coverage 20%." + +from idlelib import rpc +import unittest + + + +class CodePicklerTest(unittest.TestCase): + + def test_pickle_unpickle(self): + def f(): return a + b + c + func, (cbytes,) = rpc.pickle_code(f.__code__) + self.assertIs(func, rpc.unpickle_code) + self.assertIn(b'test_rpc.py', cbytes) + code = rpc.unpickle_code(cbytes) + self.assertEqual(code.co_names, ('a', 'b', 'c')) + + def test_code_pickler(self): + self.assertIn(type((lambda:None).__code__), + rpc.CodePickler.dispatch_table) + + def test_dumps(self): + def f(): pass + # The main test here is that pickling code does not raise. + self.assertIn(b'test_rpc.py', rpc.dumps(f.__code__)) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_run.py b/micromamba_root/Lib/idlelib/idle_test/test_run.py new file mode 100644 index 0000000000000000000000000000000000000000..83ecbffa2a197e7460ba98402f197a689bd43a4d --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_run.py @@ -0,0 +1,433 @@ +"Test run, coverage 54%." + +from idlelib import run +import io +import sys +from test.support import captured_output, captured_stderr +import unittest +from unittest import mock +import idlelib +from idlelib.idle_test.mock_idle import Func +from test.support import force_not_colorized + +idlelib.testing = True # Use {} for executing test user code. + + +class ExceptionTest(unittest.TestCase): + + def test_print_exception_unhashable(self): + class UnhashableException(Exception): + def __eq__(self, other): + return True + + ex1 = UnhashableException('ex1') + ex2 = UnhashableException('ex2') + try: + raise ex2 from ex1 + except UnhashableException: + try: + raise ex1 + except UnhashableException: + with captured_stderr() as output: + with mock.patch.object(run, 'cleanup_traceback') as ct: + ct.side_effect = lambda t, e: t + run.print_exception() + + tb = output.getvalue().strip().splitlines() + self.assertEqual(11, len(tb)) + self.assertIn('UnhashableException: ex2', tb[3]) + self.assertIn('UnhashableException: ex1', tb[10]) + + data = (('1/0', ZeroDivisionError, "division by zero\n"), + ('abc', NameError, "name 'abc' is not defined. " + "Did you mean: 'abs'? " + "Or did you forget to import 'abc'?\n"), + ('int.reel', AttributeError, + "type object 'int' has no attribute 'reel'. " + "Did you mean: 'real'?\n"), + ) + + @force_not_colorized + def test_get_message(self): + for code, exc, msg in self.data: + with self.subTest(code=code): + try: + eval(compile(code, '', 'eval')) + except exc: + typ, val, tb = sys.exc_info() + actual = run.get_message_lines(typ, val, tb)[0] + expect = f'{exc.__name__}: {msg}' + self.assertEqual(actual, expect) + + @force_not_colorized + @mock.patch.object(run, 'cleanup_traceback', + new_callable=lambda: (lambda t, e: None)) + def test_get_multiple_message(self, mock): + d = self.data + data2 = ((d[0], d[1]), (d[1], d[2]), (d[2], d[0])) + subtests = 0 + for (code1, exc1, msg1), (code2, exc2, msg2) in data2: + with self.subTest(codes=(code1,code2)): + try: + eval(compile(code1, '', 'eval')) + except exc1: + try: + eval(compile(code2, '', 'eval')) + except exc2: + with captured_stderr() as output: + run.print_exception() + actual = output.getvalue() + self.assertIn(msg1, actual) + self.assertIn(msg2, actual) + subtests += 1 + self.assertEqual(subtests, len(data2)) # All subtests ran? + +# StdioFile tests. + +class S(str): + def __str__(self): + return '%s:str' % type(self).__name__ + def __unicode__(self): + return '%s:unicode' % type(self).__name__ + def __len__(self): + return 3 + def __iter__(self): + return iter('abc') + def __getitem__(self, *args): + return '%s:item' % type(self).__name__ + def __getslice__(self, *args): + return '%s:slice' % type(self).__name__ + + +class MockShell: + def __init__(self): + self.reset() + def write(self, *args): + self.written.append(args) + def readline(self): + return self.lines.pop() + def close(self): + pass + def reset(self): + self.written = [] + def push(self, lines): + self.lines = list(lines)[::-1] + + +class StdInputFilesTest(unittest.TestCase): + + def test_misc(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + self.assertIsInstance(f, io.TextIOBase) + self.assertEqual(f.encoding, 'utf-8') + self.assertEqual(f.errors, 'strict') + self.assertIsNone(f.newlines) + self.assertEqual(f.name, '') + self.assertFalse(f.closed) + self.assertTrue(f.isatty()) + self.assertTrue(f.readable()) + self.assertFalse(f.writable()) + self.assertFalse(f.seekable()) + + def test_unsupported(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + self.assertRaises(OSError, f.fileno) + self.assertRaises(OSError, f.tell) + self.assertRaises(OSError, f.seek, 0) + self.assertRaises(OSError, f.write, 'x') + self.assertRaises(OSError, f.writelines, ['x']) + + def test_read(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.read(), 'one\ntwo\n') + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.read(-1), 'one\ntwo\n') + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.read(None), 'one\ntwo\n') + shell.push(['one\n', 'two\n', 'three\n', '']) + self.assertEqual(f.read(2), 'on') + self.assertEqual(f.read(3), 'e\nt') + self.assertEqual(f.read(10), 'wo\nthree\n') + + shell.push(['one\n', 'two\n']) + self.assertEqual(f.read(0), '') + self.assertRaises(TypeError, f.read, 1.5) + self.assertRaises(TypeError, f.read, '1') + self.assertRaises(TypeError, f.read, 1, 1) + + def test_readline(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + shell.push(['one\n', 'two\n', 'three\n', 'four\n']) + self.assertEqual(f.readline(), 'one\n') + self.assertEqual(f.readline(-1), 'two\n') + self.assertEqual(f.readline(None), 'three\n') + shell.push(['one\ntwo\n']) + self.assertEqual(f.readline(), 'one\n') + self.assertEqual(f.readline(), 'two\n') + shell.push(['one', 'two', 'three']) + self.assertEqual(f.readline(), 'one') + self.assertEqual(f.readline(), 'two') + shell.push(['one\n', 'two\n', 'three\n']) + self.assertEqual(f.readline(2), 'on') + self.assertEqual(f.readline(1), 'e') + self.assertEqual(f.readline(1), '\n') + self.assertEqual(f.readline(10), 'two\n') + + shell.push(['one\n', 'two\n']) + self.assertEqual(f.readline(0), '') + self.assertRaises(TypeError, f.readlines, 1.5) + self.assertRaises(TypeError, f.readlines, '1') + self.assertRaises(TypeError, f.readlines, 1, 1) + + def test_readlines(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(), ['one\n', 'two\n']) + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(-1), ['one\n', 'two\n']) + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(None), ['one\n', 'two\n']) + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(0), ['one\n', 'two\n']) + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(3), ['one\n']) + shell.push(['one\n', 'two\n', '']) + self.assertEqual(f.readlines(4), ['one\n', 'two\n']) + + shell.push(['one\n', 'two\n', '']) + self.assertRaises(TypeError, f.readlines, 1.5) + self.assertRaises(TypeError, f.readlines, '1') + self.assertRaises(TypeError, f.readlines, 1, 1) + + def test_close(self): + shell = MockShell() + f = run.StdInputFile(shell, 'stdin') + shell.push(['one\n', 'two\n', '']) + self.assertFalse(f.closed) + self.assertEqual(f.readline(), 'one\n') + f.close() + self.assertFalse(f.closed) + self.assertEqual(f.readline(), 'two\n') + self.assertRaises(TypeError, f.close, 1) + + +class StdOutputFilesTest(unittest.TestCase): + + def test_misc(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stdout') + self.assertIsInstance(f, io.TextIOBase) + self.assertEqual(f.encoding, 'utf-8') + self.assertEqual(f.errors, 'strict') + self.assertIsNone(f.newlines) + self.assertEqual(f.name, '') + self.assertFalse(f.closed) + self.assertTrue(f.isatty()) + self.assertFalse(f.readable()) + self.assertTrue(f.writable()) + self.assertFalse(f.seekable()) + + def test_unsupported(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stdout') + self.assertRaises(OSError, f.fileno) + self.assertRaises(OSError, f.tell) + self.assertRaises(OSError, f.seek, 0) + self.assertRaises(OSError, f.read, 0) + self.assertRaises(OSError, f.readline, 0) + + def test_write(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stdout') + f.write('test') + self.assertEqual(shell.written, [('test', 'stdout')]) + shell.reset() + f.write('t\xe8\u015b\U0001d599') + self.assertEqual(shell.written, [('t\xe8\u015b\U0001d599', 'stdout')]) + shell.reset() + + f.write(S('t\xe8\u015b\U0001d599')) + self.assertEqual(shell.written, [('t\xe8\u015b\U0001d599', 'stdout')]) + self.assertEqual(type(shell.written[0][0]), str) + shell.reset() + + self.assertRaises(TypeError, f.write) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, b'test') + self.assertRaises(TypeError, f.write, 123) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, 'test', 'spam') + self.assertEqual(shell.written, []) + + def test_write_stderr_nonencodable(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stderr', 'iso-8859-15', 'backslashreplace') + f.write('t\xe8\u015b\U0001d599\xa4') + self.assertEqual(shell.written, [('t\xe8\\u015b\\U0001d599\\xa4', 'stderr')]) + shell.reset() + + f.write(S('t\xe8\u015b\U0001d599\xa4')) + self.assertEqual(shell.written, [('t\xe8\\u015b\\U0001d599\\xa4', 'stderr')]) + self.assertEqual(type(shell.written[0][0]), str) + shell.reset() + + self.assertRaises(TypeError, f.write) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, b'test') + self.assertRaises(TypeError, f.write, 123) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, 'test', 'spam') + self.assertEqual(shell.written, []) + + def test_writelines(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stdout') + f.writelines([]) + self.assertEqual(shell.written, []) + shell.reset() + f.writelines(['one\n', 'two']) + self.assertEqual(shell.written, + [('one\n', 'stdout'), ('two', 'stdout')]) + shell.reset() + f.writelines(['on\xe8\n', 'tw\xf2']) + self.assertEqual(shell.written, + [('on\xe8\n', 'stdout'), ('tw\xf2', 'stdout')]) + shell.reset() + + f.writelines([S('t\xe8st')]) + self.assertEqual(shell.written, [('t\xe8st', 'stdout')]) + self.assertEqual(type(shell.written[0][0]), str) + shell.reset() + + self.assertRaises(TypeError, f.writelines) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.writelines, 123) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.writelines, [b'test']) + self.assertRaises(TypeError, f.writelines, [123]) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.writelines, [], []) + self.assertEqual(shell.written, []) + + def test_close(self): + shell = MockShell() + f = run.StdOutputFile(shell, 'stdout') + self.assertFalse(f.closed) + f.write('test') + f.close() + self.assertTrue(f.closed) + self.assertRaises(ValueError, f.write, 'x') + self.assertEqual(shell.written, [('test', 'stdout')]) + f.close() + self.assertRaises(TypeError, f.close, 1) + + +class RecursionLimitTest(unittest.TestCase): + # Test (un)install_recursionlimit_wrappers and fixdoc. + + def test_bad_setrecursionlimit_calls(self): + run.install_recursionlimit_wrappers() + self.addCleanup(run.uninstall_recursionlimit_wrappers) + f = sys.setrecursionlimit + self.assertRaises(TypeError, f, limit=100) + self.assertRaises(TypeError, f, 100, 1000) + self.assertRaises(ValueError, f, 0) + + def test_roundtrip(self): + run.install_recursionlimit_wrappers() + self.addCleanup(run.uninstall_recursionlimit_wrappers) + + # Check that setting the recursion limit works. + orig_reclimit = sys.getrecursionlimit() + self.addCleanup(sys.setrecursionlimit, orig_reclimit) + sys.setrecursionlimit(orig_reclimit + 3) + + # Check that the new limit is returned by sys.getrecursionlimit(). + new_reclimit = sys.getrecursionlimit() + self.assertEqual(new_reclimit, orig_reclimit + 3) + + def test_default_recursion_limit_preserved(self): + orig_reclimit = sys.getrecursionlimit() + run.install_recursionlimit_wrappers() + self.addCleanup(run.uninstall_recursionlimit_wrappers) + new_reclimit = sys.getrecursionlimit() + self.assertEqual(new_reclimit, orig_reclimit) + + def test_fixdoc(self): + # Put here until better place for miscellaneous test. + def func(): "docstring" + run.fixdoc(func, "more") + self.assertEqual(func.__doc__, "docstring\n\nmore") + func.__doc__ = None + run.fixdoc(func, "more") + self.assertEqual(func.__doc__, "more") + + +class HandleErrorTest(unittest.TestCase): + # Method of MyRPCServer + def test_fatal_error(self): + eq = self.assertEqual + with captured_output('__stderr__') as err,\ + mock.patch('idlelib.run.thread.interrupt_main', + new_callable=Func) as func: + try: + raise EOFError + except EOFError: + run.MyRPCServer.handle_error(None, 'abc', '123') + eq(run.exit_now, True) + run.exit_now = False + eq(err.getvalue(), '') + + try: + raise IndexError + except IndexError: + run.MyRPCServer.handle_error(None, 'abc', '123') + eq(run.quitting, True) + run.quitting = False + msg = err.getvalue() + self.assertIn('abc', msg) + self.assertIn('123', msg) + self.assertIn('IndexError', msg) + eq(func.called, 2) + + +class ExecRuncodeTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.addClassCleanup(setattr,run,'print_exception',run.print_exception) + cls.prt = Func() # Need reference. + run.print_exception = cls.prt + mockrpc = mock.Mock() + mockrpc.console.getvar = Func(result=False) + cls.ex = run.Executive(mockrpc) + + @classmethod + def tearDownClass(cls): + assert sys.excepthook == sys.__excepthook__ + + def test_exceptions(self): + ex = self.ex + ex.runcode('1/0') + self.assertIs(ex.user_exc_info[0], ZeroDivisionError) + + self.addCleanup(setattr, sys, 'excepthook', sys.__excepthook__) + sys.excepthook = lambda t, e, tb: run.print_exception(t) + ex.runcode('1/0') + self.assertIs(self.prt.args[0], ZeroDivisionError) + + sys.excepthook = lambda: None + ex.runcode('1/0') + t, e, tb = ex.user_exc_info + self.assertIs(t, TypeError) + self.assertTrue(isinstance(e.__context__, ZeroDivisionError)) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_runscript.py b/micromamba_root/Lib/idlelib/idle_test/test_runscript.py new file mode 100644 index 0000000000000000000000000000000000000000..5fc60185a663e8f33d5fd10591df989190e038f8 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_runscript.py @@ -0,0 +1,33 @@ +"Test runscript, coverage 16%." + +from idlelib import runscript +import unittest +from test.support import requires +from tkinter import Tk +from idlelib.editor import EditorWindow + + +class ScriptBindingTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + ew = EditorWindow(root=self.root) + sb = runscript.ScriptBinding(ew) + ew._close() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_scrolledlist.py b/micromamba_root/Lib/idlelib/idle_test/test_scrolledlist.py new file mode 100644 index 0000000000000000000000000000000000000000..2f819fda025ba3d453e081327a05ffc2fd7cf972 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_scrolledlist.py @@ -0,0 +1,27 @@ +"Test scrolledlist, coverage 38%." + +from idlelib.scrolledlist import ScrolledList +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk + + +class ScrolledListTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + + def test_init(self): + ScrolledList(self.root) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_search.py b/micromamba_root/Lib/idlelib/idle_test/test_search.py new file mode 100644 index 0000000000000000000000000000000000000000..de703c195cd22900b92f3b239018f805bbf373da --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_search.py @@ -0,0 +1,80 @@ +"Test search, coverage 69%." + +from idlelib import search +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk, Text, BooleanVar +from idlelib import searchengine + +# Does not currently test the event handler wrappers. +# A usage test should simulate clicks and check highlighting. +# Tests need to be coordinated with SearchDialogBase tests +# to avoid duplication. + + +class SearchDialogTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def setUp(self): + self.engine = searchengine.SearchEngine(self.root) + self.dialog = search.SearchDialog(self.root, self.engine) + self.dialog.bell = lambda: None + self.text = Text(self.root) + self.text.insert('1.0', 'Hello World!') + + def test_find_again(self): + # Search for various expressions + text = self.text + + self.engine.setpat('') + self.assertFalse(self.dialog.find_again(text)) + self.dialog.bell = lambda: None + + self.engine.setpat('Hello') + self.assertTrue(self.dialog.find_again(text)) + + self.engine.setpat('Goodbye') + self.assertFalse(self.dialog.find_again(text)) + + self.engine.setpat('World!') + self.assertTrue(self.dialog.find_again(text)) + + self.engine.setpat('Hello World!') + self.assertTrue(self.dialog.find_again(text)) + + # Regular expression + self.engine.revar = BooleanVar(self.root, True) + self.engine.setpat('W[aeiouy]r') + self.assertTrue(self.dialog.find_again(text)) + + def test_find_selection(self): + # Select some text and make sure it's found + text = self.text + # Add additional line to find + self.text.insert('2.0', 'Hello World!') + + text.tag_add('sel', '1.0', '1.4') # Select 'Hello' + self.assertTrue(self.dialog.find_selection(text)) + + text.tag_remove('sel', '1.0', 'end') + text.tag_add('sel', '1.6', '1.11') # Select 'World!' + self.assertTrue(self.dialog.find_selection(text)) + + text.tag_remove('sel', '1.0', 'end') + text.tag_add('sel', '1.0', '1.11') # Select 'Hello World!' + self.assertTrue(self.dialog.find_selection(text)) + + # Remove additional line + text.delete('2.0', 'end') + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_searchbase.py b/micromamba_root/Lib/idlelib/idle_test/test_searchbase.py new file mode 100644 index 0000000000000000000000000000000000000000..8c9c410ebaf47c0626655cffe0fda4db83960819 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_searchbase.py @@ -0,0 +1,160 @@ +"Test searchbase, coverage 98%." +# The only thing not covered is inconsequential -- +# testing skipping of suite when self.needwrapbutton is false. + +import unittest +from test.support import requires +from tkinter import Text, Tk, Toplevel +from tkinter.ttk import Frame +from idlelib import searchengine as se +from idlelib import searchbase as sdb +from idlelib.idle_test.mock_idle import Func +## from idlelib.idle_test.mock_tk import Var + +# The ## imports above & following could help make some tests gui-free. +# However, they currently make radiobutton tests fail. +##def setUpModule(): +## # Replace tk objects used to initialize se.SearchEngine. +## se.BooleanVar = Var +## se.StringVar = Var +## +##def tearDownModule(): +## se.BooleanVar = BooleanVar +## se.StringVar = StringVar + + +class SearchDialogBaseTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def setUp(self): + self.engine = se.SearchEngine(self.root) # None also seems to work + self.dialog = sdb.SearchDialogBase(root=self.root, engine=self.engine) + + def tearDown(self): + self.dialog.close() + + def test_open_and_close(self): + # open calls create_widgets, which needs default_command + self.dialog.default_command = None + + toplevel = Toplevel(self.root) + text = Text(toplevel) + self.dialog.open(text) + self.assertEqual(self.dialog.top.state(), 'normal') + self.dialog.close() + self.assertEqual(self.dialog.top.state(), 'withdrawn') + + self.dialog.open(text, searchphrase="hello") + self.assertEqual(self.dialog.ent.get(), 'hello') + toplevel.update_idletasks() + toplevel.destroy() + + def test_create_widgets(self): + self.dialog.create_entries = Func() + self.dialog.create_option_buttons = Func() + self.dialog.create_other_buttons = Func() + self.dialog.create_command_buttons = Func() + + self.dialog.default_command = None + self.dialog.create_widgets() + + self.assertTrue(self.dialog.create_entries.called) + self.assertTrue(self.dialog.create_option_buttons.called) + self.assertTrue(self.dialog.create_other_buttons.called) + self.assertTrue(self.dialog.create_command_buttons.called) + + def test_make_entry(self): + equal = self.assertEqual + self.dialog.row = 0 + self.dialog.frame = Frame(self.root) + entry, label = self.dialog.make_entry("Test:", 'hello') + equal(label['text'], 'Test:') + + self.assertIn(entry.get(), 'hello') + egi = entry.grid_info() + equal(int(egi['row']), 0) + equal(int(egi['column']), 1) + equal(int(egi['rowspan']), 1) + equal(int(egi['columnspan']), 1) + equal(self.dialog.row, 1) + + def test_create_entries(self): + self.dialog.frame = Frame(self.root) + self.dialog.row = 0 + self.engine.setpat('hello') + self.dialog.create_entries() + self.assertIn(self.dialog.ent.get(), 'hello') + + def test_make_frame(self): + self.dialog.row = 0 + self.dialog.frame = Frame(self.root) + frame, label = self.dialog.make_frame() + self.assertEqual(label, '') + self.assertEqual(str(type(frame)), "") + # self.assertIsInstance(frame, Frame) fails when test is run by + # test_idle not run from IDLE editor. See issue 33987 PR. + + frame, label = self.dialog.make_frame('testlabel') + self.assertEqual(label['text'], 'testlabel') + + def btn_test_setup(self, meth): + self.dialog.frame = Frame(self.root) + self.dialog.row = 0 + return meth() + + def test_create_option_buttons(self): + e = self.engine + for state in (0, 1): + for var in (e.revar, e.casevar, e.wordvar, e.wrapvar): + var.set(state) + frame, options = self.btn_test_setup( + self.dialog.create_option_buttons) + for spec, button in zip (options, frame.pack_slaves()): + var, label = spec + self.assertEqual(button['text'], label) + self.assertEqual(var.get(), state) + + def test_create_other_buttons(self): + for state in (False, True): + var = self.engine.backvar + var.set(state) + frame, others = self.btn_test_setup( + self.dialog.create_other_buttons) + buttons = frame.pack_slaves() + for spec, button in zip(others, buttons): + val, label = spec + self.assertEqual(button['text'], label) + if val == state: + # hit other button, then this one + # indexes depend on button order + self.assertEqual(var.get(), state) + + def test_make_button(self): + self.dialog.frame = Frame(self.root) + self.dialog.buttonframe = Frame(self.dialog.frame) + btn = self.dialog.make_button('Test', self.dialog.close) + self.assertEqual(btn['text'], 'Test') + + def test_create_command_buttons(self): + self.dialog.frame = Frame(self.root) + self.dialog.create_command_buttons() + # Look for close button command in buttonframe + closebuttoncommand = '' + for child in self.dialog.buttonframe.winfo_children(): + if child['text'] == 'Close': + closebuttoncommand = child['command'] + self.assertIn('close', closebuttoncommand) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_searchengine.py b/micromamba_root/Lib/idlelib/idle_test/test_searchengine.py new file mode 100644 index 0000000000000000000000000000000000000000..9d97983941958606af154d8a4f8bb70bf9695d00 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_searchengine.py @@ -0,0 +1,332 @@ +"Test searchengine, coverage 99%." + +from idlelib import searchengine as se +import unittest +# from test.support import requires +from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text +from tkinter import messagebox +from idlelib.idle_test.mock_tk import Var, Mbox +from idlelib.idle_test.mock_tk import Text as mockText +import re + +# With mock replacements, the module does not use any gui widgets. +# The use of tk.Text is avoided (for now, until mock Text is improved) +# by patching instances with an index function returning what is needed. +# This works because mock Text.get does not use .index. +# The tkinter imports are used to restore searchengine. + +def setUpModule(): + # Replace s-e module tkinter imports other than non-gui TclError. + se.BooleanVar = Var + se.StringVar = Var + se.messagebox = Mbox + +def tearDownModule(): + # Restore 'just in case', though other tests should also replace. + se.BooleanVar = BooleanVar + se.StringVar = StringVar + se.messagebox = messagebox + + +class Mock: + def __init__(self, *args, **kwargs): pass + +class GetTest(unittest.TestCase): + # SearchEngine.get returns singleton created & saved on first call. + def test_get(self): + saved_Engine = se.SearchEngine + se.SearchEngine = Mock # monkey-patch class + try: + root = Mock() + engine = se.get(root) + self.assertIsInstance(engine, se.SearchEngine) + self.assertIs(root._searchengine, engine) + self.assertIs(se.get(root), engine) + finally: + se.SearchEngine = saved_Engine # restore class to module + +class GetLineColTest(unittest.TestCase): + # Test simple text-independent helper function + def test_get_line_col(self): + self.assertEqual(se.get_line_col('1.0'), (1, 0)) + self.assertEqual(se.get_line_col('1.11'), (1, 11)) + + self.assertRaises(ValueError, se.get_line_col, ('1.0 lineend')) + self.assertRaises(ValueError, se.get_line_col, ('end')) + +class GetSelectionTest(unittest.TestCase): + # Test text-dependent helper function. +## # Need gui for text.index('sel.first/sel.last/insert'). +## @classmethod +## def setUpClass(cls): +## requires('gui') +## cls.root = Tk() +## +## @classmethod +## def tearDownClass(cls): +## cls.root.destroy() +## del cls.root + + def test_get_selection(self): + # text = Text(master=self.root) + text = mockText() + text.insert('1.0', 'Hello World!') + + # fix text.index result when called in get_selection + def sel(s): + # select entire text, cursor irrelevant + if s == 'sel.first': return '1.0' + if s == 'sel.last': return '1.12' + raise TclError + text.index = sel # replaces .tag_add('sel', '1.0, '1.12') + self.assertEqual(se.get_selection(text), ('1.0', '1.12')) + + def mark(s): + # no selection, cursor after 'Hello' + if s == 'insert': return '1.5' + raise TclError + text.index = mark # replaces .mark_set('insert', '1.5') + self.assertEqual(se.get_selection(text), ('1.5', '1.5')) + + +class ReverseSearchTest(unittest.TestCase): + # Test helper function that searches backwards within a line. + def test_search_reverse(self): + Equal = self.assertEqual + line = "Here is an 'is' test text." + prog = re.compile('is') + Equal(se.search_reverse(prog, line, len(line)).span(), (12, 14)) + Equal(se.search_reverse(prog, line, 14).span(), (12, 14)) + Equal(se.search_reverse(prog, line, 13).span(), (5, 7)) + Equal(se.search_reverse(prog, line, 7).span(), (5, 7)) + Equal(se.search_reverse(prog, line, 6), None) + + +class SearchEngineTest(unittest.TestCase): + # Test class methods that do not use Text widget. + + def setUp(self): + self.engine = se.SearchEngine(root=None) + # Engine.root is only used to create error message boxes. + # The mock replacement ignores the root argument. + + def test_is_get(self): + engine = self.engine + Equal = self.assertEqual + + Equal(engine.getpat(), '') + engine.setpat('hello') + Equal(engine.getpat(), 'hello') + + Equal(engine.isre(), False) + engine.revar.set(1) + Equal(engine.isre(), True) + + Equal(engine.iscase(), False) + engine.casevar.set(1) + Equal(engine.iscase(), True) + + Equal(engine.isword(), False) + engine.wordvar.set(1) + Equal(engine.isword(), True) + + Equal(engine.iswrap(), True) + engine.wrapvar.set(0) + Equal(engine.iswrap(), False) + + Equal(engine.isback(), False) + engine.backvar.set(1) + Equal(engine.isback(), True) + + def test_setcookedpat(self): + engine = self.engine + engine.setcookedpat(r'\s') + self.assertEqual(engine.getpat(), r'\s') + engine.revar.set(1) + engine.setcookedpat(r'\s') + self.assertEqual(engine.getpat(), r'\\s') + + def test_getcookedpat(self): + engine = self.engine + Equal = self.assertEqual + + Equal(engine.getcookedpat(), '') + engine.setpat('hello') + Equal(engine.getcookedpat(), 'hello') + engine.wordvar.set(True) + Equal(engine.getcookedpat(), r'\bhello\b') + engine.wordvar.set(False) + + engine.setpat(r'\s') + Equal(engine.getcookedpat(), r'\\s') + engine.revar.set(True) + Equal(engine.getcookedpat(), r'\s') + + def test_getprog(self): + engine = self.engine + Equal = self.assertEqual + + engine.setpat('Hello') + temppat = engine.getprog() + Equal(temppat.pattern, re.compile('Hello', re.IGNORECASE).pattern) + engine.casevar.set(1) + temppat = engine.getprog() + Equal(temppat.pattern, re.compile('Hello').pattern, 0) + + engine.setpat('') + Equal(engine.getprog(), None) + Equal(Mbox.showerror.message, + 'Error: Empty regular expression') + engine.setpat('+') + engine.revar.set(1) + Equal(engine.getprog(), None) + Equal(Mbox.showerror.message, + 'Error: nothing to repeat\nPattern: +\nOffset: 0') + + def test_report_error(self): + showerror = Mbox.showerror + Equal = self.assertEqual + pat = '[a-z' + msg = 'unexpected end of regular expression' + + Equal(self.engine.report_error(pat, msg), None) + Equal(showerror.title, 'Regular expression error') + expected_message = ("Error: " + msg + "\nPattern: [a-z") + Equal(showerror.message, expected_message) + + Equal(self.engine.report_error(pat, msg, 5), None) + Equal(showerror.title, 'Regular expression error') + expected_message += "\nOffset: 5" + Equal(showerror.message, expected_message) + + +class SearchTest(unittest.TestCase): + # Test that search_text makes right call to right method. + + @classmethod + def setUpClass(cls): +## requires('gui') +## cls.root = Tk() +## cls.text = Text(master=cls.root) + cls.text = mockText() + test_text = ( + 'First line\n' + 'Line with target\n' + 'Last line\n') + cls.text.insert('1.0', test_text) + cls.pat = re.compile('target') + + cls.engine = se.SearchEngine(None) + cls.engine.search_forward = lambda *args: ('f', args) + cls.engine.search_backward = lambda *args: ('b', args) + +## @classmethod +## def tearDownClass(cls): +## cls.root.destroy() +## del cls.root + + def test_search(self): + Equal = self.assertEqual + engine = self.engine + search = engine.search_text + text = self.text + pat = self.pat + + engine.patvar.set(None) + #engine.revar.set(pat) + Equal(search(text), None) + + def mark(s): + # no selection, cursor after 'Hello' + if s == 'insert': return '1.5' + raise TclError + text.index = mark + Equal(search(text, pat), ('f', (text, pat, 1, 5, True, False))) + engine.wrapvar.set(False) + Equal(search(text, pat), ('f', (text, pat, 1, 5, False, False))) + engine.wrapvar.set(True) + engine.backvar.set(True) + Equal(search(text, pat), ('b', (text, pat, 1, 5, True, False))) + engine.backvar.set(False) + + def sel(s): + if s == 'sel.first': return '2.10' + if s == 'sel.last': return '2.16' + raise TclError + text.index = sel + Equal(search(text, pat), ('f', (text, pat, 2, 16, True, False))) + Equal(search(text, pat, True), ('f', (text, pat, 2, 10, True, True))) + engine.backvar.set(True) + Equal(search(text, pat), ('b', (text, pat, 2, 10, True, False))) + Equal(search(text, pat, True), ('b', (text, pat, 2, 16, True, True))) + + +class ForwardBackwardTest(unittest.TestCase): + # Test that search_forward method finds the target. +## @classmethod +## def tearDownClass(cls): +## cls.root.destroy() +## del cls.root + + @classmethod + def setUpClass(cls): + cls.engine = se.SearchEngine(None) +## requires('gui') +## cls.root = Tk() +## cls.text = Text(master=cls.root) + cls.text = mockText() + # search_backward calls index('end-1c') + cls.text.index = lambda index: '4.0' + test_text = ( + 'First line\n' + 'Line with target\n' + 'Last line\n') + cls.text.insert('1.0', test_text) + cls.pat = re.compile('target') + cls.res = (2, (10, 16)) # line, slice indexes of 'target' + cls.failpat = re.compile('xyz') # not in text + cls.emptypat = re.compile(r'\w*') # empty match possible + + def make_search(self, func): + def search(pat, line, col, wrap, ok=0): + res = func(self.text, pat, line, col, wrap, ok) + # res is (line, matchobject) or None + return (res[0], res[1].span()) if res else res + return search + + def test_search_forward(self): + # search for non-empty match + Equal = self.assertEqual + forward = self.make_search(self.engine.search_forward) + pat = self.pat + Equal(forward(pat, 1, 0, True), self.res) + Equal(forward(pat, 3, 0, True), self.res) # wrap + Equal(forward(pat, 3, 0, False), None) # no wrap + Equal(forward(pat, 2, 10, False), self.res) + + Equal(forward(self.failpat, 1, 0, True), None) + Equal(forward(self.emptypat, 2, 9, True, ok=True), (2, (9, 9))) + #Equal(forward(self.emptypat, 2, 9, True), self.res) + # While the initial empty match is correctly ignored, skipping + # the rest of the line and returning (3, (0,4)) seems buggy - tjr. + Equal(forward(self.emptypat, 2, 10, True), self.res) + + def test_search_backward(self): + # search for non-empty match + Equal = self.assertEqual + backward = self.make_search(self.engine.search_backward) + pat = self.pat + Equal(backward(pat, 3, 5, True), self.res) + Equal(backward(pat, 2, 0, True), self.res) # wrap + Equal(backward(pat, 2, 0, False), None) # no wrap + Equal(backward(pat, 2, 16, False), self.res) + + Equal(backward(self.failpat, 3, 9, True), None) + Equal(backward(self.emptypat, 2, 10, True, ok=True), (2, (9,9))) + # Accepted because 9 < 10, not because ok=True. + # It is not clear that ok=True is useful going back - tjr + Equal(backward(self.emptypat, 2, 9, True), (2, (5, 9))) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_sidebar.py b/micromamba_root/Lib/idlelib/idle_test/test_sidebar.py new file mode 100644 index 0000000000000000000000000000000000000000..4157a4b4dcdd2aaf1a0e1936b115421aa339b5ed --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_sidebar.py @@ -0,0 +1,775 @@ +"""Test sidebar, coverage 85%""" +from textwrap import dedent +import sys + +from itertools import chain +import unittest +import unittest.mock +from test.support import requires, swap_attr +from test import support +import tkinter as tk +from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop + +from idlelib.delegator import Delegator +from idlelib.editor import fixwordbreaks +from idlelib.percolator import Percolator +import idlelib.pyshell +from idlelib.pyshell import fix_x11_paste, PyShell, PyShellFileList +from idlelib.run import fix_scaling +import idlelib.sidebar +from idlelib.sidebar import get_end_linenumber, get_lineno + + +class Dummy_editwin: + def __init__(self, text): + self.text = text + self.text_frame = self.text.master + self.per = Percolator(text) + self.undo = Delegator() + self.per.insertfilter(self.undo) + + def setvar(self, name, value): + pass + + def getlineno(self, index): + return int(float(self.text.index(index))) + + +class LineNumbersTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + cls.root.withdraw() + + cls.text_frame = tk.Frame(cls.root) + cls.text_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) + cls.text_frame.rowconfigure(1, weight=1) + cls.text_frame.columnconfigure(1, weight=1) + + cls.text = tk.Text(cls.text_frame, width=80, height=24, wrap=tk.NONE) + cls.text.grid(row=1, column=1, sticky=tk.NSEW) + + cls.editwin = Dummy_editwin(cls.text) + cls.editwin.vbar = tk.Scrollbar(cls.text_frame) + + @classmethod + def tearDownClass(cls): + cls.editwin.per.close() + cls.root.update_idletasks() + cls.root.destroy() + del cls.text, cls.text_frame, cls.editwin, cls.root + + def setUp(self): + self.linenumber = idlelib.sidebar.LineNumbers(self.editwin) + + self.highlight_cfg = {"background": '#abcdef', + "foreground": '#123456'} + orig_idleConf_GetHighlight = idlelib.sidebar.idleConf.GetHighlight + def mock_idleconf_GetHighlight(theme, element): + if element == 'linenumber': + return self.highlight_cfg + return orig_idleConf_GetHighlight(theme, element) + GetHighlight_patcher = unittest.mock.patch.object( + idlelib.sidebar.idleConf, 'GetHighlight', mock_idleconf_GetHighlight) + GetHighlight_patcher.start() + self.addCleanup(GetHighlight_patcher.stop) + + self.font_override = 'TkFixedFont' + def mock_idleconf_GetFont(root, configType, section): + return self.font_override + GetFont_patcher = unittest.mock.patch.object( + idlelib.sidebar.idleConf, 'GetFont', mock_idleconf_GetFont) + GetFont_patcher.start() + self.addCleanup(GetFont_patcher.stop) + + def tearDown(self): + self.text.delete('1.0', 'end') + + def get_selection(self): + return tuple(map(str, self.text.tag_ranges('sel'))) + + def get_line_screen_position(self, line): + bbox = self.linenumber.sidebar_text.bbox(f'{line}.end -1c') + x = bbox[0] + 2 + y = bbox[1] + 2 + return x, y + + def assert_state_disabled(self): + state = self.linenumber.sidebar_text.config()['state'] + self.assertEqual(state[-1], tk.DISABLED) + + def get_sidebar_text_contents(self): + return self.linenumber.sidebar_text.get('1.0', tk.END) + + def assert_sidebar_n_lines(self, n_lines): + expected = '\n'.join(chain(map(str, range(1, n_lines + 1)), [''])) + self.assertEqual(self.get_sidebar_text_contents(), expected) + + def assert_text_equals(self, expected): + return self.assertEqual(self.text.get('1.0', 'end'), expected) + + def test_init_empty(self): + self.assert_sidebar_n_lines(1) + + def test_init_not_empty(self): + self.text.insert('insert', 'foo bar\n'*3) + self.assert_text_equals('foo bar\n'*3 + '\n') + self.assert_sidebar_n_lines(4) + + def test_toggle_linenumbering(self): + self.assertEqual(self.linenumber.is_shown, False) + self.linenumber.show_sidebar() + self.assertEqual(self.linenumber.is_shown, True) + self.linenumber.hide_sidebar() + self.assertEqual(self.linenumber.is_shown, False) + self.linenumber.hide_sidebar() + self.assertEqual(self.linenumber.is_shown, False) + self.linenumber.show_sidebar() + self.assertEqual(self.linenumber.is_shown, True) + self.linenumber.show_sidebar() + self.assertEqual(self.linenumber.is_shown, True) + + def test_insert(self): + self.text.insert('insert', 'foobar') + self.assert_text_equals('foobar\n') + self.assert_sidebar_n_lines(1) + self.assert_state_disabled() + + self.text.insert('insert', '\nfoo') + self.assert_text_equals('foobar\nfoo\n') + self.assert_sidebar_n_lines(2) + self.assert_state_disabled() + + self.text.insert('insert', 'hello\n'*2) + self.assert_text_equals('foobar\nfoohello\nhello\n\n') + self.assert_sidebar_n_lines(4) + self.assert_state_disabled() + + self.text.insert('insert', '\nworld') + self.assert_text_equals('foobar\nfoohello\nhello\n\nworld\n') + self.assert_sidebar_n_lines(5) + self.assert_state_disabled() + + def test_delete(self): + self.text.insert('insert', 'foobar') + self.assert_text_equals('foobar\n') + self.text.delete('1.1', '1.3') + self.assert_text_equals('fbar\n') + self.assert_sidebar_n_lines(1) + self.assert_state_disabled() + + self.text.insert('insert', 'foo\n'*2) + self.assert_text_equals('fbarfoo\nfoo\n\n') + self.assert_sidebar_n_lines(3) + self.assert_state_disabled() + + # Deleting up to "2.end" doesn't delete the final newline. + self.text.delete('2.0', '2.end') + self.assert_text_equals('fbarfoo\n\n\n') + self.assert_sidebar_n_lines(3) + self.assert_state_disabled() + + self.text.delete('1.3', 'end') + self.assert_text_equals('fba\n') + self.assert_sidebar_n_lines(1) + self.assert_state_disabled() + + # Text widgets always keep a single '\n' character at the end. + self.text.delete('1.0', 'end') + self.assert_text_equals('\n') + self.assert_sidebar_n_lines(1) + self.assert_state_disabled() + + def test_sidebar_text_width(self): + """ + Test that linenumber text widget is always at the minimum + width + """ + def get_width(): + return self.linenumber.sidebar_text.config()['width'][-1] + + self.assert_sidebar_n_lines(1) + self.assertEqual(get_width(), 1) + + self.text.insert('insert', 'foo') + self.assert_sidebar_n_lines(1) + self.assertEqual(get_width(), 1) + + self.text.insert('insert', 'foo\n'*8) + self.assert_sidebar_n_lines(9) + self.assertEqual(get_width(), 1) + + self.text.insert('insert', 'foo\n') + self.assert_sidebar_n_lines(10) + self.assertEqual(get_width(), 2) + + self.text.insert('insert', 'foo\n') + self.assert_sidebar_n_lines(11) + self.assertEqual(get_width(), 2) + + self.text.delete('insert -1l linestart', 'insert linestart') + self.assert_sidebar_n_lines(10) + self.assertEqual(get_width(), 2) + + self.text.delete('insert -1l linestart', 'insert linestart') + self.assert_sidebar_n_lines(9) + self.assertEqual(get_width(), 1) + + self.text.insert('insert', 'foo\n'*90) + self.assert_sidebar_n_lines(99) + self.assertEqual(get_width(), 2) + + self.text.insert('insert', 'foo\n') + self.assert_sidebar_n_lines(100) + self.assertEqual(get_width(), 3) + + self.text.insert('insert', 'foo\n') + self.assert_sidebar_n_lines(101) + self.assertEqual(get_width(), 3) + + self.text.delete('insert -1l linestart', 'insert linestart') + self.assert_sidebar_n_lines(100) + self.assertEqual(get_width(), 3) + + self.text.delete('insert -1l linestart', 'insert linestart') + self.assert_sidebar_n_lines(99) + self.assertEqual(get_width(), 2) + + self.text.delete('50.0 -1c', 'end -1c') + self.assert_sidebar_n_lines(49) + self.assertEqual(get_width(), 2) + + self.text.delete('5.0 -1c', 'end -1c') + self.assert_sidebar_n_lines(4) + self.assertEqual(get_width(), 1) + + # Text widgets always keep a single '\n' character at the end. + self.text.delete('1.0', 'end -1c') + self.assert_sidebar_n_lines(1) + self.assertEqual(get_width(), 1) + + # The following tests are temporarily disabled due to relying on + # simulated user input and inspecting which text is selected, which + # are fragile and can fail when several GUI tests are run in parallel + # or when the windows created by the test lose focus. + # + # TODO: Re-work these tests or remove them from the test suite. + + @unittest.skip('test disabled') + def test_click_selection(self): + self.linenumber.show_sidebar() + self.text.insert('1.0', 'one\ntwo\nthree\nfour\n') + self.root.update() + + # Click on the second line. + x, y = self.get_line_screen_position(2) + self.linenumber.sidebar_text.event_generate('', x=x, y=y) + self.linenumber.sidebar_text.update() + self.root.update() + + self.assertEqual(self.get_selection(), ('2.0', '3.0')) + + def simulate_drag(self, start_line, end_line): + start_x, start_y = self.get_line_screen_position(start_line) + end_x, end_y = self.get_line_screen_position(end_line) + + self.linenumber.sidebar_text.event_generate('', + x=start_x, y=start_y) + self.root.update() + + def lerp(a, b, steps): + """linearly interpolate from a to b (inclusive) in equal steps""" + last_step = steps - 1 + for i in range(steps): + yield ((last_step - i) / last_step) * a + (i / last_step) * b + + for x, y in zip( + map(int, lerp(start_x, end_x, steps=11)), + map(int, lerp(start_y, end_y, steps=11)), + ): + self.linenumber.sidebar_text.event_generate('', x=x, y=y) + self.root.update() + + self.linenumber.sidebar_text.event_generate('', + x=end_x, y=end_y) + self.root.update() + + @unittest.skip('test disabled') + def test_drag_selection_down(self): + self.linenumber.show_sidebar() + self.text.insert('1.0', 'one\ntwo\nthree\nfour\nfive\n') + self.root.update() + + # Drag from the second line to the fourth line. + self.simulate_drag(2, 4) + self.assertEqual(self.get_selection(), ('2.0', '5.0')) + + @unittest.skip('test disabled') + def test_drag_selection_up(self): + self.linenumber.show_sidebar() + self.text.insert('1.0', 'one\ntwo\nthree\nfour\nfive\n') + self.root.update() + + # Drag from the fourth line to the second line. + self.simulate_drag(4, 2) + self.assertEqual(self.get_selection(), ('2.0', '5.0')) + + def test_scroll(self): + self.linenumber.show_sidebar() + self.text.insert('1.0', 'line\n' * 100) + self.root.update() + + # Scroll down 10 lines. + self.text.yview_scroll(10, 'unit') + self.root.update() + self.assertEqual(self.text.index('@0,0'), '11.0') + self.assertEqual(self.linenumber.sidebar_text.index('@0,0'), '11.0') + + # Generate a mouse-wheel event and make sure it scrolled up or down. + # The meaning of the "delta" is OS-dependent, so this just checks for + # any change. + self.linenumber.sidebar_text.event_generate('', + x=0, y=0, + delta=10) + self.root.update() + self.assertNotEqual(self.text.index('@0,0'), '11.0') + self.assertNotEqual(self.linenumber.sidebar_text.index('@0,0'), '11.0') + + def test_font(self): + ln = self.linenumber + + orig_font = ln.sidebar_text['font'] + test_font = 'TkTextFont' + self.assertNotEqual(orig_font, test_font) + + # Ensure line numbers aren't shown. + ln.hide_sidebar() + + self.font_override = test_font + # Nothing breaks when line numbers aren't shown. + ln.update_font() + + # Activate line numbers, previous font change is immediately effective. + ln.show_sidebar() + self.assertEqual(ln.sidebar_text['font'], test_font) + + # Call the font update with line numbers shown, change is picked up. + self.font_override = orig_font + ln.update_font() + self.assertEqual(ln.sidebar_text['font'], orig_font) + + def test_highlight_colors(self): + ln = self.linenumber + + orig_colors = dict(self.highlight_cfg) + test_colors = {'background': '#222222', 'foreground': '#ffff00'} + + def assert_colors_are_equal(colors): + self.assertEqual(ln.sidebar_text['background'], colors['background']) + self.assertEqual(ln.sidebar_text['foreground'], colors['foreground']) + + # Ensure line numbers aren't shown. + ln.hide_sidebar() + + self.highlight_cfg = test_colors + # Nothing breaks with inactive line numbers. + ln.update_colors() + + # Show line numbers, previous colors change is immediately effective. + ln.show_sidebar() + assert_colors_are_equal(test_colors) + + # Call colors update with no change to the configured colors. + ln.update_colors() + assert_colors_are_equal(test_colors) + + # Call the colors update with line numbers shown, change is picked up. + self.highlight_cfg = orig_colors + ln.update_colors() + assert_colors_are_equal(orig_colors) + + +class ShellSidebarTest(unittest.TestCase): + root: tk.Tk = None + shell: PyShell = None + + @classmethod + def setUpClass(cls): + requires('gui') + + cls.root = root = tk.Tk() + root.withdraw() + + fix_scaling(root) + fixwordbreaks(root) + fix_x11_paste(root) + + cls.flist = flist = PyShellFileList(root) + # See #43981 about macosx.setupApp(root, flist) causing failure. + root.update_idletasks() + + cls.init_shell() + + @classmethod + def tearDownClass(cls): + if cls.shell is not None: + cls.shell.executing = False + cls.shell.close() + cls.shell = None + cls.flist = None + cls.root.update_idletasks() + cls.root.destroy() + cls.root = None + + @classmethod + def init_shell(cls): + cls.shell = cls.flist.open_shell() + cls.shell.pollinterval = 10 + cls.root.update() + cls.n_preface_lines = get_lineno(cls.shell.text, 'end-1c') - 1 + + @classmethod + def reset_shell(cls): + cls.shell.per.bottom.delete(f'{cls.n_preface_lines+1}.0', 'end-1c') + cls.shell.shell_sidebar.update_sidebar() + cls.root.update() + + def setUp(self): + # In some test environments, e.g. Azure Pipelines (as of + # Apr. 2021), sys.stdout is changed between tests. However, + # PyShell relies on overriding sys.stdout when run without a + # sub-process (as done here; see setUpClass). + self._saved_stdout = None + if sys.stdout != self.shell.stdout: + self._saved_stdout = sys.stdout + sys.stdout = self.shell.stdout + + self.reset_shell() + + def tearDown(self): + if self._saved_stdout is not None: + sys.stdout = self._saved_stdout + + def get_sidebar_lines(self): + canvas = self.shell.shell_sidebar.canvas + texts = list(canvas.find(tk.ALL)) + texts_by_y_coords = { + canvas.bbox(text)[1]: canvas.itemcget(text, 'text') + for text in texts + } + line_y_coords = self.get_shell_line_y_coords() + return [texts_by_y_coords.get(y, None) for y in line_y_coords] + + def assert_sidebar_lines_end_with(self, expected_lines): + self.shell.shell_sidebar.update_sidebar() + self.assertEqual( + self.get_sidebar_lines()[-len(expected_lines):], + expected_lines, + ) + + def get_shell_line_y_coords(self): + text = self.shell.text + y_coords = [] + index = text.index("@0,0") + if index.split('.', 1)[1] != '0': + index = text.index(f"{index} +1line linestart") + while (lineinfo := text.dlineinfo(index)) is not None: + y_coords.append(lineinfo[1]) + index = text.index(f"{index} +1line") + return y_coords + + def get_sidebar_line_y_coords(self): + canvas = self.shell.shell_sidebar.canvas + texts = list(canvas.find(tk.ALL)) + texts.sort(key=lambda text: canvas.bbox(text)[1]) + return [canvas.bbox(text)[1] for text in texts] + + def assert_sidebar_lines_synced(self): + self.assertLessEqual( + set(self.get_sidebar_line_y_coords()), + set(self.get_shell_line_y_coords()), + ) + + def do_input(self, input): + shell = self.shell + text = shell.text + for line_index, line in enumerate(input.split('\n')): + if line_index > 0: + text.event_generate('<>') + text.insert('insert', line, 'stdin') + + def test_initial_state(self): + sidebar_lines = self.get_sidebar_lines() + self.assertEqual( + sidebar_lines, + [None] * (len(sidebar_lines) - 1) + ['>>>'], + ) + self.assert_sidebar_lines_synced() + + @run_in_tk_mainloop() + def test_single_empty_input(self): + self.do_input('\n') + yield + self.assert_sidebar_lines_end_with(['>>>', '>>>']) + + @run_in_tk_mainloop() + def test_single_line_statement(self): + self.do_input('1\n') + yield + self.assert_sidebar_lines_end_with(['>>>', None, '>>>']) + + @run_in_tk_mainloop() + def test_multi_line_statement(self): + # Block statements are not indented because IDLE auto-indents. + self.do_input(dedent('''\ + if True: + print(1) + + ''')) + yield + self.assert_sidebar_lines_end_with([ + '>>>', + '...', + '...', + '...', + None, + '>>>', + ]) + + @run_in_tk_mainloop() + def test_single_long_line_wraps(self): + self.do_input('1' * 200 + '\n') + yield + self.assert_sidebar_lines_end_with(['>>>', None, '>>>']) + self.assert_sidebar_lines_synced() + + @run_in_tk_mainloop() + def test_squeeze_multi_line_output(self): + shell = self.shell + text = shell.text + + self.do_input('print("a\\nb\\nc")\n') + yield + self.assert_sidebar_lines_end_with(['>>>', None, None, None, '>>>']) + + text.mark_set('insert', f'insert -1line linestart') + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with(['>>>', None, '>>>']) + self.assert_sidebar_lines_synced() + + shell.squeezer.expandingbuttons[0].expand() + yield + self.assert_sidebar_lines_end_with(['>>>', None, None, None, '>>>']) + self.assert_sidebar_lines_synced() + + @run_in_tk_mainloop() + def test_interrupt_recall_undo_redo(self): + text = self.shell.text + # Block statements are not indented because IDLE auto-indents. + initial_sidebar_lines = self.get_sidebar_lines() + + self.do_input(dedent('''\ + if True: + print(1) + ''')) + yield + self.assert_sidebar_lines_end_with(['>>>', '...', '...']) + with_block_sidebar_lines = self.get_sidebar_lines() + self.assertNotEqual(with_block_sidebar_lines, initial_sidebar_lines) + + # Control-C + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with(['>>>', '...', '...', None, '>>>']) + + # Recall previous via history + text.event_generate('<>') + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with(['>>>', '...', None, '>>>']) + + # Recall previous via recall + text.mark_set('insert', text.index('insert -2l')) + text.event_generate('<>') + yield + + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with(['>>>']) + + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with(['>>>', '...']) + + text.event_generate('<>') + text.event_generate('<>') + yield + self.assert_sidebar_lines_end_with( + ['>>>', '...', '...', '...', None, '>>>'] + ) + + @run_in_tk_mainloop() + def test_very_long_wrapped_line(self): + with support.adjust_int_max_str_digits(11_111), \ + swap_attr(self.shell, 'squeezer', None): + self.do_input('x = ' + '1'*10_000 + '\n') + yield + self.assertEqual(self.get_sidebar_lines(), ['>>>']) + + def test_font(self): + sidebar = self.shell.shell_sidebar + + test_font = 'TkTextFont' + + def mock_idleconf_GetFont(root, configType, section): + return test_font + GetFont_patcher = unittest.mock.patch.object( + idlelib.sidebar.idleConf, 'GetFont', mock_idleconf_GetFont) + GetFont_patcher.start() + def cleanup(): + GetFont_patcher.stop() + sidebar.update_font() + self.addCleanup(cleanup) + + def get_sidebar_font(): + canvas = sidebar.canvas + texts = list(canvas.find(tk.ALL)) + fonts = {canvas.itemcget(text, 'font') for text in texts} + self.assertEqual(len(fonts), 1) + return next(iter(fonts)) + + self.assertNotEqual(get_sidebar_font(), test_font) + sidebar.update_font() + self.assertEqual(get_sidebar_font(), test_font) + + def test_highlight_colors(self): + sidebar = self.shell.shell_sidebar + + test_colors = {"background": '#abcdef', "foreground": '#123456'} + + orig_idleConf_GetHighlight = idlelib.sidebar.idleConf.GetHighlight + def mock_idleconf_GetHighlight(theme, element): + if element in ['linenumber', 'console']: + return test_colors + return orig_idleConf_GetHighlight(theme, element) + GetHighlight_patcher = unittest.mock.patch.object( + idlelib.sidebar.idleConf, 'GetHighlight', + mock_idleconf_GetHighlight) + GetHighlight_patcher.start() + def cleanup(): + GetHighlight_patcher.stop() + sidebar.update_colors() + self.addCleanup(cleanup) + + def get_sidebar_colors(): + canvas = sidebar.canvas + texts = list(canvas.find(tk.ALL)) + fgs = {canvas.itemcget(text, 'fill') for text in texts} + self.assertEqual(len(fgs), 1) + fg = next(iter(fgs)) + bg = canvas.cget('background') + return {"background": bg, "foreground": fg} + + self.assertNotEqual(get_sidebar_colors(), test_colors) + sidebar.update_colors() + self.assertEqual(get_sidebar_colors(), test_colors) + + @run_in_tk_mainloop() + def test_mousewheel(self): + sidebar = self.shell.shell_sidebar + text = self.shell.text + + # Enter a 100-line string to scroll the shell screen down. + self.do_input('x = """' + '\n'*100 + '"""\n') + yield + self.assertGreater(get_lineno(text, '@0,0'), 1) + + last_lineno = get_end_linenumber(text) + self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0'))) + + # Delta for , whose meaning is platform-dependent. + delta = 1 if sidebar.canvas._windowingsystem == 'aqua' else 120 + + # Scroll up. + if sidebar.canvas._windowingsystem == 'x11': + sidebar.canvas.event_generate('', x=0, y=0) + else: + sidebar.canvas.event_generate('', x=0, y=0, delta=delta) + yield + self.assertIsNone(text.dlineinfo(text.index(f'{last_lineno}.0'))) + + # Scroll back down. + if sidebar.canvas._windowingsystem == 'x11': + sidebar.canvas.event_generate('', x=0, y=0) + else: + sidebar.canvas.event_generate('', x=0, y=0, delta=-delta) + yield + self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0'))) + + @run_in_tk_mainloop() + def test_copy(self): + sidebar = self.shell.shell_sidebar + text = self.shell.text + + first_line = get_end_linenumber(text) + + self.do_input(dedent('''\ + if True: + print(1) + + ''')) + yield + + text.tag_add('sel', f'{first_line}.0', 'end-1c') + selected_text = text.get('sel.first', 'sel.last') + self.assertStartsWith(selected_text, 'if True:\n') + self.assertIn('\n1\n', selected_text) + + text.event_generate('<>') + self.addCleanup(text.clipboard_clear) + + copied_text = text.clipboard_get() + self.assertEqual(copied_text, selected_text) + + @run_in_tk_mainloop() + def test_copy_with_prompts(self): + sidebar = self.shell.shell_sidebar + text = self.shell.text + + first_line = get_end_linenumber(text) + self.do_input(dedent('''\ + if True: + print(1) + + ''')) + yield + + text.tag_add('sel', f'{first_line}.3', 'end-1c') + selected_text = text.get('sel.first', 'sel.last') + self.assertStartsWith(selected_text, 'True:\n') + + selected_lines_text = text.get('sel.first linestart', 'sel.last') + selected_lines = selected_lines_text.split('\n') + selected_lines.pop() # Final '' is a split artifact, not a line. + # Expect a block of input and a single output line. + expected_prompts = \ + ['>>>'] + ['...'] * (len(selected_lines) - 2) + [None] + selected_text_with_prompts = '\n'.join( + line if prompt is None else prompt + ' ' + line + for prompt, line in zip(expected_prompts, + selected_lines, + strict=True) + ) + '\n' + + text.event_generate('<>') + self.addCleanup(text.clipboard_clear) + + copied_text = text.clipboard_get() + self.assertEqual(copied_text, selected_text_with_prompts) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_squeezer.py b/micromamba_root/Lib/idlelib/idle_test/test_squeezer.py new file mode 100644 index 0000000000000000000000000000000000000000..86c5d41b6297192ff56f7ec07fcb28e136b9a3a8 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_squeezer.py @@ -0,0 +1,466 @@ +"Test squeezer, coverage 95%" + +from textwrap import dedent +from tkinter import Text, Tk +import unittest +from unittest.mock import Mock, NonCallableMagicMock, patch, sentinel, ANY +from test.support import requires + +from idlelib.config import idleConf +from idlelib.percolator import Percolator +from idlelib.squeezer import count_lines_with_wrapping, ExpandingButton, \ + Squeezer +from idlelib import macosx +from idlelib.textview import view_text +from idlelib.tooltip import Hovertip + +SENTINEL_VALUE = sentinel.SENTINEL_VALUE + + +def get_test_tk_root(test_instance): + """Helper for tests: Create a root Tk object.""" + requires('gui') + root = Tk() + root.withdraw() + + def cleanup_root(): + root.update_idletasks() + root.destroy() + test_instance.addCleanup(cleanup_root) + + return root + + +class CountLinesTest(unittest.TestCase): + """Tests for the count_lines_with_wrapping function.""" + def check(self, expected, text, linewidth): + return self.assertEqual( + expected, + count_lines_with_wrapping(text, linewidth), + ) + + def test_count_empty(self): + """Test with an empty string.""" + self.assertEqual(count_lines_with_wrapping(""), 0) + + def test_count_begins_with_empty_line(self): + """Test with a string which begins with a newline.""" + self.assertEqual(count_lines_with_wrapping("\ntext"), 2) + + def test_count_ends_with_empty_line(self): + """Test with a string which ends with a newline.""" + self.assertEqual(count_lines_with_wrapping("text\n"), 1) + + def test_count_several_lines(self): + """Test with several lines of text.""" + self.assertEqual(count_lines_with_wrapping("1\n2\n3\n"), 3) + + def test_empty_lines(self): + self.check(expected=1, text='\n', linewidth=80) + self.check(expected=2, text='\n\n', linewidth=80) + self.check(expected=10, text='\n' * 10, linewidth=80) + + def test_long_line(self): + self.check(expected=3, text='a' * 200, linewidth=80) + self.check(expected=3, text='a' * 200 + '\n', linewidth=80) + + def test_several_lines_different_lengths(self): + text = dedent("""\ + 13 characters + 43 is the number of characters on this line + + 7 chars + 13 characters""") + self.check(expected=5, text=text, linewidth=80) + self.check(expected=5, text=text + '\n', linewidth=80) + self.check(expected=6, text=text, linewidth=40) + self.check(expected=7, text=text, linewidth=20) + self.check(expected=11, text=text, linewidth=10) + + +class SqueezerTest(unittest.TestCase): + """Tests for the Squeezer class.""" + def make_mock_editor_window(self, with_text_widget=False): + """Create a mock EditorWindow instance.""" + editwin = NonCallableMagicMock() + editwin.width = 80 + + if with_text_widget: + editwin.root = get_test_tk_root(self) + text_widget = self.make_text_widget(root=editwin.root) + editwin.text = editwin.per.bottom = text_widget + + return editwin + + def make_squeezer_instance(self, editor_window=None): + """Create an actual Squeezer instance with a mock EditorWindow.""" + if editor_window is None: + editor_window = self.make_mock_editor_window() + squeezer = Squeezer(editor_window) + return squeezer + + def make_text_widget(self, root=None): + if root is None: + root = get_test_tk_root(self) + text_widget = Text(root) + text_widget["font"] = ('Courier', 10) + text_widget.mark_set("iomark", "1.0") + return text_widget + + def set_idleconf_option_with_cleanup(self, configType, section, option, value): + prev_val = idleConf.GetOption(configType, section, option) + idleConf.SetOption(configType, section, option, value) + self.addCleanup(idleConf.SetOption, + configType, section, option, prev_val) + + def test_count_lines(self): + """Test Squeezer.count_lines() with various inputs.""" + editwin = self.make_mock_editor_window() + squeezer = self.make_squeezer_instance(editwin) + + for text_code, line_width, expected in [ + (r"'\n'", 80, 1), + (r"'\n' * 3", 80, 3), + (r"'a' * 40 + '\n'", 80, 1), + (r"'a' * 80 + '\n'", 80, 1), + (r"'a' * 200 + '\n'", 80, 3), + (r"'aa\t' * 20", 80, 2), + (r"'aa\t' * 21", 80, 3), + (r"'aa\t' * 20", 40, 4), + ]: + with self.subTest(text_code=text_code, + line_width=line_width, + expected=expected): + text = eval(text_code) + with patch.object(editwin, 'width', line_width): + self.assertEqual(squeezer.count_lines(text), expected) + + def test_init(self): + """Test the creation of Squeezer instances.""" + editwin = self.make_mock_editor_window() + squeezer = self.make_squeezer_instance(editwin) + self.assertIs(squeezer.editwin, editwin) + self.assertEqual(squeezer.expandingbuttons, []) + + def test_write_no_tags(self): + """Test Squeezer's overriding of the EditorWindow's write() method.""" + editwin = self.make_mock_editor_window() + for text in ['', 'TEXT', 'LONG TEXT' * 1000, 'MANY_LINES\n' * 100]: + editwin.write = orig_write = Mock(return_value=SENTINEL_VALUE) + squeezer = self.make_squeezer_instance(editwin) + + self.assertEqual(squeezer.editwin.write(text, ()), SENTINEL_VALUE) + self.assertEqual(orig_write.call_count, 1) + orig_write.assert_called_with(text, ()) + self.assertEqual(len(squeezer.expandingbuttons), 0) + + def test_write_not_stdout(self): + """Test Squeezer's overriding of the EditorWindow's write() method.""" + for text in ['', 'TEXT', 'LONG TEXT' * 1000, 'MANY_LINES\n' * 100]: + editwin = self.make_mock_editor_window() + editwin.write.return_value = SENTINEL_VALUE + orig_write = editwin.write + squeezer = self.make_squeezer_instance(editwin) + + self.assertEqual(squeezer.editwin.write(text, "stderr"), + SENTINEL_VALUE) + self.assertEqual(orig_write.call_count, 1) + orig_write.assert_called_with(text, "stderr") + self.assertEqual(len(squeezer.expandingbuttons), 0) + + def test_write_stdout(self): + """Test Squeezer's overriding of the EditorWindow's write() method.""" + editwin = self.make_mock_editor_window() + + for text in ['', 'TEXT']: + editwin.write = orig_write = Mock(return_value=SENTINEL_VALUE) + squeezer = self.make_squeezer_instance(editwin) + squeezer.auto_squeeze_min_lines = 50 + + self.assertEqual(squeezer.editwin.write(text, "stdout"), + SENTINEL_VALUE) + self.assertEqual(orig_write.call_count, 1) + orig_write.assert_called_with(text, "stdout") + self.assertEqual(len(squeezer.expandingbuttons), 0) + + for text in ['LONG TEXT' * 1000, 'MANY_LINES\n' * 100]: + editwin.write = orig_write = Mock(return_value=SENTINEL_VALUE) + squeezer = self.make_squeezer_instance(editwin) + squeezer.auto_squeeze_min_lines = 50 + + self.assertEqual(squeezer.editwin.write(text, "stdout"), None) + self.assertEqual(orig_write.call_count, 0) + self.assertEqual(len(squeezer.expandingbuttons), 1) + + def test_auto_squeeze(self): + """Test that the auto-squeezing creates an ExpandingButton properly.""" + editwin = self.make_mock_editor_window(with_text_widget=True) + text_widget = editwin.text + squeezer = self.make_squeezer_instance(editwin) + squeezer.auto_squeeze_min_lines = 5 + squeezer.count_lines = Mock(return_value=6) + + editwin.write('TEXT\n'*6, "stdout") + self.assertEqual(text_widget.get('1.0', 'end'), '\n') + self.assertEqual(len(squeezer.expandingbuttons), 1) + + def test_squeeze_current_text(self): + """Test the squeeze_current_text method.""" + # Squeezing text should work for both stdout and stderr. + for tag_name in ["stdout", "stderr"]: + editwin = self.make_mock_editor_window(with_text_widget=True) + text_widget = editwin.text + squeezer = self.make_squeezer_instance(editwin) + squeezer.count_lines = Mock(return_value=6) + + # Prepare some text in the Text widget. + text_widget.insert("1.0", "SOME\nTEXT\n", tag_name) + text_widget.mark_set("insert", "1.0") + self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n') + + self.assertEqual(len(squeezer.expandingbuttons), 0) + + # Test squeezing the current text. + retval = squeezer.squeeze_current_text() + self.assertEqual(retval, "break") + self.assertEqual(text_widget.get('1.0', 'end'), '\n\n') + self.assertEqual(len(squeezer.expandingbuttons), 1) + self.assertEqual(squeezer.expandingbuttons[0].s, 'SOME\nTEXT') + + # Test that expanding the squeezed text works and afterwards + # the Text widget contains the original text. + squeezer.expandingbuttons[0].expand() + self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n') + self.assertEqual(len(squeezer.expandingbuttons), 0) + + def test_squeeze_current_text_no_allowed_tags(self): + """Test that the event doesn't squeeze text without a relevant tag.""" + editwin = self.make_mock_editor_window(with_text_widget=True) + text_widget = editwin.text + squeezer = self.make_squeezer_instance(editwin) + squeezer.count_lines = Mock(return_value=6) + + # Prepare some text in the Text widget. + text_widget.insert("1.0", "SOME\nTEXT\n", "TAG") + text_widget.mark_set("insert", "1.0") + self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n') + + self.assertEqual(len(squeezer.expandingbuttons), 0) + + # Test squeezing the current text. + retval = squeezer.squeeze_current_text() + self.assertEqual(retval, "break") + self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n') + self.assertEqual(len(squeezer.expandingbuttons), 0) + + def test_squeeze_text_before_existing_squeezed_text(self): + """Test squeezing text before existing squeezed text.""" + editwin = self.make_mock_editor_window(with_text_widget=True) + text_widget = editwin.text + squeezer = self.make_squeezer_instance(editwin) + squeezer.count_lines = Mock(return_value=6) + + # Prepare some text in the Text widget and squeeze it. + text_widget.insert("1.0", "SOME\nTEXT\n", "stdout") + text_widget.mark_set("insert", "1.0") + squeezer.squeeze_current_text() + self.assertEqual(len(squeezer.expandingbuttons), 1) + + # Test squeezing the current text. + text_widget.insert("1.0", "MORE\nSTUFF\n", "stdout") + text_widget.mark_set("insert", "1.0") + retval = squeezer.squeeze_current_text() + self.assertEqual(retval, "break") + self.assertEqual(text_widget.get('1.0', 'end'), '\n\n\n') + self.assertEqual(len(squeezer.expandingbuttons), 2) + self.assertTrue(text_widget.compare( + squeezer.expandingbuttons[0], + '<', + squeezer.expandingbuttons[1], + )) + + def test_reload(self): + """Test the reload() class-method.""" + editwin = self.make_mock_editor_window(with_text_widget=True) + squeezer = self.make_squeezer_instance(editwin) + + orig_auto_squeeze_min_lines = squeezer.auto_squeeze_min_lines + + # Increase auto-squeeze-min-lines. + new_auto_squeeze_min_lines = orig_auto_squeeze_min_lines + 10 + self.set_idleconf_option_with_cleanup( + 'main', 'PyShell', 'auto-squeeze-min-lines', + str(new_auto_squeeze_min_lines)) + + Squeezer.reload() + self.assertEqual(squeezer.auto_squeeze_min_lines, + new_auto_squeeze_min_lines) + + def test_reload_no_squeezer_instances(self): + """Test that Squeezer.reload() runs without any instances existing.""" + Squeezer.reload() + + +class ExpandingButtonTest(unittest.TestCase): + """Tests for the ExpandingButton class.""" + # In these tests the squeezer instance is a mock, but actual tkinter + # Text and Button instances are created. + def make_mock_squeezer(self): + """Helper for tests: Create a mock Squeezer object.""" + root = get_test_tk_root(self) + squeezer = Mock() + squeezer.editwin.text = Text(root) + squeezer.editwin.per = Percolator(squeezer.editwin.text) + self.addCleanup(squeezer.editwin.per.close) + + # Set default values for the configuration settings. + squeezer.auto_squeeze_min_lines = 50 + return squeezer + + @patch('idlelib.squeezer.Hovertip', autospec=Hovertip) + def test_init(self, MockHovertip): + """Test the simplest creation of an ExpandingButton.""" + squeezer = self.make_mock_squeezer() + text_widget = squeezer.editwin.text + + expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) + self.assertEqual(expandingbutton.s, 'TEXT') + + # Check that the underlying tkinter.Button is properly configured. + self.assertEqual(expandingbutton.master, text_widget) + self.assertTrue('50 lines' in expandingbutton.cget('text')) + + # Check that the text widget still contains no text. + self.assertEqual(text_widget.get('1.0', 'end'), '\n') + + # Check that the mouse events are bound. + self.assertIn('', expandingbutton.bind()) + right_button_code = '' % ('2' if macosx.isAquaTk() else '3') + self.assertIn(right_button_code, expandingbutton.bind()) + + # Check that ToolTip was called once, with appropriate values. + self.assertEqual(MockHovertip.call_count, 1) + MockHovertip.assert_called_with(expandingbutton, ANY, hover_delay=ANY) + + # Check that 'right-click' appears in the tooltip text. + tooltip_text = MockHovertip.call_args[0][1] + self.assertIn('right-click', tooltip_text.lower()) + + def test_expand(self): + """Test the expand event.""" + squeezer = self.make_mock_squeezer() + expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) + + # Insert the button into the text widget + # (this is normally done by the Squeezer class). + text_widget = squeezer.editwin.text + text_widget.window_create("1.0", window=expandingbutton) + + # trigger the expand event + retval = expandingbutton.expand(event=Mock()) + self.assertEqual(retval, None) + + # Check that the text was inserted into the text widget. + self.assertEqual(text_widget.get('1.0', 'end'), 'TEXT\n') + + # Check that the 'TAGS' tag was set on the inserted text. + text_end_index = text_widget.index('end-1c') + self.assertEqual(text_widget.get('1.0', text_end_index), 'TEXT') + self.assertEqual(text_widget.tag_nextrange('TAGS', '1.0'), + ('1.0', text_end_index)) + + # Check that the button removed itself from squeezer.expandingbuttons. + self.assertEqual(squeezer.expandingbuttons.remove.call_count, 1) + squeezer.expandingbuttons.remove.assert_called_with(expandingbutton) + + def test_expand_dangerous_oupput(self): + """Test that expanding very long output asks user for confirmation.""" + squeezer = self.make_mock_squeezer() + text = 'a' * 10**5 + expandingbutton = ExpandingButton(text, 'TAGS', 50, squeezer) + expandingbutton.set_is_dangerous() + self.assertTrue(expandingbutton.is_dangerous) + + # Insert the button into the text widget + # (this is normally done by the Squeezer class). + text_widget = expandingbutton.text + text_widget.window_create("1.0", window=expandingbutton) + + # Patch the message box module to always return False. + with patch('idlelib.squeezer.messagebox') as mock_msgbox: + mock_msgbox.askokcancel.return_value = False + mock_msgbox.askyesno.return_value = False + # Trigger the expand event. + retval = expandingbutton.expand(event=Mock()) + + # Check that the event chain was broken and no text was inserted. + self.assertEqual(retval, 'break') + self.assertEqual(expandingbutton.text.get('1.0', 'end-1c'), '') + + # Patch the message box module to always return True. + with patch('idlelib.squeezer.messagebox') as mock_msgbox: + mock_msgbox.askokcancel.return_value = True + mock_msgbox.askyesno.return_value = True + # Trigger the expand event. + retval = expandingbutton.expand(event=Mock()) + + # Check that the event chain wasn't broken and the text was inserted. + self.assertEqual(retval, None) + self.assertEqual(expandingbutton.text.get('1.0', 'end-1c'), text) + + def test_copy(self): + """Test the copy event.""" + # Testing with the actual clipboard proved problematic, so this + # test replaces the clipboard manipulation functions with mocks + # and checks that they are called appropriately. + squeezer = self.make_mock_squeezer() + expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) + expandingbutton.clipboard_clear = Mock() + expandingbutton.clipboard_append = Mock() + + # Trigger the copy event. + retval = expandingbutton.copy(event=Mock()) + self.assertEqual(retval, None) + + # Vheck that the expanding button called clipboard_clear() and + # clipboard_append('TEXT') once each. + self.assertEqual(expandingbutton.clipboard_clear.call_count, 1) + self.assertEqual(expandingbutton.clipboard_append.call_count, 1) + expandingbutton.clipboard_append.assert_called_with('TEXT') + + def test_view(self): + """Test the view event.""" + squeezer = self.make_mock_squeezer() + expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) + expandingbutton.selection_own = Mock() + + with patch('idlelib.squeezer.view_text', autospec=view_text)\ + as mock_view_text: + # Trigger the view event. + expandingbutton.view(event=Mock()) + + # Check that the expanding button called view_text. + self.assertEqual(mock_view_text.call_count, 1) + + # Check that the proper text was passed. + self.assertEqual(mock_view_text.call_args[0][2], 'TEXT') + + def test_rmenu(self): + """Test the context menu.""" + squeezer = self.make_mock_squeezer() + expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) + with patch('tkinter.Menu') as mock_Menu: + mock_menu = Mock() + mock_Menu.return_value = mock_menu + mock_event = Mock() + mock_event.x = 10 + mock_event.y = 10 + expandingbutton.context_menu_event(event=mock_event) + self.assertEqual(mock_menu.add_command.call_count, + len(expandingbutton.rmenu_specs)) + for label, *data in expandingbutton.rmenu_specs: + mock_menu.add_command.assert_any_call(label=label, command=ANY) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_stackviewer.py b/micromamba_root/Lib/idlelib/idle_test/test_stackviewer.py new file mode 100644 index 0000000000000000000000000000000000000000..55f510382bf4c3699ab3baff416af72068660fc7 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_stackviewer.py @@ -0,0 +1,41 @@ +"Test stackviewer, coverage 63%." + +from idlelib import stackviewer +import unittest +from test.support import requires +from tkinter import Tk + +from idlelib.tree import TreeNode, ScrolledCanvas + + +class StackBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + + cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + try: + abc + except NameError as exc: + sb = stackviewer.StackBrowser(self.root, exc) + isi = self.assertIsInstance + isi(stackviewer.sc, ScrolledCanvas) + isi(stackviewer.item, stackviewer.StackTreeItem) + isi(stackviewer.node, TreeNode) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_statusbar.py b/micromamba_root/Lib/idlelib/idle_test/test_statusbar.py new file mode 100644 index 0000000000000000000000000000000000000000..203a57db89ca6a7df608cc7d24c4301299d222d8 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_statusbar.py @@ -0,0 +1,41 @@ +"Test statusbar, coverage 100%." + +from idlelib import statusbar +import unittest +from test.support import requires +from tkinter import Tk + + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_init(self): + bar = statusbar.MultiStatusBar(self.root) + self.assertEqual(bar.labels, {}) + + def test_set_label(self): + bar = statusbar.MultiStatusBar(self.root) + bar.set_label('left', text='sometext', width=10) + self.assertIn('left', bar.labels) + left = bar.labels['left'] + self.assertEqual(left['text'], 'sometext') + self.assertEqual(left['width'], 10) + bar.set_label('left', text='revised text') + self.assertEqual(left['text'], 'revised text') + bar.set_label('right', text='correct text') + self.assertEqual(bar.labels['right']['text'], 'correct text') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_text.py b/micromamba_root/Lib/idlelib/idle_test/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..43a9ba02c3d3c9a8739ec85e4780fc03743ef29c --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_text.py @@ -0,0 +1,236 @@ +''' Test mock_tk.Text class against tkinter.Text class + +Run same tests with both by creating a mixin class. +''' +import unittest +from test.support import requires +from _tkinter import TclError + +class TextTest: + "Define items common to both sets of tests." + + hw = 'hello\nworld' # Several tests insert this after initialization. + hwn = hw+'\n' # \n present at initialization, before insert + + # setUpClass defines cls.Text and maybe cls.root. + # setUp defines self.text from Text and maybe root. + + def test_init(self): + self.assertEqual(self.text.get('1.0'), '\n') + self.assertEqual(self.text.get('end'), '') + + def test_index_empty(self): + index = self.text.index + + for dex in (-1.0, 0.3, '1.-1', '1.0', '1.0 lineend', '1.end', '1.33', + 'insert'): + self.assertEqual(index(dex), '1.0') + + for dex in 'end', 2.0, '2.1', '33.44': + self.assertEqual(index(dex), '2.0') + + def test_index_data(self): + index = self.text.index + self.text.insert('1.0', self.hw) + + for dex in -1.0, 0.3, '1.-1', '1.0': + self.assertEqual(index(dex), '1.0') + + for dex in '1.0 lineend', '1.end', '1.33': + self.assertEqual(index(dex), '1.5') + + for dex in 'end', '33.44': + self.assertEqual(index(dex), '3.0') + + def test_get(self): + get = self.text.get + Equal = self.assertEqual + self.text.insert('1.0', self.hw) + + Equal(get('end'), '') + Equal(get('end', 'end'), '') + Equal(get('1.0'), 'h') + Equal(get('1.0', '1.1'), 'h') + Equal(get('1.0', '1.3'), 'hel') + Equal(get('1.1', '1.3'), 'el') + Equal(get('1.0', '1.0 lineend'), 'hello') + Equal(get('1.0', '1.10'), 'hello') + Equal(get('1.0 lineend'), '\n') + Equal(get('1.1', '2.3'), 'ello\nwor') + Equal(get('1.0', '2.5'), self.hw) + Equal(get('1.0', 'end'), self.hwn) + Equal(get('0.0', '5.0'), self.hwn) + + def test_insert(self): + insert = self.text.insert + get = self.text.get + Equal = self.assertEqual + + insert('1.0', self.hw) + Equal(get('1.0', 'end'), self.hwn) + + insert('1.0', '') # nothing + Equal(get('1.0', 'end'), self.hwn) + + insert('1.0', '*') + Equal(get('1.0', 'end'), '*hello\nworld\n') + + insert('1.0 lineend', '*') + Equal(get('1.0', 'end'), '*hello*\nworld\n') + + insert('2.3', '*') + Equal(get('1.0', 'end'), '*hello*\nwor*ld\n') + + insert('end', 'x') + Equal(get('1.0', 'end'), '*hello*\nwor*ldx\n') + + insert('1.4', 'x\n') + Equal(get('1.0', 'end'), '*helx\nlo*\nwor*ldx\n') + + def test_no_delete(self): + # if index1 == 'insert' or 'end' or >= end, there is no deletion + delete = self.text.delete + get = self.text.get + Equal = self.assertEqual + self.text.insert('1.0', self.hw) + + delete('insert') + Equal(get('1.0', 'end'), self.hwn) + + delete('end') + Equal(get('1.0', 'end'), self.hwn) + + delete('insert', 'end') + Equal(get('1.0', 'end'), self.hwn) + + delete('insert', '5.5') + Equal(get('1.0', 'end'), self.hwn) + + delete('1.4', '1.0') + Equal(get('1.0', 'end'), self.hwn) + + delete('1.4', '1.4') + Equal(get('1.0', 'end'), self.hwn) + + def test_delete_char(self): + delete = self.text.delete + get = self.text.get + Equal = self.assertEqual + self.text.insert('1.0', self.hw) + + delete('1.0') + Equal(get('1.0', '1.end'), 'ello') + + delete('1.0', '1.1') + Equal(get('1.0', '1.end'), 'llo') + + # delete \n and combine 2 lines into 1 + delete('1.end') + Equal(get('1.0', '1.end'), 'lloworld') + + self.text.insert('1.3', '\n') + delete('1.10') + Equal(get('1.0', '1.end'), 'lloworld') + + self.text.insert('1.3', '\n') + delete('1.3', '2.0') + Equal(get('1.0', '1.end'), 'lloworld') + + def test_delete_slice(self): + delete = self.text.delete + get = self.text.get + Equal = self.assertEqual + self.text.insert('1.0', self.hw) + + delete('1.0', '1.0 lineend') + Equal(get('1.0', 'end'), '\nworld\n') + + delete('1.0', 'end') + Equal(get('1.0', 'end'), '\n') + + self.text.insert('1.0', self.hw) + delete('1.0', '2.0') + Equal(get('1.0', 'end'), 'world\n') + + delete('1.0', 'end') + Equal(get('1.0', 'end'), '\n') + + self.text.insert('1.0', self.hw) + delete('1.2', '2.3') + Equal(get('1.0', 'end'), 'held\n') + + def test_multiple_lines(self): # insert and delete + self.text.insert('1.0', 'hello') + + self.text.insert('1.3', '1\n2\n3\n4\n5') + self.assertEqual(self.text.get('1.0', 'end'), 'hel1\n2\n3\n4\n5lo\n') + + self.text.delete('1.3', '5.1') + self.assertEqual(self.text.get('1.0', 'end'), 'hello\n') + + def test_compare(self): + compare = self.text.compare + Equal = self.assertEqual + # need data so indexes not squished to 1,0 + self.text.insert('1.0', 'First\nSecond\nThird\n') + + self.assertRaises(TclError, compare, '2.2', 'op', '2.2') + + for op, less1, less0, equal, greater0, greater1 in ( + ('<', True, True, False, False, False), + ('<=', True, True, True, False, False), + ('>', False, False, False, True, True), + ('>=', False, False, True, True, True), + ('==', False, False, True, False, False), + ('!=', True, True, False, True, True), + ): + Equal(compare('1.1', op, '2.2'), less1, op) + Equal(compare('2.1', op, '2.2'), less0, op) + Equal(compare('2.2', op, '2.2'), equal, op) + Equal(compare('2.3', op, '2.2'), greater0, op) + Equal(compare('3.3', op, '2.2'), greater1, op) + + +class MockTextTest(TextTest, unittest.TestCase): + + @classmethod + def setUpClass(cls): + from idlelib.idle_test.mock_tk import Text + cls.Text = Text + + def setUp(self): + self.text = self.Text() + + + def test_decode(self): + # test endflags (-1, 0) not tested by test_index (which uses +1) + decode = self.text._decode + Equal = self.assertEqual + self.text.insert('1.0', self.hw) + + Equal(decode('end', -1), (2, 5)) + Equal(decode('3.1', -1), (2, 5)) + Equal(decode('end', 0), (2, 6)) + Equal(decode('3.1', 0), (2, 6)) + + +class TkTextTest(TextTest, unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + from tkinter import Tk, Text + cls.Text = Text + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def setUp(self): + self.text = self.Text(self.root) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_textview.py b/micromamba_root/Lib/idlelib/idle_test/test_textview.py new file mode 100644 index 0000000000000000000000000000000000000000..7189378ab3dd615e04cf17c2869e1fd611cb4eb1 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_textview.py @@ -0,0 +1,233 @@ +"""Test textview, coverage 100%. + +Since all methods and functions create (or destroy) a ViewWindow, which +is a widget containing a widget, etcetera, all tests must be gui tests. +Using mock Text would not change this. Other mocks are used to retrieve +information about calls. +""" +from idlelib import textview as tv +from test.support import requires +requires('gui') + +import os +import unittest +from tkinter import Tk, TclError, CHAR, NONE, WORD +from tkinter.ttk import Button +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox_func + +def setUpModule(): + global root + root = Tk() + root.withdraw() + +def tearDownModule(): + global root + root.update_idletasks() + root.destroy() + del root + +# If we call ViewWindow or wrapper functions with defaults +# modal=True, _utest=False, test hangs on call to wait_window. +# Have also gotten tk error 'can't invoke "event" command'. + + +class VW(tv.ViewWindow): # Used in ViewWindowTest. + transient = Func() + grab_set = Func() + wait_window = Func() + + +# Call wrapper class VW with mock wait_window. +class ViewWindowTest(unittest.TestCase): + + def setUp(self): + VW.transient.__init__() + VW.grab_set.__init__() + VW.wait_window.__init__() + + def test_init_modal(self): + view = VW(root, 'Title', 'test text') + self.assertTrue(VW.transient.called) + self.assertTrue(VW.grab_set.called) + self.assertTrue(VW.wait_window.called) + view.ok() + + def test_init_nonmodal(self): + view = VW(root, 'Title', 'test text', modal=False) + self.assertFalse(VW.transient.called) + self.assertFalse(VW.grab_set.called) + self.assertFalse(VW.wait_window.called) + view.ok() + + def test_ok(self): + view = VW(root, 'Title', 'test text', modal=False) + view.destroy = Func() + view.ok() + self.assertTrue(view.destroy.called) + del view.destroy # Unmask real function. + view.destroy() + + +class AutoHideScrollbarTest(unittest.TestCase): + # Method set is tested in ScrollableTextFrameTest + def test_forbidden_geometry(self): + scroll = tv.AutoHideScrollbar(root) + self.assertRaises(TclError, scroll.pack) + self.assertRaises(TclError, scroll.place) + + +class ScrollableTextFrameTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = root = Tk() + root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def make_frame(self, wrap=NONE, **kwargs): + frame = tv.ScrollableTextFrame(self.root, wrap=wrap, **kwargs) + def cleanup_frame(): + frame.update_idletasks() + frame.destroy() + self.addCleanup(cleanup_frame) + return frame + + def test_line1(self): + frame = self.make_frame() + frame.text.insert('1.0', 'test text') + self.assertEqual(frame.text.get('1.0', '1.end'), 'test text') + + def test_horiz_scrollbar(self): + # The horizontal scrollbar should be shown/hidden according to + # the 'wrap' setting: It should only be shown when 'wrap' is + # set to NONE. + + # wrap = NONE -> with horizontal scrolling + frame = self.make_frame(wrap=NONE) + self.assertEqual(frame.text.cget('wrap'), NONE) + self.assertIsNotNone(frame.xscroll) + + # wrap != NONE -> no horizontal scrolling + for wrap in [CHAR, WORD]: + with self.subTest(wrap=wrap): + frame = self.make_frame(wrap=wrap) + self.assertEqual(frame.text.cget('wrap'), wrap) + self.assertIsNone(frame.xscroll) + + +class ViewFrameTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = root = Tk() + root.withdraw() + cls.frame = tv.ViewFrame(root, 'test text') + + @classmethod + def tearDownClass(cls): + del cls.frame + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_line1(self): + get = self.frame.text.get + self.assertEqual(get('1.0', '1.end'), 'test text') + + +# Call ViewWindow with modal=False. +class ViewFunctionTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.orig_error = tv.showerror + tv.showerror = Mbox_func() + + @classmethod + def tearDownClass(cls): + tv.showerror = cls.orig_error + del cls.orig_error + + def test_view_text(self): + view = tv.view_text(root, 'Title', 'test text', modal=False) + self.assertIsInstance(view, tv.ViewWindow) + self.assertIsInstance(view.viewframe, tv.ViewFrame) + view.viewframe.ok() + + def test_view_file(self): + view = tv.view_file(root, 'Title', __file__, 'ascii', modal=False) + self.assertIsInstance(view, tv.ViewWindow) + self.assertIsInstance(view.viewframe, tv.ViewFrame) + get = view.viewframe.textframe.text.get + self.assertIn('Test', get('1.0', '1.end')) + view.ok() + + def test_bad_file(self): + # Mock showerror will be used; view_file will return None. + view = tv.view_file(root, 'Title', 'abc.xyz', 'ascii', modal=False) + self.assertIsNone(view) + self.assertEqual(tv.showerror.title, 'File Load Error') + + def test_bad_encoding(self): + p = os.path + fn = p.abspath(p.join(p.dirname(__file__), '..', 'CREDITS.txt')) + view = tv.view_file(root, 'Title', fn, 'ascii', modal=False) + self.assertIsNone(view) + self.assertEqual(tv.showerror.title, 'Unicode Decode Error') + + def test_nowrap(self): + view = tv.view_text(root, 'Title', 'test', modal=False, wrap='none') + text_widget = view.viewframe.textframe.text + self.assertEqual(text_widget.cget('wrap'), 'none') + + +# Call ViewWindow with _utest=True. +class ButtonClickTest(unittest.TestCase): + + def setUp(self): + self.view = None + self.called = False + + def tearDown(self): + if self.view: + self.view.destroy() + + def test_view_text_bind_with_button(self): + def _command(): + self.called = True + self.view = tv.view_text(root, 'TITLE_TEXT', 'COMMAND', _utest=True) + button = Button(root, text='BUTTON', command=_command) + button.invoke() + self.addCleanup(button.destroy) + + self.assertEqual(self.called, True) + self.assertEqual(self.view.title(), 'TITLE_TEXT') + self.assertEqual(self.view.viewframe.textframe.text.get('1.0', '1.end'), + 'COMMAND') + + def test_view_file_bind_with_button(self): + def _command(): + self.called = True + self.view = tv.view_file(root, 'TITLE_FILE', __file__, + encoding='ascii', _utest=True) + button = Button(root, text='BUTTON', command=_command) + button.invoke() + self.addCleanup(button.destroy) + + self.assertEqual(self.called, True) + self.assertEqual(self.view.title(), 'TITLE_FILE') + get = self.view.viewframe.textframe.text.get + with open(__file__) as f: + self.assertEqual(get('1.0', '1.end'), f.readline().strip()) + f.readline() + self.assertEqual(get('3.0', '3.end'), f.readline().strip()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_tooltip.py b/micromamba_root/Lib/idlelib/idle_test/test_tooltip.py new file mode 100644 index 0000000000000000000000000000000000000000..c616d4fde3b6d30433c0e163206059c1c55f1ea2 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_tooltip.py @@ -0,0 +1,161 @@ +"""Test tooltip, coverage 100%. + +Coverage is 100% after excluding 6 lines with "# pragma: no cover". +They involve TclErrors that either should or should not happen in a +particular situation, and which are 'pass'ed if they do. +""" + +from idlelib.tooltip import TooltipBase, Hovertip +from test.support import requires +requires('gui') + +from functools import wraps +import time +from tkinter import Button, Tk, Toplevel +import unittest + + +def setUpModule(): + global root + root = Tk() + +def tearDownModule(): + global root + root.update_idletasks() + root.destroy() + del root + + +def add_call_counting(func): + @wraps(func) + def wrapped_func(*args, **kwargs): + wrapped_func.call_args_list.append((args, kwargs)) + return func(*args, **kwargs) + wrapped_func.call_args_list = [] + return wrapped_func + + +def _make_top_and_button(testobj): + global root + top = Toplevel(root) + testobj.addCleanup(top.destroy) + top.title("Test tooltip") + button = Button(top, text='ToolTip test button') + button.pack() + testobj.addCleanup(button.destroy) + top.lift() + return top, button + + +class ToolTipBaseTest(unittest.TestCase): + def setUp(self): + self.top, self.button = _make_top_and_button(self) + + def test_base_class_is_unusable(self): + global root + top = Toplevel(root) + self.addCleanup(top.destroy) + + button = Button(top, text='ToolTip test button') + button.pack() + self.addCleanup(button.destroy) + + with self.assertRaises(NotImplementedError): + tooltip = TooltipBase(button) + tooltip.showtip() + + +class HovertipTest(unittest.TestCase): + def setUp(self): + self.top, self.button = _make_top_and_button(self) + + def is_tipwindow_shown(self, tooltip): + return tooltip.tipwindow and tooltip.tipwindow.winfo_viewable() + + def test_showtip(self): + tooltip = Hovertip(self.button, 'ToolTip text') + self.addCleanup(tooltip.hidetip) + self.assertFalse(self.is_tipwindow_shown(tooltip)) + tooltip.showtip() + self.assertTrue(self.is_tipwindow_shown(tooltip)) + + def test_showtip_twice(self): + tooltip = Hovertip(self.button, 'ToolTip text') + self.addCleanup(tooltip.hidetip) + self.assertFalse(self.is_tipwindow_shown(tooltip)) + tooltip.showtip() + self.assertTrue(self.is_tipwindow_shown(tooltip)) + orig_tipwindow = tooltip.tipwindow + tooltip.showtip() + self.assertTrue(self.is_tipwindow_shown(tooltip)) + self.assertIs(tooltip.tipwindow, orig_tipwindow) + + def test_hidetip(self): + tooltip = Hovertip(self.button, 'ToolTip text') + self.addCleanup(tooltip.hidetip) + tooltip.showtip() + tooltip.hidetip() + self.assertFalse(self.is_tipwindow_shown(tooltip)) + + def test_showtip_on_mouse_enter_no_delay(self): + tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=None) + self.addCleanup(tooltip.hidetip) + tooltip.showtip = add_call_counting(tooltip.showtip) + root.update() + self.assertFalse(self.is_tipwindow_shown(tooltip)) + self.button.event_generate('', x=0, y=0) + root.update() + self.assertTrue(self.is_tipwindow_shown(tooltip)) + self.assertGreater(len(tooltip.showtip.call_args_list), 0) + + def test_hover_with_delay(self): + # Run multiple tests requiring an actual delay simultaneously. + + # Test #1: A hover tip with a non-zero delay appears after the delay. + tooltip1 = Hovertip(self.button, 'ToolTip text', hover_delay=100) + self.addCleanup(tooltip1.hidetip) + tooltip1.showtip = add_call_counting(tooltip1.showtip) + root.update() + self.assertFalse(self.is_tipwindow_shown(tooltip1)) + self.button.event_generate('', x=0, y=0) + root.update() + self.assertFalse(self.is_tipwindow_shown(tooltip1)) + + # Test #2: A hover tip with a non-zero delay doesn't appear when + # the mouse stops hovering over the base widget before the delay + # expires. + tooltip2 = Hovertip(self.button, 'ToolTip text', hover_delay=100) + self.addCleanup(tooltip2.hidetip) + tooltip2.showtip = add_call_counting(tooltip2.showtip) + root.update() + self.button.event_generate('', x=0, y=0) + root.update() + self.button.event_generate('', x=0, y=0) + root.update() + + time.sleep(0.15) + root.update() + + # Test #1 assertions. + self.assertTrue(self.is_tipwindow_shown(tooltip1)) + self.assertGreater(len(tooltip1.showtip.call_args_list), 0) + + # Test #2 assertions. + self.assertFalse(self.is_tipwindow_shown(tooltip2)) + self.assertEqual(tooltip2.showtip.call_args_list, []) + + def test_hidetip_on_mouse_leave(self): + tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=None) + self.addCleanup(tooltip.hidetip) + tooltip.showtip = add_call_counting(tooltip.showtip) + root.update() + self.button.event_generate('', x=0, y=0) + root.update() + self.button.event_generate('', x=0, y=0) + root.update() + self.assertFalse(self.is_tipwindow_shown(tooltip)) + self.assertGreater(len(tooltip.showtip.call_args_list), 0) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_tree.py b/micromamba_root/Lib/idlelib/idle_test/test_tree.py new file mode 100644 index 0000000000000000000000000000000000000000..b3e4c10cf9e38e7efc183352f6de98673841d9fd --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_tree.py @@ -0,0 +1,60 @@ +"Test tree. coverage 56%." + +from idlelib import tree +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk, EventType, SCROLL + + +class TreeTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_init(self): + # Start with code slightly adapted from htest. + sc = tree.ScrolledCanvas( + self.root, bg="white", highlightthickness=0, takefocus=1) + sc.frame.pack(expand=1, fill="both", side='left') + item = tree.FileTreeItem(tree.ICONDIR) + node = tree.TreeNode(sc.canvas, None, item) + node.expand() + + +class TestScrollEvent(unittest.TestCase): + + def test_wheel_event(self): + # Fake widget class containing `yview` only. + class _Widget: + def __init__(widget, *expected): + widget.expected = expected + def yview(widget, *args): + self.assertTupleEqual(widget.expected, args) + # Fake event class + class _Event: + pass + # (type, delta, num, amount) + tests = ((EventType.MouseWheel, 120, -1, -5), + (EventType.MouseWheel, -120, -1, 5), + (EventType.ButtonPress, -1, 4, -5), + (EventType.ButtonPress, -1, 5, 5)) + + event = _Event() + for ty, delta, num, amount in tests: + event.type = ty + event.delta = delta + event.num = num + res = tree.wheel_event(event, _Widget(SCROLL, amount, "units")) + self.assertEqual(res, "break") + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_undo.py b/micromamba_root/Lib/idlelib/idle_test/test_undo.py new file mode 100644 index 0000000000000000000000000000000000000000..beb5b582039f8844dd179561c7bb939606184375 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_undo.py @@ -0,0 +1,135 @@ +"Test undo, coverage 77%." +# Only test UndoDelegator so far. + +from idlelib.undo import UndoDelegator +import unittest +from test.support import requires +requires('gui') + +from unittest.mock import Mock +from tkinter import Text, Tk +from idlelib.percolator import Percolator + + +class UndoDelegatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.text = Text(cls.root) + cls.percolator = Percolator(cls.text) + + @classmethod + def tearDownClass(cls): + cls.percolator.redir.close() + del cls.percolator, cls.text + cls.root.destroy() + del cls.root + + def setUp(self): + self.delegator = UndoDelegator() + self.delegator.bell = Mock() + self.percolator.insertfilter(self.delegator) + + def tearDown(self): + self.percolator.removefilter(self.delegator) + self.text.delete('1.0', 'end') + self.delegator.resetcache() + + def test_undo_event(self): + text = self.text + + text.insert('insert', 'foobar') + text.insert('insert', 'h') + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), '\n') + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.2', '1.4') + text.insert('insert', 'hello') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.4'), 'foar') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.6'), 'foobar') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.3'), 'foo') + text.event_generate('<>') + self.delegator.undo_event('event') + self.assertTrue(self.delegator.bell.called) + + def test_redo_event(self): + text = self.text + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.0', '1.3') + text.event_generate('<>') + text.event_generate('<>') + self.assertEqual(text.get('1.0', '1.3'), 'bar') + text.event_generate('<>') + self.assertTrue(self.delegator.bell.called) + + def test_dump_event(self): + """ + Dump_event cannot be tested directly without changing + environment variables. So, test statements in dump_event + indirectly + """ + text = self.text + d = self.delegator + + text.insert('insert', 'foo') + text.insert('insert', 'bar') + text.delete('1.2', '1.4') + self.assertTupleEqual((d.pointer, d.can_merge), (3, True)) + text.event_generate('<>') + self.assertTupleEqual((d.pointer, d.can_merge), (2, False)) + + def test_get_set_saved(self): + # test the getter method get_saved + # test the setter method set_saved + # indirectly test check_saved + d = self.delegator + + self.assertTrue(d.get_saved()) + self.text.insert('insert', 'a') + self.assertFalse(d.get_saved()) + d.saved_change_hook = Mock() + + d.set_saved(True) + self.assertEqual(d.pointer, d.saved) + self.assertTrue(d.saved_change_hook.called) + + d.set_saved(False) + self.assertEqual(d.saved, -1) + self.assertTrue(d.saved_change_hook.called) + + def test_undo_start_stop(self): + # test the undo_block_start and undo_block_stop methods + text = self.text + + text.insert('insert', 'foo') + self.delegator.undo_block_start() + text.insert('insert', 'bar') + text.insert('insert', 'bar') + self.delegator.undo_block_stop() + self.assertEqual(text.get('1.0', '1.3'), 'foo') + + # test another code path + self.delegator.undo_block_start() + text.insert('insert', 'bar') + self.delegator.undo_block_stop() + self.assertEqual(text.get('1.0', '1.3'), 'foo') + + def test_addcmd(self): + text = self.text + # when number of undo operations exceeds max_undo + self.delegator.max_undo = max_undo = 10 + for i in range(max_undo + 10): + text.insert('insert', 'foo') + self.assertLessEqual(len(self.delegator.undolist), max_undo) + + +if __name__ == '__main__': + unittest.main(verbosity=2, exit=False) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_util.py b/micromamba_root/Lib/idlelib/idle_test/test_util.py new file mode 100644 index 0000000000000000000000000000000000000000..20721fe980c784e1497ef96c7e52d11f834d9740 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_util.py @@ -0,0 +1,14 @@ +"""Test util, coverage 100%""" + +import unittest +from idlelib import util + + +class UtilTest(unittest.TestCase): + def test_extensions(self): + for extension in {'.pyi', '.py', '.pyw'}: + self.assertIn(extension, util.py_extensions) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_warning.py b/micromamba_root/Lib/idlelib/idle_test/test_warning.py new file mode 100644 index 0000000000000000000000000000000000000000..221068c5885fcbad118283b6c1702a1c55896ec7 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_warning.py @@ -0,0 +1,73 @@ +'''Test warnings replacement in pyshell.py and run.py. + +This file could be expanded to include traceback overrides +(in same two modules). If so, change name. +Revise if output destination changes (http://bugs.python.org/issue18318). +Make sure warnings module is left unaltered (http://bugs.python.org/issue18081). +''' +from idlelib import run +from idlelib import pyshell as shell +import unittest +from test.support import captured_stderr +import warnings + +# Try to capture default showwarning before Idle modules are imported. +showwarning = warnings.showwarning +# But if we run this file within idle, we are in the middle of the run.main loop +# and default showwarnings has already been replaced. +running_in_idle = 'idle' in showwarning.__name__ + +# The following was generated from pyshell.idle_formatwarning +# and checked as matching expectation. +idlemsg = ''' +Warning (from warnings module): + File "test_warning.py", line 99 + Line of code +UserWarning: Test +''' +shellmsg = idlemsg + ">>> " + + +class RunWarnTest(unittest.TestCase): + + @unittest.skipIf(running_in_idle, "Does not work when run within Idle.") + def test_showwarnings(self): + self.assertIs(warnings.showwarning, showwarning) + run.capture_warnings(True) + self.assertIs(warnings.showwarning, run.idle_showwarning_subproc) + run.capture_warnings(False) + self.assertIs(warnings.showwarning, showwarning) + + def test_run_show(self): + with captured_stderr() as f: + run.idle_showwarning_subproc( + 'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code') + # The following uses .splitlines to erase line-ending differences + self.assertEqual(idlemsg.splitlines(), f.getvalue().splitlines()) + + +class ShellWarnTest(unittest.TestCase): + + @unittest.skipIf(running_in_idle, "Does not work when run within Idle.") + def test_showwarnings(self): + self.assertIs(warnings.showwarning, showwarning) + shell.capture_warnings(True) + self.assertIs(warnings.showwarning, shell.idle_showwarning) + shell.capture_warnings(False) + self.assertIs(warnings.showwarning, showwarning) + + def test_idle_formatter(self): + # Will fail if format changed without regenerating idlemsg + s = shell.idle_formatwarning( + 'Test', UserWarning, 'test_warning.py', 99, 'Line of code') + self.assertEqual(idlemsg, s) + + def test_shell_show(self): + with captured_stderr() as f: + shell.idle_showwarning( + 'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code') + self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_window.py b/micromamba_root/Lib/idlelib/idle_test/test_window.py new file mode 100644 index 0000000000000000000000000000000000000000..5a2645b9cc27dcee4ceea7e8443dad8e9e0d80c7 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_window.py @@ -0,0 +1,45 @@ +"Test window, coverage 47%." + +from idlelib import window +import unittest +from test.support import requires +from tkinter import Tk + + +class WindowListTest(unittest.TestCase): + + def test_init(self): + wl = window.WindowList() + self.assertEqual(wl.dict, {}) + self.assertEqual(wl.callbacks, []) + + # Further tests need mock Window. + + +class ListedToplevelTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + window.registry = set() + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + window.registry = window.WindowList() + cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + + win = window.ListedToplevel(self.root) + self.assertIn(win, window.registry) + self.assertEqual(win.focused_widget, win) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_zoomheight.py b/micromamba_root/Lib/idlelib/idle_test/test_zoomheight.py new file mode 100644 index 0000000000000000000000000000000000000000..aa5bdfb4fbd4c62f97d04669e9e8de667cbce0aa --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_zoomheight.py @@ -0,0 +1,39 @@ +"Test zoomheight, coverage 66%." +# Some code is system dependent. + +from idlelib import zoomheight +import unittest +from test.support import requires +from tkinter import Tk +from idlelib.editor import EditorWindow + + +class Test(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.editwin = EditorWindow(root=cls.root) + + @classmethod + def tearDownClass(cls): + cls.editwin._close() + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + zoom = zoomheight.ZoomHeight(self.editwin) + self.assertIs(zoom.editwin, self.editwin) + + def test_zoom_height_event(self): + zoom = zoomheight.ZoomHeight(self.editwin) + zoom.zoom_height_event() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/test_zzdummy.py b/micromamba_root/Lib/idlelib/idle_test/test_zzdummy.py new file mode 100644 index 0000000000000000000000000000000000000000..209d8564da06641f38e352846a24592636186c77 --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/test_zzdummy.py @@ -0,0 +1,152 @@ +"Test zzdummy, coverage 100%." + +from idlelib import zzdummy +import unittest +from test.support import requires +from tkinter import Tk, Text +from unittest import mock +from idlelib import config +from idlelib import editor +from idlelib import format + + +usercfg = zzdummy.idleConf.userCfg +testcfg = { + 'main': config.IdleUserConfParser(''), + 'highlight': config.IdleUserConfParser(''), + 'keys': config.IdleUserConfParser(''), + 'extensions': config.IdleUserConfParser(''), +} +code_sample = """\ + +class C1: + # Class comment. + def __init__(self, a, b): + self.a = a + self.b = b +""" + + +class DummyEditwin: + get_selection_indices = editor.EditorWindow.get_selection_indices + def __init__(self, root, text): + self.root = root + self.top = root + self.text = text + self.fregion = format.FormatRegion(self) + self.text.undo_block_start = mock.Mock() + self.text.undo_block_stop = mock.Mock() + + +class ZZDummyTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + root = cls.root = Tk() + root.withdraw() + text = cls.text = Text(cls.root) + cls.editor = DummyEditwin(root, text) + zzdummy.idleConf.userCfg = testcfg + + @classmethod + def tearDownClass(cls): + zzdummy.idleConf.userCfg = usercfg + del cls.editor, cls.text + cls.root.update_idletasks() + for id in cls.root.tk.call('after', 'info'): + cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def setUp(self): + text = self.text + text.insert('1.0', code_sample) + text.undo_block_start.reset_mock() + text.undo_block_stop.reset_mock() + zz = self.zz = zzdummy.ZzDummy(self.editor) + zzdummy.ZzDummy.ztext = '# ignore #' + + def tearDown(self): + self.text.delete('1.0', 'end') + del self.zz + + def checklines(self, text, value): + # Verify that there are lines being checked. + end_line = int(float(text.index('end'))) + + # Check each line for the starting text. + actual = [] + for line in range(1, end_line): + txt = text.get(f'{line}.0', f'{line}.end') + actual.append(txt.startswith(value)) + return actual + + def test_init(self): + zz = self.zz + self.assertEqual(zz.editwin, self.editor) + self.assertEqual(zz.text, self.editor.text) + + def test_reload(self): + self.assertEqual(self.zz.ztext, '# ignore #') + testcfg['extensions'].SetOption('ZzDummy', 'z-text', 'spam') + zzdummy.ZzDummy.reload() + self.assertEqual(self.zz.ztext, 'spam') + + def test_z_in_event(self): + eq = self.assertEqual + zz = self.zz + text = zz.text + eq(self.zz.ztext, '# ignore #') + + # No lines have the leading text. + expected = [False, False, False, False, False, False, False] + actual = self.checklines(text, zz.ztext) + eq(expected, actual) + + text.tag_add('sel', '2.0', '4.end') + eq(zz.z_in_event(), 'break') + expected = [False, True, True, True, False, False, False] + actual = self.checklines(text, zz.ztext) + eq(expected, actual) + + text.undo_block_start.assert_called_once() + text.undo_block_stop.assert_called_once() + + def test_z_out_event(self): + eq = self.assertEqual + zz = self.zz + text = zz.text + eq(self.zz.ztext, '# ignore #') + + # Prepend text. + text.tag_add('sel', '2.0', '5.end') + zz.z_in_event() + text.undo_block_start.reset_mock() + text.undo_block_stop.reset_mock() + + # Select a few lines to remove text. + text.tag_remove('sel', '1.0', 'end') + text.tag_add('sel', '3.0', '4.end') + eq(zz.z_out_event(), 'break') + expected = [False, True, False, False, True, False, False] + actual = self.checklines(text, zz.ztext) + eq(expected, actual) + + text.undo_block_start.assert_called_once() + text.undo_block_stop.assert_called_once() + + def test_roundtrip(self): + # Insert and remove to all code should give back original text. + zz = self.zz + text = zz.text + + text.tag_add('sel', '1.0', 'end-1c') + zz.z_in_event() + zz.z_out_event() + + self.assertEqual(text.get('1.0', 'end-1c'), code_sample) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/micromamba_root/Lib/idlelib/idle_test/tkinter_testing_utils.py b/micromamba_root/Lib/idlelib/idle_test/tkinter_testing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a89839bbe38add465aa20b89b327a5732d50f9fd --- /dev/null +++ b/micromamba_root/Lib/idlelib/idle_test/tkinter_testing_utils.py @@ -0,0 +1,62 @@ +"""Utilities for testing with Tkinter""" +import functools + + +def run_in_tk_mainloop(delay=1): + """Decorator for running a test method with a real Tk mainloop. + + This starts a Tk mainloop before running the test, and stops it + at the end. This is faster and more robust than the common + alternative method of calling .update() and/or .update_idletasks(). + + Test methods using this must be written as generator functions, + using "yield" to allow the mainloop to process events and "after" + callbacks, and then continue the test from that point. + + The delay argument is passed into root.after(...) calls as the number + of ms to wait before passing execution back to the generator function. + + This also assumes that the test class has a .root attribute, + which is a tkinter.Tk object. + + For example (from test_sidebar.py): + + @run_test_with_tk_mainloop() + def test_single_empty_input(self): + self.do_input('\n') + yield + self.assert_sidebar_lines_end_with(['>>>', '>>>']) + """ + def decorator(test_method): + @functools.wraps(test_method) + def new_test_method(self): + test_generator = test_method(self) + root = self.root + # Exceptions raised by self.assert...() need to be raised + # outside of the after() callback in order for the test + # harness to capture them. + exception = None + def after_callback(): + nonlocal exception + try: + next(test_generator) + except StopIteration: + root.quit() + except Exception as exc: + exception = exc + root.quit() + else: + # Schedule the Tk mainloop to call this function again, + # using a robust method of ensuring that it gets a + # chance to process queued events before doing so. + # See: https://stackoverflow.com/q/18499082#comment65004099_38817470 + root.after(delay, root.after_idle, after_callback) + root.after(0, root.after_idle, after_callback) + root.mainloop() + + if exception: + raise exception + + return new_test_method + + return decorator diff --git a/micromamba_root/Lib/importlib/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b96a77d7d6ab825c75398383e181e86d9c21f1d1 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/_abc.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/_abc.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..272f728c880b157a096e6304f0684b813dcb3ee7 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/_abc.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/_bootstrap.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/_bootstrap.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48dd377c57dafde72b46e5f1a2e1303f77a17590 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/_bootstrap.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/_bootstrap_external.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/_bootstrap_external.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89b1c162c5f65406a431d9e4e4dd26ed314290d8 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/_bootstrap_external.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/abc.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/abc.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09daf6ae4b30a018974c177d29d74974acde8e86 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/abc.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/machinery.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/machinery.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a91e215491008a70c0b1a534953e3b71e109a545 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/machinery.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/readers.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/readers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b2117d590747a568e57a061ee85ffdfc1f0b3f7 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/readers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/simple.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/simple.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7157f29cad590fe1f23f42e6b509f8fea1c5adf Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/simple.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/__pycache__/util.cpython-314.pyc b/micromamba_root/Lib/importlib/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9b596f1c78d4ec8ece13dbdbbf7a8d29ba3d333 Binary files /dev/null and b/micromamba_root/Lib/importlib/__pycache__/util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__init__.py b/micromamba_root/Lib/importlib/metadata/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8ce62dd864fc2735dc4c863909b0622b4f5f4548 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/__init__.py @@ -0,0 +1,1093 @@ +from __future__ import annotations + +import os +import re +import abc +import sys +import json +import email +import types +import inspect +import pathlib +import zipfile +import operator +import textwrap +import warnings +import functools +import itertools +import posixpath +import collections + +from . import _meta +from ._collections import FreezableDefaultDict, Pair +from ._functools import method_cache, pass_none +from ._itertools import always_iterable, unique_everseen +from ._meta import PackageMetadata, SimplePath + +from contextlib import suppress +from importlib import import_module +from importlib.abc import MetaPathFinder +from itertools import starmap +from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast + +__all__ = [ + 'Distribution', + 'DistributionFinder', + 'PackageMetadata', + 'PackageNotFoundError', + 'distribution', + 'distributions', + 'entry_points', + 'files', + 'metadata', + 'packages_distributions', + 'requires', + 'version', +] + + +class PackageNotFoundError(ModuleNotFoundError): + """The package was not found.""" + + def __str__(self) -> str: + return f"No package metadata was found for {self.name}" + + @property + def name(self) -> str: # type: ignore[override] + (name,) = self.args + return name + + +class Sectioned: + """ + A simple entry point config parser for performance + + >>> for item in Sectioned.read(Sectioned._sample): + ... print(item) + Pair(name='sec1', value='# comments ignored') + Pair(name='sec1', value='a = 1') + Pair(name='sec1', value='b = 2') + Pair(name='sec2', value='a = 2') + + >>> res = Sectioned.section_pairs(Sectioned._sample) + >>> item = next(res) + >>> item.name + 'sec1' + >>> item.value + Pair(name='a', value='1') + >>> item = next(res) + >>> item.value + Pair(name='b', value='2') + >>> item = next(res) + >>> item.name + 'sec2' + >>> item.value + Pair(name='a', value='2') + >>> list(res) + [] + """ + + _sample = textwrap.dedent( + """ + [sec1] + # comments ignored + a = 1 + b = 2 + + [sec2] + a = 2 + """ + ).lstrip() + + @classmethod + def section_pairs(cls, text): + return ( + section._replace(value=Pair.parse(section.value)) + for section in cls.read(text, filter_=cls.valid) + if section.name is not None + ) + + @staticmethod + def read(text, filter_=None): + lines = filter(filter_, map(str.strip, text.splitlines())) + name = None + for value in lines: + section_match = value.startswith('[') and value.endswith(']') + if section_match: + name = value.strip('[]') + continue + yield Pair(name, value) + + @staticmethod + def valid(line: str): + return line and not line.startswith('#') + + +class EntryPoint: + """An entry point as defined by Python packaging conventions. + + See `the packaging docs on entry points + `_ + for more information. + + >>> ep = EntryPoint( + ... name=None, group=None, value='package.module:attr [extra1, extra2]') + >>> ep.module + 'package.module' + >>> ep.attr + 'attr' + >>> ep.extras + ['extra1', 'extra2'] + """ + + pattern = re.compile( + r'(?P[\w.]+)\s*' + r'(:\s*(?P[\w.]+)\s*)?' + r'((?P\[.*\])\s*)?$' + ) + """ + A regular expression describing the syntax for an entry point, + which might look like: + + - module + - package.module + - package.module:attribute + - package.module:object.attribute + - package.module:attr [extra1, extra2] + + Other combinations are possible as well. + + The expression is lenient about whitespace around the ':', + following the attr, and following any extras. + """ + + name: str + value: str + group: str + + dist: Optional[Distribution] = None + + def __init__(self, name: str, value: str, group: str) -> None: + vars(self).update(name=name, value=value, group=group) + + def load(self) -> Any: + """Load the entry point from its definition. If only a module + is indicated by the value, return that module. Otherwise, + return the named object. + """ + match = cast(Match, self.pattern.match(self.value)) + module = import_module(match.group('module')) + attrs = filter(None, (match.group('attr') or '').split('.')) + return functools.reduce(getattr, attrs, module) + + @property + def module(self) -> str: + match = self.pattern.match(self.value) + assert match is not None + return match.group('module') + + @property + def attr(self) -> str: + match = self.pattern.match(self.value) + assert match is not None + return match.group('attr') + + @property + def extras(self) -> List[str]: + match = self.pattern.match(self.value) + assert match is not None + return re.findall(r'\w+', match.group('extras') or '') + + def _for(self, dist): + vars(self).update(dist=dist) + return self + + def matches(self, **params): + """ + EntryPoint matches the given parameters. + + >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') + >>> ep.matches(group='foo') + True + >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]') + True + >>> ep.matches(group='foo', name='other') + False + >>> ep.matches() + True + >>> ep.matches(extras=['extra1', 'extra2']) + True + >>> ep.matches(module='bing') + True + >>> ep.matches(attr='bong') + True + """ + attrs = (getattr(self, param) for param in params) + return all(map(operator.eq, params.values(), attrs)) + + def _key(self): + return self.name, self.value, self.group + + def __lt__(self, other): + return self._key() < other._key() + + def __eq__(self, other): + return self._key() == other._key() + + def __setattr__(self, name, value): + raise AttributeError("EntryPoint objects are immutable.") + + def __repr__(self): + return ( + f'EntryPoint(name={self.name!r}, value={self.value!r}, ' + f'group={self.group!r})' + ) + + def __hash__(self) -> int: + return hash(self._key()) + + +class EntryPoints(tuple): + """ + An immutable collection of selectable EntryPoint objects. + """ + + __slots__ = () + + def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] + """ + Get the EntryPoint in self matching name. + """ + try: + return next(iter(self.select(name=name))) + except StopIteration: + raise KeyError(name) + + def __repr__(self): + """ + Repr with classname and tuple constructor to + signal that we deviate from regular tuple behavior. + """ + return '%s(%r)' % (self.__class__.__name__, tuple(self)) + + def select(self, **params) -> EntryPoints: + """ + Select entry points from self that match the + given parameters (typically group and/or name). + """ + return EntryPoints(ep for ep in self if ep.matches(**params)) + + @property + def names(self) -> Set[str]: + """ + Return the set of all names of all entry points. + """ + return {ep.name for ep in self} + + @property + def groups(self) -> Set[str]: + """ + Return the set of all groups of all entry points. + """ + return {ep.group for ep in self} + + @classmethod + def _from_text_for(cls, text, dist): + return cls(ep._for(dist) for ep in cls._from_text(text)) + + @staticmethod + def _from_text(text): + return ( + EntryPoint(name=item.value.name, value=item.value.value, group=item.name) + for item in Sectioned.section_pairs(text or '') + ) + + +class PackagePath(pathlib.PurePosixPath): + """A reference to a path in a package""" + + hash: Optional[FileHash] + size: int + dist: Distribution + + def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override] + return self.locate().read_text(encoding=encoding) + + def read_binary(self) -> bytes: + return self.locate().read_bytes() + + def locate(self) -> SimplePath: + """Return a path-like object for this path""" + return self.dist.locate_file(self) + + +class FileHash: + def __init__(self, spec: str) -> None: + self.mode, _, self.value = spec.partition('=') + + def __repr__(self) -> str: + return f'' + + +class DeprecatedNonAbstract: + # Required until Python 3.14 + def __new__(cls, *args, **kwargs): + all_names = { + name for subclass in inspect.getmro(cls) for name in vars(subclass) + } + abstract = { + name + for name in all_names + if getattr(getattr(cls, name), '__isabstractmethod__', False) + } + if abstract: + warnings.warn( + f"Unimplemented abstract methods {abstract}", + DeprecationWarning, + stacklevel=2, + ) + return super().__new__(cls) + + +class Distribution(DeprecatedNonAbstract): + """ + An abstract Python distribution package. + + Custom providers may derive from this class and define + the abstract methods to provide a concrete implementation + for their environment. Some providers may opt to override + the default implementation of some properties to bypass + the file-reading mechanism. + """ + + @abc.abstractmethod + def read_text(self, filename) -> Optional[str]: + """Attempt to load metadata file given by the name. + + Python distribution metadata is organized by blobs of text + typically represented as "files" in the metadata directory + (e.g. package-1.0.dist-info). These files include things + like: + + - METADATA: The distribution metadata including fields + like Name and Version and Description. + - entry_points.txt: A series of entry points as defined in + `the entry points spec `_. + - RECORD: A record of files according to + `this recording spec `_. + + A package may provide any set of files, including those + not listed here or none at all. + + :param filename: The name of the file in the distribution info. + :return: The text if found, otherwise None. + """ + + @abc.abstractmethod + def locate_file(self, path: str | os.PathLike[str]) -> SimplePath: + """ + Given a path to a file in this distribution, return a SimplePath + to it. + """ + + @classmethod + def from_name(cls, name: str) -> Distribution: + """Return the Distribution for the given package name. + + :param name: The name of the distribution package to search for. + :return: The Distribution instance (or subclass thereof) for the named + package, if found. + :raises PackageNotFoundError: When the named package's distribution + metadata cannot be found. + :raises ValueError: When an invalid value is supplied for name. + """ + if not name: + raise ValueError("A distribution name is required.") + try: + return next(iter(cls.discover(name=name))) + except StopIteration: + raise PackageNotFoundError(name) + + @classmethod + def discover( + cls, *, context: Optional[DistributionFinder.Context] = None, **kwargs + ) -> Iterable[Distribution]: + """Return an iterable of Distribution objects for all packages. + + Pass a ``context`` or pass keyword arguments for constructing + a context. + + :context: A ``DistributionFinder.Context`` object. + :return: Iterable of Distribution objects for packages matching + the context. + """ + if context and kwargs: + raise ValueError("cannot accept context and kwargs") + context = context or DistributionFinder.Context(**kwargs) + return itertools.chain.from_iterable( + resolver(context) for resolver in cls._discover_resolvers() + ) + + @staticmethod + def at(path: str | os.PathLike[str]) -> Distribution: + """Return a Distribution for the indicated metadata path. + + :param path: a string or path-like object + :return: a concrete Distribution instance for the path + """ + return PathDistribution(pathlib.Path(path)) + + @staticmethod + def _discover_resolvers(): + """Search the meta_path for resolvers (MetadataPathFinders).""" + declared = ( + getattr(finder, 'find_distributions', None) for finder in sys.meta_path + ) + return filter(None, declared) + + @property + def metadata(self) -> _meta.PackageMetadata: + """Return the parsed metadata for this Distribution. + + The returned object will have keys that name the various bits of + metadata per the + `Core metadata specifications `_. + + Custom providers may provide the METADATA file or override this + property. + """ + # deferred for performance (python/cpython#109829) + from . import _adapters + + opt_text = ( + self.read_text('METADATA') + or self.read_text('PKG-INFO') + # This last clause is here to support old egg-info files. Its + # effect is to just end up using the PathDistribution's self._path + # (which points to the egg-info file) attribute unchanged. + or self.read_text('') + ) + text = cast(str, opt_text) + return _adapters.Message(email.message_from_string(text)) + + @property + def name(self) -> str: + """Return the 'Name' metadata for the distribution package.""" + return self.metadata['Name'] + + @property + def _normalized_name(self): + """Return a normalized version of the name.""" + return Prepared.normalize(self.name) + + @property + def version(self) -> str: + """Return the 'Version' metadata for the distribution package.""" + return self.metadata['Version'] + + @property + def entry_points(self) -> EntryPoints: + """ + Return EntryPoints for this distribution. + + Custom providers may provide the ``entry_points.txt`` file + or override this property. + """ + return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self) + + @property + def files(self) -> Optional[List[PackagePath]]: + """Files in this distribution. + + :return: List of PackagePath for this distribution or None + + Result is `None` if the metadata file that enumerates files + (i.e. RECORD for dist-info, or installed-files.txt or + SOURCES.txt for egg-info) is missing. + Result may be empty if the metadata exists but is empty. + + Custom providers are recommended to provide a "RECORD" file (in + ``read_text``) or override this property to allow for callers to be + able to resolve filenames provided by the package. + """ + + def make_file(name, hash=None, size_str=None): + result = PackagePath(name) + result.hash = FileHash(hash) if hash else None + result.size = int(size_str) if size_str else None + result.dist = self + return result + + @pass_none + def make_files(lines): + # Delay csv import, since Distribution.files is not as widely used + # as other parts of importlib.metadata + import csv + + return starmap(make_file, csv.reader(lines)) + + @pass_none + def skip_missing_files(package_paths): + return list(filter(lambda path: path.locate().exists(), package_paths)) + + return skip_missing_files( + make_files( + self._read_files_distinfo() + or self._read_files_egginfo_installed() + or self._read_files_egginfo_sources() + ) + ) + + def _read_files_distinfo(self): + """ + Read the lines of RECORD. + """ + text = self.read_text('RECORD') + return text and text.splitlines() + + def _read_files_egginfo_installed(self): + """ + Read installed-files.txt and return lines in a similar + CSV-parsable format as RECORD: each file must be placed + relative to the site-packages directory and must also be + quoted (since file names can contain literal commas). + + This file is written when the package is installed by pip, + but it might not be written for other installation methods. + Assume the file is accurate if it exists. + """ + text = self.read_text('installed-files.txt') + # Prepend the .egg-info/ subdir to the lines in this file. + # But this subdir is only available from PathDistribution's + # self._path. + subdir = getattr(self, '_path', None) + if not text or not subdir: + return + + paths = ( + (subdir / name) + .resolve() + .relative_to(self.locate_file('').resolve(), walk_up=True) + .as_posix() + for name in text.splitlines() + ) + return map('"{}"'.format, paths) + + def _read_files_egginfo_sources(self): + """ + Read SOURCES.txt and return lines in a similar CSV-parsable + format as RECORD: each file name must be quoted (since it + might contain literal commas). + + Note that SOURCES.txt is not a reliable source for what + files are installed by a package. This file is generated + for a source archive, and the files that are present + there (e.g. setup.py) may not correctly reflect the files + that are present after the package has been installed. + """ + text = self.read_text('SOURCES.txt') + return text and map('"{}"'.format, text.splitlines()) + + @property + def requires(self) -> Optional[List[str]]: + """Generated requirements specified for this Distribution""" + reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs() + return reqs and list(reqs) + + def _read_dist_info_reqs(self): + return self.metadata.get_all('Requires-Dist') + + def _read_egg_info_reqs(self): + source = self.read_text('requires.txt') + return pass_none(self._deps_from_requires_text)(source) + + @classmethod + def _deps_from_requires_text(cls, source): + return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source)) + + @staticmethod + def _convert_egg_info_reqs_to_simple_reqs(sections): + """ + Historically, setuptools would solicit and store 'extra' + requirements, including those with environment markers, + in separate sections. More modern tools expect each + dependency to be defined separately, with any relevant + extras and environment markers attached directly to that + requirement. This method converts the former to the + latter. See _test_deps_from_requires_text for an example. + """ + + def make_condition(name): + return name and f'extra == "{name}"' + + def quoted_marker(section): + section = section or '' + extra, sep, markers = section.partition(':') + if extra and markers: + markers = f'({markers})' + conditions = list(filter(None, [markers, make_condition(extra)])) + return '; ' + ' and '.join(conditions) if conditions else '' + + def url_req_space(req): + """ + PEP 508 requires a space between the url_spec and the quoted_marker. + Ref python/importlib_metadata#357. + """ + # '@' is uniquely indicative of a url_req. + return ' ' * ('@' in req) + + for section in sections: + space = url_req_space(section.value) + yield section.value + space + quoted_marker(section.name) + + @property + def origin(self): + return self._load_json('direct_url.json') + + def _load_json(self, filename): + return pass_none(json.loads)( + self.read_text(filename), + object_hook=lambda data: types.SimpleNamespace(**data), + ) + + +class DistributionFinder(MetaPathFinder): + """ + A MetaPathFinder capable of discovering installed distributions. + + Custom providers should implement this interface in order to + supply metadata. + """ + + class Context: + """ + Keyword arguments presented by the caller to + ``distributions()`` or ``Distribution.discover()`` + to narrow the scope of a search for distributions + in all DistributionFinders. + + Each DistributionFinder may expect any parameters + and should attempt to honor the canonical + parameters defined below when appropriate. + + This mechanism gives a custom provider a means to + solicit additional details from the caller beyond + "name" and "path" when searching distributions. + For example, imagine a provider that exposes suites + of packages in either a "public" or "private" ``realm``. + A caller may wish to query only for distributions in + a particular realm and could call + ``distributions(realm="private")`` to signal to the + custom provider to only include distributions from that + realm. + """ + + name = None + """ + Specific name for which a distribution finder should match. + A name of ``None`` matches all distributions. + """ + + def __init__(self, **kwargs): + vars(self).update(kwargs) + + @property + def path(self) -> List[str]: + """ + The sequence of directory path that a distribution finder + should search. + + Typically refers to Python installed package paths such as + "site-packages" directories and defaults to ``sys.path``. + """ + return vars(self).get('path', sys.path) + + @abc.abstractmethod + def find_distributions(self, context=Context()) -> Iterable[Distribution]: + """ + Find distributions. + + Return an iterable of all Distribution instances capable of + loading the metadata for packages matching the ``context``, + a DistributionFinder.Context instance. + """ + + +class FastPath: + """ + Micro-optimized class for searching a root for children. + + Root is a path on the file system that may contain metadata + directories either as natural directories or within a zip file. + + >>> FastPath('').children() + ['...'] + + FastPath objects are cached and recycled for any given root. + + >>> FastPath('foobar') is FastPath('foobar') + True + """ + + @functools.lru_cache() # type: ignore + def __new__(cls, root): + return super().__new__(cls) + + def __init__(self, root): + self.root = root + + def joinpath(self, child): + return pathlib.Path(self.root, child) + + def children(self): + with suppress(Exception): + return os.listdir(self.root or '.') + with suppress(Exception): + return self.zip_children() + return [] + + def zip_children(self): + zip_path = zipfile.Path(self.root) + names = zip_path.root.namelist() + self.joinpath = zip_path.joinpath + + return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names) + + def search(self, name): + return self.lookup(self.mtime).search(name) + + @property + def mtime(self): + with suppress(OSError): + return os.stat(self.root).st_mtime + self.lookup.cache_clear() + + @method_cache + def lookup(self, mtime): + return Lookup(self) + + +class Lookup: + """ + A micro-optimized class for searching a (fast) path for metadata. + """ + + def __init__(self, path: FastPath): + """ + Calculate all of the children representing metadata. + + From the children in the path, calculate early all of the + children that appear to represent metadata (infos) or legacy + metadata (eggs). + """ + + base = os.path.basename(path.root).lower() + base_is_egg = base.endswith(".egg") + self.infos = FreezableDefaultDict(list) + self.eggs = FreezableDefaultDict(list) + + for child in path.children(): + low = child.lower() + if low.endswith((".dist-info", ".egg-info")): + # rpartition is faster than splitext and suitable for this purpose. + name = low.rpartition(".")[0].partition("-")[0] + normalized = Prepared.normalize(name) + self.infos[normalized].append(path.joinpath(child)) + elif base_is_egg and low == "egg-info": + name = base.rpartition(".")[0].partition("-")[0] + legacy_normalized = Prepared.legacy_normalize(name) + self.eggs[legacy_normalized].append(path.joinpath(child)) + + self.infos.freeze() + self.eggs.freeze() + + def search(self, prepared: Prepared): + """ + Yield all infos and eggs matching the Prepared query. + """ + infos = ( + self.infos[prepared.normalized] + if prepared + else itertools.chain.from_iterable(self.infos.values()) + ) + eggs = ( + self.eggs[prepared.legacy_normalized] + if prepared + else itertools.chain.from_iterable(self.eggs.values()) + ) + return itertools.chain(infos, eggs) + + +class Prepared: + """ + A prepared search query for metadata on a possibly-named package. + + Pre-calculates the normalization to prevent repeated operations. + + >>> none = Prepared(None) + >>> none.normalized + >>> none.legacy_normalized + >>> bool(none) + False + >>> sample = Prepared('Sample__Pkg-name.foo') + >>> sample.normalized + 'sample_pkg_name_foo' + >>> sample.legacy_normalized + 'sample__pkg_name.foo' + >>> bool(sample) + True + """ + + normalized = None + legacy_normalized = None + + def __init__(self, name: Optional[str]): + self.name = name + if name is None: + return + self.normalized = self.normalize(name) + self.legacy_normalized = self.legacy_normalize(name) + + @staticmethod + def normalize(name): + """ + PEP 503 normalization plus dashes as underscores. + """ + return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') + + @staticmethod + def legacy_normalize(name): + """ + Normalize the package name as found in the convention in + older packaging tools versions and specs. + """ + return name.lower().replace('-', '_') + + def __bool__(self): + return bool(self.name) + + +class MetadataPathFinder(DistributionFinder): + @classmethod + def find_distributions( + cls, context=DistributionFinder.Context() + ) -> Iterable[PathDistribution]: + """ + Find distributions. + + Return an iterable of all Distribution instances capable of + loading the metadata for packages matching ``context.name`` + (or all names if ``None`` indicated) along the paths in the list + of directories ``context.path``. + """ + found = cls._search_paths(context.name, context.path) + return map(PathDistribution, found) + + @classmethod + def _search_paths(cls, name, paths): + """Find metadata directories in paths heuristically.""" + prepared = Prepared(name) + return itertools.chain.from_iterable( + path.search(prepared) for path in map(FastPath, paths) + ) + + @classmethod + def invalidate_caches(cls) -> None: + FastPath.__new__.cache_clear() + + +class PathDistribution(Distribution): + def __init__(self, path: SimplePath) -> None: + """Construct a distribution. + + :param path: SimplePath indicating the metadata directory. + """ + self._path = path + + def read_text(self, filename: str | os.PathLike[str]) -> Optional[str]: + with suppress( + FileNotFoundError, + IsADirectoryError, + KeyError, + NotADirectoryError, + PermissionError, + ): + return self._path.joinpath(filename).read_text(encoding='utf-8') + + return None + + read_text.__doc__ = Distribution.read_text.__doc__ + + def locate_file(self, path: str | os.PathLike[str]) -> SimplePath: + return self._path.parent / path + + @property + def _normalized_name(self): + """ + Performance optimization: where possible, resolve the + normalized name from the file system path. + """ + stem = os.path.basename(str(self._path)) + return ( + pass_none(Prepared.normalize)(self._name_from_stem(stem)) + or super()._normalized_name + ) + + @staticmethod + def _name_from_stem(stem): + """ + >>> PathDistribution._name_from_stem('foo-3.0.egg-info') + 'foo' + >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') + 'CherryPy' + >>> PathDistribution._name_from_stem('face.egg-info') + 'face' + >>> PathDistribution._name_from_stem('foo.bar') + """ + filename, ext = os.path.splitext(stem) + if ext not in ('.dist-info', '.egg-info'): + return + name, sep, rest = filename.partition('-') + return name + + +def distribution(distribution_name: str) -> Distribution: + """Get the ``Distribution`` instance for the named package. + + :param distribution_name: The name of the distribution package as a string. + :return: A ``Distribution`` instance (or subclass thereof). + """ + return Distribution.from_name(distribution_name) + + +def distributions(**kwargs) -> Iterable[Distribution]: + """Get all ``Distribution`` instances in the current environment. + + :return: An iterable of ``Distribution`` instances. + """ + return Distribution.discover(**kwargs) + + +def metadata(distribution_name: str) -> _meta.PackageMetadata: + """Get the metadata for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: A PackageMetadata containing the parsed metadata. + """ + return Distribution.from_name(distribution_name).metadata + + +def version(distribution_name: str) -> str: + """Get the version string for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: The version string for the package as defined in the package's + "Version" metadata key. + """ + return distribution(distribution_name).version + + +_unique = functools.partial( + unique_everseen, + key=operator.attrgetter('_normalized_name'), +) +""" +Wrapper for ``distributions`` to return unique distributions by name. +""" + + +def entry_points(**params) -> EntryPoints: + """Return EntryPoint objects for all installed packages. + + Pass selection parameters (group or name) to filter the + result to entry points matching those properties (see + EntryPoints.select()). + + :return: EntryPoints for all installed packages. + """ + eps = itertools.chain.from_iterable( + dist.entry_points for dist in _unique(distributions()) + ) + return EntryPoints(eps).select(**params) + + +def files(distribution_name: str) -> Optional[List[PackagePath]]: + """Return a list of files for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: List of files composing the distribution. + """ + return distribution(distribution_name).files + + +def requires(distribution_name: str) -> Optional[List[str]]: + """ + Return a list of requirements for the named package. + + :return: An iterable of requirements, suitable for + packaging.requirement.Requirement. + """ + return distribution(distribution_name).requires + + +def packages_distributions() -> Mapping[str, List[str]]: + """ + Return a mapping of top-level packages to their + distributions. + + >>> import collections.abc + >>> pkgs = packages_distributions() + >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values()) + True + """ + pkg_to_dist = collections.defaultdict(list) + for dist in distributions(): + for pkg in _top_level_declared(dist) or _top_level_inferred(dist): + pkg_to_dist[pkg].append(dist.metadata['Name']) + return dict(pkg_to_dist) + + +def _top_level_declared(dist): + return (dist.read_text('top_level.txt') or '').split() + + +def _topmost(name: PackagePath) -> Optional[str]: + """ + Return the top-most parent as long as there is a parent. + """ + top, *rest = name.parts + return top if rest else None + + +def _get_toplevel_name(name: PackagePath) -> str: + """ + Infer a possibly importable module name from a name presumed on + sys.path. + + >>> _get_toplevel_name(PackagePath('foo.py')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo.pyc')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo/__init__.py')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo.pth')) + 'foo.pth' + >>> _get_toplevel_name(PackagePath('foo.dist-info')) + 'foo.dist-info' + """ + return _topmost(name) or ( + # python/typeshed#10328 + inspect.getmodulename(name) # type: ignore + or str(name) + ) + + +def _top_level_inferred(dist): + opt_names = set(map(_get_toplevel_name, always_iterable(dist.files))) + + def importable_name(name): + return '.' not in name + + return filter(importable_name, opt_names) diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5633503fa127421210ac815508460169b3fb99ba Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_adapters.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_adapters.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a8830430fe6fa13965103623a89a9fcf46d62a3 Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_adapters.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_collections.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_collections.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49c53fcc47039056bbe9a87319c4bcb13fc0bf0a Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_collections.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_functools.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_functools.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af787be142a36443a121a0114dcfcb9221b68b82 Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_functools.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_itertools.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_itertools.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55df3aa22d61eb0ba04c017572da948e39d52e51 Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_itertools.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_meta.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_meta.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e7fb2554a51df7b74276ae6add74e7e89d9f45b Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_meta.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/_text.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/_text.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d63e649f238dd5c70b6178e9d05d9d69b19f3b0 Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/_text.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/__pycache__/diagnose.cpython-314.pyc b/micromamba_root/Lib/importlib/metadata/__pycache__/diagnose.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e0c6c867adc45d5b6b0a1b8bd04c40cf29727ba1 Binary files /dev/null and b/micromamba_root/Lib/importlib/metadata/__pycache__/diagnose.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/metadata/_adapters.py b/micromamba_root/Lib/importlib/metadata/_adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..591168808953ba8ec54b47f14584a3ed7bc073f2 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_adapters.py @@ -0,0 +1,89 @@ +import functools +import warnings +import re +import textwrap +import email.message + +from ._text import FoldedCase + + +# Do not remove prior to 2024-01-01 or Python 3.14 +_warn = functools.partial( + warnings.warn, + "Implicit None on return values is deprecated and will raise KeyErrors.", + DeprecationWarning, + stacklevel=2, +) + + +class Message(email.message.Message): + multiple_use_keys = set( + map( + FoldedCase, + [ + 'Classifier', + 'Obsoletes-Dist', + 'Platform', + 'Project-URL', + 'Provides-Dist', + 'Provides-Extra', + 'Requires-Dist', + 'Requires-External', + 'Supported-Platform', + 'Dynamic', + ], + ) + ) + """ + Keys that may be indicated multiple times per PEP 566. + """ + + def __new__(cls, orig: email.message.Message): + res = super().__new__(cls) + vars(res).update(vars(orig)) + return res + + def __init__(self, *args, **kwargs): + self._headers = self._repair_headers() + + # suppress spurious error from mypy + def __iter__(self): + return super().__iter__() + + def __getitem__(self, item): + """ + Warn users that a ``KeyError`` can be expected when a + missing key is supplied. Ref python/importlib_metadata#371. + """ + res = super().__getitem__(item) + if res is None: + _warn() + return res + + def _repair_headers(self): + def redent(value): + "Correct for RFC822 indentation" + if not value or '\n' not in value: + return value + return textwrap.dedent(' ' * 8 + value) + + headers = [(key, redent(value)) for key, value in vars(self)['_headers']] + if self._payload: + headers.append(('Description', self.get_payload())) + return headers + + @property + def json(self): + """ + Convert PackageMetadata to a JSON-compatible format + per PEP 0566. + """ + + def transform(key): + value = self.get_all(key) if key in self.multiple_use_keys else self[key] + if key == 'Keywords': + value = re.split(r'\s+', value) + tk = key.lower().replace('-', '_') + return tk, value + + return dict(map(transform, map(FoldedCase, self))) diff --git a/micromamba_root/Lib/importlib/metadata/_collections.py b/micromamba_root/Lib/importlib/metadata/_collections.py new file mode 100644 index 0000000000000000000000000000000000000000..cf0954e1a30546d781bf25781ec716ef92a77e32 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_collections.py @@ -0,0 +1,30 @@ +import collections + + +# from jaraco.collections 3.3 +class FreezableDefaultDict(collections.defaultdict): + """ + Often it is desirable to prevent the mutation of + a default dict after its initial construction, such + as to prevent mutation during iteration. + + >>> dd = FreezableDefaultDict(list) + >>> dd[0].append('1') + >>> dd.freeze() + >>> dd[1] + [] + >>> len(dd) + 1 + """ + + def __missing__(self, key): + return getattr(self, '_frozen', super().__missing__)(key) + + def freeze(self): + self._frozen = lambda key: self.default_factory() + + +class Pair(collections.namedtuple('Pair', 'name value')): + @classmethod + def parse(cls, text): + return cls(*map(str.strip, text.split("=", 1))) diff --git a/micromamba_root/Lib/importlib/metadata/_functools.py b/micromamba_root/Lib/importlib/metadata/_functools.py new file mode 100644 index 0000000000000000000000000000000000000000..71f66bd03cb713a2190853bdf7170c4ea80d2425 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_functools.py @@ -0,0 +1,104 @@ +import types +import functools + + +# from jaraco.functools 3.3 +def method_cache(method, cache_wrapper=None): + """ + Wrap lru_cache to support storing the cache data in the object instances. + + Abstracts the common paradigm where the method explicitly saves an + underscore-prefixed protected property on first call and returns that + subsequently. + + >>> class MyClass: + ... calls = 0 + ... + ... @method_cache + ... def method(self, value): + ... self.calls += 1 + ... return value + + >>> a = MyClass() + >>> a.method(3) + 3 + >>> for x in range(75): + ... res = a.method(x) + >>> a.calls + 75 + + Note that the apparent behavior will be exactly like that of lru_cache + except that the cache is stored on each instance, so values in one + instance will not flush values from another, and when an instance is + deleted, so are the cached values for that instance. + + >>> b = MyClass() + >>> for x in range(35): + ... res = b.method(x) + >>> b.calls + 35 + >>> a.method(0) + 0 + >>> a.calls + 75 + + Note that if method had been decorated with ``functools.lru_cache()``, + a.calls would have been 76 (due to the cached value of 0 having been + flushed by the 'b' instance). + + Clear the cache with ``.cache_clear()`` + + >>> a.method.cache_clear() + + Same for a method that hasn't yet been called. + + >>> c = MyClass() + >>> c.method.cache_clear() + + Another cache wrapper may be supplied: + + >>> cache = functools.lru_cache(maxsize=2) + >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache) + >>> a = MyClass() + >>> a.method2() + 3 + + Caution - do not subsequently wrap the method with another decorator, such + as ``@property``, which changes the semantics of the function. + + See also + http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/ + for another implementation and additional justification. + """ + cache_wrapper = cache_wrapper or functools.lru_cache() + + def wrapper(self, *args, **kwargs): + # it's the first call, replace the method with a cached, bound method + bound_method = types.MethodType(method, self) + cached_method = cache_wrapper(bound_method) + setattr(self, method.__name__, cached_method) + return cached_method(*args, **kwargs) + + # Support cache clear even before cache has been created. + wrapper.cache_clear = lambda: None + + return wrapper + + +# From jaraco.functools 3.3 +def pass_none(func): + """ + Wrap func so it's not called if its first param is None + + >>> print_text = pass_none(print) + >>> print_text('text') + text + >>> print_text(None) + """ + + @functools.wraps(func) + def wrapper(param, *args, **kwargs): + if param is not None: + return func(param, *args, **kwargs) + + return wrapper diff --git a/micromamba_root/Lib/importlib/metadata/_itertools.py b/micromamba_root/Lib/importlib/metadata/_itertools.py new file mode 100644 index 0000000000000000000000000000000000000000..d4ca9b9140e3f085b36609bb8dfdaea79c78e144 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_itertools.py @@ -0,0 +1,73 @@ +from itertools import filterfalse + + +def unique_everseen(iterable, key=None): + "List unique elements, preserving order. Remember all elements ever seen." + # unique_everseen('AAAABBBCCDAABBB') --> A B C D + # unique_everseen('ABBCcAD', str.lower) --> A B C D + seen = set() + seen_add = seen.add + if key is None: + for element in filterfalse(seen.__contains__, iterable): + seen_add(element) + yield element + else: + for element in iterable: + k = key(element) + if k not in seen: + seen_add(k) + yield element + + +# copied from more_itertools 8.8 +def always_iterable(obj, base_type=(str, bytes)): + """If *obj* is iterable, return an iterator over its items:: + + >>> obj = (1, 2, 3) + >>> list(always_iterable(obj)) + [1, 2, 3] + + If *obj* is not iterable, return a one-item iterable containing *obj*:: + + >>> obj = 1 + >>> list(always_iterable(obj)) + [1] + + If *obj* is ``None``, return an empty iterable: + + >>> obj = None + >>> list(always_iterable(None)) + [] + + By default, binary and text strings are not considered iterable:: + + >>> obj = 'foo' + >>> list(always_iterable(obj)) + ['foo'] + + If *base_type* is set, objects for which ``isinstance(obj, base_type)`` + returns ``True`` won't be considered iterable. + + >>> obj = {'a': 1} + >>> list(always_iterable(obj)) # Iterate over the dict's keys + ['a'] + >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit + [{'a': 1}] + + Set *base_type* to ``None`` to avoid any special handling and treat objects + Python considers iterable as iterable: + + >>> obj = 'foo' + >>> list(always_iterable(obj, base_type=None)) + ['f', 'o', 'o'] + """ + if obj is None: + return iter(()) + + if (base_type is not None) and isinstance(obj, base_type): + return iter((obj,)) + + try: + return iter(obj) + except TypeError: + return iter((obj,)) diff --git a/micromamba_root/Lib/importlib/metadata/_meta.py b/micromamba_root/Lib/importlib/metadata/_meta.py new file mode 100644 index 0000000000000000000000000000000000000000..1927d0f624d82f2fa12f81c80cce91279f039e84 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_meta.py @@ -0,0 +1,67 @@ +from __future__ import annotations + +import os +from typing import Protocol +from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload + + +_T = TypeVar("_T") + + +class PackageMetadata(Protocol): + def __len__(self) -> int: ... # pragma: no cover + + def __contains__(self, item: str) -> bool: ... # pragma: no cover + + def __getitem__(self, key: str) -> str: ... # pragma: no cover + + def __iter__(self) -> Iterator[str]: ... # pragma: no cover + + @overload + def get( + self, name: str, failobj: None = None + ) -> Optional[str]: ... # pragma: no cover + + @overload + def get(self, name: str, failobj: _T) -> Union[str, _T]: ... # pragma: no cover + + # overload per python/importlib_metadata#435 + @overload + def get_all( + self, name: str, failobj: None = None + ) -> Optional[List[Any]]: ... # pragma: no cover + + @overload + def get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]: + """ + Return all values associated with a possibly multi-valued key. + """ + + @property + def json(self) -> Dict[str, Union[str, List[str]]]: + """ + A JSON-compatible form of the metadata. + """ + + +class SimplePath(Protocol): + """ + A minimal subset of pathlib.Path required by Distribution. + """ + + def joinpath( + self, other: Union[str, os.PathLike[str]] + ) -> SimplePath: ... # pragma: no cover + + def __truediv__( + self, other: Union[str, os.PathLike[str]] + ) -> SimplePath: ... # pragma: no cover + + @property + def parent(self) -> SimplePath: ... # pragma: no cover + + def read_text(self, encoding=None) -> str: ... # pragma: no cover + + def read_bytes(self) -> bytes: ... # pragma: no cover + + def exists(self) -> bool: ... # pragma: no cover diff --git a/micromamba_root/Lib/importlib/metadata/_text.py b/micromamba_root/Lib/importlib/metadata/_text.py new file mode 100644 index 0000000000000000000000000000000000000000..c88cfbb2349c6401336bc5ba6623f51afd1eb59d --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/_text.py @@ -0,0 +1,99 @@ +import re + +from ._functools import method_cache + + +# from jaraco.text 3.5 +class FoldedCase(str): + """ + A case insensitive string class; behaves just like str + except compares equal when the only variation is case. + + >>> s = FoldedCase('hello world') + + >>> s == 'Hello World' + True + + >>> 'Hello World' == s + True + + >>> s != 'Hello World' + False + + >>> s.index('O') + 4 + + >>> s.split('O') + ['hell', ' w', 'rld'] + + >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta'])) + ['alpha', 'Beta', 'GAMMA'] + + Sequence membership is straightforward. + + >>> "Hello World" in [s] + True + >>> s in ["Hello World"] + True + + You may test for set inclusion, but candidate and elements + must both be folded. + + >>> FoldedCase("Hello World") in {s} + True + >>> s in {FoldedCase("Hello World")} + True + + String inclusion works as long as the FoldedCase object + is on the right. + + >>> "hello" in FoldedCase("Hello World") + True + + But not if the FoldedCase object is on the left: + + >>> FoldedCase('hello') in 'Hello World' + False + + In that case, use in_: + + >>> FoldedCase('hello').in_('Hello World') + True + + >>> FoldedCase('hello') > FoldedCase('Hello') + False + """ + + def __lt__(self, other): + return self.lower() < other.lower() + + def __gt__(self, other): + return self.lower() > other.lower() + + def __eq__(self, other): + return self.lower() == other.lower() + + def __ne__(self, other): + return self.lower() != other.lower() + + def __hash__(self): + return hash(self.lower()) + + def __contains__(self, other): + return super().lower().__contains__(other.lower()) + + def in_(self, other): + "Does self appear in other?" + return self in FoldedCase(other) + + # cache lower since it's likely to be called frequently. + @method_cache + def lower(self): + return super().lower() + + def index(self, sub): + return self.lower().index(sub.lower()) + + def split(self, splitter=' ', maxsplit=0): + pattern = re.compile(re.escape(splitter), re.I) + return pattern.split(self, maxsplit) diff --git a/micromamba_root/Lib/importlib/metadata/diagnose.py b/micromamba_root/Lib/importlib/metadata/diagnose.py new file mode 100644 index 0000000000000000000000000000000000000000..e405471ac4d94371b1ee9b1622227ff76b337180 --- /dev/null +++ b/micromamba_root/Lib/importlib/metadata/diagnose.py @@ -0,0 +1,21 @@ +import sys + +from . import Distribution + + +def inspect(path): + print("Inspecting", path) + dists = list(Distribution.discover(path=[path])) + if not dists: + return + print("Found", len(dists), "packages:", end=' ') + print(', '.join(dist.name for dist in dists)) + + +def run(): + for path in sys.path: + inspect(path) + + +if __name__ == '__main__': + run() diff --git a/micromamba_root/Lib/importlib/resources/__init__.py b/micromamba_root/Lib/importlib/resources/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..723c9f9eb33ce1e5f7fb5a70c5c9d62628a93521 --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/__init__.py @@ -0,0 +1,43 @@ +""" +Read resources contained within a package. + +This codebase is shared between importlib.resources in the stdlib +and importlib_resources in PyPI. See +https://github.com/python/importlib_metadata/wiki/Development-Methodology +for more detail. +""" + +from ._common import ( + as_file, + files, + Package, + Anchor, +) + +from ._functional import ( + contents, + is_resource, + open_binary, + open_text, + path, + read_binary, + read_text, +) + +from .abc import ResourceReader + + +__all__ = [ + 'Package', + 'Anchor', + 'ResourceReader', + 'as_file', + 'files', + 'contents', + 'is_resource', + 'open_binary', + 'open_text', + 'path', + 'read_binary', + 'read_text', +] diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..587940217b552a210fb54fed7e49fd1ae1ac90c1 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/_adapters.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/_adapters.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39b0d3fc63063034b2d4ab7e00a15a894f7b4ebe Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/_adapters.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/_common.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/_common.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa2affe07bfaca20f1bbe84814b82b37c0ea3ae5 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/_common.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/_functional.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/_functional.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d00e7fc1957d7a6cd35ca043ba5c3edc9c97e10 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/_functional.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/_itertools.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/_itertools.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ce049f404eeb3fdb1ad2396bd676d7e23b6d2f5 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/_itertools.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/abc.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/abc.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a89d4d27f3c19f07e21a17cdf031e35946a48c93 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/abc.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/readers.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/readers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf296b73aeeaf158d25b57506b569409f9f7c4c3 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/readers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/__pycache__/simple.cpython-314.pyc b/micromamba_root/Lib/importlib/resources/__pycache__/simple.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a7da890dac97d40bdb27b9dd94e6abcd3253048 Binary files /dev/null and b/micromamba_root/Lib/importlib/resources/__pycache__/simple.cpython-314.pyc differ diff --git a/micromamba_root/Lib/importlib/resources/_adapters.py b/micromamba_root/Lib/importlib/resources/_adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..50688fbb666658c5b0569a363a4ea5b75f2fc00d --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/_adapters.py @@ -0,0 +1,168 @@ +from contextlib import suppress +from io import TextIOWrapper + +from . import abc + + +class SpecLoaderAdapter: + """ + Adapt a package spec to adapt the underlying loader. + """ + + def __init__(self, spec, adapter=lambda spec: spec.loader): + self.spec = spec + self.loader = adapter(spec) + + def __getattr__(self, name): + return getattr(self.spec, name) + + +class TraversableResourcesLoader: + """ + Adapt a loader to provide TraversableResources. + """ + + def __init__(self, spec): + self.spec = spec + + def get_resource_reader(self, name): + return CompatibilityFiles(self.spec)._native() + + +def _io_wrapper(file, mode='r', *args, **kwargs): + if mode == 'r': + return TextIOWrapper(file, *args, **kwargs) + elif mode == 'rb': + return file + raise ValueError(f"Invalid mode value '{mode}', only 'r' and 'rb' are supported") + + +class CompatibilityFiles: + """ + Adapter for an existing or non-existent resource reader + to provide a compatibility .files(). + """ + + class SpecPath(abc.Traversable): + """ + Path tied to a module spec. + Can be read and exposes the resource reader children. + """ + + def __init__(self, spec, reader): + self._spec = spec + self._reader = reader + + def iterdir(self): + if not self._reader: + return iter(()) + return iter( + CompatibilityFiles.ChildPath(self._reader, path) + for path in self._reader.contents() + ) + + def is_file(self): + return False + + is_dir = is_file + + def joinpath(self, other): + if not self._reader: + return CompatibilityFiles.OrphanPath(other) + return CompatibilityFiles.ChildPath(self._reader, other) + + @property + def name(self): + return self._spec.name + + def open(self, mode='r', *args, **kwargs): + return _io_wrapper(self._reader.open_resource(None), mode, *args, **kwargs) + + class ChildPath(abc.Traversable): + """ + Path tied to a resource reader child. + Can be read but doesn't expose any meaningful children. + """ + + def __init__(self, reader, name): + self._reader = reader + self._name = name + + def iterdir(self): + return iter(()) + + def is_file(self): + return self._reader.is_resource(self.name) + + def is_dir(self): + return not self.is_file() + + def joinpath(self, other): + return CompatibilityFiles.OrphanPath(self.name, other) + + @property + def name(self): + return self._name + + def open(self, mode='r', *args, **kwargs): + return _io_wrapper( + self._reader.open_resource(self.name), mode, *args, **kwargs + ) + + class OrphanPath(abc.Traversable): + """ + Orphan path, not tied to a module spec or resource reader. + Can't be read and doesn't expose any meaningful children. + """ + + def __init__(self, *path_parts): + if len(path_parts) < 1: + raise ValueError('Need at least one path part to construct a path') + self._path = path_parts + + def iterdir(self): + return iter(()) + + def is_file(self): + return False + + is_dir = is_file + + def joinpath(self, other): + return CompatibilityFiles.OrphanPath(*self._path, other) + + @property + def name(self): + return self._path[-1] + + def open(self, mode='r', *args, **kwargs): + raise FileNotFoundError("Can't open orphan path") + + def __init__(self, spec): + self.spec = spec + + @property + def _reader(self): + with suppress(AttributeError): + return self.spec.loader.get_resource_reader(self.spec.name) + + def _native(self): + """ + Return the native reader if it supports files(). + """ + reader = self._reader + return reader if hasattr(reader, 'files') else self + + def __getattr__(self, attr): + return getattr(self._reader, attr) + + def files(self): + return CompatibilityFiles.SpecPath(self.spec, self._reader) + + +def wrap_spec(package): + """ + Construct a package spec with traversable compatibility + on the spec/loader/reader. + """ + return SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader) diff --git a/micromamba_root/Lib/importlib/resources/_common.py b/micromamba_root/Lib/importlib/resources/_common.py new file mode 100644 index 0000000000000000000000000000000000000000..4e9014c45a056e220eaa131839e69c9ba7d3023f --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/_common.py @@ -0,0 +1,211 @@ +import os +import pathlib +import tempfile +import functools +import contextlib +import types +import importlib +import inspect +import warnings +import itertools + +from typing import Union, Optional, cast +from .abc import ResourceReader, Traversable + +Package = Union[types.ModuleType, str] +Anchor = Package + + +def package_to_anchor(func): + """ + Replace 'package' parameter as 'anchor' and warn about the change. + + Other errors should fall through. + + >>> files('a', 'b') + Traceback (most recent call last): + TypeError: files() takes from 0 to 1 positional arguments but 2 were given + + Remove this compatibility in Python 3.14. + """ + undefined = object() + + @functools.wraps(func) + def wrapper(anchor=undefined, package=undefined): + if package is not undefined: + if anchor is not undefined: + return func(anchor, package) + warnings.warn( + "First parameter to files is renamed to 'anchor'", + DeprecationWarning, + stacklevel=2, + ) + return func(package) + elif anchor is undefined: + return func() + return func(anchor) + + return wrapper + + +@package_to_anchor +def files(anchor: Optional[Anchor] = None) -> Traversable: + """ + Get a Traversable resource for an anchor. + """ + return from_package(resolve(anchor)) + + +def get_resource_reader(package: types.ModuleType) -> Optional[ResourceReader]: + """ + Return the package's loader if it's a ResourceReader. + """ + # We can't use + # a issubclass() check here because apparently abc.'s __subclasscheck__() + # hook wants to create a weak reference to the object, but + # zipimport.zipimporter does not support weak references, resulting in a + # TypeError. That seems terrible. + spec = package.__spec__ + reader = getattr(spec.loader, 'get_resource_reader', None) # type: ignore[union-attr] + if reader is None: + return None + return reader(spec.name) # type: ignore[union-attr] + + +@functools.singledispatch +def resolve(cand: Optional[Anchor]) -> types.ModuleType: + return cast(types.ModuleType, cand) + + +@resolve.register +def _(cand: str) -> types.ModuleType: + return importlib.import_module(cand) + + +@resolve.register +def _(cand: None) -> types.ModuleType: + return resolve(_infer_caller().f_globals['__name__']) + + +def _infer_caller(): + """ + Walk the stack and find the frame of the first caller not in this module. + """ + + def is_this_file(frame_info): + return frame_info.filename == stack[0].filename + + def is_wrapper(frame_info): + return frame_info.function == 'wrapper' + + stack = inspect.stack() + not_this_file = itertools.filterfalse(is_this_file, stack) + # also exclude 'wrapper' due to singledispatch in the call stack + callers = itertools.filterfalse(is_wrapper, not_this_file) + return next(callers).frame + + +def from_package(package: types.ModuleType): + """ + Return a Traversable object for the given package. + + """ + # deferred for performance (python/cpython#109829) + from ._adapters import wrap_spec + + spec = wrap_spec(package) + reader = spec.loader.get_resource_reader(spec.name) + return reader.files() + + +@contextlib.contextmanager +def _tempfile( + reader, + suffix='', + # gh-93353: Keep a reference to call os.remove() in late Python + # finalization. + *, + _os_remove=os.remove, +): + # Not using tempfile.NamedTemporaryFile as it leads to deeper 'try' + # blocks due to the need to close the temporary file to work on Windows + # properly. + fd, raw_path = tempfile.mkstemp(suffix=suffix) + try: + try: + os.write(fd, reader()) + finally: + os.close(fd) + del reader + yield pathlib.Path(raw_path) + finally: + try: + _os_remove(raw_path) + except FileNotFoundError: + pass + + +def _temp_file(path): + return _tempfile(path.read_bytes, suffix=path.name) + + +def _is_present_dir(path: Traversable) -> bool: + """ + Some Traversables implement ``is_dir()`` to raise an + exception (i.e. ``FileNotFoundError``) when the + directory doesn't exist. This function wraps that call + to always return a boolean and only return True + if there's a dir and it exists. + """ + with contextlib.suppress(FileNotFoundError): + return path.is_dir() + return False + + +@functools.singledispatch +def as_file(path): + """ + Given a Traversable object, return that object as a + path on the local file system in a context manager. + """ + return _temp_dir(path) if _is_present_dir(path) else _temp_file(path) + + +@as_file.register(pathlib.Path) +@contextlib.contextmanager +def _(path): + """ + Degenerate behavior for pathlib.Path objects. + """ + yield path + + +@contextlib.contextmanager +def _temp_path(dir: tempfile.TemporaryDirectory): + """ + Wrap tempfile.TemporaryDirectory to return a pathlib object. + """ + with dir as result: + yield pathlib.Path(result) + + +@contextlib.contextmanager +def _temp_dir(path): + """ + Given a traversable dir, recursively replicate the whole tree + to the file system in a context manager. + """ + assert path.is_dir() + with _temp_path(tempfile.TemporaryDirectory()) as temp_dir: + yield _write_contents(temp_dir, path) + + +def _write_contents(target, source): + child = target.joinpath(source.name) + if source.is_dir(): + child.mkdir() + for item in source.iterdir(): + _write_contents(child, item) + else: + child.write_bytes(source.read_bytes()) + return child diff --git a/micromamba_root/Lib/importlib/resources/_functional.py b/micromamba_root/Lib/importlib/resources/_functional.py new file mode 100644 index 0000000000000000000000000000000000000000..f59416f2dd627d560b3e393775cc5be14c578370 --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/_functional.py @@ -0,0 +1,81 @@ +"""Simplified function-based API for importlib.resources""" + +import warnings + +from ._common import files, as_file + + +_MISSING = object() + + +def open_binary(anchor, *path_names): + """Open for binary reading the *resource* within *package*.""" + return _get_resource(anchor, path_names).open('rb') + + +def open_text(anchor, *path_names, encoding=_MISSING, errors='strict'): + """Open for text reading the *resource* within *package*.""" + encoding = _get_encoding_arg(path_names, encoding) + resource = _get_resource(anchor, path_names) + return resource.open('r', encoding=encoding, errors=errors) + + +def read_binary(anchor, *path_names): + """Read and return contents of *resource* within *package* as bytes.""" + return _get_resource(anchor, path_names).read_bytes() + + +def read_text(anchor, *path_names, encoding=_MISSING, errors='strict'): + """Read and return contents of *resource* within *package* as str.""" + encoding = _get_encoding_arg(path_names, encoding) + resource = _get_resource(anchor, path_names) + return resource.read_text(encoding=encoding, errors=errors) + + +def path(anchor, *path_names): + """Return the path to the *resource* as an actual file system path.""" + return as_file(_get_resource(anchor, path_names)) + + +def is_resource(anchor, *path_names): + """Return ``True`` if there is a resource named *name* in the package, + + Otherwise returns ``False``. + """ + return _get_resource(anchor, path_names).is_file() + + +def contents(anchor, *path_names): + """Return an iterable over the named resources within the package. + + The iterable returns :class:`str` resources (e.g. files). + The iterable does not recurse into subdirectories. + """ + warnings.warn( + "importlib.resources.contents is deprecated. " + "Use files(anchor).iterdir() instead.", + DeprecationWarning, + stacklevel=1, + ) + return (resource.name for resource in _get_resource(anchor, path_names).iterdir()) + + +def _get_encoding_arg(path_names, encoding): + # For compatibility with versions where *encoding* was a positional + # argument, it needs to be given explicitly when there are multiple + # *path_names*. + # This limitation can be removed in Python 3.15. + if encoding is _MISSING: + if len(path_names) > 1: + raise TypeError( + "'encoding' argument required with multiple path names", + ) + else: + return 'utf-8' + return encoding + + +def _get_resource(anchor, path_names): + if anchor is None: + raise TypeError("anchor must be module or string, got None") + return files(anchor).joinpath(*path_names) diff --git a/micromamba_root/Lib/importlib/resources/_itertools.py b/micromamba_root/Lib/importlib/resources/_itertools.py new file mode 100644 index 0000000000000000000000000000000000000000..7b775ef5ae893f2b8061c5f996dc0a15a4c72adb --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/_itertools.py @@ -0,0 +1,38 @@ +# from more_itertools 9.0 +def only(iterable, default=None, too_long=None): + """If *iterable* has only one item, return it. + If it has zero items, return *default*. + If it has more than one item, raise the exception given by *too_long*, + which is ``ValueError`` by default. + >>> only([], default='missing') + 'missing' + >>> only([1]) + 1 + >>> only([1, 2]) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + ValueError: Expected exactly one item in iterable, but got 1, 2, + and perhaps more.' + >>> only([1, 2], too_long=TypeError) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + TypeError + Note that :func:`only` attempts to advance *iterable* twice to ensure there + is only one item. See :func:`spy` or :func:`peekable` to check + iterable contents less destructively. + """ + it = iter(iterable) + first_value = next(it, default) + + try: + second_value = next(it) + except StopIteration: + pass + else: + msg = ( + 'Expected exactly one item in iterable, but got {!r}, {!r}, ' + 'and perhaps more.'.format(first_value, second_value) + ) + raise too_long or ValueError(msg) + + return first_value diff --git a/micromamba_root/Lib/importlib/resources/abc.py b/micromamba_root/Lib/importlib/resources/abc.py new file mode 100644 index 0000000000000000000000000000000000000000..6750a7aaf14aa9695fa89d4f8bb43b4be13d9fa5 --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/abc.py @@ -0,0 +1,173 @@ +import abc +import io +import itertools +import os +import pathlib +from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional +from typing import runtime_checkable, Protocol +from typing import Union + + +StrPath = Union[str, os.PathLike[str]] + +__all__ = ["ResourceReader", "Traversable", "TraversableResources"] + + +class ResourceReader(metaclass=abc.ABCMeta): + """Abstract base class for loaders to provide resource reading support.""" + + @abc.abstractmethod + def open_resource(self, resource: Text) -> BinaryIO: + """Return an opened, file-like object for binary reading. + + The 'resource' argument is expected to represent only a file name. + If the resource cannot be found, FileNotFoundError is raised. + """ + # This deliberately raises FileNotFoundError instead of + # NotImplementedError so that if this method is accidentally called, + # it'll still do the right thing. + raise FileNotFoundError + + @abc.abstractmethod + def resource_path(self, resource: Text) -> Text: + """Return the file system path to the specified resource. + + The 'resource' argument is expected to represent only a file name. + If the resource does not exist on the file system, raise + FileNotFoundError. + """ + # This deliberately raises FileNotFoundError instead of + # NotImplementedError so that if this method is accidentally called, + # it'll still do the right thing. + raise FileNotFoundError + + @abc.abstractmethod + def is_resource(self, path: Text) -> bool: + """Return True if the named 'path' is a resource. + + Files are resources, directories are not. + """ + raise FileNotFoundError + + @abc.abstractmethod + def contents(self) -> Iterable[str]: + """Return an iterable of entries in `package`.""" + raise FileNotFoundError + + +class TraversalError(Exception): + pass + + +@runtime_checkable +class Traversable(Protocol): + """ + An object with a subset of pathlib.Path methods suitable for + traversing directories and opening files. + + Any exceptions that occur when accessing the backing resource + may propagate unaltered. + """ + + @abc.abstractmethod + def iterdir(self) -> Iterator["Traversable"]: + """ + Yield Traversable objects in self + """ + + def read_bytes(self) -> bytes: + """ + Read contents of self as bytes + """ + with self.open('rb') as strm: + return strm.read() + + def read_text(self, encoding: Optional[str] = None) -> str: + """ + Read contents of self as text + """ + with self.open(encoding=encoding) as strm: + return strm.read() + + @abc.abstractmethod + def is_dir(self) -> bool: + """ + Return True if self is a directory + """ + + @abc.abstractmethod + def is_file(self) -> bool: + """ + Return True if self is a file + """ + + def joinpath(self, *descendants: StrPath) -> "Traversable": + """ + Return Traversable resolved with any descendants applied. + + Each descendant should be a path segment relative to self + and each may contain multiple levels separated by + ``posixpath.sep`` (``/``). + """ + if not descendants: + return self + names = itertools.chain.from_iterable( + path.parts for path in map(pathlib.PurePosixPath, descendants) + ) + target = next(names) + matches = ( + traversable for traversable in self.iterdir() if traversable.name == target + ) + try: + match = next(matches) + except StopIteration: + raise TraversalError( + "Target not found during traversal.", target, list(names) + ) + return match.joinpath(*names) + + def __truediv__(self, child: StrPath) -> "Traversable": + """ + Return Traversable child in self + """ + return self.joinpath(child) + + @abc.abstractmethod + def open(self, mode='r', *args, **kwargs): + """ + mode may be 'r' or 'rb' to open as text or binary. Return a handle + suitable for reading (same as pathlib.Path.open). + + When opening as text, accepts encoding parameters such as those + accepted by io.TextIOWrapper. + """ + + @property + @abc.abstractmethod + def name(self) -> str: + """ + The base name of this object without any parent references. + """ + + +class TraversableResources(ResourceReader): + """ + The required interface for providing traversable + resources. + """ + + @abc.abstractmethod + def files(self) -> "Traversable": + """Return a Traversable object for the loaded package.""" + + def open_resource(self, resource: StrPath) -> io.BufferedReader: + return self.files().joinpath(resource).open('rb') + + def resource_path(self, resource: Any) -> NoReturn: + raise FileNotFoundError(resource) + + def is_resource(self, path: StrPath) -> bool: + return self.files().joinpath(path).is_file() + + def contents(self) -> Iterator[str]: + return (item.name for item in self.files().iterdir()) diff --git a/micromamba_root/Lib/importlib/resources/readers.py b/micromamba_root/Lib/importlib/resources/readers.py new file mode 100644 index 0000000000000000000000000000000000000000..70fc7e2b9c0145b003e4be8d3723b01e31bd52db --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/readers.py @@ -0,0 +1,203 @@ +from __future__ import annotations + +import collections +import contextlib +import itertools +import pathlib +import operator +import re +import warnings +import zipfile +from collections.abc import Iterator + +from . import abc + +from ._itertools import only + + +def remove_duplicates(items): + return iter(collections.OrderedDict.fromkeys(items)) + + +class FileReader(abc.TraversableResources): + def __init__(self, loader): + self.path = pathlib.Path(loader.path).parent + + def resource_path(self, resource): + """ + Return the file system path to prevent + `resources.path()` from creating a temporary + copy. + """ + return str(self.path.joinpath(resource)) + + def files(self): + return self.path + + +class ZipReader(abc.TraversableResources): + def __init__(self, loader, module): + self.prefix = loader.prefix.replace('\\', '/') + if loader.is_package(module): + _, _, name = module.rpartition('.') + self.prefix += name + '/' + self.archive = loader.archive + + def open_resource(self, resource): + try: + return super().open_resource(resource) + except KeyError as exc: + raise FileNotFoundError(exc.args[0]) + + def is_resource(self, path): + """ + Workaround for `zipfile.Path.is_file` returning true + for non-existent paths. + """ + target = self.files().joinpath(path) + return target.is_file() and target.exists() + + def files(self): + return zipfile.Path(self.archive, self.prefix) + + +class MultiplexedPath(abc.Traversable): + """ + Given a series of Traversable objects, implement a merged + version of the interface across all objects. Useful for + namespace packages which may be multihomed at a single + name. + """ + + def __init__(self, *paths): + self._paths = list(map(_ensure_traversable, remove_duplicates(paths))) + if not self._paths: + message = 'MultiplexedPath must contain at least one path' + raise FileNotFoundError(message) + if not all(path.is_dir() for path in self._paths): + raise NotADirectoryError('MultiplexedPath only supports directories') + + def iterdir(self): + children = (child for path in self._paths for child in path.iterdir()) + by_name = operator.attrgetter('name') + groups = itertools.groupby(sorted(children, key=by_name), key=by_name) + return map(self._follow, (locs for name, locs in groups)) + + def read_bytes(self): + raise FileNotFoundError(f'{self} is not a file') + + def read_text(self, *args, **kwargs): + raise FileNotFoundError(f'{self} is not a file') + + def is_dir(self): + return True + + def is_file(self): + return False + + def joinpath(self, *descendants): + try: + return super().joinpath(*descendants) + except abc.TraversalError: + # One of the paths did not resolve (a directory does not exist). + # Just return something that will not exist. + return self._paths[0].joinpath(*descendants) + + @classmethod + def _follow(cls, children): + """ + Construct a MultiplexedPath if needed. + + If children contains a sole element, return it. + Otherwise, return a MultiplexedPath of the items. + Unless one of the items is not a Directory, then return the first. + """ + subdirs, one_dir, one_file = itertools.tee(children, 3) + + try: + return only(one_dir) + except ValueError: + try: + return cls(*subdirs) + except NotADirectoryError: + return next(one_file) + + def open(self, *args, **kwargs): + raise FileNotFoundError(f'{self} is not a file') + + @property + def name(self): + return self._paths[0].name + + def __repr__(self): + paths = ', '.join(f"'{path}'" for path in self._paths) + return f'MultiplexedPath({paths})' + + +class NamespaceReader(abc.TraversableResources): + def __init__(self, namespace_path): + if 'NamespacePath' not in str(namespace_path): + raise ValueError('Invalid path') + self.path = MultiplexedPath(*filter(bool, map(self._resolve, namespace_path))) + + @classmethod + def _resolve(cls, path_str) -> abc.Traversable | None: + r""" + Given an item from a namespace path, resolve it to a Traversable. + + path_str might be a directory on the filesystem or a path to a + zipfile plus the path within the zipfile, e.g. ``/foo/bar`` or + ``/foo/baz.zip/inner_dir`` or ``foo\baz.zip\inner_dir\sub``. + + path_str might also be a sentinel used by editable packages to + trigger other behaviors (see python/importlib_resources#311). + In that case, return None. + """ + dirs = (cand for cand in cls._candidate_paths(path_str) if cand.is_dir()) + return next(dirs, None) + + @classmethod + def _candidate_paths(cls, path_str: str) -> Iterator[abc.Traversable]: + yield pathlib.Path(path_str) + yield from cls._resolve_zip_path(path_str) + + @staticmethod + def _resolve_zip_path(path_str: str): + for match in reversed(list(re.finditer(r'[\\/]', path_str))): + with contextlib.suppress( + FileNotFoundError, + IsADirectoryError, + NotADirectoryError, + PermissionError, + ): + inner = path_str[match.end() :].replace('\\', '/') + '/' + yield zipfile.Path(path_str[: match.start()], inner.lstrip('/')) + + def resource_path(self, resource): + """ + Return the file system path to prevent + `resources.path()` from creating a temporary + copy. + """ + return str(self.path.joinpath(resource)) + + def files(self): + return self.path + + +def _ensure_traversable(path): + """ + Convert deprecated string arguments to traversables (pathlib.Path). + + Remove with Python 3.15. + """ + if not isinstance(path, str): + return path + + warnings.warn( + "String arguments are deprecated. Pass a Traversable instead.", + DeprecationWarning, + stacklevel=3, + ) + + return pathlib.Path(path) diff --git a/micromamba_root/Lib/importlib/resources/simple.py b/micromamba_root/Lib/importlib/resources/simple.py new file mode 100644 index 0000000000000000000000000000000000000000..2e75299b13aabf3dd11aea5a23e6723d67854fc9 --- /dev/null +++ b/micromamba_root/Lib/importlib/resources/simple.py @@ -0,0 +1,106 @@ +""" +Interface adapters for low-level readers. +""" + +import abc +import io +import itertools +from typing import BinaryIO, List + +from .abc import Traversable, TraversableResources + + +class SimpleReader(abc.ABC): + """ + The minimum, low-level interface required from a resource + provider. + """ + + @property + @abc.abstractmethod + def package(self) -> str: + """ + The name of the package for which this reader loads resources. + """ + + @abc.abstractmethod + def children(self) -> List['SimpleReader']: + """ + Obtain an iterable of SimpleReader for available + child containers (e.g. directories). + """ + + @abc.abstractmethod + def resources(self) -> List[str]: + """ + Obtain available named resources for this virtual package. + """ + + @abc.abstractmethod + def open_binary(self, resource: str) -> BinaryIO: + """ + Obtain a File-like for a named resource. + """ + + @property + def name(self): + return self.package.split('.')[-1] + + +class ResourceContainer(Traversable): + """ + Traversable container for a package's resources via its reader. + """ + + def __init__(self, reader: SimpleReader): + self.reader = reader + + def is_dir(self): + return True + + def is_file(self): + return False + + def iterdir(self): + files = (ResourceHandle(self, name) for name in self.reader.resources) + dirs = map(ResourceContainer, self.reader.children()) + return itertools.chain(files, dirs) + + def open(self, *args, **kwargs): + raise IsADirectoryError() + + +class ResourceHandle(Traversable): + """ + Handle to a named resource in a ResourceReader. + """ + + def __init__(self, parent: ResourceContainer, name: str): + self.parent = parent + self.name = name # type: ignore[misc] + + def is_file(self): + return True + + def is_dir(self): + return False + + def open(self, mode='r', *args, **kwargs): + stream = self.parent.reader.open_binary(self.name) + if 'b' not in mode: + stream = io.TextIOWrapper(stream, *args, **kwargs) + return stream + + def joinpath(self, name): + raise RuntimeError("Cannot traverse into a resource") + + +class TraversableReader(TraversableResources, SimpleReader): + """ + A TraversableResources based on SimpleReader. Resource providers + may derive from this class to provide the TraversableResources + interface by supplying the SimpleReader interface. + """ + + def files(self): + return ResourceContainer(self) diff --git a/micromamba_root/Lib/json/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a946ab01b2d4120573c0685ec743005f1fac5f2f Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/json/__pycache__/__main__.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/__main__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35586ceac53d81555290eccd1e405eddee6cb909 Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/__main__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/json/__pycache__/decoder.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/decoder.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93462edace29d61b1430054f84b8373e0b1799d2 Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/decoder.cpython-314.pyc differ diff --git a/micromamba_root/Lib/json/__pycache__/encoder.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/encoder.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62591806b215f13a741bc70ccd28a85f3a4ca635 Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/encoder.cpython-314.pyc differ diff --git a/micromamba_root/Lib/json/__pycache__/scanner.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/scanner.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9a831b846e8801111c072af384e430513373ac1 Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/scanner.cpython-314.pyc differ diff --git a/micromamba_root/Lib/json/__pycache__/tool.cpython-314.pyc b/micromamba_root/Lib/json/__pycache__/tool.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5bda411536f9819f3fe3495ae9e00e1c3c5f5d8 Binary files /dev/null and b/micromamba_root/Lib/json/__pycache__/tool.cpython-314.pyc differ diff --git a/micromamba_root/Lib/logging/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/logging/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b123662e3bd1c15c994f5ca7ab66d7729d42c2c Binary files /dev/null and b/micromamba_root/Lib/logging/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/logging/__pycache__/config.cpython-314.pyc b/micromamba_root/Lib/logging/__pycache__/config.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7346e2088076c849f7b5e977e9028a5fa0e1e51 Binary files /dev/null and b/micromamba_root/Lib/logging/__pycache__/config.cpython-314.pyc differ diff --git a/micromamba_root/Lib/logging/__pycache__/handlers.cpython-314.pyc b/micromamba_root/Lib/logging/__pycache__/handlers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1a5168feced28c66297b7a6b1772b6b7c2c8401 Binary files /dev/null and b/micromamba_root/Lib/logging/__pycache__/handlers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62c5ad99729a896c7bb46c9b1ca28c5e2955393e Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/connection.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/connection.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4daaed82341ea86207706e1e1204ccebe15e2b35 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/connection.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/context.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/context.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9667e6fa511813f62db466246412ef2a9025c1e9 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/context.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/forkserver.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/forkserver.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d20ce8ac5f84914c78c59b20cf633ab58d824f1 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/forkserver.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/heap.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/heap.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..634180fc24f03fbdb2c5e43ae565b55fbdd7f50d Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/heap.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/managers.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/managers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95af42dcc7e065dde651d83c95790481356bc654 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/managers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/pool.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/pool.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8a9ec7953fba78f3d73c6bb3894fcefe62e3a4d Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/pool.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/popen_fork.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/popen_fork.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a14a69308cb2c9e76b25cb75303995b9e03dde3e Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/popen_fork.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/popen_forkserver.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/popen_forkserver.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8ca08dcba14e1c4c6eea45accd9dddf3265e3e7 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/popen_forkserver.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_posix.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_posix.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ef7f5c18f3120b57c671a7a01230f803841f18f Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_posix.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_win32.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_win32.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d57f13227836544f7015d85b25a864af97cb485 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/popen_spawn_win32.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/process.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/process.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6996bd20b9f9c1a32cbc782942af2557e30d60b6 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/process.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/queues.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/queues.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ce2c991217556d57e5fce9fd1781f9e18bca842 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/queues.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/reduction.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/reduction.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81819d939f32a96afc28eb087a444796f31fbc9a Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/reduction.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/resource_sharer.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/resource_sharer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3b1095c5a5719c06cc2f78e047fcae0d018180a Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/resource_sharer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/resource_tracker.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/resource_tracker.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0789faed42c3fdda63f26f6aeb5058b78d5ecf2 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/resource_tracker.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/shared_memory.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/shared_memory.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7e1d56f3fd15b4603bf71e78543dee32550c886 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/shared_memory.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/sharedctypes.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/sharedctypes.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74bfe29a628128b6e823de691b940d39c12aa92f Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/sharedctypes.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/spawn.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/spawn.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b26f9ffa4e3a25984dadfcb702b9b1071fe0a37e Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/spawn.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/synchronize.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/synchronize.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f66eb931928961471473912fdbdeb1919c41cb4 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/synchronize.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/__pycache__/util.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7724fd88718e8f5f10eba0affdf9bdc64fe5ed1 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/__pycache__/util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/dummy/__init__.py b/micromamba_root/Lib/multiprocessing/dummy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7dc5d1c8dde8484e59728eb6dfa7a36c158dd2ef --- /dev/null +++ b/micromamba_root/Lib/multiprocessing/dummy/__init__.py @@ -0,0 +1,126 @@ +# +# Support for the API of the multiprocessing package using threads +# +# multiprocessing/dummy/__init__.py +# +# Copyright (c) 2006-2008, R Oudkerk +# Licensed to PSF under a Contributor Agreement. +# + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Barrier', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' + ] + +# +# Imports +# + +import threading +import sys +import weakref +import array + +from .connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event, Condition, Barrier +from queue import Queue + +# +# +# + +class DummyProcess(threading.Thread): + + def __init__(self, group=None, target=None, name=None, args=(), kwargs=None): + threading.Thread.__init__(self, group, target, name, args, kwargs) + self._pid = None + self._children = weakref.WeakKeyDictionary() + self._start_called = False + self._parent = current_process() + + def start(self): + if self._parent is not current_process(): + raise RuntimeError( + "Parent is {0!r} but current_process is {1!r}".format( + self._parent, current_process())) + self._start_called = True + if hasattr(self._parent, '_children'): + self._parent._children[self] = None + threading.Thread.start(self) + + @property + def exitcode(self): + if self._start_called and not self.is_alive(): + return 0 + else: + return None + +# +# +# + +Process = DummyProcess +current_process = threading.current_thread +current_process()._children = weakref.WeakKeyDictionary() + +def active_children(): + children = current_process()._children + for p in list(children): + if not p.is_alive(): + children.pop(p, None) + return list(children) + +def freeze_support(): + pass + +# +# +# + +class Namespace(object): + def __init__(self, /, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = list(self.__dict__.items()) + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return '%s(%s)' % (self.__class__.__name__, ', '.join(temp)) + +dict = dict +list = list + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + + @property + def value(self): + return self._value + + @value.setter + def value(self, value): + self._value = value + + def __repr__(self): + return '<%s(%r, %r)>'%(type(self).__name__,self._typecode,self._value) + +def Manager(): + return sys.modules[__name__] + +def shutdown(): + pass + +def Pool(processes=None, initializer=None, initargs=()): + from ..pool import ThreadPool + return ThreadPool(processes, initializer, initargs) + +JoinableQueue = Queue diff --git a/micromamba_root/Lib/multiprocessing/dummy/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/dummy/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e835aa2718a820a49c1410c2303a39a64cdd8d4 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/dummy/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/dummy/__pycache__/connection.cpython-314.pyc b/micromamba_root/Lib/multiprocessing/dummy/__pycache__/connection.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea14c9feb69c28f4c2b1ef318ea1881c43615c83 Binary files /dev/null and b/micromamba_root/Lib/multiprocessing/dummy/__pycache__/connection.cpython-314.pyc differ diff --git a/micromamba_root/Lib/multiprocessing/dummy/connection.py b/micromamba_root/Lib/multiprocessing/dummy/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..f0ce320fcf514083f3a6477e87abf40e9719285a --- /dev/null +++ b/micromamba_root/Lib/multiprocessing/dummy/connection.py @@ -0,0 +1,75 @@ +# +# Analogue of `multiprocessing.connection` which uses queues instead of sockets +# +# multiprocessing/dummy/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk +# Licensed to PSF under a Contributor Agreement. +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +from queue import Queue + + +families = [None] + + +class Listener(object): + + def __init__(self, address=None, family=None, backlog=1): + self._backlog_queue = Queue(backlog) + + def accept(self): + return Connection(*self._backlog_queue.get()) + + def close(self): + self._backlog_queue = None + + @property + def address(self): + return self._backlog_queue + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + self.close() + + +def Client(address): + _in, _out = Queue(), Queue() + address.put((_out, _in)) + return Connection(_in, _out) + + +def Pipe(duplex=True): + a, b = Queue(), Queue() + return Connection(a, b), Connection(b, a) + + +class Connection(object): + + def __init__(self, _in, _out): + self._out = _out + self._in = _in + self.send = self.send_bytes = _out.put + self.recv = self.recv_bytes = _in.get + + def poll(self, timeout=0.0): + if self._in.qsize() > 0: + return True + if timeout <= 0.0: + return False + with self._in.not_empty: + self._in.not_empty.wait(timeout) + return self._in.qsize() > 0 + + def close(self): + pass + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + self.close() diff --git a/micromamba_root/Lib/pathlib/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/pathlib/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93ce1c51080361bae0a4fa78f81de6f97418507d Binary files /dev/null and b/micromamba_root/Lib/pathlib/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/pathlib/__pycache__/_local.cpython-314.pyc b/micromamba_root/Lib/pathlib/__pycache__/_local.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5127cd33d2f285ddab12b64af41702311543a06 Binary files /dev/null and b/micromamba_root/Lib/pathlib/__pycache__/_local.cpython-314.pyc differ diff --git a/micromamba_root/Lib/pathlib/__pycache__/_os.cpython-314.pyc b/micromamba_root/Lib/pathlib/__pycache__/_os.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c6aab7352ae199b6b4d08b0c50fbcc5fe085cc9 Binary files /dev/null and b/micromamba_root/Lib/pathlib/__pycache__/_os.cpython-314.pyc differ diff --git a/micromamba_root/Lib/pathlib/__pycache__/types.cpython-314.pyc b/micromamba_root/Lib/pathlib/__pycache__/types.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41cb13e293a93e1da9b7b04d9fdf7ae4cf2e1446 Binary files /dev/null and b/micromamba_root/Lib/pathlib/__pycache__/types.cpython-314.pyc differ diff --git a/micromamba_root/Lib/pydoc_data/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/pydoc_data/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53223a5e36acf73ac8b48b71a4df5ece433f53a1 Binary files /dev/null and b/micromamba_root/Lib/pydoc_data/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/pydoc_data/__pycache__/module_docs.cpython-314.pyc b/micromamba_root/Lib/pydoc_data/__pycache__/module_docs.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4692159a24bea1bd5da345f9ba9d3a1143d14def Binary files /dev/null and b/micromamba_root/Lib/pydoc_data/__pycache__/module_docs.cpython-314.pyc differ diff --git a/micromamba_root/Lib/re/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/re/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85f95dd0c277f9b0c2870391519d33f2f6a36dcf Binary files /dev/null and b/micromamba_root/Lib/re/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/re/__pycache__/_casefix.cpython-314.pyc b/micromamba_root/Lib/re/__pycache__/_casefix.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9e00297aa587d9233c5e3d96d0c54cd84771faf Binary files /dev/null and b/micromamba_root/Lib/re/__pycache__/_casefix.cpython-314.pyc differ diff --git a/micromamba_root/Lib/re/__pycache__/_compiler.cpython-314.pyc b/micromamba_root/Lib/re/__pycache__/_compiler.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25fa0d44d0d2026c0028e5ab1f2d8ac3b6f9af6c Binary files /dev/null and b/micromamba_root/Lib/re/__pycache__/_compiler.cpython-314.pyc differ diff --git a/micromamba_root/Lib/re/__pycache__/_constants.cpython-314.pyc b/micromamba_root/Lib/re/__pycache__/_constants.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c479f817bdb7294b62ccfc4743593cdbc0ddac86 Binary files /dev/null and b/micromamba_root/Lib/re/__pycache__/_constants.cpython-314.pyc differ diff --git a/micromamba_root/Lib/re/__pycache__/_parser.cpython-314.pyc b/micromamba_root/Lib/re/__pycache__/_parser.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59ef6bee58ff9a82dbb889f631445a12ed69c478 Binary files /dev/null and b/micromamba_root/Lib/re/__pycache__/_parser.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..341b4e6ecebebc5354e680986bf9b0b54808df48 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/core.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/core.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b3b9f56d71f4f6fa7cf65992f1c8feddead6670 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/core.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/dates.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/dates.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43b01eb7ff19ecee6406e959bc6fea1eff32a622 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/dates.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/languages.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/languages.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60435e690e678bcb2a995f359799f2b862d09571 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/languages.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/lists.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/lists.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53b492661ef4a3c92bfbebd62616d2c9626d597e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/lists.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/localedata.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/localedata.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..122f4377db7aa36af60f0887b910eefb453f5cd3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/localedata.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/numbers.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/numbers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0b5f8e5dda756ba43c8538e1fa2ed4df4627adf Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/numbers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/plural.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/plural.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..23792adac3e5ad63f7df13fad1696228cc3ffad6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/plural.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/support.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/support.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..098f475f4f7e0b943deef86ff8d328567c5f07ff Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/support.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/units.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/units.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6580b4788b04fc1f9f7f99cb2d1ef08e603d2585 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/units.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/__pycache__/util.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2fdc4c6e4957ea1405ab1afb99a41f467cada9a9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/__pycache__/util.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/LICENSE.unicode b/micromamba_root/Lib/site-packages/babel/locale-data/LICENSE.unicode new file mode 100644 index 0000000000000000000000000000000000000000..861b74f3c812088755fd185d964e82a244503bbd --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/locale-data/LICENSE.unicode @@ -0,0 +1,41 @@ +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2004-2025 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +SPDX-License-Identifier: Unicode-3.0 diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva.dat new file mode 100644 index 0000000000000000000000000000000000000000..184addcd430d0b365574dffb2d4ba45ffbef34ac Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..8a1e28980c4166f7d6b942005b8528d8a3518db7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Deva_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..35b2695db7962af7f9f290d6faabfd5028771583 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..8a1e28980c4166f7d6b942005b8528d8a3518db7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Latn_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya.dat new file mode 100644 index 0000000000000000000000000000000000000000..98172abd950bd3cf13a880b488f2c748a9317e1b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..8a1e28980c4166f7d6b942005b8528d8a3518db7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Orya_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu.dat new file mode 100644 index 0000000000000000000000000000000000000000..1b3ac8b8c11820ad46579b3bed22333a70ce3b10 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..8a1e28980c4166f7d6b942005b8528d8a3518db7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/kxv_Telu_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ky_KG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ky_KG.dat new file mode 100644 index 0000000000000000000000000000000000000000..c61073fe2d704f7de254bf9937769fb98c59a71b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ky_KG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/la.dat b/micromamba_root/Lib/site-packages/babel/locale-data/la.dat new file mode 100644 index 0000000000000000000000000000000000000000..1ccac42fa74d3d488caeabf8668972afd7a08ca3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/la.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/la_VA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/la_VA.dat new file mode 100644 index 0000000000000000000000000000000000000000..31a68ac99d364d4c35e937cd4a90fa50580b7f4a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/la_VA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lag.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lag.dat new file mode 100644 index 0000000000000000000000000000000000000000..f8da045f8865c761792921ff7eb145ba8ad5f138 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lag.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lag_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lag_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..7893a0eda2ad8833be220faac3668ceefcd9031c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lag_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lb_LU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lb_LU.dat new file mode 100644 index 0000000000000000000000000000000000000000..bcb56532aa2d3783f530d822f181b8a809f56afb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lb_LU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lg.dat new file mode 100644 index 0000000000000000000000000000000000000000..cd4e5a9d4bed9e9bab2079eb03b1b0b8928756ae Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lg_UG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lg_UG.dat new file mode 100644 index 0000000000000000000000000000000000000000..6ee321dc7f52d05a56322b21460ae97e859f2deb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lg_UG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lij_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lij_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..6969b5283273f116c0fe167c4f1b1c72fe05a617 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lij_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lkt.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lkt.dat new file mode 100644 index 0000000000000000000000000000000000000000..515ac6c47cd8bde606e213d4b5ef4b55b2b92234 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lkt.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lkt_US.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lkt_US.dat new file mode 100644 index 0000000000000000000000000000000000000000..44a5969a02d4653b44ee1cef9a3ef8c460ded918 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lkt_US.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lld.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lld.dat new file mode 100644 index 0000000000000000000000000000000000000000..04c0806888b89091b708c58fb431d5067842f8b2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lld.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lld_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lld_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..f8d12f0fab6585ad64cc8659af5880982f5a8345 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lld_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lmo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lmo.dat new file mode 100644 index 0000000000000000000000000000000000000000..c7388c7dae2ce08b793d8c6f300e31975ed0f186 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lmo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lmo_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lmo_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..50dd59272f2559d925bc535f62656e963fb2a760 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lmo_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ln.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ln.dat new file mode 100644 index 0000000000000000000000000000000000000000..cc8edb15ba028473c951dd30c2fbefecbf8def42 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ln.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ln_AO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ln_AO.dat new file mode 100644 index 0000000000000000000000000000000000000000..60dd0ba87f4635fcacb66dc1b1146c1fab07757c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ln_AO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ln_CD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CD.dat new file mode 100644 index 0000000000000000000000000000000000000000..b87aad7d28925d9db976365cc1af27dfb736612a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ln_CF.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CF.dat new file mode 100644 index 0000000000000000000000000000000000000000..b5a9a827ee2871c12c330fafdd13ba4d24343b24 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CF.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ln_CG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CG.dat new file mode 100644 index 0000000000000000000000000000000000000000..4059b369e75596e442343fb2c0bedadbb8a5dfe3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ln_CG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lo_LA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lo_LA.dat new file mode 100644 index 0000000000000000000000000000000000000000..6f12ab55995942428f0faad4a1bf30ffc6ad8e20 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lo_LA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lrc.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lrc.dat new file mode 100644 index 0000000000000000000000000000000000000000..4452aa52edf97353fe25e1da4d56ff02de86204e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lrc.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IQ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IQ.dat new file mode 100644 index 0000000000000000000000000000000000000000..b7fdaf27a0559fedab829c0ca1d18fed93160dd1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IQ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IR.dat new file mode 100644 index 0000000000000000000000000000000000000000..75d897526c32c812a089147faf1d6d4ee1fa9f0d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lrc_IR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lt_LT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lt_LT.dat new file mode 100644 index 0000000000000000000000000000000000000000..abd28f771f27c9ae600a7bd2319cf2cbc972b96c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lt_LT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ltg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ltg.dat new file mode 100644 index 0000000000000000000000000000000000000000..8937b94340aaec75a9952957c4e9596d66f02937 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ltg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ltg_LV.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ltg_LV.dat new file mode 100644 index 0000000000000000000000000000000000000000..6afb15176f5af8c27324b9ddf6372de9959d30c3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ltg_LV.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lu.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lu.dat new file mode 100644 index 0000000000000000000000000000000000000000..438bb41b1e962e9a330a94a7ca5bb2b8f104959d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lu.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lu_CD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lu_CD.dat new file mode 100644 index 0000000000000000000000000000000000000000..b2f405ccf6bc6b294b96546547731a655480d957 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lu_CD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/luo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/luo.dat new file mode 100644 index 0000000000000000000000000000000000000000..1fbbe68e4cc171e4c2d5fa12a4a1ee5ca9b3366a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/luo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/luo_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/luo_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..9ad4a6a49e0351b00d3b218e1a6123b7dd0dce79 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/luo_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/luy.dat b/micromamba_root/Lib/site-packages/babel/locale-data/luy.dat new file mode 100644 index 0000000000000000000000000000000000000000..c82c89292138b3a1cb34b0bb8c3ec220463c34cb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/luy.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/luy_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/luy_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..e1b346e46e46347a6bee8be9d548f066a54d089b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/luy_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/lv_LV.dat b/micromamba_root/Lib/site-packages/babel/locale-data/lv_LV.dat new file mode 100644 index 0000000000000000000000000000000000000000..37bb4e261bb466b1ddd8e02b315a257b0a43557a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/lv_LV.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mai.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mai.dat new file mode 100644 index 0000000000000000000000000000000000000000..bde3b353b461a556480f3dd0f859922aa37fe52a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mai.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mai_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mai_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..288b92f8a8947a8e0c0ed4472cb29811d4ad3f47 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mai_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mas.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mas.dat new file mode 100644 index 0000000000000000000000000000000000000000..7e254ed9466b903dd1389bc1b30f07d12cfef944 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mas.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mas_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mas_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..b264c8371c065ae8a34083e4f335c5cb73cd88f1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mas_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mas_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mas_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..d5c71c37f9a2807c88508942f9add20eee7995e8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mas_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mdf.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mdf.dat new file mode 100644 index 0000000000000000000000000000000000000000..5d4d3f839e8dbce60b786f9738e8b9216dbfde12 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mdf.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mdf_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mdf_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..9457135938f9f140fcded2860931c6bb14a8aabd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mdf_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mer.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mer.dat new file mode 100644 index 0000000000000000000000000000000000000000..f6657fe13d56aee002dd062da1b2ce9aa1a25b93 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mer.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mer_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mer_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..a7c286f72bb11d021537e292f6efd6bdbe19ea55 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mer_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mfe.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mfe.dat new file mode 100644 index 0000000000000000000000000000000000000000..10eef776c01ea1debd6da686d7e74579d269f1a3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mfe.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mfe_MU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mfe_MU.dat new file mode 100644 index 0000000000000000000000000000000000000000..2f4715ba083648ed21845f0e48b0f1808266b37f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mfe_MU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mg.dat new file mode 100644 index 0000000000000000000000000000000000000000..f91a1dd194af199229fd02d8ac8ae03d07f9aefa Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mg_MG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mg_MG.dat new file mode 100644 index 0000000000000000000000000000000000000000..9e18e6cb756b87633bd09a2102d2f6844008e201 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mg_MG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mgh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mgh.dat new file mode 100644 index 0000000000000000000000000000000000000000..e8a28060538c61b1420bb56b67737c1c04f8a154 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mgh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mgh_MZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mgh_MZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..999e8efb02c824f2ee9b44e396f4b750de11d276 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mgh_MZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mgo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mgo.dat new file mode 100644 index 0000000000000000000000000000000000000000..edbda97941e390080a9c3a32bb144c0978ff1384 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mgo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mgo_CM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mgo_CM.dat new file mode 100644 index 0000000000000000000000000000000000000000..667c017285337c4b48c3bdc86047738a83888882 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mgo_CM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mhn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mhn.dat new file mode 100644 index 0000000000000000000000000000000000000000..1a3303d9b5daedb0cc2d5c4d29d18b3f3ff2b246 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mhn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mhn_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mhn_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..c647205542d73e8daa4ecf485cd244deabf3c33e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mhn_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mi.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mi.dat new file mode 100644 index 0000000000000000000000000000000000000000..79eb095aa3549568dfb2542817542c8bed633a24 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mi.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mi_NZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mi_NZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..7c8b4d19b8e9e4e3840b296766d8469ddde66f29 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mi_NZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mic.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mic.dat new file mode 100644 index 0000000000000000000000000000000000000000..3ca1892e1d51369f5a68369b8c12da3bfb230daf Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mic.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mic_CA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mic_CA.dat new file mode 100644 index 0000000000000000000000000000000000000000..f43465a947872a0f4ec053bd7c88228619d50efb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mic_CA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mk_MK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mk_MK.dat new file mode 100644 index 0000000000000000000000000000000000000000..33207d9a9960ba975c30fd1b4c2d6f418bee86fa Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mk_MK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ml_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ml_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..5f89f111a5decfceccfb95ad80d6e552253c3268 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ml_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mn_MN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mn_MN.dat new file mode 100644 index 0000000000000000000000000000000000000000..096cb10478eefce99d693c2877f3d1e444c3a75b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mn_MN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong.dat new file mode 100644 index 0000000000000000000000000000000000000000..287f85265b30743065120e2fa442bb5bfc54492f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..284cbee85de0bc4210e44769410b40a617b5b494 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_MN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_MN.dat new file mode 100644 index 0000000000000000000000000000000000000000..ad54681c07d5d696d72bba8f9a49c02c2d86baed Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mn_Mong_MN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mni.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mni.dat new file mode 100644 index 0000000000000000000000000000000000000000..4ebcfc59aad390f57e5af3047d0d522d31ebdb50 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mni.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng.dat new file mode 100644 index 0000000000000000000000000000000000000000..de357a87140a76e8342b6d9c7fb878a91b06ced8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..28787ccd0c661f1d3765f33dad8f51154d52ab47 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Beng_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei.dat new file mode 100644 index 0000000000000000000000000000000000000000..654042f8bb4c2da1fb319cf9ec89d64d61458188 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..28787ccd0c661f1d3765f33dad8f51154d52ab47 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mni_Mtei_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/moh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/moh.dat new file mode 100644 index 0000000000000000000000000000000000000000..c301f3f730cdf8e657f9af60771d1ce434dd7db8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/moh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/moh_CA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/moh_CA.dat new file mode 100644 index 0000000000000000000000000000000000000000..ba2eddea629cd2557f9bdd3e48cfe2be012bdf3f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/moh_CA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mr_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mr_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..a57af72d972822e818300a8c827367a7362d2b4a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mr_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab.dat new file mode 100644 index 0000000000000000000000000000000000000000..7ee5bee07c52d8711e69205a711aee26f4fd91d2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_BN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_BN.dat new file mode 100644 index 0000000000000000000000000000000000000000..1785baa75df82ae8b657074e9ec1d894ece1c20a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_BN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_MY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_MY.dat new file mode 100644 index 0000000000000000000000000000000000000000..5df0cb7512eee5622689658266dfa12550f73321 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_Arab_MY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_BN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_BN.dat new file mode 100644 index 0000000000000000000000000000000000000000..1785baa75df82ae8b657074e9ec1d894ece1c20a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_BN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_ID.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_ID.dat new file mode 100644 index 0000000000000000000000000000000000000000..07b0e7693690a52fa6abbbac6388fc95bcd01210 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_ID.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_MY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_MY.dat new file mode 100644 index 0000000000000000000000000000000000000000..5df0cb7512eee5622689658266dfa12550f73321 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_MY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ms_SG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ms_SG.dat new file mode 100644 index 0000000000000000000000000000000000000000..33205113e184c9337fc92ac987a32e68b16c7325 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ms_SG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mt.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mt.dat new file mode 100644 index 0000000000000000000000000000000000000000..502594b2908c824af35e6fb29e5212de1500fedc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mt.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mt_MT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mt_MT.dat new file mode 100644 index 0000000000000000000000000000000000000000..9f4731e41b870956c24fa2e322e292705bcc1ff2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mt_MT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mua.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mua.dat new file mode 100644 index 0000000000000000000000000000000000000000..7d28adf1b12cfc6b77afbbc3959132275f1a9f96 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mua.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mua_CM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mua_CM.dat new file mode 100644 index 0000000000000000000000000000000000000000..5b71a89b73f4e0225d52cfe9a9efb20fd197bde9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mua_CM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mus.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mus.dat new file mode 100644 index 0000000000000000000000000000000000000000..b323269db48c396fa6b73444439b0a8cb15a1046 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mus.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mus_US.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mus_US.dat new file mode 100644 index 0000000000000000000000000000000000000000..a506b8bdc53b29aa79518d3a7ac160cfdfe85fba Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mus_US.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/my_MM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/my_MM.dat new file mode 100644 index 0000000000000000000000000000000000000000..33bc9111bc7d012bd403d66369cc6c854e32bb40 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/my_MM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/myv.dat b/micromamba_root/Lib/site-packages/babel/locale-data/myv.dat new file mode 100644 index 0000000000000000000000000000000000000000..896bdd71e70083976936fe2c146e4688ccdf074f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/myv.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/myv_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/myv_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..de64fee658593881d312351505ea347eeae06f7e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/myv_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mzn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mzn.dat new file mode 100644 index 0000000000000000000000000000000000000000..51d9f1323d3bca270ea4e58b3ed8843bc5b6902f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mzn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/mzn_IR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/mzn_IR.dat new file mode 100644 index 0000000000000000000000000000000000000000..73990744c34b9dc21913fb29a7a2a7cb2fce118b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/mzn_IR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/naq.dat b/micromamba_root/Lib/site-packages/babel/locale-data/naq.dat new file mode 100644 index 0000000000000000000000000000000000000000..786b2ffedea8a833d5b635e02907404f6a235388 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/naq.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/naq_NA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/naq_NA.dat new file mode 100644 index 0000000000000000000000000000000000000000..82c109a0e40453c362ef5af05fc22ee11ef15d2c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/naq_NA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nb.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nb.dat new file mode 100644 index 0000000000000000000000000000000000000000..5abc2536ec7d0e253ec14958960b83981c94df6c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nb.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nb_NO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nb_NO.dat new file mode 100644 index 0000000000000000000000000000000000000000..fc57a39a55e6f0d10d4bdeb99da1c49e16111b66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nb_NO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nb_SJ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nb_SJ.dat new file mode 100644 index 0000000000000000000000000000000000000000..9af3a275de68e92a628034bcc058d913aa1f99b4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nb_SJ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nd.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nd.dat new file mode 100644 index 0000000000000000000000000000000000000000..c13781ab1845c9e17e776fc7633d5c6b03cbfc7b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nd.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nd_ZW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nd_ZW.dat new file mode 100644 index 0000000000000000000000000000000000000000..bb86d3f6ae698e8f87e8a34483f98cee09460fb9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nd_ZW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nds.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nds.dat new file mode 100644 index 0000000000000000000000000000000000000000..e1c76cae91eba026aa8ba057d694465376c5d940 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nds.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nds_DE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nds_DE.dat new file mode 100644 index 0000000000000000000000000000000000000000..771fba3e2ecb6b40cad0a4343eeb490c10b1c802 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nds_DE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nds_NL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nds_NL.dat new file mode 100644 index 0000000000000000000000000000000000000000..14b9b12306790de2097804d28e8e9ea2ab92740e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nds_NL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ne_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ne_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..647efe6d89a1cc182a20e0c20247296f92834a0c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ne_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ne_NP.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ne_NP.dat new file mode 100644 index 0000000000000000000000000000000000000000..5c513db988b647f59c5b8f0daa7147efb43a53e3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ne_NP.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_AW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_AW.dat new file mode 100644 index 0000000000000000000000000000000000000000..0bd826c468a7010a777176528b95795c904423d4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_AW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_BE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_BE.dat new file mode 100644 index 0000000000000000000000000000000000000000..4023b7a2a8975e37c6e2b4df17d34c0d7e95354b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_BE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_BQ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_BQ.dat new file mode 100644 index 0000000000000000000000000000000000000000..8f686f79c1bcf0273415016ebaee024a15c79ff2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_BQ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_CW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_CW.dat new file mode 100644 index 0000000000000000000000000000000000000000..ea3eb94fe8753e8e1ea147664f09f6b1ce4903b2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_CW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_NL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_NL.dat new file mode 100644 index 0000000000000000000000000000000000000000..c686473e2ce475ef8c48fa1595e2ad5179d7b014 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_NL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_SR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_SR.dat new file mode 100644 index 0000000000000000000000000000000000000000..6ffb0f92c9f2219111867a3ac57fab37c3f1b44f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_SR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nl_SX.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nl_SX.dat new file mode 100644 index 0000000000000000000000000000000000000000..6932aa19fdf9f10afa37ad18d667e7b5ab329c9c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nl_SX.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nmg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nmg.dat new file mode 100644 index 0000000000000000000000000000000000000000..1e508106d4c505b1a447dcfe3ae7d44675222bfd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nmg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nmg_CM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nmg_CM.dat new file mode 100644 index 0000000000000000000000000000000000000000..f675485dbffb6757f2c4c527c9265c6f9d234b72 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nmg_CM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nn.dat new file mode 100644 index 0000000000000000000000000000000000000000..fde5bfc99a3bdfbcc428f9002eb2d1ede104a206 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nn_NO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nn_NO.dat new file mode 100644 index 0000000000000000000000000000000000000000..0e233b7d2ae91fc1fa221785eb341dd8f0837f94 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nn_NO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nnh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nnh.dat new file mode 100644 index 0000000000000000000000000000000000000000..2389679051264463b4622188dc3be6e7b3f47918 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nnh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nnh_CM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nnh_CM.dat new file mode 100644 index 0000000000000000000000000000000000000000..7722c099277483aea5ce2d679da8f078fe8a5770 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nnh_CM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nqo_GN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nqo_GN.dat new file mode 100644 index 0000000000000000000000000000000000000000..3cdbcbcd5ae4700ac750c9e3a24b1f0338088001 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nqo_GN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nr.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nr.dat new file mode 100644 index 0000000000000000000000000000000000000000..1306c925de68f0494c58a8bbae38d23e6c84a224 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nr.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nr_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nr_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..ff0ba0b081864023c8dc43e26fc41dba3ed8ae38 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nr_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nso.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nso.dat new file mode 100644 index 0000000000000000000000000000000000000000..25529c1af5588d068f2c17c89caff64ef7818b70 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nso.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nso_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nso_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..42f9efca9ca91ded4ab6bb32c1d8500f7eb83050 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nso_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nus.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nus.dat new file mode 100644 index 0000000000000000000000000000000000000000..6bc938281e5c8dd2ae139c32a3e097f70f84a57f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nus.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nus_SS.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nus_SS.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b86575ec1940f98bef06533bf3d049e3de8ffc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nus_SS.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nv.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nv.dat new file mode 100644 index 0000000000000000000000000000000000000000..146e037b9543e98059b19a19639bf6b6c028eb68 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nv.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nv_US.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nv_US.dat new file mode 100644 index 0000000000000000000000000000000000000000..2c78aa76506372a1532d53bac1b8e42e53677c51 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nv_US.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ny.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ny.dat new file mode 100644 index 0000000000000000000000000000000000000000..e1fc061388f76d4949d585278c1b5809552e1996 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ny.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ny_MW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ny_MW.dat new file mode 100644 index 0000000000000000000000000000000000000000..003925586cac629d3ee8905b84490e4c68b0501f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ny_MW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nyn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nyn.dat new file mode 100644 index 0000000000000000000000000000000000000000..ccd34096be729fa5b770ce802d74273ec91c6c26 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nyn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/nyn_UG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/nyn_UG.dat new file mode 100644 index 0000000000000000000000000000000000000000..2e51c77b7f00af6db1bf126b0cf0905121ceed64 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/nyn_UG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/oc.dat b/micromamba_root/Lib/site-packages/babel/locale-data/oc.dat new file mode 100644 index 0000000000000000000000000000000000000000..b678c283ab791173b7f8d3b380937fac4843dd81 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/oc.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/oc_ES.dat b/micromamba_root/Lib/site-packages/babel/locale-data/oc_ES.dat new file mode 100644 index 0000000000000000000000000000000000000000..936a4bacaf1d69c4be16af8b8552127154dbaa44 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/oc_ES.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/oc_FR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/oc_FR.dat new file mode 100644 index 0000000000000000000000000000000000000000..613abbe703e300c4514c9ef5f0f5a1d5d6565bc0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/oc_FR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/om.dat b/micromamba_root/Lib/site-packages/babel/locale-data/om.dat new file mode 100644 index 0000000000000000000000000000000000000000..c83455ff1ae8c40c618939a71d45d7e3fd6fec61 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/om.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/om_ET.dat b/micromamba_root/Lib/site-packages/babel/locale-data/om_ET.dat new file mode 100644 index 0000000000000000000000000000000000000000..82c438b4bdfe6d49fdec95ed1410a4d375a0f8a4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/om_ET.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/om_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/om_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..daf3734d8bc3321ec6c6e6f46cec5bc18e8bf6c6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/om_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/or_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/or_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..12b4f1bcbbce3f411f945bbcdaaee98c6c42350c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/or_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/os.dat b/micromamba_root/Lib/site-packages/babel/locale-data/os.dat new file mode 100644 index 0000000000000000000000000000000000000000..a90e8198ee26d4118dc21ca1e8a1da0ca1bdbea5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/os.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/os_GE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/os_GE.dat new file mode 100644 index 0000000000000000000000000000000000000000..205ddbf23aea70eb4ad61d0e4de3d7d4ec9d2c5a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/os_GE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/os_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/os_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..f51d3d917392be3c302134ec56c2935ca1cb23b2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/os_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/osa.dat b/micromamba_root/Lib/site-packages/babel/locale-data/osa.dat new file mode 100644 index 0000000000000000000000000000000000000000..eb1d4ff42ffa3247631b07605977997ac1b02ba4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/osa.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/osa_US.dat b/micromamba_root/Lib/site-packages/babel/locale-data/osa_US.dat new file mode 100644 index 0000000000000000000000000000000000000000..03c110027bf4fc1ed63dbd85ad525ec60fa65e77 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/osa_US.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab.dat new file mode 100644 index 0000000000000000000000000000000000000000..0d02acbd475a0e8dde9a58b0986bf85601c20630 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..eefdeba166313b4fc73728951d7b40134f0059fe Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Arab_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru.dat new file mode 100644 index 0000000000000000000000000000000000000000..ed8c6b6f0425c4510e391e282e72733dc130d21d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..6af3517d71095fa5f27b527915d1a8871017af84 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pa_Guru_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pap.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pap.dat new file mode 100644 index 0000000000000000000000000000000000000000..68b8dc4626d6a72322b5dd754766fc846e39e4b5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pap.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pap_AW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pap_AW.dat new file mode 100644 index 0000000000000000000000000000000000000000..973cc7637c55c10d66dad0ab3d92a98c5897ce32 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pap_AW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pap_CW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pap_CW.dat new file mode 100644 index 0000000000000000000000000000000000000000..3c481d471cdc3c17c26a82434e7d66c81070930e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pap_CW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pcm_NG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pcm_NG.dat new file mode 100644 index 0000000000000000000000000000000000000000..7ee82746f22bcd192bab118da5ceaa98d4fa1a36 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pcm_NG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pis.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pis.dat new file mode 100644 index 0000000000000000000000000000000000000000..55726a02fcfe8efcec0209eae4b2571bc180ccd6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pis.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pis_SB.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pis_SB.dat new file mode 100644 index 0000000000000000000000000000000000000000..3b1f17cde15d79277dcda75fd0c662b1f5d9c440 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pis_SB.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pl_PL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pl_PL.dat new file mode 100644 index 0000000000000000000000000000000000000000..7a4339abac54c5a104e8dae0ee24a67d75bf51a3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pl_PL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/prg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/prg.dat new file mode 100644 index 0000000000000000000000000000000000000000..06219914d6b96ee3ef9d57adcdf6348b21cc253e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/prg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/prg_PL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/prg_PL.dat new file mode 100644 index 0000000000000000000000000000000000000000..7b1970517c0e7eda3f412ab77eae5a628c6b080a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/prg_PL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ps_AF.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ps_AF.dat new file mode 100644 index 0000000000000000000000000000000000000000..94a50bffb0731a4244db3bc63bccc03552ae2d46 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ps_AF.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ps_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ps_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..691557eaaa20262a7dd86f8598f0c1543fa3e6ad Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ps_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_AO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_AO.dat new file mode 100644 index 0000000000000000000000000000000000000000..4cd1fbdac7cfc218a0c9ab5dad23b260c0a6d91a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_AO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_BR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_BR.dat new file mode 100644 index 0000000000000000000000000000000000000000..22952c77d0156d99b1a57a17c6d3f4a2ec34fd83 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_BR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_CH.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_CH.dat new file mode 100644 index 0000000000000000000000000000000000000000..268428655db5c8288d57d534df4d70b91453d16d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_CH.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_CV.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_CV.dat new file mode 100644 index 0000000000000000000000000000000000000000..78e2bbcf844a54d1973d06425f237743e89549b0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_CV.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_GQ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_GQ.dat new file mode 100644 index 0000000000000000000000000000000000000000..88968337f024e2090db6a647e327b3da3e3ae981 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_GQ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_GW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_GW.dat new file mode 100644 index 0000000000000000000000000000000000000000..d44108a14b441bb8e6befd35965e43a4278798e8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_GW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_LU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_LU.dat new file mode 100644 index 0000000000000000000000000000000000000000..af0b45b3dfa18f4a64fad761f6ecb6461986db26 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_LU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_MO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_MO.dat new file mode 100644 index 0000000000000000000000000000000000000000..4fcee0991caf305b91bec53eaf4499180449fa02 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_MO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_MZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_MZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..198075e8198e9bbcb9a3d49ab8ae1e912c572792 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_MZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_PT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_PT.dat new file mode 100644 index 0000000000000000000000000000000000000000..aa6a6ccb9080927139e20b0cc32493ca5c9b43f3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_PT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_ST.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_ST.dat new file mode 100644 index 0000000000000000000000000000000000000000..cdccab774c4c8a1949ea8c9c3a42133a702d4e66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_ST.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/pt_TL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/pt_TL.dat new file mode 100644 index 0000000000000000000000000000000000000000..7bb756cda597ecabd0864f06d527d249ed7ec3d3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/pt_TL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/qu.dat b/micromamba_root/Lib/site-packages/babel/locale-data/qu.dat new file mode 100644 index 0000000000000000000000000000000000000000..85cc9eca812e0277658be03e451a0b8aa1a9d412 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/qu.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/qu_BO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/qu_BO.dat new file mode 100644 index 0000000000000000000000000000000000000000..bc994ff71279cddb8ff5f163e6c55b13603cfdb6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/qu_BO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/qu_EC.dat b/micromamba_root/Lib/site-packages/babel/locale-data/qu_EC.dat new file mode 100644 index 0000000000000000000000000000000000000000..8f7f46ad54b91576184c6b8c63dcc996b333f504 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/qu_EC.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/qu_PE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/qu_PE.dat new file mode 100644 index 0000000000000000000000000000000000000000..07aacf94b96a35e1e5305c9539acf688c6f355b2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/qu_PE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/quc.dat b/micromamba_root/Lib/site-packages/babel/locale-data/quc.dat new file mode 100644 index 0000000000000000000000000000000000000000..f7e02d8abcbdbace395dc68ab09f34cb6f8e8538 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/quc.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/quc_GT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/quc_GT.dat new file mode 100644 index 0000000000000000000000000000000000000000..c14f849cbbb44e7186dfce2305d938dccb991c23 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/quc_GT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/raj.dat b/micromamba_root/Lib/site-packages/babel/locale-data/raj.dat new file mode 100644 index 0000000000000000000000000000000000000000..8f4477fa0201ca11adf07c795bc48a13ab188712 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/raj.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/raj_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/raj_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..e56e75027f47427213473db8b21702ff874b6c75 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/raj_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rhg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rhg.dat new file mode 100644 index 0000000000000000000000000000000000000000..192bbff035a534ee3776e2c02598e74b591cd8c0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rhg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg.dat new file mode 100644 index 0000000000000000000000000000000000000000..01b82ecf252b8e27e8e21cd8ba16f40c5b5de863 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_BD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_BD.dat new file mode 100644 index 0000000000000000000000000000000000000000..cc14c7f83aba67864d14968a00ba2937e7adcd94 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_BD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_MM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_MM.dat new file mode 100644 index 0000000000000000000000000000000000000000..6cfde86150cf0c630c1a25eaf24544221d3979e9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rhg_Rohg_MM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rif.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rif.dat new file mode 100644 index 0000000000000000000000000000000000000000..b5efc905394ac93ddca4c68a75831cd5788cb21b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rif.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rif_MA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rif_MA.dat new file mode 100644 index 0000000000000000000000000000000000000000..9b7f4342e75ed050ba9c3e2f4ea9969c3cfad261 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rif_MA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rm.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rm.dat new file mode 100644 index 0000000000000000000000000000000000000000..2398d9074f095fd87b56ff2c852cc1467c2b8125 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rm.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rm_CH.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rm_CH.dat new file mode 100644 index 0000000000000000000000000000000000000000..26eccfc329149ee1eba4e79a7a3c4a326227ab7d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rm_CH.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rn.dat new file mode 100644 index 0000000000000000000000000000000000000000..f21edd4ded5cf9afab85f5022d68935403280b43 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rn_BI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rn_BI.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1ef9755fd037d5bd16a8a1425871b3e7400da99 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rn_BI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ro_MD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ro_MD.dat new file mode 100644 index 0000000000000000000000000000000000000000..82b8bb6d93ef041761e5d3fd6a8269e66c70463e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ro_MD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ro_RO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ro_RO.dat new file mode 100644 index 0000000000000000000000000000000000000000..3517a61009c522d0149fbc45d50ddd88fd119194 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ro_RO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rof.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rof.dat new file mode 100644 index 0000000000000000000000000000000000000000..6f0e55144527317134867c80a2096bfafc9fc64a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rof.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rof_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rof_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..d7ffaeb0a76c472368770e0b89c4ca3f548e0bec Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rof_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/root.dat b/micromamba_root/Lib/site-packages/babel/locale-data/root.dat new file mode 100644 index 0000000000000000000000000000000000000000..441bbdc9afbf7a5b871c150adfb512d55c93e0be Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/root.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_BY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_BY.dat new file mode 100644 index 0000000000000000000000000000000000000000..e8ef98d49b3f9e7a332dd318b2eae72abb3bda1b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_BY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_KG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_KG.dat new file mode 100644 index 0000000000000000000000000000000000000000..f3e59502c9630323391f612d73430c070032f36e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_KG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_KZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_KZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..b66765a5cd34a1c674992aa836c3adbb96c7f187 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_KZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_MD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_MD.dat new file mode 100644 index 0000000000000000000000000000000000000000..d70419944cc220a58cc228563058cc4188a468cd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_MD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..a11835701502cde3d61172ac31ce75aba85650c2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ru_UA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ru_UA.dat new file mode 100644 index 0000000000000000000000000000000000000000..cebd8c23b818cb244dc79471fb2c8fef39295fdf Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ru_UA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rw.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rw.dat new file mode 100644 index 0000000000000000000000000000000000000000..d767b3093d8803f48495b46720153470ee2d2b50 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rw.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rw_RW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rw_RW.dat new file mode 100644 index 0000000000000000000000000000000000000000..4ade0dd6463c6ca8ded2cf511a016204f72993bc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rw_RW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rwk.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rwk.dat new file mode 100644 index 0000000000000000000000000000000000000000..fd69cc075357bd892714a04ac375d53d14d8c166 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rwk.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/rwk_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/rwk_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..fedafc3ef2eb0ed4c45dc0672420040a1e12edd2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/rwk_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sa.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sa.dat new file mode 100644 index 0000000000000000000000000000000000000000..76f67c4d570eb3c69cb0067c45af14aa9429cc0d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sa.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sa_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sa_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..317817512296780bbc08e5a16a6fc9f0b0fae82e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sa_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sah.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sah.dat new file mode 100644 index 0000000000000000000000000000000000000000..bad972f99b8ff84db7fcb3a149f2d52b78ceecce Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sah.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sah_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sah_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..44075f9fa05087862b23d993c4cbb3feee664763 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sah_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/saq.dat b/micromamba_root/Lib/site-packages/babel/locale-data/saq.dat new file mode 100644 index 0000000000000000000000000000000000000000..9532083360997414160626483375e8a66942cd08 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/saq.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/saq_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/saq_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..ffd91c3524ca86dea29df7af3d62dd3ef27b1aac Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/saq_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sat.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sat.dat new file mode 100644 index 0000000000000000000000000000000000000000..3a63c743e9e7cf2c64850e6d3a64e1ea744ea046 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sat.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva.dat new file mode 100644 index 0000000000000000000000000000000000000000..9a1af369a0d66e19e5c8d92040e1e3e276107975 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..1781be05559c4785f3de05c40b9e72bb66e3976c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Deva_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck.dat new file mode 100644 index 0000000000000000000000000000000000000000..444b35844ee4767f280814e5577d674a8a992633 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..1781be05559c4785f3de05c40b9e72bb66e3976c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sat_Olck_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sbp.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sbp.dat new file mode 100644 index 0000000000000000000000000000000000000000..e1ea58b95cafa2a8a1be83a601dc3922b1a4a3a7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sbp.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sbp_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sbp_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..2292ffb6f713c108e496b514adc70ffcc6bb427f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sbp_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sc_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sc_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..12c8c5630fb293389f3f1f9f64ba514d9444fa20 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sc_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/scn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/scn.dat new file mode 100644 index 0000000000000000000000000000000000000000..c8ebaec1509ce5d9b454877b51f44535d82fe853 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/scn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/scn_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/scn_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..0e8b90ec46da7160c9ca3adc39be0b71c7835188 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/scn_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab.dat new file mode 100644 index 0000000000000000000000000000000000000000..8003f26f9e289645c45b938a95ae9b5e6da27670 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..42f6290f13c23b37fe618ea639def889b7d77fe8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Arab_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva.dat new file mode 100644 index 0000000000000000000000000000000000000000..5193db74b6d4e5540d2e78ed42f4df92293d155d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..21aee01ca3c81d80b437d36e0ff6fe8722208eec Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sd_Deva_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sdh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sdh.dat new file mode 100644 index 0000000000000000000000000000000000000000..f51767d16291d64ebd08ac206081beec41893da0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sdh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IQ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IQ.dat new file mode 100644 index 0000000000000000000000000000000000000000..774d04d58131d20e0f41869658d9b86527c6e423 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IQ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IR.dat new file mode 100644 index 0000000000000000000000000000000000000000..6e83d1f11ec54d6d342c30130bc602a3734ad066 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sdh_IR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/se.dat b/micromamba_root/Lib/site-packages/babel/locale-data/se.dat new file mode 100644 index 0000000000000000000000000000000000000000..8da459229016874775b910345a0204d96094e472 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/se.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/se_FI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/se_FI.dat new file mode 100644 index 0000000000000000000000000000000000000000..2f927646782dd3c588ff94cbeae5e2bd725e5c5c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/se_FI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/se_NO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/se_NO.dat new file mode 100644 index 0000000000000000000000000000000000000000..09eca0d2b90185593876c25eb6b9ac7d7e7475a1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/se_NO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/se_SE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/se_SE.dat new file mode 100644 index 0000000000000000000000000000000000000000..632b54e7c2c279853e98bc4376cc3b8509e5fbc3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/se_SE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/seh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/seh.dat new file mode 100644 index 0000000000000000000000000000000000000000..e61f09ba4f51b8ae980211e2bf304965f2249131 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/seh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/seh_MZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/seh_MZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..ba30e958ac150994928afc1416a42d02b1f4eaa0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/seh_MZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ses.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ses.dat new file mode 100644 index 0000000000000000000000000000000000000000..f9858d965c73945b3a7fcc0578124ffd34d488d3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ses.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ses_ML.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ses_ML.dat new file mode 100644 index 0000000000000000000000000000000000000000..a0010889626d998765bcb8341368b773fb0591f5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ses_ML.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sg.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sg.dat new file mode 100644 index 0000000000000000000000000000000000000000..8ce0d409ecf73a0225169b2ee7c7d7af0d658864 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sg.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sg_CF.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sg_CF.dat new file mode 100644 index 0000000000000000000000000000000000000000..0ca555a69e81432f4499cc9ea2d3dd532f62fd84 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sg_CF.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shi.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shi.dat new file mode 100644 index 0000000000000000000000000000000000000000..f3d106679e47f50ef0ee7ec2a04dd4c7aef844e9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shi.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..fecc8217a3a7ce7f38d2ceab1d31bfbbab058b8f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn_MA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn_MA.dat new file mode 100644 index 0000000000000000000000000000000000000000..14955853f11ba0456a324ba01a15e69b344035b6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Latn_MA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng.dat new file mode 100644 index 0000000000000000000000000000000000000000..63ebefe7836a18f2c25e3eae285b52075a7c70d7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng_MA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng_MA.dat new file mode 100644 index 0000000000000000000000000000000000000000..14955853f11ba0456a324ba01a15e69b344035b6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shi_Tfng_MA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shn.dat new file mode 100644 index 0000000000000000000000000000000000000000..7eb56999cfe4dcfec3e2a5c2f52b31dc1adc52a5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shn_MM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shn_MM.dat new file mode 100644 index 0000000000000000000000000000000000000000..3cace2923308a496a9b54e51f207f66a211388c4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shn_MM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/shn_TH.dat b/micromamba_root/Lib/site-packages/babel/locale-data/shn_TH.dat new file mode 100644 index 0000000000000000000000000000000000000000..cc5364a2d984bd1db01ccf2d78ecd678b52cd7e1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/shn_TH.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/si_LK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/si_LK.dat new file mode 100644 index 0000000000000000000000000000000000000000..eb323029502a6044f9ab907cadcd096e7cbd5ae1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/si_LK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sid.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sid.dat new file mode 100644 index 0000000000000000000000000000000000000000..3445845df95cb84e640ceb39779467a6d7da7cf2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sid.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sid_ET.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sid_ET.dat new file mode 100644 index 0000000000000000000000000000000000000000..1be7a4a9060cd200310d19dcebbb586c48b706eb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sid_ET.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sk_SK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sk_SK.dat new file mode 100644 index 0000000000000000000000000000000000000000..4ba6c84139206eace0430588a3194e3b2e07177c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sk_SK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/skr.dat b/micromamba_root/Lib/site-packages/babel/locale-data/skr.dat new file mode 100644 index 0000000000000000000000000000000000000000..d9fc42902123f12cd4886b8e6cbb84146bcb2932 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/skr.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/skr_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/skr_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..8db57bc586b6a2352cf618c05985073fb8de3c54 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/skr_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sl_SI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sl_SI.dat new file mode 100644 index 0000000000000000000000000000000000000000..b4955823a5ffd7ed7e855f25a37114b3308eba11 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sl_SI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sma.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sma.dat new file mode 100644 index 0000000000000000000000000000000000000000..925c9565690eb2ccb1fb4e9dcbc126a2f9a0f578 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sma.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sma_NO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sma_NO.dat new file mode 100644 index 0000000000000000000000000000000000000000..325e16cc601d985ccc4ea77f2ebda7ee20f27bd1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sma_NO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sma_SE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sma_SE.dat new file mode 100644 index 0000000000000000000000000000000000000000..b9cb4e75432c2271f0c4530b650cf17882caf524 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sma_SE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/smj.dat b/micromamba_root/Lib/site-packages/babel/locale-data/smj.dat new file mode 100644 index 0000000000000000000000000000000000000000..377b17c7023540028324205ecba59267f9cdb8e2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/smj.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/smj_NO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/smj_NO.dat new file mode 100644 index 0000000000000000000000000000000000000000..7cc36547fc202742bd6c92af1270d907c54d034a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/smj_NO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/smj_SE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/smj_SE.dat new file mode 100644 index 0000000000000000000000000000000000000000..78aa9de9e710fc9325c156d781058e30c8d827e0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/smj_SE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/smn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/smn.dat new file mode 100644 index 0000000000000000000000000000000000000000..f63177affd2dac60e2d8fd144362c1bb8dcb37f3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/smn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/smn_FI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/smn_FI.dat new file mode 100644 index 0000000000000000000000000000000000000000..a88e29d9de08a73a47ff0e85a90ef2ca79409a66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/smn_FI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sms.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sms.dat new file mode 100644 index 0000000000000000000000000000000000000000..590f25adbddb3883f99ec5739e418c55e3e995e6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sms.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sms_FI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sms_FI.dat new file mode 100644 index 0000000000000000000000000000000000000000..91bdf45ea9b4a2826d121a196f97d995f299b4f0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sms_FI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sn.dat new file mode 100644 index 0000000000000000000000000000000000000000..cb8e1bd84853eb5d4bab203b741f8dc69f301217 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sn_ZW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sn_ZW.dat new file mode 100644 index 0000000000000000000000000000000000000000..4dd1932db2306017bf98ba7f556aa4610759bb08 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sn_ZW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/so_DJ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/so_DJ.dat new file mode 100644 index 0000000000000000000000000000000000000000..756644b6d4fc3c62c3317de59cb5180cc5105970 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/so_DJ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/so_ET.dat b/micromamba_root/Lib/site-packages/babel/locale-data/so_ET.dat new file mode 100644 index 0000000000000000000000000000000000000000..abd6c12547ff495072603b833697f526480faea2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/so_ET.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/so_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/so_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..2c422f93be494a29087d1df7e70fc56741ea1dd6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/so_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/so_SO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/so_SO.dat new file mode 100644 index 0000000000000000000000000000000000000000..aa7955c507825ed0cf07fbc45fb8176f8d706e9b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/so_SO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sq_AL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sq_AL.dat new file mode 100644 index 0000000000000000000000000000000000000000..5a5320fce78a249a2ede83a487834c2aba9fc4c2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sq_AL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sq_MK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sq_MK.dat new file mode 100644 index 0000000000000000000000000000000000000000..32565ce7c375306da1fb3223f08e11300148748a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sq_MK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sq_XK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sq_XK.dat new file mode 100644 index 0000000000000000000000000000000000000000..bbe0062ec8c42c6cd349aa34d64ecf1c87aff874 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sq_XK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl.dat new file mode 100644 index 0000000000000000000000000000000000000000..89154355eb169abd69d29b60f028cdc711db14fc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_BA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_BA.dat new file mode 100644 index 0000000000000000000000000000000000000000..6a0aaf69a1ec25e1ba9a921985b33c66b31241b4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_BA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_ME.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_ME.dat new file mode 100644 index 0000000000000000000000000000000000000000..357ab293176b6418e8d7acf46dfc0deb795b57af Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_ME.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_RS.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_RS.dat new file mode 100644 index 0000000000000000000000000000000000000000..b26330986819e979ae2f69dd23733cef18c8bba0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_RS.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_XK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_XK.dat new file mode 100644 index 0000000000000000000000000000000000000000..b574d058a91e78c50aac552b26f4f8822dc690d1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Cyrl_XK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_BA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_BA.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1be6b892586f58be464ea56d38b8c8cdd3a8f54 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_BA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_ME.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_ME.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b9a5b4bfde9df9249517fd8cc79444c88f6a42 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_ME.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_RS.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_RS.dat new file mode 100644 index 0000000000000000000000000000000000000000..b26330986819e979ae2f69dd23733cef18c8bba0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_RS.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_XK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_XK.dat new file mode 100644 index 0000000000000000000000000000000000000000..778db676e1814bb2650ccf42cc356f68d231f56f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sr_Latn_XK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ss.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ss.dat new file mode 100644 index 0000000000000000000000000000000000000000..91c10e2c036419d78257cd0f1cf4ea870082f287 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ss.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ss_SZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ss_SZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..b4fcf77904aad4b123c599eee895c194903c1973 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ss_SZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ss_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ss_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..67315698ed962181e364d2a1242be770b8e2ef93 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ss_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ssy.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ssy.dat new file mode 100644 index 0000000000000000000000000000000000000000..a42b5e83b5fe50bcad0bef85aa75ccb920c10b50 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ssy.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ssy_ER.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ssy_ER.dat new file mode 100644 index 0000000000000000000000000000000000000000..1d28855a7056fc961022a4aa34ce3ce6a2234a70 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ssy_ER.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/st.dat b/micromamba_root/Lib/site-packages/babel/locale-data/st.dat new file mode 100644 index 0000000000000000000000000000000000000000..26d9b21a3242ddf795e9bd56538ff6e9c11ad135 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/st.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/st_LS.dat b/micromamba_root/Lib/site-packages/babel/locale-data/st_LS.dat new file mode 100644 index 0000000000000000000000000000000000000000..50eef7844fcd01a53c341198517466d5ff8baa72 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/st_LS.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/st_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/st_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..9539d6249c3db89c3f93d47981ff61f51dc72d14 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/st_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/su.dat b/micromamba_root/Lib/site-packages/babel/locale-data/su.dat new file mode 100644 index 0000000000000000000000000000000000000000..011036d541ad874cf0ea91cd231a89a315b7667c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/su.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..79e460ed88bcbc6255655dd2141f8e03de55b37c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn_ID.dat b/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn_ID.dat new file mode 100644 index 0000000000000000000000000000000000000000..5c45bdcea34a8c8de4db40d0d9deeaddda1da834 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/su_Latn_ID.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sv_AX.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sv_AX.dat new file mode 100644 index 0000000000000000000000000000000000000000..bfb414d6bab40d59c092aded29c864b8eaa77f6a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sv_AX.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sv_FI.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sv_FI.dat new file mode 100644 index 0000000000000000000000000000000000000000..49deaf31f211efd7a9640bce5260adbfc06216bc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sv_FI.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sv_SE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sv_SE.dat new file mode 100644 index 0000000000000000000000000000000000000000..57a602a0393956695b2a2692ac681d894e516fc6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sv_SE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sw_CD.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sw_CD.dat new file mode 100644 index 0000000000000000000000000000000000000000..b1a7f0e5cdb8605748f6ed73d20996016e371470 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sw_CD.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sw_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sw_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..f19305af90b915b31fedf29b2740ebbb1d45e491 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sw_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sw_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sw_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..a267886d23723f85dc7654a69c05d7103b0ae57a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sw_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/sw_UG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/sw_UG.dat new file mode 100644 index 0000000000000000000000000000000000000000..0d160d55aedbb97aa5b9cc0b3b0c2633e3a3a2ab Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/sw_UG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/syr_IQ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/syr_IQ.dat new file mode 100644 index 0000000000000000000000000000000000000000..7821e9248c152da6644e407c6b87b30a8910afe4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/syr_IQ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/syr_SY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/syr_SY.dat new file mode 100644 index 0000000000000000000000000000000000000000..1edf041cc887052babca9f2caf72b5e81fbccd78 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/syr_SY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/szl.dat b/micromamba_root/Lib/site-packages/babel/locale-data/szl.dat new file mode 100644 index 0000000000000000000000000000000000000000..4a767b486d696d83b0387bb68a178ad0e5718390 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/szl.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/szl_PL.dat b/micromamba_root/Lib/site-packages/babel/locale-data/szl_PL.dat new file mode 100644 index 0000000000000000000000000000000000000000..f0b99548a66ae7f85d6a9d393c42ee1d480a396a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/szl_PL.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ta_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ta_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..cd08ee8f866708b9c87a2bc2977b7cb9f69f98b6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ta_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ta_LK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ta_LK.dat new file mode 100644 index 0000000000000000000000000000000000000000..f473b057d5c0d7e14b517ce3a11933761b2508bc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ta_LK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ta_MY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ta_MY.dat new file mode 100644 index 0000000000000000000000000000000000000000..8e791e9214f750549b6680b8caa2fd509741c8fb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ta_MY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ta_SG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ta_SG.dat new file mode 100644 index 0000000000000000000000000000000000000000..9f1131ccc6893f14071a114793cd8333070feebb Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ta_SG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/te_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/te_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..d76a4160aae915af1deb7a4247c0b403254f7566 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/te_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/teo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/teo.dat new file mode 100644 index 0000000000000000000000000000000000000000..d4cfa1af3ce1251d5f7136667b09f6b9d39c8244 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/teo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/teo_KE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/teo_KE.dat new file mode 100644 index 0000000000000000000000000000000000000000..66b33cad9b32e26ab006d8c8edfdba62fdbbcaf9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/teo_KE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/teo_UG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/teo_UG.dat new file mode 100644 index 0000000000000000000000000000000000000000..e81befadb02575014d87ac56a32748024923c7c8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/teo_UG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tg_TJ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tg_TJ.dat new file mode 100644 index 0000000000000000000000000000000000000000..1982383d7723bedac26e3a377e713b531d94f3ef Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tg_TJ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/th_TH.dat b/micromamba_root/Lib/site-packages/babel/locale-data/th_TH.dat new file mode 100644 index 0000000000000000000000000000000000000000..c2a4c994dad4bd585234e3c67da775b2e0eceb0a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/th_TH.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ti_ER.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ti_ER.dat new file mode 100644 index 0000000000000000000000000000000000000000..41ca554cd3a41b5580a46398b3eca270090e64db Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ti_ER.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ti_ET.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ti_ET.dat new file mode 100644 index 0000000000000000000000000000000000000000..50a447b53cc6ff74b69b9d9f1d22859fd7c35525 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ti_ET.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tig.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tig.dat new file mode 100644 index 0000000000000000000000000000000000000000..ed1b2a7914395580a6660a4d659b6ba4d2130d37 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tig.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tig_ER.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tig_ER.dat new file mode 100644 index 0000000000000000000000000000000000000000..5632fa6fe202158b3275d64e9bd86b462546123f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tig_ER.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tk_TM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tk_TM.dat new file mode 100644 index 0000000000000000000000000000000000000000..01e7cf61f21ffc4e5128226c660b6b5aad2e8da4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tk_TM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tn.dat new file mode 100644 index 0000000000000000000000000000000000000000..65c0267f90af6d066d4f5eb915966b7870205dcd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tn_BW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tn_BW.dat new file mode 100644 index 0000000000000000000000000000000000000000..5da0cc5d97fb4fcaf4813eb8bdc51db7a65e04d4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tn_BW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tn_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tn_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..a559a128c3d4dcd2f0145c1fc3cca4dff18fbdb9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tn_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/to_TO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/to_TO.dat new file mode 100644 index 0000000000000000000000000000000000000000..8cdedf551c10c7f831f8ac8cdd22eb89e28f9797 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/to_TO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tok.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tok.dat new file mode 100644 index 0000000000000000000000000000000000000000..a8b7a88673fbeeed37aea2e487d06a1a45fe49fc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tok.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tok_001.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tok_001.dat new file mode 100644 index 0000000000000000000000000000000000000000..ea39a455828717e17926de41fa64304a8e2c2c29 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tok_001.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tpi.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tpi.dat new file mode 100644 index 0000000000000000000000000000000000000000..0434b6fa6c7bf2a76f9433be1323c5fa87110f6b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tpi.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tpi_PG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tpi_PG.dat new file mode 100644 index 0000000000000000000000000000000000000000..9057c6e44a6112984a2fbe817aae13e5cbddbdae Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tpi_PG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tr_CY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tr_CY.dat new file mode 100644 index 0000000000000000000000000000000000000000..a0bbd6f0dc0659c9c1634813916e372114f743f7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tr_CY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tr_TR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tr_TR.dat new file mode 100644 index 0000000000000000000000000000000000000000..8c20ebb664b3658195f3fb4f3e18d78c8ead8d23 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tr_TR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/trv.dat b/micromamba_root/Lib/site-packages/babel/locale-data/trv.dat new file mode 100644 index 0000000000000000000000000000000000000000..1b784bc836f2eb84f6b2bbb36f84449499cccc22 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/trv.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/trv_TW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/trv_TW.dat new file mode 100644 index 0000000000000000000000000000000000000000..da4e716dbb3fbec59c66d1e6dab3897c6488411c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/trv_TW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/trw_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/trw_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..593e957e62cb45cb33c9a7318deefdd05f72ab4f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/trw_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ts.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ts.dat new file mode 100644 index 0000000000000000000000000000000000000000..900383d330181cd8d106c2c8cf6410d460afad5a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ts.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ts_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ts_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..536403200a9ea876cb802ac385d6c0d9a554ecfd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ts_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tt_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tt_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..88ba72f3fd4593f9e5a8896be971a244e5d95b88 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tt_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/twq.dat b/micromamba_root/Lib/site-packages/babel/locale-data/twq.dat new file mode 100644 index 0000000000000000000000000000000000000000..2f99122fb0f0bc4ad624fb4a057b645d0b13e280 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/twq.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/twq_NE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/twq_NE.dat new file mode 100644 index 0000000000000000000000000000000000000000..be95079d2000b7bf5fc13b5ad62b802304e5a64b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/twq_NE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tyv.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tyv.dat new file mode 100644 index 0000000000000000000000000000000000000000..fe1564b9e8a89215858944fa5ea27ae84bc33911 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tyv.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tyv_RU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tyv_RU.dat new file mode 100644 index 0000000000000000000000000000000000000000..92ab47b5d72424023cb8635ca395ddacffc18a6f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tyv_RU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tzm.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tzm.dat new file mode 100644 index 0000000000000000000000000000000000000000..14f6276b96dbbe533ce1f7ffef01f6f0eed2bcc1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tzm.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/tzm_MA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/tzm_MA.dat new file mode 100644 index 0000000000000000000000000000000000000000..b74c9377556d2b62102e2f4cbca1f9022152d3c9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/tzm_MA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ug_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ug_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..997752b72d3df2f59159a2c2f97de4a7af2b2240 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ug_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uk_UA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uk_UA.dat new file mode 100644 index 0000000000000000000000000000000000000000..e1ff80ca19cda32f9bf19a5de99432b59f554e5b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uk_UA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ur_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ur_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..582a1fc3d19aa4a857f9a3afb7779be4ec222496 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ur_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ur_PK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ur_PK.dat new file mode 100644 index 0000000000000000000000000000000000000000..5a3d6cecc3bdae30f5aed848b89bd781e19cb6f3 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ur_PK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab.dat new file mode 100644 index 0000000000000000000000000000000000000000..0ed5c3aed59f37a7215b06805bfe45650e99b3f2 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab_AF.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab_AF.dat new file mode 100644 index 0000000000000000000000000000000000000000..d7355f66e596155722c067bd079ff867346bd7e7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Arab_AF.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl.dat new file mode 100644 index 0000000000000000000000000000000000000000..382b3cc0fece0a218c57cd39762e13c804bf25ec Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl_UZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl_UZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..0e9fb275c0f92fa00d2fc38c5254738325279575 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Cyrl_UZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..217235e4e1d1b6d531bb9ab9c81ec5abb1f5a1d9 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn_UZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn_UZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..0e9fb275c0f92fa00d2fc38c5254738325279575 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/uz_Latn_UZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vai.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vai.dat new file mode 100644 index 0000000000000000000000000000000000000000..c69f2cba6d61430abb43ff07b4e2408b729ca3e8 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vai.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..849c491d409bfc38d82a5a7374be6ace9f82c641 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn_LR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn_LR.dat new file mode 100644 index 0000000000000000000000000000000000000000..f3bc7f0396f2859f201621a4e2ccb58d0608da66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Latn_LR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii.dat new file mode 100644 index 0000000000000000000000000000000000000000..6519e24e6ad03612674b240fa9b1d444d4c5eb81 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii_LR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii_LR.dat new file mode 100644 index 0000000000000000000000000000000000000000..f3bc7f0396f2859f201621a4e2ccb58d0608da66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vai_Vaii_LR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ve.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ve.dat new file mode 100644 index 0000000000000000000000000000000000000000..517c7a44997f3189bda46cfde8530100ee38b3ca Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ve.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/ve_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/ve_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..81c087b33b7685b3fcb0739a20bb27dab52bdb84 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/ve_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vec_IT.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vec_IT.dat new file mode 100644 index 0000000000000000000000000000000000000000..a1f0238ce44ca634ea287f9635b5d09d96b79115 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vec_IT.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vi_VN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vi_VN.dat new file mode 100644 index 0000000000000000000000000000000000000000..d1942c8e335e6e9e02beafd5cbeffb23029c59ed Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vi_VN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vmw.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vmw.dat new file mode 100644 index 0000000000000000000000000000000000000000..7116de27b700b439127acc9de6ea0cabe360e607 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vmw.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vmw_MZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vmw_MZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..2199974574a79609080f7cf1560c912ab9c7c827 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vmw_MZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vo.dat new file mode 100644 index 0000000000000000000000000000000000000000..00137183bbd21aeab6f981e3453c5b47e6854e09 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vo_001.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vo_001.dat new file mode 100644 index 0000000000000000000000000000000000000000..e06ed1c85e3c0b08dabf848eba79512b8c10fafd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vo_001.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vun.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vun.dat new file mode 100644 index 0000000000000000000000000000000000000000..8fd175bb1e187a480391d75ef57ce7644e02f1b0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vun.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/vun_TZ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/vun_TZ.dat new file mode 100644 index 0000000000000000000000000000000000000000..a29794a6f9d73b75476ef3f3c716ae05015e3ea5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/vun_TZ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wa.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wa.dat new file mode 100644 index 0000000000000000000000000000000000000000..6699fd2144c05b3bdf3d90b68a26f83f97b77325 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wa.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wa_BE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wa_BE.dat new file mode 100644 index 0000000000000000000000000000000000000000..63f30c15cc8f655a055f4fd7d588f731066e342b Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wa_BE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wae.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wae.dat new file mode 100644 index 0000000000000000000000000000000000000000..7deede2ee56acf65146675c6a0a39be4766f14dc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wae.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wae_CH.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wae_CH.dat new file mode 100644 index 0000000000000000000000000000000000000000..7e10feea10bcd838bdf077b8e20916c987bf7173 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wae_CH.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wal.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wal.dat new file mode 100644 index 0000000000000000000000000000000000000000..99770a061d1c86977278f6eaa113c29d1411ca66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wal.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wal_ET.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wal_ET.dat new file mode 100644 index 0000000000000000000000000000000000000000..fa5fc6d0184a41415ae0fc0cae9751caeed86aa5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wal_ET.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wbp.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wbp.dat new file mode 100644 index 0000000000000000000000000000000000000000..22bcdd776485af2da5d12af077bb58850113d536 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wbp.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wbp_AU.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wbp_AU.dat new file mode 100644 index 0000000000000000000000000000000000000000..3b6b5b1ead5876326af14ea312c06d6d1c4afc08 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wbp_AU.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wo.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wo.dat new file mode 100644 index 0000000000000000000000000000000000000000..ed881e934f3fd6cdd89036fd582fc11ec01d5f8e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wo.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/wo_SN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/wo_SN.dat new file mode 100644 index 0000000000000000000000000000000000000000..ce673ad4306aaa8967a3b9a50e1bfba2aaa4a8ea Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/wo_SN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/xh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/xh.dat new file mode 100644 index 0000000000000000000000000000000000000000..487e18a08ca92ff4bce72a69ed2d27833acd3263 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/xh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/xh_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/xh_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..68d7166887ed2effb6a387e52dfc667358ff3377 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/xh_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/xnr_IN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/xnr_IN.dat new file mode 100644 index 0000000000000000000000000000000000000000..360f58c4fa0f4ad5fdadb966363991affb7a4c1e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/xnr_IN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/xog.dat b/micromamba_root/Lib/site-packages/babel/locale-data/xog.dat new file mode 100644 index 0000000000000000000000000000000000000000..365dd8aa975725c0d08e3c262d85656ca001c0b7 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/xog.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/xog_UG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/xog_UG.dat new file mode 100644 index 0000000000000000000000000000000000000000..b5fb4da0af1505ceb63a61825547c7e3017291b4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/xog_UG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yav.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yav.dat new file mode 100644 index 0000000000000000000000000000000000000000..547b6b9122c1925224864cdba2a536a3d619e1ac Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yav.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yav_CM.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yav_CM.dat new file mode 100644 index 0000000000000000000000000000000000000000..2a0cbb26e74f95921164edf7f90f6aa18f35aaff Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yav_CM.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yi.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yi.dat new file mode 100644 index 0000000000000000000000000000000000000000..c39639f0da098f347ba5b105fb449d0ffa12f12a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yi.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yi_UA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yi_UA.dat new file mode 100644 index 0000000000000000000000000000000000000000..9f967db03a6a2562ea66f9128f5e5c90a563cf6e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yi_UA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yo_BJ.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yo_BJ.dat new file mode 100644 index 0000000000000000000000000000000000000000..b9d79c3e1ee6bc1974c43694e0c0bbd6779a540e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yo_BJ.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yo_NG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yo_NG.dat new file mode 100644 index 0000000000000000000000000000000000000000..e473a96cddad82c1ecea13a10d948711a58b3f25 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yo_NG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yrl_BR.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_BR.dat new file mode 100644 index 0000000000000000000000000000000000000000..bf1012ee0cf20f18292aef66ad38efcf69a087ba Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_BR.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yrl_CO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_CO.dat new file mode 100644 index 0000000000000000000000000000000000000000..c8a8c22e3f14787173f074fb40d702be24f05238 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_CO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yrl_VE.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_VE.dat new file mode 100644 index 0000000000000000000000000000000000000000..d8ebd8edd7b82dfdf299db4043236f6d9a95afc1 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yrl_VE.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hans_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hans_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..1ba619717ab3d2d840011e43b75240b76956877f Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hans_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant.dat new file mode 100644 index 0000000000000000000000000000000000000000..d67403460f660fca99a552aba9a23d38dd231b68 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..6ca866c4caa321950a55f330470b3ded8abd8c0c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_HK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_HK.dat new file mode 100644 index 0000000000000000000000000000000000000000..853efcbb39cd8feceb97d63ab194363fec67d658 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_HK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_MO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_MO.dat new file mode 100644 index 0000000000000000000000000000000000000000..fca6b29db232a136b1a647b56ed3cab2fd3c4d31 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/yue_Hant_MO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/za.dat b/micromamba_root/Lib/site-packages/babel/locale-data/za.dat new file mode 100644 index 0000000000000000000000000000000000000000..174e68390a5448f82d344df41dd4431f29332228 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/za.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/za_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/za_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..f0cbb5db71e7d7d5fe859d0f21d94adfa8e6923a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/za_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zgh.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zgh.dat new file mode 100644 index 0000000000000000000000000000000000000000..a0c342c249e4a0c423ee229bcfc19ab664ea0233 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zgh.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zgh_MA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zgh_MA.dat new file mode 100644 index 0000000000000000000000000000000000000000..8475afed46521f62fdc9fac49663211f9ff4ac96 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zgh_MA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans.dat new file mode 100644 index 0000000000000000000000000000000000000000..c5c94bf8bcb2fe714f5a073d67f013a3d7ef7a66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..09d08c10851e614c5ea75983800d9c111cb3ad26 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_HK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_HK.dat new file mode 100644 index 0000000000000000000000000000000000000000..2396da0a225cde1e1bbd9b905ad6fd5a99f147de Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_HK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MO.dat new file mode 100644 index 0000000000000000000000000000000000000000..4f0232e532f08bcc4c8c3381cbf63fcf2485a227 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MY.dat new file mode 100644 index 0000000000000000000000000000000000000000..bddaab921a963ca4a05fc3f904288ccae557b577 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_MY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_SG.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_SG.dat new file mode 100644 index 0000000000000000000000000000000000000000..646b57d613d526c3f99aa2a36d4a86044543889c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hans_SG.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_HK.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_HK.dat new file mode 100644 index 0000000000000000000000000000000000000000..d8ef238fd10abdfad85d7c4292819b9d8bbde99e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_HK.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MO.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MO.dat new file mode 100644 index 0000000000000000000000000000000000000000..2e4683576c2fa445db1ecdf739959e4695dc94c4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MO.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MY.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MY.dat new file mode 100644 index 0000000000000000000000000000000000000000..1198fb41648f90122ae72f1772fdc0c2b8574ca5 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_MY.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_TW.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_TW.dat new file mode 100644 index 0000000000000000000000000000000000000000..657e88859949c4db157635d5a2f7089c1acb69c4 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Hant_TW.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn.dat new file mode 100644 index 0000000000000000000000000000000000000000..c5c94bf8bcb2fe714f5a073d67f013a3d7ef7a66 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn_CN.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn_CN.dat new file mode 100644 index 0000000000000000000000000000000000000000..09d08c10851e614c5ea75983800d9c111cb3ad26 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zh_Latn_CN.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/locale-data/zu_ZA.dat b/micromamba_root/Lib/site-packages/babel/locale-data/zu_ZA.dat new file mode 100644 index 0000000000000000000000000000000000000000..026694ca6b9e4822497aadb5c7c1a66bd3137750 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/locale-data/zu_ZA.dat differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__init__.py b/micromamba_root/Lib/site-packages/babel/localtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9eb95ab2e98e50b596fe563770112a0b11e177dc --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/localtime/__init__.py @@ -0,0 +1,43 @@ +""" +babel.localtime +~~~~~~~~~~~~~~~ + +Babel specific fork of tzlocal to determine the local timezone +of the system. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +import datetime +import sys + +if sys.platform == 'win32': + from babel.localtime._win32 import _get_localzone +else: + from babel.localtime._unix import _get_localzone + + +# TODO(3.0): the offset constants are not part of the public API +# and should be removed +from babel.localtime._fallback import ( + DSTDIFF, # noqa: F401 + DSTOFFSET, # noqa: F401 + STDOFFSET, # noqa: F401 + ZERO, # noqa: F401 + _FallbackLocalTimezone, +) + + +def get_localzone() -> datetime.tzinfo: + """Returns the current underlying local timezone object. + Generally this function does not need to be used, it's a + better idea to use the :data:`LOCALTZ` singleton instead. + """ + return _get_localzone() + + +try: + LOCALTZ = get_localzone() +except LookupError: + LOCALTZ = _FallbackLocalTimezone() diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a804d2acf97980427451478fe29ac276ce2dbeb0 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_fallback.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_fallback.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3dc66bcbc0cbf6dcddae415a5971b6e9919805a Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_fallback.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_helpers.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_helpers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd3f6da97a676db41c9761e78c9e7ec64dd1231d Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_helpers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_unix.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_unix.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30d3d17422e9434cac1b2a63c18034c9b584a59e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_unix.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_win32.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_win32.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1eb2fd6fbcd117294dd93a9ac06991d7fec85c47 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/localtime/__pycache__/_win32.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/localtime/_fallback.py b/micromamba_root/Lib/site-packages/babel/localtime/_fallback.py new file mode 100644 index 0000000000000000000000000000000000000000..218813905b74c5aa6975455bdf4a73f053fb0c09 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/localtime/_fallback.py @@ -0,0 +1,43 @@ +""" +babel.localtime._fallback +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Emulated fallback local timezone when all else fails. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +import datetime +import time + +STDOFFSET = datetime.timedelta(seconds=-time.timezone) +DSTOFFSET = datetime.timedelta(seconds=-time.altzone) if time.daylight else STDOFFSET + +DSTDIFF = DSTOFFSET - STDOFFSET +ZERO = datetime.timedelta(0) + + +class _FallbackLocalTimezone(datetime.tzinfo): + def utcoffset(self, dt: datetime.datetime) -> datetime.timedelta: + if self._isdst(dt): + return DSTOFFSET + else: + return STDOFFSET + + def dst(self, dt: datetime.datetime) -> datetime.timedelta: + if self._isdst(dt): + return DSTDIFF + else: + return ZERO + + def tzname(self, dt: datetime.datetime) -> str: + return time.tzname[self._isdst(dt)] + + def _isdst(self, dt: datetime.datetime) -> bool: + tt = (dt.year, dt.month, dt.day, + dt.hour, dt.minute, dt.second, + dt.weekday(), 0, -1) # fmt: skip + stamp = time.mktime(tt) + tt = time.localtime(stamp) + return tt.tm_isdst > 0 diff --git a/micromamba_root/Lib/site-packages/babel/localtime/_helpers.py b/micromamba_root/Lib/site-packages/babel/localtime/_helpers.py new file mode 100644 index 0000000000000000000000000000000000000000..e7e67052c1fbdb7e88761fd6e8f08e97d54cb54e --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/localtime/_helpers.py @@ -0,0 +1,57 @@ +try: + import pytz +except ModuleNotFoundError: + pytz = None + +try: + import zoneinfo +except ModuleNotFoundError: + zoneinfo = None + + +def _get_tzinfo(tzenv: str): + """Get the tzinfo from `zoneinfo` or `pytz` + + :param tzenv: timezone in the form of Continent/City + :return: tzinfo object or None if not found + """ + if pytz: + try: + return pytz.timezone(tzenv) + except pytz.UnknownTimeZoneError: + pass + else: + try: + return zoneinfo.ZoneInfo(tzenv) + except ValueError as ve: + # This is somewhat hacky, but since _validate_tzfile_path() doesn't + # raise a specific error type, we'll need to check the message to be + # one we know to be from that function. + # If so, we pretend it meant that the TZ didn't exist, for the benefit + # of `babel.localtime` catching the `LookupError` raised by + # `_get_tzinfo_or_raise()`. + # See https://github.com/python-babel/babel/issues/1092 + if str(ve).startswith("ZoneInfo keys "): + return None + except zoneinfo.ZoneInfoNotFoundError: + pass + + return None + + +def _get_tzinfo_or_raise(tzenv: str): + tzinfo = _get_tzinfo(tzenv) + if tzinfo is None: + raise LookupError( + f"Can not find timezone {tzenv}. \n" + "Timezone names are generally in the form `Continent/City`.", + ) + return tzinfo + + +def _get_tzinfo_from_file(tzfilename: str): + with open(tzfilename, 'rb') as tzfile: + if pytz: + return pytz.tzfile.build_tzinfo('local', tzfile) + else: + return zoneinfo.ZoneInfo.from_file(tzfile) diff --git a/micromamba_root/Lib/site-packages/babel/localtime/_unix.py b/micromamba_root/Lib/site-packages/babel/localtime/_unix.py new file mode 100644 index 0000000000000000000000000000000000000000..70dd2322cf3b12c14df15bfab5a72bd7d11b2720 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/localtime/_unix.py @@ -0,0 +1,104 @@ +import datetime +import os +import re + +from babel.localtime._helpers import ( + _get_tzinfo, + _get_tzinfo_from_file, + _get_tzinfo_or_raise, +) + + +def _tz_from_env(tzenv: str) -> datetime.tzinfo: + if tzenv[0] == ':': + tzenv = tzenv[1:] + + # TZ specifies a file + if os.path.exists(tzenv): + return _get_tzinfo_from_file(tzenv) + + # TZ specifies a zoneinfo zone. + return _get_tzinfo_or_raise(tzenv) + + +def _get_localzone(_root: str = '/') -> datetime.tzinfo: + """Tries to find the local timezone configuration. + This method prefers finding the timezone name and passing that to + zoneinfo or pytz, over passing in the localtime file, as in the later + case the zoneinfo name is unknown. + The parameter _root makes the function look for files like /etc/localtime + beneath the _root directory. This is primarily used by the tests. + In normal usage you call the function without parameters. + """ + + tzenv = os.environ.get('TZ') + if tzenv: + return _tz_from_env(tzenv) + + # This is actually a pretty reliable way to test for the local time + # zone on operating systems like OS X. On OS X especially this is the + # only one that actually works. + try: + link_dst = os.readlink('/etc/localtime') + except OSError: + pass + else: + pos = link_dst.find('/zoneinfo/') + if pos >= 0: + # On occasion, the `/etc/localtime` symlink has a double slash, e.g. + # "/usr/share/zoneinfo//UTC", which would make `zoneinfo.ZoneInfo` + # complain (no absolute paths allowed), and we'd end up returning + # `None` (as a fix for #1092). + # Instead, let's just "fix" the double slash symlink by stripping + # leading slashes before passing the assumed zone name forward. + zone_name = link_dst[pos + 10 :].lstrip("/") + tzinfo = _get_tzinfo(zone_name) + if tzinfo is not None: + return tzinfo + + # Now look for distribution specific configuration files + # that contain the timezone name. + tzpath = os.path.join(_root, 'etc/timezone') + if os.path.exists(tzpath): + with open(tzpath, 'rb') as tzfile: + data = tzfile.read() + + # Issue #3 in tzlocal was that /etc/timezone was a zoneinfo file. + # That's a misconfiguration, but we need to handle it gracefully: + if data[:5] != b'TZif2': + etctz = data.strip().decode() + # Get rid of host definitions and comments: + if ' ' in etctz: + etctz, dummy = etctz.split(' ', 1) + if '#' in etctz: + etctz, dummy = etctz.split('#', 1) + + return _get_tzinfo_or_raise(etctz.replace(' ', '_')) + + # CentOS has a ZONE setting in /etc/sysconfig/clock, + # OpenSUSE has a TIMEZONE setting in /etc/sysconfig/clock and + # Gentoo has a TIMEZONE setting in /etc/conf.d/clock + # We look through these files for a timezone: + timezone_re = re.compile(r'\s*(TIME)?ZONE\s*=\s*"(?P.+)"') + + for filename in ('etc/sysconfig/clock', 'etc/conf.d/clock'): + tzpath = os.path.join(_root, filename) + if not os.path.exists(tzpath): + continue + with open(tzpath) as tzfile: + for line in tzfile: + match = timezone_re.match(line) + if match is not None: + # We found a timezone + etctz = match.group("etctz") + return _get_tzinfo_or_raise(etctz.replace(' ', '_')) + + # No explicit setting existed. Use localtime + for filename in ('etc/localtime', 'usr/local/etc/localtime'): + tzpath = os.path.join(_root, filename) + + if not os.path.exists(tzpath): + continue + return _get_tzinfo_from_file(tzpath) + + raise LookupError('Can not find any timezone configuration') diff --git a/micromamba_root/Lib/site-packages/babel/localtime/_win32.py b/micromamba_root/Lib/site-packages/babel/localtime/_win32.py new file mode 100644 index 0000000000000000000000000000000000000000..0fb625ba906b8d9d19f5358e89a88e6882b50c01 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/localtime/_win32.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +try: + import winreg +except ImportError: + winreg = None + +import datetime +from typing import Any, Dict, cast + +from babel.core import get_global +from babel.localtime._helpers import _get_tzinfo_or_raise + +# When building the cldr data on windows this module gets imported. +# Because at that point there is no global.dat yet this call will +# fail. We want to catch it down in that case then and just assume +# the mapping was empty. +try: + tz_names: dict[str, str] = cast(Dict[str, str], get_global('windows_zone_mapping')) +except RuntimeError: + tz_names = {} + + +def valuestodict(key) -> dict[str, Any]: + """Convert a registry key's values to a dictionary.""" + dict = {} + size = winreg.QueryInfoKey(key)[1] + for i in range(size): + data = winreg.EnumValue(key, i) + dict[data[0]] = data[1] + return dict + + +def get_localzone_name() -> str: + # Windows is special. It has unique time zone names (in several + # meanings of the word) available, but unfortunately, they can be + # translated to the language of the operating system, so we need to + # do a backwards lookup, by going through all time zones and see which + # one matches. + handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + + TZLOCALKEYNAME = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation' + localtz = winreg.OpenKey(handle, TZLOCALKEYNAME) + keyvalues = valuestodict(localtz) + localtz.Close() + if 'TimeZoneKeyName' in keyvalues: + # Windows 7 (and Vista?) + + # For some reason this returns a string with loads of NUL bytes at + # least on some systems. I don't know if this is a bug somewhere, I + # just work around it. + tzkeyname = keyvalues['TimeZoneKeyName'].split('\x00', 1)[0] + else: + # Windows 2000 or XP + + # This is the localized name: + tzwin = keyvalues['StandardName'] + + # Open the list of timezones to look up the real name: + TZKEYNAME = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' + tzkey = winreg.OpenKey(handle, TZKEYNAME) + + # Now, match this value to Time Zone information + tzkeyname = None + for i in range(winreg.QueryInfoKey(tzkey)[0]): + subkey = winreg.EnumKey(tzkey, i) + sub = winreg.OpenKey(tzkey, subkey) + data = valuestodict(sub) + sub.Close() + if data.get('Std', None) == tzwin: + tzkeyname = subkey + break + + tzkey.Close() + handle.Close() + + if tzkeyname is None: + raise LookupError('Can not find Windows timezone configuration') + + timezone = tz_names.get(tzkeyname) + if timezone is None: + # Nope, that didn't work. Try adding 'Standard Time', + # it seems to work a lot of times: + timezone = tz_names.get(f"{tzkeyname} Standard Time") + + # Return what we have. + if timezone is None: + raise LookupError(f"Can not find timezone {tzkeyname}") + + return timezone + + +def _get_localzone() -> datetime.tzinfo: + if winreg is None: + raise LookupError('Runtime support not available') + + return _get_tzinfo_or_raise(get_localzone_name()) diff --git a/micromamba_root/Lib/site-packages/babel/messages/__init__.py b/micromamba_root/Lib/site-packages/babel/messages/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8dde3f299b0f6a77bf6949c4820ccfdcb5560b90 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/__init__.py @@ -0,0 +1,21 @@ +""" +babel.messages +~~~~~~~~~~~~~~ + +Support for ``gettext`` message catalogs. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from babel.messages.catalog import ( + Catalog, + Message, + TranslationError, +) + +__all__ = [ + "Catalog", + "Message", + "TranslationError", +] diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/__init__.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1769b7652dd790b38d593d93f2969ced24f7071 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/__init__.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/_compat.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/_compat.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6f4fa2c7965a9d9c66521048fe9ed0b570311dc Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/_compat.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/catalog.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/catalog.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9249179705791b09892c921f9f5779591cbacd79 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/catalog.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/checkers.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/checkers.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb0bd6d99f12c1c1cae84a3d7b208a78fa009151 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/checkers.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/extract.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/extract.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb57957207ea167a836434b900cd03b807a253fa Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/extract.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/frontend.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/frontend.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba50786afd4f9ebe5093885c4b977a026a3352dd Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/frontend.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/jslexer.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/jslexer.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dfbb55af69d91e2148e829a6c9ec5ecf8074d55c Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/jslexer.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/mofile.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/mofile.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2739c7761953c8704ff03ba614dfe1156892f2e Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/mofile.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/plurals.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/plurals.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5075b24838523bd2b1043d1c301cdd0afd3f4803 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/plurals.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/pofile.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/pofile.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a5f304b57e963f30dcaba1f3a431c930efb1dd6 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/pofile.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/__pycache__/setuptools_frontend.cpython-314.pyc b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/setuptools_frontend.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c305618de63857cdeaeb83e223a2811058098341 Binary files /dev/null and b/micromamba_root/Lib/site-packages/babel/messages/__pycache__/setuptools_frontend.cpython-314.pyc differ diff --git a/micromamba_root/Lib/site-packages/babel/messages/_compat.py b/micromamba_root/Lib/site-packages/babel/messages/_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..319b545f0327962b145858e20a89ceb2b641fb67 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/_compat.py @@ -0,0 +1,34 @@ +import sys +from functools import partial + + +def find_entrypoints(group_name: str): + """ + Find entrypoints of a given group using either `importlib.metadata` or the + older `pkg_resources` mechanism. + + Yields tuples of the entrypoint name and a callable function that will + load the actual entrypoint. + """ + if sys.version_info >= (3, 10): + # "Changed in version 3.10: importlib.metadata is no longer provisional." + try: + from importlib.metadata import entry_points + except ImportError: + pass + else: + eps = entry_points(group=group_name) + # Only do this if this implementation of `importlib.metadata` is + # modern enough to not return a dict. + if not isinstance(eps, dict): + for entry_point in eps: + yield (entry_point.name, entry_point.load) + return + + try: + from pkg_resources import working_set + except ImportError: + pass + else: + for entry_point in working_set.iter_entry_points(group_name): + yield (entry_point.name, partial(entry_point.load, require=True)) diff --git a/micromamba_root/Lib/site-packages/babel/messages/catalog.py b/micromamba_root/Lib/site-packages/babel/messages/catalog.py new file mode 100644 index 0000000000000000000000000000000000000000..9a9739a724120a273e1fffd1db3d266a2f16ba48 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/catalog.py @@ -0,0 +1,1055 @@ +""" +babel.messages.catalog +~~~~~~~~~~~~~~~~~~~~~~ + +Data structures for message catalogs. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from __future__ import annotations + +import datetime +import re +from collections.abc import Iterable, Iterator +from copy import copy +from difflib import SequenceMatcher +from email import message_from_string +from heapq import nlargest +from string import Formatter +from typing import TYPE_CHECKING + +from babel import __version__ as VERSION +from babel.core import Locale, UnknownLocaleError +from babel.dates import format_datetime +from babel.messages.plurals import get_plural +from babel.util import LOCALTZ, _cmp + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + + _MessageID: TypeAlias = str | tuple[str, ...] | list[str] + +__all__ = [ + 'DEFAULT_HEADER', + 'PYTHON_FORMAT', + 'Catalog', + 'Message', + 'TranslationError', +] + + +def get_close_matches(word, possibilities, n=3, cutoff=0.6): + """A modified version of ``difflib.get_close_matches``. + + It just passes ``autojunk=False`` to the ``SequenceMatcher``, to work + around https://github.com/python/cpython/issues/90825. + """ + if not n > 0: # pragma: no cover + raise ValueError(f"n must be > 0: {n!r}") + if not 0.0 <= cutoff <= 1.0: # pragma: no cover + raise ValueError(f"cutoff must be in [0.0, 1.0]: {cutoff!r}") + result = [] + s = SequenceMatcher(autojunk=False) # only line changed from difflib.py + s.set_seq2(word) + for x in possibilities: + s.set_seq1(x) + if ( + s.real_quick_ratio() >= cutoff + and s.quick_ratio() >= cutoff + and s.ratio() >= cutoff + ): + result.append((s.ratio(), x)) + + # Move the best scorers to head of list + result = nlargest(n, result) + # Strip scores for the best n matches + return [x for score, x in result] + + +PYTHON_FORMAT = re.compile( + r''' + \% + (?:\(([\w]*)\))? + ( + [-#0\ +]?(?:\*|[\d]+)? + (?:\.(?:\*|[\d]+))? + [hlL]? + ) + ([diouxXeEfFgGcrs%]) +''', + re.VERBOSE, +) + + +def _has_python_brace_format(string: str) -> bool: + if "{" not in string: + return False + fmt = Formatter() + try: + # `fmt.parse` returns 3-or-4-tuples of the form + # `(literal_text, field_name, format_spec, conversion)`; + # if `field_name` is set, this smells like brace format + field_name_seen = False + for t in fmt.parse(string): + if t[1] is not None: + field_name_seen = True + # We cannot break here, as we need to consume the whole string + # to ensure that it is a valid format string. + except ValueError: + return False + return field_name_seen + + +def _parse_datetime_header(value: str) -> datetime.datetime: + match = re.match(r'^(?P.*?)(?P[+-]\d{4})?$', value) + + dt = datetime.datetime.strptime(match.group('datetime'), '%Y-%m-%d %H:%M') + + # Separate the offset into a sign component, hours, and # minutes + tzoffset = match.group('tzoffset') + if tzoffset is not None: + plus_minus_s, rest = tzoffset[0], tzoffset[1:] + hours_offset_s, mins_offset_s = rest[:2], rest[2:] + + # Make them all integers + plus_minus = int(f"{plus_minus_s}1") + hours_offset = int(hours_offset_s) + mins_offset = int(mins_offset_s) + + # Calculate net offset + net_mins_offset = hours_offset * 60 + net_mins_offset += mins_offset + net_mins_offset *= plus_minus + + # Create an offset object + tzoffset = datetime.timezone( + offset=datetime.timedelta(minutes=net_mins_offset), + name=f'Etc/GMT{net_mins_offset:+d}', + ) + + # Store the offset in a datetime object + dt = dt.replace(tzinfo=tzoffset) + + return dt + + +class Message: + """Representation of a single message in a catalog.""" + + def __init__( + self, + id: _MessageID, + string: _MessageID | None = '', + locations: Iterable[tuple[str, int]] = (), + flags: Iterable[str] = (), + auto_comments: Iterable[str] = (), + user_comments: Iterable[str] = (), + previous_id: _MessageID = (), + lineno: int | None = None, + context: str | None = None, + ) -> None: + """Create the message object. + + :param id: the message ID, or a ``(singular, plural)`` tuple for + pluralizable messages + :param string: the translated message string, or a + ``(singular, plural)`` tuple for pluralizable messages + :param locations: a sequence of ``(filename, lineno)`` tuples + :param flags: a set or sequence of flags + :param auto_comments: a sequence of automatic comments for the message + :param user_comments: a sequence of user comments for the message + :param previous_id: the previous message ID, or a ``(singular, plural)`` + tuple for pluralizable messages + :param lineno: the line number on which the msgid line was found in the + PO file, if any + :param context: the message context + """ + self.id = id + if not string and self.pluralizable: + string = ('', '') + self.string = string + self.locations = list(dict.fromkeys(locations)) if locations else [] + self.flags = set(flags) + if id and self.python_format: + self.flags.add('python-format') + else: + self.flags.discard('python-format') + if id and self.python_brace_format: + self.flags.add('python-brace-format') + else: + self.flags.discard('python-brace-format') + self.auto_comments = list(dict.fromkeys(auto_comments)) if auto_comments else [] + self.user_comments = list(dict.fromkeys(user_comments)) if user_comments else [] + if previous_id: + if isinstance(previous_id, str): + self.previous_id = [previous_id] + else: + self.previous_id = list(previous_id) + else: + self.previous_id = [] + self.lineno = lineno + self.context = context + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.id!r} (flags: {list(self.flags)!r})>" + + def __cmp__(self, other: object) -> int: + """Compare Messages, taking into account plural ids""" + + def values_to_compare(obj): + if isinstance(obj, Message) and obj.pluralizable: + return obj.id[0], obj.context or '' + return obj.id, obj.context or '' + + return _cmp(values_to_compare(self), values_to_compare(other)) + + def __gt__(self, other: object) -> bool: + return self.__cmp__(other) > 0 + + def __lt__(self, other: object) -> bool: + return self.__cmp__(other) < 0 + + def __ge__(self, other: object) -> bool: + return self.__cmp__(other) >= 0 + + def __le__(self, other: object) -> bool: + return self.__cmp__(other) <= 0 + + def __eq__(self, other: object) -> bool: + return self.__cmp__(other) == 0 + + def __ne__(self, other: object) -> bool: + return self.__cmp__(other) != 0 + + def is_identical(self, other: Message) -> bool: + """Checks whether messages are identical, taking into account all + properties. + """ + assert isinstance(other, Message) + return self.__dict__ == other.__dict__ + + def clone(self) -> Message: + return Message( + id=copy(self.id), + string=copy(self.string), + locations=copy(self.locations), + flags=copy(self.flags), + auto_comments=copy(self.auto_comments), + user_comments=copy(self.user_comments), + previous_id=copy(self.previous_id), + lineno=self.lineno, # immutable (str/None) + context=self.context, # immutable (str/None) + ) + + def check(self, catalog: Catalog | None = None) -> list[TranslationError]: + """Run various validation checks on the message. Some validations + are only performed if the catalog is provided. This method returns + a sequence of `TranslationError` objects. + + :rtype: ``iterator`` + :param catalog: A catalog instance that is passed to the checkers + :see: `Catalog.check` for a way to perform checks for all messages + in a catalog. + """ + from babel.messages.checkers import checkers + + errors: list[TranslationError] = [] + for checker in checkers: + try: + checker(catalog, self) + except TranslationError as e: + errors.append(e) + return errors + + @property + def fuzzy(self) -> bool: + """Whether the translation is fuzzy. + + >>> Message('foo').fuzzy + False + >>> msg = Message('foo', 'foo', flags=['fuzzy']) + >>> msg.fuzzy + True + >>> msg + + + :type: `bool`""" + return 'fuzzy' in self.flags + + @property + def pluralizable(self) -> bool: + """Whether the message is plurizable. + + >>> Message('foo').pluralizable + False + >>> Message(('foo', 'bar')).pluralizable + True + + :type: `bool`""" + return isinstance(self.id, (list, tuple)) + + @property + def python_format(self) -> bool: + """Whether the message contains Python-style parameters. + + >>> Message('foo %(name)s bar').python_format + True + >>> Message(('foo %(name)s', 'foo %(name)s')).python_format + True + + :type: `bool`""" + ids = self.id + if isinstance(ids, (list, tuple)): + for id in ids: # Explicit loop for performance reasons. + if PYTHON_FORMAT.search(id): + return True + return False + return bool(PYTHON_FORMAT.search(ids)) + + @property + def python_brace_format(self) -> bool: + """Whether the message contains Python f-string parameters. + + >>> Message('Hello, {name}!').python_brace_format + True + >>> Message(('One apple', '{count} apples')).python_brace_format + True + + :type: `bool`""" + ids = self.id + if isinstance(ids, (list, tuple)): + for id in ids: # Explicit loop for performance reasons. + if _has_python_brace_format(id): + return True + return False + return _has_python_brace_format(ids) + + +class TranslationError(Exception): + """Exception thrown by translation checkers when invalid message + translations are encountered.""" + + +DEFAULT_HEADER = """\ +# Translations template for PROJECT. +# Copyright (C) YEAR ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , YEAR. +#""" + + +def parse_separated_header(value: str) -> dict[str, str]: + # Adapted from https://peps.python.org/pep-0594/#cgi + from email.message import Message + + m = Message() + m['content-type'] = value + return dict(m.get_params()) + + +def _force_text(s: str | bytes, encoding: str = 'utf-8', errors: str = 'strict') -> str: + if isinstance(s, str): + return s + if isinstance(s, bytes): + return s.decode(encoding, errors) + return str(s) + + +class Catalog: + """Representation of a message catalog.""" + + def __init__( + self, + locale: Locale | str | None = None, + domain: str | None = None, + header_comment: str | None = DEFAULT_HEADER, + project: str | None = None, + version: str | None = None, + copyright_holder: str | None = None, + msgid_bugs_address: str | None = None, + creation_date: datetime.datetime | str | None = None, + revision_date: datetime.datetime | datetime.time | float | str | None = None, + last_translator: str | None = None, + language_team: str | None = None, + charset: str | None = None, + fuzzy: bool = True, + ) -> None: + """Initialize the catalog object. + + :param locale: the locale identifier or `Locale` object, or `None` + if the catalog is not bound to a locale (which basically + means it's a template) + :param domain: the message domain + :param header_comment: the header comment as string, or `None` for the + default header + :param project: the project's name + :param version: the project's version + :param copyright_holder: the copyright holder of the catalog + :param msgid_bugs_address: the email address or URL to submit bug + reports to + :param creation_date: the date the catalog was created + :param revision_date: the date the catalog was revised + :param last_translator: the name and email of the last translator + :param language_team: the name and email of the language team + :param charset: the encoding to use in the output (defaults to utf-8) + :param fuzzy: the fuzzy bit on the catalog header + """ + self.domain = domain + self.locale = locale + self._header_comment = header_comment + self._messages: dict[str | tuple[str, str], Message] = {} + + self.project = project or 'PROJECT' + self.version = version or 'VERSION' + self.copyright_holder = copyright_holder or 'ORGANIZATION' + self.msgid_bugs_address = msgid_bugs_address or 'EMAIL@ADDRESS' + + self.last_translator = last_translator or 'FULL NAME ' + """Name and email address of the last translator.""" + self.language_team = language_team or 'LANGUAGE ' + """Name and email address of the language team.""" + + self.charset = charset or 'utf-8' + + if creation_date is None: + creation_date = datetime.datetime.now(LOCALTZ) + elif isinstance(creation_date, datetime.datetime) and not creation_date.tzinfo: + creation_date = creation_date.replace(tzinfo=LOCALTZ) + self.creation_date = creation_date + if revision_date is None: + revision_date = 'YEAR-MO-DA HO:MI+ZONE' + elif isinstance(revision_date, datetime.datetime) and not revision_date.tzinfo: + revision_date = revision_date.replace(tzinfo=LOCALTZ) + self.revision_date = revision_date + self.fuzzy = fuzzy + + # Dictionary of obsolete messages + self.obsolete: dict[str | tuple[str, str], Message] = {} + self._num_plurals = None + self._plural_expr = None + + def _set_locale(self, locale: Locale | str | None) -> None: + if locale is None: + self._locale_identifier = None + self._locale = None + return + + if isinstance(locale, Locale): + self._locale_identifier = str(locale) + self._locale = locale + return + + if isinstance(locale, str): + self._locale_identifier = str(locale) + try: + self._locale = Locale.parse(locale) + except UnknownLocaleError: + self._locale = None + return + + raise TypeError( + f"`locale` must be a Locale, a locale identifier string, or None; got {locale!r}", + ) + + def _get_locale(self) -> Locale | None: + return self._locale + + def _get_locale_identifier(self) -> str | None: + return self._locale_identifier + + locale = property(_get_locale, _set_locale) + locale_identifier = property(_get_locale_identifier) + + def _get_header_comment(self) -> str: + comment = self._header_comment + year = datetime.datetime.now(LOCALTZ).strftime('%Y') + if hasattr(self.revision_date, 'strftime'): + year = self.revision_date.strftime('%Y') + comment = ( + comment.replace('PROJECT', self.project) + .replace('VERSION', self.version) + .replace('YEAR', year) + .replace('ORGANIZATION', self.copyright_holder) + ) + locale_name = self.locale.english_name if self.locale else self.locale_identifier + if locale_name: + comment = comment.replace("Translations template", f"{locale_name} translations") + return comment + + def _set_header_comment(self, string: str | None) -> None: + self._header_comment = string + + header_comment = property( + _get_header_comment, + _set_header_comment, + doc="""\ + The header comment for the catalog. + + >>> catalog = Catalog(project='Foobar', version='1.0', + ... copyright_holder='Foo Company') + >>> print(catalog.header_comment) #doctest: +ELLIPSIS + # Translations template for Foobar. + # Copyright (C) ... Foo Company + # This file is distributed under the same license as the Foobar project. + # FIRST AUTHOR , .... + # + + The header can also be set from a string. Any known upper-case variables + will be replaced when the header is retrieved again: + + >>> catalog = Catalog(project='Foobar', version='1.0', + ... copyright_holder='Foo Company') + >>> catalog.header_comment = '''\\ + ... # The POT for my really cool PROJECT project. + ... # Copyright (C) 1990-2003 ORGANIZATION + ... # This file is distributed under the same license as the PROJECT + ... # project. + ... #''' + >>> print(catalog.header_comment) + # The POT for my really cool Foobar project. + # Copyright (C) 1990-2003 Foo Company + # This file is distributed under the same license as the Foobar + # project. + # + + :type: `unicode` + """, + ) + + def _get_mime_headers(self) -> list[tuple[str, str]]: + if isinstance(self.revision_date, (datetime.datetime, datetime.time, int, float)): + revision_date = format_datetime( + self.revision_date, + 'yyyy-MM-dd HH:mmZ', + locale='en', + ) + else: + revision_date = self.revision_date + + language_team = self.language_team + if self.locale_identifier and 'LANGUAGE' in language_team: + language_team = language_team.replace('LANGUAGE', str(self.locale_identifier)) + + headers: list[tuple[str, str]] = [ + ("Project-Id-Version", f"{self.project} {self.version}"), + ('Report-Msgid-Bugs-To', self.msgid_bugs_address), + ('POT-Creation-Date', format_datetime(self.creation_date, 'yyyy-MM-dd HH:mmZ', locale='en')), + ('PO-Revision-Date', revision_date), + ('Last-Translator', self.last_translator), + ] # fmt: skip + if self.locale_identifier: + headers.append(('Language', str(self.locale_identifier))) + headers.append(('Language-Team', language_team)) + if self.locale is not None: + headers.append(('Plural-Forms', self.plural_forms)) + headers += [ + ('MIME-Version', '1.0'), + ("Content-Type", f"text/plain; charset={self.charset}"), + ('Content-Transfer-Encoding', '8bit'), + ("Generated-By", f"Babel {VERSION}\n"), + ] + return headers + + def _set_mime_headers(self, headers: Iterable[tuple[str, str]]) -> None: + for name, value in headers: + name = _force_text(name.lower(), encoding=self.charset) + value = _force_text(value, encoding=self.charset) + if name == 'project-id-version': + parts = value.split(' ') + self.project = ' '.join(parts[:-1]) + self.version = parts[-1] + elif name == 'report-msgid-bugs-to': + self.msgid_bugs_address = value + elif name == 'last-translator': + self.last_translator = value + elif name == 'language': + value = value.replace('-', '_') + # The `or None` makes sure that the locale is set to None + # if the header's value is an empty string, which is what + # some tools generate (instead of eliding the empty Language + # header altogether). + self._set_locale(value or None) + elif name == 'language-team': + self.language_team = value + elif name == 'content-type': + params = parse_separated_header(value) + if 'charset' in params: + self.charset = params['charset'].lower() + elif name == 'plural-forms': + params = parse_separated_header(f" ;{value}") + self._num_plurals = int(params.get('nplurals', 2)) + self._plural_expr = params.get('plural', '(n != 1)') + elif name == 'pot-creation-date': + self.creation_date = _parse_datetime_header(value) + elif name == 'po-revision-date': + # Keep the value if it's not the default one + if 'YEAR' not in value: + self.revision_date = _parse_datetime_header(value) + + mime_headers = property( + _get_mime_headers, + _set_mime_headers, + doc="""\ + The MIME headers of the catalog, used for the special ``msgid ""`` entry. + + The behavior of this property changes slightly depending on whether a locale + is set or not, the latter indicating that the catalog is actually a template + for actual translations. + + Here's an example of the output for such a catalog template: + + >>> from babel.dates import UTC + >>> from datetime import datetime + >>> created = datetime(1990, 4, 1, 15, 30, tzinfo=UTC) + >>> catalog = Catalog(project='Foobar', version='1.0', + ... creation_date=created) + >>> for name, value in catalog.mime_headers: + ... print('%s: %s' % (name, value)) + Project-Id-Version: Foobar 1.0 + Report-Msgid-Bugs-To: EMAIL@ADDRESS + POT-Creation-Date: 1990-04-01 15:30+0000 + PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE + Last-Translator: FULL NAME + Language-Team: LANGUAGE + MIME-Version: 1.0 + Content-Type: text/plain; charset=utf-8 + Content-Transfer-Encoding: 8bit + Generated-By: Babel ... + + And here's an example of the output when the locale is set: + + >>> revised = datetime(1990, 8, 3, 12, 0, tzinfo=UTC) + >>> catalog = Catalog(locale='de_DE', project='Foobar', version='1.0', + ... creation_date=created, revision_date=revised, + ... last_translator='John Doe ', + ... language_team='de_DE ') + >>> for name, value in catalog.mime_headers: + ... print('%s: %s' % (name, value)) + Project-Id-Version: Foobar 1.0 + Report-Msgid-Bugs-To: EMAIL@ADDRESS + POT-Creation-Date: 1990-04-01 15:30+0000 + PO-Revision-Date: 1990-08-03 12:00+0000 + Last-Translator: John Doe + Language: de_DE + Language-Team: de_DE + Plural-Forms: nplurals=2; plural=(n != 1); + MIME-Version: 1.0 + Content-Type: text/plain; charset=utf-8 + Content-Transfer-Encoding: 8bit + Generated-By: Babel ... + + :type: `list` + """, + ) + + @property + def num_plurals(self) -> int: + """The number of plurals used by the catalog or locale. + + >>> Catalog(locale='en').num_plurals + 2 + >>> Catalog(locale='ga').num_plurals + 5 + + :type: `int`""" + if self._num_plurals is None: + num = 2 + if self.locale: + num = get_plural(self.locale)[0] + self._num_plurals = num + return self._num_plurals + + @property + def plural_expr(self) -> str: + """The plural expression used by the catalog or locale. + + >>> Catalog(locale='en').plural_expr + '(n != 1)' + >>> Catalog(locale='ga').plural_expr + '(n==1 ? 0 : n==2 ? 1 : n>=3 && n<=6 ? 2 : n>=7 && n<=10 ? 3 : 4)' + >>> Catalog(locale='ding').plural_expr # unknown locale + '(n != 1)' + + :type: `str`""" + if self._plural_expr is None: + expr = '(n != 1)' + if self.locale: + expr = get_plural(self.locale)[1] + self._plural_expr = expr + return self._plural_expr + + @property + def plural_forms(self) -> str: + """Return the plural forms declaration for the locale. + + >>> Catalog(locale='en').plural_forms + 'nplurals=2; plural=(n != 1);' + >>> Catalog(locale='pt_BR').plural_forms + 'nplurals=2; plural=(n > 1);' + + :type: `str`""" + return f"nplurals={self.num_plurals}; plural={self.plural_expr};" + + def __contains__(self, id: _MessageID) -> bool: + """Return whether the catalog has a message with the specified ID.""" + return self._key_for(id) in self._messages + + def __len__(self) -> int: + """The number of messages in the catalog. + + This does not include the special ``msgid ""`` entry.""" + return len(self._messages) + + def __iter__(self) -> Iterator[Message]: + """Iterates through all the entries in the catalog, in the order they + were added, yielding a `Message` object for every entry. + + :rtype: ``iterator``""" + buf = [] + for name, value in self.mime_headers: + buf.append(f"{name}: {value}") + flags = set() + if self.fuzzy: + flags |= {'fuzzy'} + yield Message('', '\n'.join(buf), flags=flags) + for key in self._messages: + yield self._messages[key] + + def __repr__(self) -> str: + locale = '' + if self.locale: + locale = f" {self.locale}" + return f"<{type(self).__name__} {self.domain!r}{locale}>" + + def __delitem__(self, id: _MessageID) -> None: + """Delete the message with the specified ID.""" + self.delete(id) + + def __getitem__(self, id: _MessageID) -> Message: + """Return the message with the specified ID. + + :param id: the message ID + """ + return self.get(id) + + def __setitem__(self, id: _MessageID, message: Message) -> None: + """Add or update the message with the specified ID. + + >>> catalog = Catalog() + >>> catalog['foo'] = Message('foo') + >>> catalog['foo'] + + + If a message with that ID is already in the catalog, it is updated + to include the locations and flags of the new message. + + >>> catalog = Catalog() + >>> catalog['foo'] = Message('foo', locations=[('main.py', 1)]) + >>> catalog['foo'].locations + [('main.py', 1)] + >>> catalog['foo'] = Message('foo', locations=[('utils.py', 5)]) + >>> catalog['foo'].locations + [('main.py', 1), ('utils.py', 5)] + + :param id: the message ID + :param message: the `Message` object + """ + assert isinstance(message, Message), 'expected a Message object' + key = self._key_for(id, message.context) + current = self._messages.get(key) + if current: + if message.pluralizable and not current.pluralizable: + # The new message adds pluralization + current.id = message.id + current.string = message.string + current.locations = list(dict.fromkeys([*current.locations, *message.locations])) + current.auto_comments = list(dict.fromkeys([*current.auto_comments, *message.auto_comments])) # fmt:skip + current.user_comments = list(dict.fromkeys([*current.user_comments, *message.user_comments])) # fmt:skip + current.flags |= message.flags + elif id == '': + # special treatment for the header message + self.mime_headers = message_from_string(message.string).items() + self.header_comment = "\n".join(f"# {c}".rstrip() for c in message.user_comments) + self.fuzzy = message.fuzzy + else: + if isinstance(id, (list, tuple)): + assert isinstance(message.string, (list, tuple)), ( + f"Expected sequence but got {type(message.string)}" + ) + self._messages[key] = message + + def add( + self, + id: _MessageID, + string: _MessageID | None = None, + locations: Iterable[tuple[str, int]] = (), + flags: Iterable[str] = (), + auto_comments: Iterable[str] = (), + user_comments: Iterable[str] = (), + previous_id: _MessageID = (), + lineno: int | None = None, + context: str | None = None, + ) -> Message: + """Add or update the message with the specified ID. + + >>> catalog = Catalog() + >>> catalog.add('foo') + + >>> catalog['foo'] + + + This method simply constructs a `Message` object with the given + arguments and invokes `__setitem__` with that object. + + :param id: the message ID, or a ``(singular, plural)`` tuple for + pluralizable messages + :param string: the translated message string, or a + ``(singular, plural)`` tuple for pluralizable messages + :param locations: a sequence of ``(filename, lineno)`` tuples + :param flags: a set or sequence of flags + :param auto_comments: a sequence of automatic comments + :param user_comments: a sequence of user comments + :param previous_id: the previous message ID, or a ``(singular, plural)`` + tuple for pluralizable messages + :param lineno: the line number on which the msgid line was found in the + PO file, if any + :param context: the message context + """ + message = Message( + id, + string, + list(locations), + flags, + auto_comments, + user_comments, + previous_id, + lineno=lineno, + context=context, + ) + self[id] = message + return message + + def check(self) -> Iterable[tuple[Message, list[TranslationError]]]: + """Run various validation checks on the translations in the catalog. + + For every message which fails validation, this method yield a + ``(message, errors)`` tuple, where ``message`` is the `Message` object + and ``errors`` is a sequence of `TranslationError` objects. + + :rtype: ``generator`` of ``(message, errors)`` + """ + for message in self._messages.values(): + errors = message.check(catalog=self) + if errors: + yield message, errors + + def get(self, id: _MessageID, context: str | None = None) -> Message | None: + """Return the message with the specified ID and context. + + :param id: the message ID + :param context: the message context, or ``None`` for no context + """ + return self._messages.get(self._key_for(id, context)) + + def delete(self, id: _MessageID, context: str | None = None) -> None: + """Delete the message with the specified ID and context. + + :param id: the message ID + :param context: the message context, or ``None`` for no context + """ + key = self._key_for(id, context) + if key in self._messages: + del self._messages[key] + + def update( + self, + template: Catalog, + no_fuzzy_matching: bool = False, + update_header_comment: bool = False, + keep_user_comments: bool = True, + update_creation_date: bool = True, + ) -> None: + """Update the catalog based on the given template catalog. + + >>> from babel.messages import Catalog + >>> template = Catalog() + >>> template.add('green', locations=[('main.py', 99)]) + + >>> template.add('blue', locations=[('main.py', 100)]) + + >>> template.add(('salad', 'salads'), locations=[('util.py', 42)]) + + >>> catalog = Catalog(locale='de_DE') + >>> catalog.add('blue', 'blau', locations=[('main.py', 98)]) + + >>> catalog.add('head', 'Kopf', locations=[('util.py', 33)]) + + >>> catalog.add(('salad', 'salads'), ('Salat', 'Salate'), + ... locations=[('util.py', 38)]) + + + >>> catalog.update(template) + >>> len(catalog) + 3 + + >>> msg1 = catalog['green'] + >>> msg1.string + >>> msg1.locations + [('main.py', 99)] + + >>> msg2 = catalog['blue'] + >>> msg2.string + 'blau' + >>> msg2.locations + [('main.py', 100)] + + >>> msg3 = catalog['salad'] + >>> msg3.string + ('Salat', 'Salate') + >>> msg3.locations + [('util.py', 42)] + + Messages that are in the catalog but not in the template are removed + from the main collection, but can still be accessed via the `obsolete` + member: + + >>> 'head' in catalog + False + >>> list(catalog.obsolete.values()) + [] + + :param template: the reference catalog, usually read from a POT file + :param no_fuzzy_matching: whether to use fuzzy matching of message IDs + :param update_header_comment: whether to copy the header comment from the template + :param keep_user_comments: whether to keep user comments from the old catalog + :param update_creation_date: whether to copy the creation date from the template + """ + messages = self._messages + remaining = messages.copy() + self._messages = {} + + # Prepare for fuzzy matching + fuzzy_candidates = {} + if not no_fuzzy_matching: + for msgid in messages: + if msgid and messages[msgid].string: + key = self._key_for(msgid) + ctxt = messages[msgid].context + fuzzy_candidates[self._to_fuzzy_match_key(key)] = (key, ctxt) + fuzzy_matches = set() + + def _merge( + message: Message, + oldkey: tuple[str, str] | str, + newkey: tuple[str, str] | str, + ) -> None: + message = message.clone() + fuzzy = False + if oldkey != newkey: + fuzzy = True + fuzzy_matches.add(oldkey) + oldmsg = messages.get(oldkey) + assert oldmsg is not None + if isinstance(oldmsg.id, str): + message.previous_id = [oldmsg.id] + else: + message.previous_id = list(oldmsg.id) + else: + oldmsg = remaining.pop(oldkey, None) + assert oldmsg is not None + message.string = oldmsg.string + + if keep_user_comments and oldmsg.user_comments: + message.user_comments = list(dict.fromkeys(oldmsg.user_comments)) + + if isinstance(message.id, (list, tuple)): + if not isinstance(message.string, (list, tuple)): + fuzzy = True + message.string = tuple( + [message.string] + ([''] * (len(message.id) - 1)), + ) + elif len(message.string) != self.num_plurals: + fuzzy = True + message.string = tuple(message.string[: len(oldmsg.string)]) + elif isinstance(message.string, (list, tuple)): + fuzzy = True + message.string = message.string[0] + message.flags |= oldmsg.flags + if fuzzy: + message.flags |= {'fuzzy'} + self[message.id] = message + + for message in template: + if message.id: + key = self._key_for(message.id, message.context) + if key in messages: + _merge(message, key, key) + else: + if not no_fuzzy_matching: + # do some fuzzy matching with difflib + matches = get_close_matches( + self._to_fuzzy_match_key(key), + fuzzy_candidates.keys(), + 1, + ) + if matches: + modified_key = matches[0] + newkey, newctxt = fuzzy_candidates[modified_key] + if newctxt is not None: + newkey = newkey, newctxt + _merge(message, newkey, key) + continue + + self[message.id] = message + + for msgid in remaining: + if no_fuzzy_matching or msgid not in fuzzy_matches: + self.obsolete[msgid] = remaining[msgid] + + if update_header_comment: + # Allow the updated catalog's header to be rewritten based on the + # template's header + self.header_comment = template.header_comment + + # Make updated catalog's POT-Creation-Date equal to the template + # used to update the catalog + if update_creation_date: + self.creation_date = template.creation_date + + def _to_fuzzy_match_key(self, key: tuple[str, str] | str) -> str: + """Converts a message key to a string suitable for fuzzy matching.""" + if isinstance(key, tuple): + matchkey = key[0] # just the msgid, no context + else: + matchkey = key + return matchkey.lower().strip() + + def _key_for( + self, + id: _MessageID, + context: str | None = None, + ) -> tuple[str, str] | str: + """The key for a message is just the singular ID even for pluralizable + messages, but is a ``(msgid, msgctxt)`` tuple for context-specific + messages. + """ + key = id + if isinstance(key, (list, tuple)): + key = id[0] + if context is not None: + key = (key, context) + return key + + def is_identical(self, other: Catalog) -> bool: + """Checks if catalogs are identical, taking into account messages and + headers. + """ + assert isinstance(other, Catalog) + for key in self._messages.keys() | other._messages.keys(): + message_1 = self.get(key) + message_2 = other.get(key) + if message_1 is None or message_2 is None or not message_1.is_identical(message_2): + return False + return dict(self.mime_headers) == dict(other.mime_headers) diff --git a/micromamba_root/Lib/site-packages/babel/messages/checkers.py b/micromamba_root/Lib/site-packages/babel/messages/checkers.py new file mode 100644 index 0000000000000000000000000000000000000000..4026ab1b3274deead5cf3fce2a31ea647991cf54 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/checkers.py @@ -0,0 +1,176 @@ +""" +babel.messages.checkers +~~~~~~~~~~~~~~~~~~~~~~~ + +Various routines that help with validation of translations. + +:since: version 0.9 + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from __future__ import annotations + +from collections.abc import Callable + +from babel.messages.catalog import PYTHON_FORMAT, Catalog, Message, TranslationError + +#: list of format chars that are compatible to each other +_string_format_compatibilities = [ + {'i', 'd', 'u'}, + {'x', 'X'}, + {'f', 'F', 'g', 'G'}, +] + + +def num_plurals(catalog: Catalog | None, message: Message) -> None: + """Verify the number of plurals in the translation.""" + if not message.pluralizable: + if not isinstance(message.string, str): + raise TranslationError("Found plural forms for non-pluralizable message") + return + + # skip further tests if no catalog is provided. + elif catalog is None: + return + + msgstrs = message.string + if not isinstance(msgstrs, (list, tuple)): + msgstrs = (msgstrs,) + if len(msgstrs) != catalog.num_plurals: + raise TranslationError( + f"Wrong number of plural forms (expected {catalog.num_plurals})", + ) + + +def python_format(catalog: Catalog | None, message: Message) -> None: + """Verify the format string placeholders in the translation.""" + if 'python-format' not in message.flags: + return + msgids = message.id + if not isinstance(msgids, (list, tuple)): + msgids = (msgids,) + msgstrs = message.string + if not isinstance(msgstrs, (list, tuple)): + msgstrs = (msgstrs,) + + if msgstrs[0]: + _validate_format(msgids[0], msgstrs[0]) + if message.pluralizable: + for msgstr in msgstrs[1:]: + if msgstr: + _validate_format(msgids[1], msgstr) + + +def _validate_format(format: str, alternative: str) -> None: + """Test format string `alternative` against `format`. `format` can be the + msgid of a message and `alternative` one of the `msgstr`\\s. The two + arguments are not interchangeable as `alternative` may contain less + placeholders if `format` uses named placeholders. + + If the string formatting of `alternative` is compatible to `format` the + function returns `None`, otherwise a `TranslationError` is raised. + + Examples for compatible format strings: + + >>> _validate_format('Hello %s!', 'Hallo %s!') + >>> _validate_format('Hello %i!', 'Hallo %d!') + + Example for an incompatible format strings: + + >>> _validate_format('Hello %(name)s!', 'Hallo %s!') + Traceback (most recent call last): + ... + TranslationError: the format strings are of different kinds + + This function is used by the `python_format` checker. + + :param format: The original format string + :param alternative: The alternative format string that should be checked + against format + :raises TranslationError: on formatting errors + """ + + def _parse(string: str) -> list[tuple[str, str]]: + result: list[tuple[str, str]] = [] + for match in PYTHON_FORMAT.finditer(string): + name, format, typechar = match.groups() + if typechar == '%' and name is None: + continue + result.append((name, str(typechar))) + return result + + def _compatible(a: str, b: str) -> bool: + if a == b: + return True + for set in _string_format_compatibilities: + if a in set and b in set: + return True + return False + + def _check_positional(results: list[tuple[str, str]]) -> bool: + positional = None + for name, _char in results: + if positional is None: + positional = name is None + else: + if (name is None) != positional: + raise TranslationError( + 'format string mixes positional and named placeholders', + ) + return bool(positional) + + a = _parse(format) + b = _parse(alternative) + + if not a: + return + + # now check if both strings are positional or named + a_positional = _check_positional(a) + b_positional = _check_positional(b) + if a_positional and not b_positional and not b: + raise TranslationError('placeholders are incompatible') + elif a_positional != b_positional: + raise TranslationError('the format strings are of different kinds') + + # if we are operating on positional strings both must have the + # same number of format chars and those must be compatible + if a_positional: + if len(a) != len(b): + raise TranslationError('positional format placeholders are unbalanced') + for idx, ((_, first), (_, second)) in enumerate(zip(a, b)): + if not _compatible(first, second): + raise TranslationError( + f'incompatible format for placeholder {idx + 1:d}: ' + f'{first!r} and {second!r} are not compatible', + ) + + # otherwise the second string must not have names the first one + # doesn't have and the types of those included must be compatible + else: + type_map = dict(a) + for name, typechar in b: + if name not in type_map: + raise TranslationError(f'unknown named placeholder {name!r}') + elif not _compatible(typechar, type_map[name]): + raise TranslationError( + f'incompatible format for placeholder {name!r}: ' + f'{typechar!r} and {type_map[name]!r} are not compatible', + ) + + +def _find_checkers() -> list[Callable[[Catalog | None, Message], object]]: + from babel.messages._compat import find_entrypoints + + checkers: list[Callable[[Catalog | None, Message], object]] = [] + checkers.extend(load() for (name, load) in find_entrypoints('babel.checkers')) + if len(checkers) == 0: + # if entrypoints are not available or no usable egg-info was found + # (see #230), just resort to hard-coded checkers + return [num_plurals, python_format] + return checkers + + +checkers: list[Callable[[Catalog | None, Message], object]] = _find_checkers() diff --git a/micromamba_root/Lib/site-packages/babel/messages/extract.py b/micromamba_root/Lib/site-packages/babel/messages/extract.py new file mode 100644 index 0000000000000000000000000000000000000000..6fad84304066521c225e26adc8a04a712ec63479 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/extract.py @@ -0,0 +1,943 @@ +""" +babel.messages.extract +~~~~~~~~~~~~~~~~~~~~~~ + +Basic infrastructure for extracting localizable messages from source files. + +This module defines an extensible system for collecting localizable message +strings from a variety of sources. A native extractor for Python source +files is builtin, extractors for other sources can be added using very +simple plugins. + +The main entry points into the extraction functionality are the functions +`extract_from_dir` and `extract_from_file`. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from __future__ import annotations + +import ast +import io +import os +import sys +import tokenize +import warnings +from collections.abc import ( + Callable, + Collection, + Generator, + Iterable, + Mapping, + MutableSequence, +) +from functools import lru_cache +from os.path import relpath +from textwrap import dedent +from tokenize import COMMENT, NAME, NL, OP, STRING, generate_tokens +from typing import TYPE_CHECKING, Any, TypedDict + +from babel.messages._compat import find_entrypoints +from babel.util import parse_encoding, parse_future_flags, pathmatch + +if TYPE_CHECKING: + from typing import IO, Final, Protocol + + from _typeshed import SupportsItems, SupportsRead, SupportsReadline + from typing_extensions import TypeAlias + + class _PyOptions(TypedDict, total=False): + encoding: str + + class _JSOptions(TypedDict, total=False): + encoding: str + jsx: bool + template_string: bool + parse_template_string: bool + + class _FileObj(SupportsRead[bytes], SupportsReadline[bytes], Protocol): + def seek(self, __offset: int, __whence: int = ...) -> int: ... + def tell(self) -> int: ... + + _SimpleKeyword: TypeAlias = tuple[int | tuple[int, int] | tuple[int, str], ...] | None + _Keyword: TypeAlias = dict[int | None, _SimpleKeyword] | _SimpleKeyword + + # 5-tuple of (filename, lineno, messages, comments, context) + _FileExtractionResult: TypeAlias = tuple[str, int, str | tuple[str, ...], list[str], str | None] # fmt: skip + + # 4-tuple of (lineno, message, comments, context) + _ExtractionResult: TypeAlias = tuple[int, str | tuple[str, ...], list[str], str | None] + + # Required arguments: fileobj, keywords, comment_tags, options + # Return value: Iterable of (lineno, message, comments, context) + _CallableExtractionMethod: TypeAlias = Callable[ + [_FileObj | IO[bytes], Mapping[str, _Keyword], Collection[str], Mapping[str, Any]], + Iterable[_ExtractionResult], + ] # fmt: skip + + _ExtractionMethod: TypeAlias = _CallableExtractionMethod | str + +GROUP_NAME: Final[str] = 'babel.extractors' + +DEFAULT_KEYWORDS: dict[str, _Keyword] = { + '_': None, + 'gettext': None, + 'ngettext': (1, 2), + 'ugettext': None, + 'ungettext': (1, 2), + 'dgettext': (2,), + 'dngettext': (2, 3), + 'dpgettext': ((2, 'c'), 3), + 'N_': None, + 'pgettext': ((1, 'c'), 2), + 'npgettext': ((1, 'c'), 2, 3), + 'dnpgettext': ((2, 'c'), 3, 4), +} + +DEFAULT_MAPPING: list[tuple[str, str]] = [('**.py', 'python')] + +# New tokens in Python 3.12, or None on older versions +FSTRING_START = getattr(tokenize, "FSTRING_START", None) +FSTRING_MIDDLE = getattr(tokenize, "FSTRING_MIDDLE", None) +FSTRING_END = getattr(tokenize, "FSTRING_END", None) + + +def _strip_comment_tags(comments: MutableSequence[str], tags: Iterable[str]): + """Helper function for `extract` that strips comment tags from strings + in a list of comment lines. This functions operates in-place. + """ + + def _strip(line: str): + for tag in tags: + if line.startswith(tag): + return line[len(tag) :].strip() + return line + + comments[:] = [_strip(c) for c in comments] + + +def _make_default_directory_filter( + method_map: Iterable[tuple[str, str]], + root_dir: str | os.PathLike[str], +): + method_map = tuple(method_map) + + def directory_filter(dirpath: str | os.PathLike[str]) -> bool: + subdir = os.path.basename(dirpath) + # Legacy default behavior: ignore dot and underscore directories + if subdir.startswith('.') or subdir.startswith('_'): + return False + + dir_rel = os.path.relpath(dirpath, root_dir).replace(os.sep, '/') + + for pattern, method in method_map: + if method == "ignore" and pathmatch(pattern, dir_rel): + return False + + return True + + return directory_filter + + +def default_directory_filter(dirpath: str | os.PathLike[str]) -> bool: # pragma: no cover + warnings.warn( + "`default_directory_filter` is deprecated and will be removed in a future version of Babel.", + DeprecationWarning, + stacklevel=2, + ) + subdir = os.path.basename(dirpath) + # Legacy default behavior: ignore dot and underscore directories + return not (subdir.startswith('.') or subdir.startswith('_')) + + +def extract_from_dir( + dirname: str | os.PathLike[str] | None = None, + method_map: Iterable[tuple[str, str]] = DEFAULT_MAPPING, + options_map: SupportsItems[str, dict[str, Any]] | None = None, + keywords: Mapping[str, _Keyword] = DEFAULT_KEYWORDS, + comment_tags: Collection[str] = (), + callback: Callable[[str, str, dict[str, Any]], object] | None = None, + strip_comment_tags: bool = False, + directory_filter: Callable[[str], bool] | None = None, +) -> Generator[_FileExtractionResult, None, None]: + """Extract messages from any source files found in the given directory. + + This function generates tuples of the form ``(filename, lineno, message, + comments, context)``. + + Which extraction method is used per file is determined by the `method_map` + parameter, which maps extended glob patterns to extraction method names. + For example, the following is the default mapping: + + >>> method_map = [ + ... ('**.py', 'python') + ... ] + + This basically says that files with the filename extension ".py" at any + level inside the directory should be processed by the "python" extraction + method. Files that don't match any of the mapping patterns are ignored. See + the documentation of the `pathmatch` function for details on the pattern + syntax. + + The following extended mapping would also use the "genshi" extraction + method on any file in "templates" subdirectory: + + >>> method_map = [ + ... ('**/templates/**.*', 'genshi'), + ... ('**.py', 'python') + ... ] + + The dictionary provided by the optional `options_map` parameter augments + these mappings. It uses extended glob patterns as keys, and the values are + dictionaries mapping options names to option values (both strings). + + The glob patterns of the `options_map` do not necessarily need to be the + same as those used in the method mapping. For example, while all files in + the ``templates`` folders in an application may be Genshi applications, the + options for those files may differ based on extension: + + >>> options_map = { + ... '**/templates/**.txt': { + ... 'template_class': 'genshi.template:TextTemplate', + ... 'encoding': 'latin-1' + ... }, + ... '**/templates/**.html': { + ... 'include_attrs': '' + ... } + ... } + + :param dirname: the path to the directory to extract messages from. If + not given the current working directory is used. + :param method_map: a list of ``(pattern, method)`` tuples that maps of + extraction method names to extended glob patterns + :param options_map: a dictionary of additional options (optional) + :param keywords: a dictionary mapping keywords (i.e. names of functions + that should be recognized as translation functions) to + tuples that specify which of their arguments contain + localizable strings + :param comment_tags: a list of tags of translator comments to search for + and include in the results + :param callback: a function that is called for every file that message are + extracted from, just before the extraction itself is + performed; the function is passed the filename, the name + of the extraction method and and the options dictionary as + positional arguments, in that order + :param strip_comment_tags: a flag that if set to `True` causes all comment + tags to be removed from the collected comments. + :param directory_filter: a callback to determine whether a directory should + be recursed into. Receives the full directory path; + should return True if the directory is valid. + :see: `pathmatch` + """ + if dirname is None: + dirname = os.getcwd() + + if options_map is None: + options_map = {} + + dirname = os.path.abspath(dirname) + + if directory_filter is None: + directory_filter = _make_default_directory_filter( + method_map=method_map, + root_dir=dirname, + ) + + for root, dirnames, filenames in os.walk(dirname): + dirnames[:] = [ + subdir for subdir in dirnames if directory_filter(os.path.join(root, subdir)) + ] + dirnames.sort() + filenames.sort() + for filename in filenames: + filepath = os.path.join(root, filename).replace(os.sep, '/') + + yield from check_and_call_extract_file( + filepath, + method_map, + options_map, + callback, + keywords, + comment_tags, + strip_comment_tags, + dirpath=dirname, + ) + + +def check_and_call_extract_file( + filepath: str | os.PathLike[str], + method_map: Iterable[tuple[str, str]], + options_map: SupportsItems[str, dict[str, Any]], + callback: Callable[[str, str, dict[str, Any]], object] | None, + keywords: Mapping[str, _Keyword], + comment_tags: Collection[str], + strip_comment_tags: bool, + dirpath: str | os.PathLike[str] | None = None, +) -> Generator[_FileExtractionResult, None, None]: + """Checks if the given file matches an extraction method mapping, and if so, calls extract_from_file. + + Note that the extraction method mappings are based relative to dirpath. + So, given an absolute path to a file `filepath`, we want to check using + just the relative path from `dirpath` to `filepath`. + + Yields 5-tuples (filename, lineno, messages, comments, context). + + :param filepath: An absolute path to a file that exists. + :param method_map: a list of ``(pattern, method)`` tuples that maps of + extraction method names to extended glob patterns + :param options_map: a dictionary of additional options (optional) + :param callback: a function that is called for every file that message are + extracted from, just before the extraction itself is + performed; the function is passed the filename, the name + of the extraction method and and the options dictionary as + positional arguments, in that order + :param keywords: a dictionary mapping keywords (i.e. names of functions + that should be recognized as translation functions) to + tuples that specify which of their arguments contain + localizable strings + :param comment_tags: a list of tags of translator comments to search for + and include in the results + :param strip_comment_tags: a flag that if set to `True` causes all comment + tags to be removed from the collected comments. + :param dirpath: the path to the directory to extract messages from. + :return: iterable of 5-tuples (filename, lineno, messages, comments, context) + :rtype: Iterable[tuple[str, int, str|tuple[str], list[str], str|None] + """ + # filename is the relative path from dirpath to the actual file + filename = relpath(filepath, dirpath) + + for pattern, method in method_map: + if not pathmatch(pattern, filename): + continue + + options = {} + for opattern, odict in options_map.items(): + if pathmatch(opattern, filename): + options = odict + break + + # Merge keywords and comment_tags from per-format options if present. + file_keywords = keywords + file_comment_tags = comment_tags + if keywords_opt := options.get("keywords"): + if not isinstance(keywords_opt, dict): # pragma: no cover + raise TypeError( + f"The `keywords` option must be a dict of parsed keywords, not {keywords_opt!r}", + ) + file_keywords = {**keywords, **keywords_opt} + + if comments_opt := options.get("add_comments"): + if not isinstance(comments_opt, (list, tuple, set)): # pragma: no cover + raise TypeError( + f"The `add_comments` option must be a collection of comment tags, not {comments_opt!r}.", + ) + file_comment_tags = tuple(set(comment_tags) | set(comments_opt)) + + if callback: + callback(filename, method, options) + for message_tuple in extract_from_file( + method, + filepath, + keywords=file_keywords, + comment_tags=file_comment_tags, + options=options, + strip_comment_tags=strip_comment_tags, + ): + yield (filename, *message_tuple) + + break + + +def extract_from_file( + method: _ExtractionMethod, + filename: str | os.PathLike[str], + keywords: Mapping[str, _Keyword] = DEFAULT_KEYWORDS, + comment_tags: Collection[str] = (), + options: Mapping[str, Any] | None = None, + strip_comment_tags: bool = False, +) -> list[_ExtractionResult]: + """Extract messages from a specific file. + + This function returns a list of tuples of the form ``(lineno, message, comments, context)``. + + :param filename: the path to the file to extract messages from + :param method: a string specifying the extraction method (.e.g. "python") + :param keywords: a dictionary mapping keywords (i.e. names of functions + that should be recognized as translation functions) to + tuples that specify which of their arguments contain + localizable strings + :param comment_tags: a list of translator tags to search for and include + in the results + :param strip_comment_tags: a flag that if set to `True` causes all comment + tags to be removed from the collected comments. + :param options: a dictionary of additional options (optional) + :returns: list of tuples of the form ``(lineno, message, comments, context)`` + :rtype: list[tuple[int, str|tuple[str], list[str], str|None] + """ + if method == 'ignore': + return [] + + with open(filename, 'rb') as fileobj: + return list( + extract(method, fileobj, keywords, comment_tags, options, strip_comment_tags), + ) + + +def _match_messages_against_spec( + lineno: int, + messages: list[str | None], + comments: list[str], + fileobj: _FileObj, + spec: tuple[int | tuple[int, str], ...], +): + translatable = [] + context = None + + # last_index is 1 based like the keyword spec + last_index = len(messages) + for index in spec: + if isinstance(index, tuple): # (n, 'c') + context = messages[index[0] - 1] + continue + if last_index < index: + # Not enough arguments + return + message = messages[index - 1] + if message is None: + return + translatable.append(message) + + # keyword spec indexes are 1 based, therefore '-1' + if isinstance(spec[0], tuple): + # context-aware *gettext method + first_msg_index = spec[1] - 1 + else: + first_msg_index = spec[0] - 1 + # An empty string msgid isn't valid, emit a warning + if not messages[first_msg_index]: + filename = getattr(fileobj, "name", None) or "(unknown)" + sys.stderr.write( + f"{filename}:{lineno}: warning: Empty msgid. It is reserved by GNU gettext: gettext(\"\") " + f"returns the header entry with meta information, not the empty string.\n", + ) + return + + translatable = tuple(translatable) + if len(translatable) == 1: + translatable = translatable[0] + + return lineno, translatable, comments, context + + +@lru_cache(maxsize=None) +def _find_extractor(name: str): + for ep_name, load in find_entrypoints(GROUP_NAME): + if ep_name == name: + return load() + return None + + +def extract( + method: _ExtractionMethod, + fileobj: _FileObj, + keywords: Mapping[str, _Keyword] = DEFAULT_KEYWORDS, + comment_tags: Collection[str] = (), + options: Mapping[str, Any] | None = None, + strip_comment_tags: bool = False, +) -> Generator[_ExtractionResult, None, None]: + """Extract messages from the given file-like object using the specified + extraction method. + + This function returns tuples of the form ``(lineno, message, comments, context)``. + + The implementation dispatches the actual extraction to plugins, based on the + value of the ``method`` parameter. + + >>> source = b'''# foo module + ... def run(argv): + ... print(_('Hello, world!')) + ... ''' + + >>> from io import BytesIO + >>> for message in extract('python', BytesIO(source)): + ... print(message) + (3, 'Hello, world!', [], None) + + :param method: an extraction method (a callable), or + a string specifying the extraction method (.e.g. "python"); + if this is a simple name, the extraction function will be + looked up by entry point; if it is an explicit reference + to a function (of the form ``package.module:funcname`` or + ``package.module.funcname``), the corresponding function + will be imported and used + :param fileobj: the file-like object the messages should be extracted from + :param keywords: a dictionary mapping keywords (i.e. names of functions + that should be recognized as translation functions) to + tuples that specify which of their arguments contain + localizable strings + :param comment_tags: a list of translator tags to search for and include + in the results + :param options: a dictionary of additional options (optional) + :param strip_comment_tags: a flag that if set to `True` causes all comment + tags to be removed from the collected comments. + :raise ValueError: if the extraction method is not registered + :returns: iterable of tuples of the form ``(lineno, message, comments, context)`` + :rtype: Iterable[tuple[int, str|tuple[str], list[str], str|None] + """ + if callable(method): + func = method + elif ':' in method or '.' in method: + if ':' not in method: + lastdot = method.rfind('.') + module, attrname = method[:lastdot], method[lastdot + 1 :] + else: + module, attrname = method.split(':', 1) + func = getattr(__import__(module, {}, {}, [attrname]), attrname) + else: + func = _find_extractor(method) + if func is None: + # if no named entry point was found, + # we resort to looking up a builtin extractor + func = _BUILTIN_EXTRACTORS.get(method) + + if func is None: + raise ValueError(f"Unknown extraction method {method!r}") + + results = func(fileobj, keywords.keys(), comment_tags, options=options or {}) + + for lineno, funcname, messages, comments in results: + if not isinstance(messages, (list, tuple)): + messages = [messages] + if not messages: + continue + + specs = keywords[funcname] or None if funcname else None + # {None: x} may be collapsed into x for backwards compatibility. + if not isinstance(specs, dict): + specs = {None: specs} + + if strip_comment_tags: + _strip_comment_tags(comments, comment_tags) + + # None matches all arities. + for arity in (None, len(messages)): + try: + spec = specs[arity] + except KeyError: + continue + if spec is None: + spec = (1,) + result = _match_messages_against_spec(lineno, messages, comments, fileobj, spec) + if result is not None: + yield result + + +def extract_nothing( + fileobj: _FileObj, + keywords: Mapping[str, _Keyword], + comment_tags: Collection[str], + options: Mapping[str, Any], +) -> list[_ExtractionResult]: + """Pseudo extractor that does not actually extract anything, but simply + returns an empty list. + """ + return [] + + +def extract_python( + fileobj: IO[bytes], + keywords: Mapping[str, _Keyword], + comment_tags: Collection[str], + options: _PyOptions, +) -> Generator[_ExtractionResult, None, None]: + """Extract messages from Python source code. + + It returns an iterator yielding tuples in the following form ``(lineno, + funcname, message, comments)``. + + :param fileobj: the seekable, file-like object the messages should be + extracted from + :param keywords: a list of keywords (i.e. function names) that should be + recognized as translation functions + :param comment_tags: a list of translator tags to search for and include + in the results + :param options: a dictionary of additional options (optional) + :rtype: ``iterator`` + """ + funcname = lineno = message_lineno = None + call_stack = [] # line numbers of calls + buf = [] + messages = [] + translator_comments = [] + in_def = in_translator_comments = False + comment_tag = None + + encoding = parse_encoding(fileobj) or options.get('encoding', 'UTF-8') + future_flags = parse_future_flags(fileobj, encoding) + next_line = lambda: fileobj.readline().decode(encoding) + + tokens = generate_tokens(next_line) + + # Current prefix of a Python 3.12 (PEP 701) f-string, or None if we're not + # currently parsing one. + current_fstring_start = None + + for tok, value, (lineno, _), _, _ in tokens: + if not call_stack and tok == NAME and value in ('def', 'class'): + in_def = True + elif tok == OP and value == '(': + if in_def: + # Avoid false positives for declarations such as: + # def gettext(arg='message'): + in_def = False + continue + if funcname: + call_stack.append(lineno) + elif in_def and tok == OP and value == ':': + # End of a class definition without parens + in_def = False + continue + elif not call_stack and tok == COMMENT: + # Strip the comment token from the line + value = value[1:].strip() + if in_translator_comments and translator_comments[-1][0] == lineno - 1: + # We're already inside a translator comment, continue appending + translator_comments.append((lineno, value)) + continue + # If execution reaches this point, let's see if comment line + # starts with one of the comment tags + for comment_tag in comment_tags: + if value.startswith(comment_tag): + in_translator_comments = True + translator_comments.append((lineno, value)) + break + elif funcname and len(call_stack) == 1: + nested = tok == NAME and value in keywords + if (tok == OP and value == ')') or nested: + if buf: + messages.append(''.join(buf)) + del buf[:] + else: + messages.append(None) + + messages = tuple(messages) if len(messages) > 1 else messages[0] + + if translator_comments: + last_comment_lineno = translator_comments[-1][0] + if last_comment_lineno < min(message_lineno, call_stack[-1]) - 1: + # Comments don't apply unless they immediately + # precede the message, or the line where the parenthesis token + # to start this message's translation call is. + translator_comments.clear() + + yield ( + message_lineno, + funcname, + messages, + [comment[1] for comment in translator_comments], + ) + + funcname = lineno = message_lineno = None + call_stack.clear() + messages = [] + translator_comments = [] + in_translator_comments = False + if nested: + funcname = value + elif tok == STRING: + val = _parse_python_string(value, encoding, future_flags) + if val is not None: + if not message_lineno: + message_lineno = lineno + buf.append(val) + + # Python 3.12+, see https://peps.python.org/pep-0701/#new-tokens + elif tok == FSTRING_START: + current_fstring_start = value + if not message_lineno: + message_lineno = lineno + elif tok == FSTRING_MIDDLE: + if current_fstring_start is not None: + current_fstring_start += value + elif tok == FSTRING_END: + if current_fstring_start is not None: + fstring = current_fstring_start + value + val = _parse_python_string(fstring, encoding, future_flags) + if val is not None: + buf.append(val) + + elif tok == OP and value == ',': + if buf: + messages.append(''.join(buf)) + del buf[:] + else: + messages.append(None) + if translator_comments: + # We have translator comments, and since we're on a + # comma(,) user is allowed to break into a new line + # Let's increase the last comment's lineno in order + # for the comment to still be a valid one + old_lineno, old_comment = translator_comments.pop() + translator_comments.append((old_lineno + 1, old_comment)) + + elif tok != NL and not message_lineno: + message_lineno = lineno + elif len(call_stack) > 1 and tok == OP and value == ')': + call_stack.pop() + elif funcname and not call_stack: + funcname = None + elif tok == NAME and value in keywords: + funcname = value + + if current_fstring_start is not None and tok not in {FSTRING_START, FSTRING_MIDDLE}: + # In Python 3.12, tokens other than FSTRING_* mean the + # f-string is dynamic, so we don't wan't to extract it. + # And if it's FSTRING_END, we've already handled it above. + # Let's forget that we're in an f-string. + current_fstring_start = None + + +def _parse_python_string(value: str, encoding: str, future_flags: int) -> str | None: + # Unwrap quotes in a safe manner, maintaining the string's encoding + # https://sourceforge.net/tracker/?func=detail&atid=355470&aid=617979&group_id=5470 + code = compile( + f'# coding={str(encoding)}\n{value}', + '', + 'eval', + ast.PyCF_ONLY_AST | future_flags, + ) + if isinstance(code, ast.Expression): + body = code.body + if isinstance(body, ast.Constant): + return body.value + if isinstance(body, ast.JoinedStr): # f-string + if all(isinstance(node, ast.Constant) for node in body.values): + return ''.join(node.value for node in body.values) + # TODO: we could raise an error or warning when not all nodes are constants + return None + + +def extract_javascript( + fileobj: _FileObj, + keywords: Mapping[str, _Keyword], + comment_tags: Collection[str], + options: _JSOptions, + lineno: int = 1, +) -> Generator[_ExtractionResult, None, None]: + """Extract messages from JavaScript source code. + + :param fileobj: the seekable, file-like object the messages should be + extracted from + :param keywords: a list of keywords (i.e. function names) that should be + recognized as translation functions + :param comment_tags: a list of translator tags to search for and include + in the results + :param options: a dictionary of additional options (optional) + Supported options are: + * `jsx` -- set to false to disable JSX/E4X support. + * `template_string` -- if `True`, supports gettext(`key`) + * `parse_template_string` -- if `True` will parse the + contents of javascript + template strings. + :param lineno: line number offset (for parsing embedded fragments) + """ + from babel.messages.jslexer import Token, tokenize, unquote_string + + funcname = message_lineno = None + messages = [] + last_argument = None + translator_comments = [] + concatenate_next = False + encoding = options.get('encoding', 'utf-8') + last_token = None + call_stack = -1 + dotted = any('.' in kw for kw in keywords) + for token in tokenize( + fileobj.read().decode(encoding), + jsx=options.get("jsx", True), + template_string=options.get("template_string", True), + dotted=dotted, + lineno=lineno, + ): + if ( # Turn keyword`foo` expressions into keyword("foo") calls: + # have a keyword... + funcname + # and we've seen nothing after the keyword... + and (last_token and last_token.type == 'name') + # and this is a template string + and token.type == 'template_string' + ): + message_lineno = token.lineno + messages = [unquote_string(token.value)] + call_stack = 0 + token = Token('operator', ')', token.lineno) + + if ( + options.get('parse_template_string') + and not funcname + and token.type == 'template_string' + ): + yield from parse_template_string( + token.value, + keywords, + comment_tags, + options, + token.lineno, + ) + + elif token.type == 'operator' and token.value == '(': + if funcname: + message_lineno = token.lineno + call_stack += 1 + + elif call_stack == -1 and token.type == 'linecomment': + value = token.value[2:].strip() + if translator_comments and translator_comments[-1][0] == token.lineno - 1: + translator_comments.append((token.lineno, value)) + continue + + for comment_tag in comment_tags: + if value.startswith(comment_tag): + translator_comments.append((token.lineno, value.strip())) + break + + elif token.type == 'multilinecomment': + # only one multi-line comment may precede a translation + translator_comments = [] + value = token.value[2:-2].strip() + for comment_tag in comment_tags: + if value.startswith(comment_tag): + lines = value.splitlines() + if lines: + lines[0] = lines[0].strip() + lines[1:] = dedent('\n'.join(lines[1:])).splitlines() + for offset, line in enumerate(lines): + translator_comments.append((token.lineno + offset, line)) + break + + elif funcname and call_stack == 0: + if token.type == 'operator' and token.value == ')': + if last_argument is not None: + messages.append(last_argument) + if len(messages) > 1: + messages = tuple(messages) + elif messages: + messages = messages[0] + else: + messages = None + + # Comments don't apply unless they immediately precede the + # message + if translator_comments and translator_comments[-1][0] < message_lineno - 1: + translator_comments = [] + + if messages is not None: + yield ( + message_lineno, + funcname, + messages, + [comment[1] for comment in translator_comments], + ) + + funcname = message_lineno = last_argument = None + concatenate_next = False + translator_comments = [] + messages = [] + call_stack = -1 + + elif token.type in ('string', 'template_string'): + new_value = unquote_string(token.value) + if concatenate_next: + last_argument = (last_argument or '') + new_value + concatenate_next = False + else: + last_argument = new_value + + elif token.type == 'operator': + if token.value == ',': + if last_argument is not None: + messages.append(last_argument) + last_argument = None + else: + messages.append(None) + concatenate_next = False + elif token.value == '+': + concatenate_next = True + + elif call_stack > 0 and token.type == 'operator' and token.value == ')': + call_stack -= 1 + + elif funcname and call_stack == -1: + funcname = None + + elif ( + call_stack == -1 + and token.type == 'name' + and token.value in keywords + and ( + last_token is None + or last_token.type != 'name' + or last_token.value != 'function' + ) + ): + funcname = token.value + + last_token = token + + +def parse_template_string( + template_string: str, + keywords: Mapping[str, _Keyword], + comment_tags: Collection[str], + options: _JSOptions, + lineno: int = 1, +) -> Generator[_ExtractionResult, None, None]: + """Parse JavaScript template string. + + :param template_string: the template string to be parsed + :param keywords: a list of keywords (i.e. function names) that should be + recognized as translation functions + :param comment_tags: a list of translator tags to search for and include + in the results + :param options: a dictionary of additional options (optional) + :param lineno: starting line number (optional) + """ + from babel.messages.jslexer import line_re + + prev_character = None + level = 0 + inside_str = False + expression_contents = '' + for character in template_string[1:-1]: + if not inside_str and character in ('"', "'", '`'): + inside_str = character + elif inside_str == character and prev_character != r'\\': + inside_str = False + if level: + expression_contents += character + if not inside_str: + if character == '{' and prev_character == '$': + level += 1 + elif level and character == '}': + level -= 1 + if level == 0 and expression_contents: + expression_contents = expression_contents[0:-1] + fake_file_obj = io.BytesIO(expression_contents.encode()) + yield from extract_javascript( + fake_file_obj, + keywords, + comment_tags, + options, + lineno, + ) + lineno += len(line_re.findall(expression_contents)) + expression_contents = '' + prev_character = character + + +_BUILTIN_EXTRACTORS = { + 'ignore': extract_nothing, + 'python': extract_python, + 'javascript': extract_javascript, +} diff --git a/micromamba_root/Lib/site-packages/babel/messages/frontend.py b/micromamba_root/Lib/site-packages/babel/messages/frontend.py new file mode 100644 index 0000000000000000000000000000000000000000..f63dd9dedb09ce393ad9c3bd8a1a5955444f7eff --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/frontend.py @@ -0,0 +1,1321 @@ +""" +babel.messages.frontend +~~~~~~~~~~~~~~~~~~~~~~~ + +Frontends for the message extraction functionality. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from __future__ import annotations + +import datetime +import fnmatch +import logging +import optparse +import os +import pathlib +import re +import shutil +import sys +import tempfile +import warnings +from configparser import RawConfigParser +from io import StringIO +from typing import Any, BinaryIO, Iterable, Literal + +from babel import Locale, localedata +from babel import __version__ as VERSION +from babel.core import UnknownLocaleError +from babel.messages.catalog import DEFAULT_HEADER, Catalog +from babel.messages.extract import ( + DEFAULT_KEYWORDS, + DEFAULT_MAPPING, + check_and_call_extract_file, + extract_from_dir, +) +from babel.messages.mofile import write_mo +from babel.messages.pofile import read_po, write_po +from babel.util import LOCALTZ + +log = logging.getLogger('babel') + + +class BaseError(Exception): + pass + + +class OptionError(BaseError): + pass + + +class SetupError(BaseError): + pass + + +class ConfigurationError(BaseError): + """ + Raised for errors in configuration files. + """ + + +def listify_value(arg, split=None): + """ + Make a list out of an argument. + + Values from `distutils` argument parsing are always single strings; + values from `optparse` parsing may be lists of strings that may need + to be further split. + + No matter the input, this function returns a flat list of whitespace-trimmed + strings, with `None` values filtered out. + + >>> listify_value("foo bar") + ['foo', 'bar'] + >>> listify_value(["foo bar"]) + ['foo', 'bar'] + >>> listify_value([["foo"], "bar"]) + ['foo', 'bar'] + >>> listify_value([["foo"], ["bar", None, "foo"]]) + ['foo', 'bar', 'foo'] + >>> listify_value("foo, bar, quux", ",") + ['foo', 'bar', 'quux'] + + :param arg: A string or a list of strings + :param split: The argument to pass to `str.split()`. + :return: + """ + out = [] + + if not isinstance(arg, (list, tuple)): + arg = [arg] + + for val in arg: + if val is None: + continue + if isinstance(val, (list, tuple)): + out.extend(listify_value(val, split=split)) + continue + out.extend(s.strip() for s in str(val).split(split)) + assert all(isinstance(val, str) for val in out) + return out + + +class CommandMixin: + # This class is a small shim between Distutils commands and + # optparse option parsing in the frontend command line. + + #: Option name to be input as `args` on the script command line. + as_args = None + + #: Options which allow multiple values. + #: This is used by the `optparse` transmogrification code. + multiple_value_options = () + + #: Options which are booleans. + #: This is used by the `optparse` transmogrification code. + # (This is actually used by distutils code too, but is never + # declared in the base class.) + boolean_options = () + + #: Option aliases, to retain standalone command compatibility. + #: Distutils does not support option aliases, but optparse does. + #: This maps the distutils argument name to an iterable of aliases + #: that are usable with optparse. + option_aliases = {} + + #: Choices for options that needed to be restricted to specific + #: list of choices. + option_choices = {} + + #: Log object. To allow replacement in the script command line runner. + log = log + + def __init__(self, dist=None): + # A less strict version of distutils' `__init__`. + self.distribution = dist + self.initialize_options() + self._dry_run = None + self.verbose = False + self.force = None + self.help = 0 + self.finalized = 0 + + def initialize_options(self): + pass + + def ensure_finalized(self): + if not self.finalized: + self.finalize_options() + self.finalized = 1 + + def finalize_options(self): + raise RuntimeError( + f"abstract method -- subclass {self.__class__} must override", + ) + + +class CompileCatalog(CommandMixin): + description = 'compile message catalogs to binary MO files' + user_options = [ + ('domain=', 'D', + "domains of PO files (space separated list, default 'messages')"), + ('directory=', 'd', + 'path to base directory containing the catalogs'), + ('input-file=', 'i', + 'name of the input file'), + ('output-file=', 'o', + "name of the output file (default " + "'//LC_MESSAGES/.mo')"), + ('locale=', 'l', + 'locale of the catalog to compile'), + ('use-fuzzy', 'f', + 'also include fuzzy translations'), + ('statistics', None, + 'print statistics about translations'), + ] # fmt: skip + boolean_options = ['use-fuzzy', 'statistics'] + + def initialize_options(self): + self.domain = 'messages' + self.directory = None + self.input_file = None + self.output_file = None + self.locale = None + self.use_fuzzy = False + self.statistics = False + + def finalize_options(self): + self.domain = listify_value(self.domain) + if not self.input_file and not self.directory: + raise OptionError('you must specify either the input file or the base directory') + if not self.output_file and not self.directory: + raise OptionError('you must specify either the output file or the base directory') + + def run(self): + n_errors = 0 + for domain in self.domain: + for errors in self._run_domain(domain).values(): + n_errors += len(errors) + if n_errors: + self.log.error('%d errors encountered.', n_errors) + return 1 if n_errors else 0 + + def _get_po_mo_triples(self, domain: str): + if not self.input_file: + dir_path = pathlib.Path(self.directory) + if self.locale: + lc_messages_path = dir_path / self.locale / "LC_MESSAGES" + po_file = lc_messages_path / f"{domain}.po" + yield self.locale, po_file, po_file.with_suffix(".mo") + else: + for locale_path in dir_path.iterdir(): + po_file = locale_path / "LC_MESSAGES" / f"{domain}.po" + if po_file.exists(): + yield locale_path.name, po_file, po_file.with_suffix(".mo") + else: + po_file = pathlib.Path(self.input_file) + if self.output_file: + mo_file = pathlib.Path(self.output_file) + else: + mo_file = ( + pathlib.Path(self.directory) / self.locale / "LC_MESSAGES" / f"{domain}.mo" + ) + yield self.locale, po_file, mo_file + + def _run_domain(self, domain): + locale_po_mo_triples = list(self._get_po_mo_triples(domain)) + if not locale_po_mo_triples: + raise OptionError(f'no message catalogs found for domain {domain!r}') + + catalogs_and_errors = {} + + for locale, po_file, mo_file in locale_po_mo_triples: + with open(po_file, 'rb') as infile: + catalog = read_po(infile, locale) + + if self.statistics: + translated = 0 + for message in list(catalog)[1:]: + if message.string: + translated += 1 + percentage = 0 + if len(catalog): + percentage = translated * 100 // len(catalog) + self.log.info( + '%d of %d messages (%d%%) translated in %s', + translated, + len(catalog), + percentage, + po_file, + ) + + if catalog.fuzzy and not self.use_fuzzy: + self.log.info('catalog %s is marked as fuzzy, skipping', po_file) + continue + + catalogs_and_errors[catalog] = catalog_errors = list(catalog.check()) + for message, errors in catalog_errors: + for error in errors: + self.log.error('error: %s:%d: %s', po_file, message.lineno, error) + + self.log.info('compiling catalog %s to %s', po_file, mo_file) + + with open(mo_file, 'wb') as outfile: + write_mo(outfile, catalog, use_fuzzy=self.use_fuzzy) + + return catalogs_and_errors + + +def _make_directory_filter(ignore_patterns): + """ + Build a directory_filter function based on a list of ignore patterns. + """ + + def cli_directory_filter(dirname): + basename = os.path.basename(dirname) + return not any( + fnmatch.fnmatch(basename, ignore_pattern) for ignore_pattern in ignore_patterns + ) + + return cli_directory_filter + + +class ExtractMessages(CommandMixin): + description = 'extract localizable strings from the project code' + user_options = [ + ('charset=', None, + 'charset to use in the output file (default "utf-8")'), + ('keywords=', 'k', + 'space-separated list of keywords to look for in addition to the ' + 'defaults (may be repeated multiple times)'), + ('no-default-keywords', None, + 'do not include the default keywords'), + ('mapping-file=', 'F', + 'path to the mapping configuration file'), + ('no-location', None, + 'do not include location comments with filename and line number'), + ('add-location=', None, + 'location lines format. If it is not given or "full", it generates ' + 'the lines with both file name and line number. If it is "file", ' + 'the line number part is omitted. If it is "never", it completely ' + 'suppresses the lines (same as --no-location).'), + ('omit-header', None, + 'do not include msgid "" entry in header'), + ('output-file=', 'o', + 'name of the output file'), + ('width=', 'w', + 'set output line width (default 76)'), + ('no-wrap', None, + 'do not break long message lines, longer than the output line width, ' + 'into several lines'), + ('sort-output', None, + 'generate sorted output (default False)'), + ('sort-by-file', None, + 'sort output by file location (default False)'), + ('msgid-bugs-address=', None, + 'set report address for msgid'), + ('copyright-holder=', None, + 'set copyright holder in output'), + ('project=', None, + 'set project name in output'), + ('version=', None, + 'set project version in output'), + ('add-comments=', 'c', + 'place comment block with TAG (or those preceding keyword lines) in ' + 'output file. Separate multiple TAGs with commas(,)'), # TODO: Support repetition of this argument + ('strip-comments', 's', + 'strip the comment TAGs from the comments.'), + ('input-paths=', None, + 'files or directories that should be scanned for messages. Separate multiple ' + 'files or directories with commas(,)'), # TODO: Support repetition of this argument + ('input-dirs=', None, # TODO (3.x): Remove me. + 'alias for input-paths (does allow files as well as directories).'), + ('ignore-dirs=', None, + 'Patterns for directories to ignore when scanning for messages. ' + 'Separate multiple patterns with spaces (default ".* ._")'), + ('header-comment=', None, + 'header comment for the catalog'), + ('last-translator=', None, + 'set the name and email of the last translator in output'), + ] # fmt: skip + boolean_options = [ + 'no-default-keywords', + 'no-location', + 'omit-header', + 'no-wrap', + 'sort-output', + 'sort-by-file', + 'strip-comments', + ] + as_args = 'input-paths' + multiple_value_options = ( + 'add-comments', + 'keywords', + 'ignore-dirs', + ) + option_aliases = { + 'keywords': ('--keyword',), + 'mapping-file': ('--mapping',), + 'output-file': ('--output',), + 'strip-comments': ('--strip-comment-tags',), + 'last-translator': ('--last-translator',), + } + option_choices = { + 'add-location': ('full', 'file', 'never'), + } + + def initialize_options(self): + self.charset = 'utf-8' + self.keywords = None + self.no_default_keywords = False + self.mapping_file = None + self.no_location = False + self.add_location = None + self.omit_header = False + self.output_file = None + self.input_dirs = None + self.input_paths = None + self.width = None + self.no_wrap = False + self.sort_output = False + self.sort_by_file = False + self.msgid_bugs_address = None + self.copyright_holder = None + self.project = None + self.version = None + self.add_comments = None + self.strip_comments = False + self.include_lineno = True + self.ignore_dirs = None + self.header_comment = None + self.last_translator = None + + def finalize_options(self): + if self.input_dirs: + if not self.input_paths: + self.input_paths = self.input_dirs + else: + raise OptionError( + 'input-dirs and input-paths are mutually exclusive', + ) + + keywords = {} if self.no_default_keywords else DEFAULT_KEYWORDS.copy() + + keywords.update(parse_keywords(listify_value(self.keywords))) + + self.keywords = keywords + + if not self.keywords: + raise OptionError( + 'you must specify new keywords if you disable the default ones', + ) + + if not self.output_file: + raise OptionError('no output file specified') + if self.no_wrap and self.width: + raise OptionError( + "'--no-wrap' and '--width' are mutually exclusive", + ) + if not self.no_wrap and not self.width: + self.width = 76 + elif self.width is not None: + self.width = int(self.width) + + if self.sort_output and self.sort_by_file: + raise OptionError( + "'--sort-output' and '--sort-by-file' are mutually exclusive", + ) + + if self.input_paths: + if isinstance(self.input_paths, str): + self.input_paths = re.split(r',\s*', self.input_paths) + elif self.distribution is not None: + self.input_paths = list( + {k.split('.', 1)[0] for k in (self.distribution.packages or ())}, + ) + else: + self.input_paths = [] + + if not self.input_paths: + raise OptionError("no input files or directories specified") + + for path in self.input_paths: + if not os.path.exists(path): + raise OptionError(f"Input path: {path} does not exist") + + self.add_comments = listify_value(self.add_comments or (), ",") + + if self.distribution: + if not self.project: + self.project = self.distribution.get_name() + if not self.version: + self.version = self.distribution.get_version() + + if self.add_location == 'never': + self.no_location = True + elif self.add_location == 'file': + self.include_lineno = False + + ignore_dirs = listify_value(self.ignore_dirs) + if ignore_dirs: + self.directory_filter = _make_directory_filter(ignore_dirs) + else: + self.directory_filter = None + + def _build_callback(self, path: str): + def callback(filename: str, method: str, options: dict): + if method == 'ignore': + return + + # If we explicitly provide a full filepath, just use that. + # Otherwise, path will be the directory path and filename + # is the relative path from that dir to the file. + # So we can join those to get the full filepath. + if os.path.isfile(path): + filepath = path + else: + filepath = os.path.normpath(os.path.join(path, filename)) + + optstr = '' + if options: + opt_values = ", ".join(f'{k}="{v}"' for k, v in options.items()) + optstr = f" ({opt_values})" + self.log.info('extracting messages from %s%s', filepath, optstr) + + return callback + + def run(self): + mappings = self._get_mappings() + with open(self.output_file, 'wb') as outfile: + catalog = Catalog( + project=self.project, + version=self.version, + msgid_bugs_address=self.msgid_bugs_address, + copyright_holder=self.copyright_holder, + charset=self.charset, + header_comment=(self.header_comment or DEFAULT_HEADER), + last_translator=self.last_translator, + ) + + for path, method_map, options_map in mappings: + callback = self._build_callback(path) + if os.path.isfile(path): + current_dir = os.getcwd() + extracted = check_and_call_extract_file( + path, + method_map, + options_map, + callback=callback, + comment_tags=self.add_comments, + dirpath=current_dir, + keywords=self.keywords, + strip_comment_tags=self.strip_comments, + ) + else: + extracted = extract_from_dir( + path, + method_map, + options_map, + callback=callback, + comment_tags=self.add_comments, + directory_filter=self.directory_filter, + keywords=self.keywords, + strip_comment_tags=self.strip_comments, + ) + for filename, lineno, message, comments, context in extracted: + if os.path.isfile(path): + filepath = filename # already normalized + else: + filepath = os.path.normpath(os.path.join(path, filename)) + + catalog.add( + message, + None, + [(filepath, lineno)], + auto_comments=comments, + context=context, + ) + + self.log.info('writing PO template file to %s', self.output_file) + write_po( + outfile, + catalog, + include_lineno=self.include_lineno, + no_location=self.no_location, + omit_header=self.omit_header, + sort_by_file=self.sort_by_file, + sort_output=self.sort_output, + width=self.width, + ) + + def _get_mappings(self): + mappings = [] + + if self.mapping_file: + if self.mapping_file.endswith(".toml"): + with open(self.mapping_file, "rb") as fileobj: + file_style = ( + "pyproject.toml" + if os.path.basename(self.mapping_file) == "pyproject.toml" + else "standalone" + ) + method_map, options_map = _parse_mapping_toml( + fileobj, + filename=self.mapping_file, + style=file_style, + ) + else: + with open(self.mapping_file) as fileobj: + method_map, options_map = parse_mapping_cfg( + fileobj, + filename=self.mapping_file, + ) + for path in self.input_paths: + mappings.append((path, method_map, options_map)) + + elif getattr(self.distribution, 'message_extractors', None): + message_extractors = self.distribution.message_extractors + for path, mapping in message_extractors.items(): + if isinstance(mapping, str): + method_map, options_map = parse_mapping_cfg(StringIO(mapping)) + else: + method_map, options_map = [], {} + for pattern, method, options in mapping: + method_map.append((pattern, method)) + options_map[pattern] = _parse_string_options(options or {}) + mappings.append((path, method_map, options_map)) + + else: + for path in self.input_paths: + mappings.append((path, DEFAULT_MAPPING, {})) + + return mappings + + +def _init_catalog(*, input_file, output_file, locale: Locale, width: int) -> None: + with open(input_file, 'rb') as infile: + # Although reading from the catalog template, read_po must be fed + # the locale in order to correctly calculate plurals + catalog = read_po(infile, locale=locale) + + catalog.locale = locale + catalog.revision_date = datetime.datetime.now(LOCALTZ) + catalog.fuzzy = False + + if dirname := os.path.dirname(output_file): + os.makedirs(dirname, exist_ok=True) + + with open(output_file, 'wb') as outfile: + write_po(outfile, catalog, width=width) + + +class InitCatalog(CommandMixin): + description = 'create a new catalog based on a POT file' + user_options = [ + ('domain=', 'D', + "domain of PO file (default 'messages')"), + ('input-file=', 'i', + 'name of the input file'), + ('output-dir=', 'd', + 'path to output directory'), + ('output-file=', 'o', + "name of the output file (default " + "'//LC_MESSAGES/.po')"), + ('locale=', 'l', + 'locale for the new localized catalog'), + ('width=', 'w', + 'set output line width (default 76)'), + ('no-wrap', None, + 'do not break long message lines, longer than the output line width, ' + 'into several lines'), + ] # fmt: skip + boolean_options = ['no-wrap'] + + def initialize_options(self): + self.output_dir = None + self.output_file = None + self.input_file = None + self.locale = None + self.domain = 'messages' + self.no_wrap = False + self.width = None + + def finalize_options(self): + if not self.input_file: + raise OptionError('you must specify the input file') + + if not self.locale: + raise OptionError('you must provide a locale for the new catalog') + try: + self._locale = Locale.parse(self.locale) + except UnknownLocaleError as e: + raise OptionError(e) from e + + if not self.output_file and not self.output_dir: + raise OptionError('you must specify the output directory') + if not self.output_file: + lc_messages_path = pathlib.Path(self.output_dir) / self.locale / "LC_MESSAGES" + self.output_file = str(lc_messages_path / f"{self.domain}.po") + + if self.no_wrap and self.width: + raise OptionError("'--no-wrap' and '--width' are mutually exclusive") + if not self.no_wrap and not self.width: + self.width = 76 + elif self.width is not None: + self.width = int(self.width) + + def run(self): + self.log.info( + 'creating catalog %s based on %s', + self.output_file, + self.input_file, + ) + _init_catalog( + input_file=self.input_file, + output_file=self.output_file, + locale=self._locale, + width=self.width, + ) + + +class UpdateCatalog(CommandMixin): + description = 'update message catalogs from a POT file' + user_options = [ + ('domain=', 'D', + "domain of PO file (default 'messages')"), + ('input-file=', 'i', + 'name of the input file'), + ('output-dir=', 'd', + 'path to base directory containing the catalogs'), + ('output-file=', 'o', + "name of the output file (default " + "'//LC_MESSAGES/.po')"), + ('omit-header', None, + "do not include msgid "" entry in header"), + ('locale=', 'l', + 'locale of the catalog to compile'), + ('width=', 'w', + 'set output line width (default 76)'), + ('no-wrap', None, + 'do not break long message lines, longer than the output line width, ' + 'into several lines'), + ('ignore-obsolete=', None, + 'whether to omit obsolete messages from the output'), + ('init-missing=', None, + 'if any output files are missing, initialize them first'), + ('no-fuzzy-matching', 'N', + 'do not use fuzzy matching'), + ('update-header-comment', None, + 'update target header comment'), + ('previous', None, + 'keep previous msgids of translated messages'), + ('check=', None, + 'don\'t update the catalog, just return the status. Return code 0 ' + 'means nothing would change. Return code 1 means that the catalog ' + 'would be updated'), + ('ignore-pot-creation-date=', None, + 'ignore changes to POT-Creation-Date when updating or checking'), + ] # fmt: skip + boolean_options = [ + 'omit-header', + 'no-wrap', + 'ignore-obsolete', + 'init-missing', + 'no-fuzzy-matching', + 'previous', + 'update-header-comment', + 'check', + 'ignore-pot-creation-date', + ] + + def initialize_options(self): + self.domain = 'messages' + self.input_file = None + self.output_dir = None + self.output_file = None + self.omit_header = False + self.locale = None + self.width = None + self.no_wrap = False + self.ignore_obsolete = False + self.init_missing = False + self.no_fuzzy_matching = False + self.update_header_comment = False + self.previous = False + self.check = False + self.ignore_pot_creation_date = False + + def finalize_options(self): + if not self.input_file: + raise OptionError('you must specify the input file') + if not self.output_file and not self.output_dir: + raise OptionError('you must specify the output file or directory') + if self.output_file and not self.locale: + raise OptionError('you must specify the locale') + + if self.init_missing: + if not self.locale: + raise OptionError( + 'you must specify the locale for the init-missing option to work', + ) + + try: + self._locale = Locale.parse(self.locale) + except UnknownLocaleError as e: + raise OptionError(e) from e + else: + self._locale = None + + if self.no_wrap and self.width: + raise OptionError("'--no-wrap' and '--width' are mutually exclusive") + if not self.no_wrap and not self.width: + self.width = 76 + elif self.width is not None: + self.width = int(self.width) + if self.no_fuzzy_matching and self.previous: + self.previous = False + + def _get_locale_po_file_tuples(self): + if not self.output_file: + output_path = pathlib.Path(self.output_dir) + if self.locale: + lc_messages_path = output_path / self.locale / "LC_MESSAGES" + yield self.locale, str(lc_messages_path / f"{self.domain}.po") + else: + for locale_path in output_path.iterdir(): + po_file = locale_path / "LC_MESSAGES" / f"{self.domain}.po" + if po_file.exists(): + yield locale_path.stem, po_file + else: + yield self.locale, self.output_file + + def run(self): + domain = self.domain + if not domain: + domain = os.path.splitext(os.path.basename(self.input_file))[0] + + check_status = {} + locale_po_file_tuples = list(self._get_locale_po_file_tuples()) + + if not locale_po_file_tuples: + raise OptionError(f'no message catalogs found for domain {domain!r}') + + with open(self.input_file, 'rb') as infile: + template = read_po(infile) + + for locale, filename in locale_po_file_tuples: + if self.init_missing and not os.path.exists(filename): + if self.check: + check_status[filename] = False + continue + self.log.info( + 'creating catalog %s based on %s', + filename, + self.input_file, + ) + + _init_catalog( + input_file=self.input_file, + output_file=filename, + locale=self._locale, + width=self.width, + ) + + self.log.info('updating catalog %s based on %s', filename, self.input_file) + with open(filename, 'rb') as infile: + catalog = read_po(infile, locale=locale, domain=domain) + + catalog.update( + template, + no_fuzzy_matching=self.no_fuzzy_matching, + update_header_comment=self.update_header_comment, + update_creation_date=not self.ignore_pot_creation_date, + ) + + tmpname = os.path.join( + os.path.dirname(filename), + tempfile.gettempprefix() + os.path.basename(filename), + ) + try: + with open(tmpname, 'wb') as tmpfile: + write_po( + tmpfile, + catalog, + ignore_obsolete=self.ignore_obsolete, + include_previous=self.previous, + omit_header=self.omit_header, + width=self.width, + ) + except Exception: + os.remove(tmpname) + raise + + if self.check: + with open(filename, "rb") as origfile: + original_catalog = read_po(origfile) + with open(tmpname, "rb") as newfile: + updated_catalog = read_po(newfile) + updated_catalog.revision_date = original_catalog.revision_date + check_status[filename] = updated_catalog.is_identical(original_catalog) + os.remove(tmpname) + continue + + try: + os.rename(tmpname, filename) + except OSError: + # We're probably on Windows, which doesn't support atomic + # renames, at least not through Python + # If the error is in fact due to a permissions problem, that + # same error is going to be raised from one of the following + # operations + os.remove(filename) + shutil.copy(tmpname, filename) + os.remove(tmpname) + + if self.check: + for filename, up_to_date in check_status.items(): + if up_to_date: + self.log.info('Catalog %s is up to date.', filename) + else: + self.log.warning('Catalog %s is out of date.', filename) + if not all(check_status.values()): + raise BaseError("Some catalogs are out of date.") + else: + self.log.info("All the catalogs are up-to-date.") + return + + +class CommandLineInterface: + """Command-line interface. + + This class provides a simple command-line interface to the message + extraction and PO file generation functionality. + """ + + usage = '%%prog %s [options] %s' + version = f'%prog {VERSION}' + commands = { + 'compile': 'compile message catalogs to MO files', + 'extract': 'extract messages from source files and generate a POT file', + 'init': 'create new message catalogs from a POT file', + 'update': 'update existing message catalogs from a POT file', + } + + command_classes = { + 'compile': CompileCatalog, + 'extract': ExtractMessages, + 'init': InitCatalog, + 'update': UpdateCatalog, + } + + log = None # Replaced on instance level + + def run(self, argv=None): + """Main entry point of the command-line interface. + + :param argv: list of arguments passed on the command-line + """ + + if argv is None: + argv = sys.argv + + self.parser = optparse.OptionParser( + usage=self.usage % ('command', '[args]'), + version=self.version, + ) + self.parser.disable_interspersed_args() + self.parser.print_help = self._help + self.parser.add_option( + "--list-locales", + dest="list_locales", + action="store_true", + help="print all known locales and exit", + ) + self.parser.add_option( + "-v", + "--verbose", + action="store_const", + dest="loglevel", + const=logging.DEBUG, + help="print as much as possible", + ) + self.parser.add_option( + "-q", + "--quiet", + action="store_const", + dest="loglevel", + const=logging.ERROR, + help="print as little as possible", + ) + self.parser.set_defaults(list_locales=False, loglevel=logging.INFO) + + options, args = self.parser.parse_args(argv[1:]) + + self._configure_logging(options.loglevel) + if options.list_locales: + identifiers = localedata.locale_identifiers() + id_width = max(len(identifier) for identifier in identifiers) + 1 + for identifier in sorted(identifiers): + locale = Locale.parse(identifier) + print(f"{identifier:<{id_width}} {locale.english_name}") + return 0 + + if not args: + self.parser.error( + "no valid command or option passed. " + "Try the -h/--help option for more information.", + ) + + cmdname = args[0] + if cmdname not in self.commands: + self.parser.error(f'unknown command "{cmdname}"') + + cmdinst = self._configure_command(cmdname, args[1:]) + return cmdinst.run() + + def _configure_logging(self, loglevel): + self.log = log + self.log.setLevel(loglevel) + # Don't add a new handler for every instance initialization (#227), this + # would cause duplicated output when the CommandLineInterface as an + # normal Python class. + if self.log.handlers: + handler = self.log.handlers[0] + else: + handler = logging.StreamHandler() + self.log.addHandler(handler) + handler.setLevel(loglevel) + formatter = logging.Formatter('%(message)s') + handler.setFormatter(formatter) + + def _help(self): + print(self.parser.format_help()) + print("commands:") + cmd_width = max(8, max(len(command) for command in self.commands) + 1) + for name, description in sorted(self.commands.items()): + print(f" {name:<{cmd_width}} {description}") + + def _configure_command(self, cmdname, argv): + """ + :type cmdname: str + :type argv: list[str] + """ + cmdclass = self.command_classes[cmdname] + cmdinst = cmdclass() + if self.log: + cmdinst.log = self.log # Use our logger, not distutils'. + assert isinstance(cmdinst, CommandMixin) + cmdinst.initialize_options() + + parser = optparse.OptionParser( + usage=self.usage % (cmdname, ''), + description=self.commands[cmdname], + ) + as_args: str | None = getattr(cmdclass, "as_args", None) + for long, short, help in cmdclass.user_options: + name = long.strip("=") + default = getattr(cmdinst, name.replace("-", "_")) + strs = [f"--{name}"] + if short: + strs.append(f"-{short}") + strs.extend(cmdclass.option_aliases.get(name, ())) + choices = cmdclass.option_choices.get(name, None) + if name == as_args: + parser.usage += f"<{name}>" + elif name in cmdclass.boolean_options: + parser.add_option(*strs, action="store_true", help=help) + elif name in cmdclass.multiple_value_options: + parser.add_option(*strs, action="append", help=help, choices=choices) + else: + parser.add_option(*strs, help=help, default=default, choices=choices) + options, args = parser.parse_args(argv) + + if as_args: + setattr(options, as_args.replace('-', '_'), args) + + for key, value in vars(options).items(): + setattr(cmdinst, key, value) + + try: + cmdinst.ensure_finalized() + except OptionError as err: + parser.error(str(err)) + + return cmdinst + + +def main(): + return CommandLineInterface().run(sys.argv) + + +def parse_mapping(fileobj, filename=None): + warnings.warn( + "parse_mapping is deprecated, use parse_mapping_cfg instead", + DeprecationWarning, + stacklevel=2, + ) + return parse_mapping_cfg(fileobj, filename) + + +def parse_mapping_cfg(fileobj, filename=None): + """Parse an extraction method mapping from a file-like object. + + :param fileobj: a readable file-like object containing the configuration + text to parse + :param filename: the name of the file being parsed, for error messages + """ + extractors = {} + method_map = [] + options_map = {} + + parser = RawConfigParser() + parser.read_file(fileobj, filename) + + for section in parser.sections(): + if section == 'extractors': + extractors = dict(parser.items(section)) + else: + method, pattern = (part.strip() for part in section.split(':', 1)) + method_map.append((pattern, method)) + options_map[pattern] = _parse_string_options(dict(parser.items(section))) + + if extractors: + for idx, (pattern, method) in enumerate(method_map): + if method in extractors: + method = extractors[method] + method_map[idx] = (pattern, method) + + return method_map, options_map + + +def _parse_string_options(options: dict[str, str]) -> dict[str, Any]: + """ + Parse string-formatted options from a mapping configuration. + + The `keywords` and `add_comments` options are parsed into a canonical + internal format, so they can be merged with global keywords/comment tags + during extraction. + """ + options: dict[str, Any] = options.copy() + + if keywords_val := options.pop("keywords", None): + options['keywords'] = parse_keywords(listify_value(keywords_val)) + + if comments_val := options.pop("add_comments", None): + options['add_comments'] = listify_value(comments_val) + + return options + + +def _parse_config_object(config: dict, *, filename="(unknown)"): + extractors = {} + method_map = [] + options_map = {} + + extractors_read = config.get("extractors", {}) + if not isinstance(extractors_read, dict): + raise ConfigurationError( + f"{filename}: extractors: Expected a dictionary, got {type(extractors_read)!r}", + ) + for method, callable_spec in extractors_read.items(): + if not isinstance(method, str): + # Impossible via TOML, but could happen with a custom object. + raise ConfigurationError( + f"{filename}: extractors: Extraction method must be a string, got {method!r}", + ) + if not isinstance(callable_spec, str): + raise ConfigurationError( + f"{filename}: extractors: Callable specification must be a string, got {callable_spec!r}", + ) + extractors[method] = callable_spec + + if "mapping" in config: + raise ConfigurationError( + f"{filename}: 'mapping' is not a valid key, did you mean 'mappings'?", + ) + + mappings_read = config.get("mappings", []) + if not isinstance(mappings_read, list): + raise ConfigurationError( + f"{filename}: mappings: Expected a list, got {type(mappings_read)!r}", + ) + for idx, entry in enumerate(mappings_read): + if not isinstance(entry, dict): + raise ConfigurationError( + f"{filename}: mappings[{idx}]: Expected a dictionary, got {type(entry)!r}", + ) + entry = entry.copy() + + method = entry.pop("method", None) + if not isinstance(method, str): + raise ConfigurationError( + f"{filename}: mappings[{idx}]: 'method' must be a string, got {method!r}", + ) + method = extractors.get(method, method) # Map the extractor name to the callable now + + pattern = entry.pop("pattern", None) + if not isinstance(pattern, (list, str)): + raise ConfigurationError( + f"{filename}: mappings[{idx}]: 'pattern' must be a list or a string, got {pattern!r}", + ) + if not isinstance(pattern, list): + pattern = [pattern] + + if keywords_val := entry.pop("keywords", None): + if isinstance(keywords_val, str): + entry["keywords"] = parse_keywords(listify_value(keywords_val)) + elif isinstance(keywords_val, list): + entry["keywords"] = parse_keywords(keywords_val) + else: + raise ConfigurationError( + f"{filename}: mappings[{idx}]: 'keywords' must be a string or list, got {keywords_val!r}", + ) + + if comments_val := entry.pop("add_comments", None): + if isinstance(comments_val, str): + entry["add_comments"] = [comments_val] + elif isinstance(comments_val, list): + entry["add_comments"] = comments_val + else: + raise ConfigurationError( + f"{filename}: mappings[{idx}]: 'add_comments' must be a string or list, got {comments_val!r}", + ) + + for pat in pattern: + if not isinstance(pat, str): + raise ConfigurationError( + f"{filename}: mappings[{idx}]: 'pattern' elements must be strings, got {pat!r}", + ) + method_map.append((pat, method)) + options_map[pat] = entry + + return method_map, options_map + + +def _parse_mapping_toml( + fileobj: BinaryIO, + filename: str = "(unknown)", + style: Literal["standalone", "pyproject.toml"] = "standalone", +): + """Parse an extraction method mapping from a binary file-like object. + + .. warning: As of this version of Babel, this is a private API subject to changes. + + :param fileobj: a readable binary file-like object containing the configuration TOML to parse + :param filename: the name of the file being parsed, for error messages + :param style: whether the file is in the style of a `pyproject.toml` file, i.e. whether to look for `tool.babel`. + """ + try: + import tomllib + except ImportError: + try: + import tomli as tomllib + except ImportError as ie: # pragma: no cover + raise ImportError("tomli or tomllib is required to parse TOML files") from ie + + try: + parsed_data = tomllib.load(fileobj) + except tomllib.TOMLDecodeError as e: + raise ConfigurationError(f"{filename}: Error parsing TOML file: {e}") from e + + if style == "pyproject.toml": + try: + babel_data = parsed_data["tool"]["babel"] + except (TypeError, KeyError) as e: + raise ConfigurationError( + f"{filename}: No 'tool.babel' section found in file", + ) from e + elif style == "standalone": + babel_data = parsed_data + if "babel" in babel_data: + raise ConfigurationError( + f"{filename}: 'babel' should not be present in a stand-alone configuration file", + ) + else: # pragma: no cover + raise ValueError(f"Unknown TOML style {style!r}") + + return _parse_config_object(babel_data, filename=filename) + + +def _parse_spec(s: str) -> tuple[int | None, tuple[int | tuple[int, str], ...]]: + inds = [] + number = None + for x in s.split(','): + if x[-1] == 't': + number = int(x[:-1]) + elif x[-1] == 'c': + inds.append((int(x[:-1]), 'c')) + else: + inds.append(int(x)) + return number, tuple(inds) + + +def parse_keywords(strings: Iterable[str] = ()): + """Parse keywords specifications from the given list of strings. + + >>> import pprint + >>> keywords = ['_', 'dgettext:2', 'dngettext:2,3', 'pgettext:1c,2', + ... 'polymorphic:1', 'polymorphic:2,2t', 'polymorphic:3c,3t'] + >>> pprint.pprint(parse_keywords(keywords)) + {'_': None, + 'dgettext': (2,), + 'dngettext': (2, 3), + 'pgettext': ((1, 'c'), 2), + 'polymorphic': {None: (1,), 2: (2,), 3: ((3, 'c'),)}} + + The input keywords are in GNU Gettext style; see :doc:`cmdline` for details. + + The output is a dictionary mapping keyword names to a dictionary of specifications. + Keys in this dictionary are numbers of arguments, where ``None`` means that all numbers + of arguments are matched, and a number means only calls with that number of arguments + are matched (which happens when using the "t" specifier). However, as a special + case for backwards compatibility, if the dictionary of specifications would + be ``{None: x}``, i.e., there is only one specification and it matches all argument + counts, then it is collapsed into just ``x``. + + A specification is either a tuple or None. If a tuple, each element can be either a number + ``n``, meaning that the nth argument should be extracted as a message, or the tuple + ``(n, 'c')``, meaning that the nth argument should be extracted as context for the + messages. A ``None`` specification is equivalent to ``(1,)``, extracting the first + argument. + """ + keywords = {} + for string in strings: + if ':' in string: + funcname, spec_str = string.split(':') + number, spec = _parse_spec(spec_str) + else: + funcname = string + number = None + spec = None + keywords.setdefault(funcname, {})[number] = spec + + # For best backwards compatibility, collapse {None: x} into x. + for k, v in keywords.items(): + if set(v) == {None}: + keywords[k] = v[None] + + return keywords + + +def __getattr__(name: str): + # Re-exports for backwards compatibility; + # `setuptools_frontend` is the canonical import location. + if name in { + 'check_message_extractors', + 'compile_catalog', + 'extract_messages', + 'init_catalog', + 'update_catalog', + }: + from babel.messages import setuptools_frontend + + return getattr(setuptools_frontend, name) + + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + + +if __name__ == '__main__': + main() diff --git a/micromamba_root/Lib/site-packages/babel/messages/jslexer.py b/micromamba_root/Lib/site-packages/babel/messages/jslexer.py new file mode 100644 index 0000000000000000000000000000000000000000..d751b58f7d21f87c1a2fb67fd41ee4151269aa50 --- /dev/null +++ b/micromamba_root/Lib/site-packages/babel/messages/jslexer.py @@ -0,0 +1,216 @@ +""" +babel.messages.jslexer +~~~~~~~~~~~~~~~~~~~~~~ + +A simple JavaScript 1.5 lexer which is used for the JavaScript +extractor. + +:copyright: (c) 2013-2026 by the Babel Team. +:license: BSD, see LICENSE for more details. +""" + +from __future__ import annotations + +import re +from collections.abc import Generator +from typing import NamedTuple + +operators: list[str] = sorted([ + '+', '-', '*', '%', '!=', '==', '<', '>', '<=', '>=', '=', + '+=', '-=', '*=', '%=', '<<', '>>', '>>>', '<<=', '>>=', + '>>>=', '&', '&=', '|', '|=', '&&', '||', '^', '^=', '(', ')', + '[', ']', '{', '}', '!', '--', '++', '~', ',', ';', '.', ':', +], key=len, reverse=True) # fmt: skip + +escapes: dict[str, str] = {'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t'} + +name_re = re.compile(r'[\w$_][\w\d$_]*', re.UNICODE) +dotted_name_re = re.compile(r'[\w$_][\w\d$_.]*[\w\d$_.]', re.UNICODE) +division_re = re.compile(r'/=?') +regex_re = re.compile(r'/(?:[^/\\]*(?:\\.[^/\\]*)*)/[a-zA-Z]*', re.DOTALL) +line_re = re.compile(r'(\r\n|\n|\r)') +line_join_re = re.compile(r'\\' + line_re.pattern) +uni_escape_re = re.compile(r'[a-fA-F0-9]{1,4}') +hex_escape_re = re.compile(r'[a-fA-F0-9]{1,2}') + + +class Token(NamedTuple): + type: str + value: str + lineno: int + + +_rules: list[tuple[str | None, re.Pattern[str]]] = [ + (None, re.compile(r'\s+', re.UNICODE)), + (None, re.compile(r'