Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/lib/tests/test.wav +3 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/console.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/debugger.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/prompts.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/pt_inputhooks/__pycache__/asyncio.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__init__.py +630 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/auto_match.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/filters.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/auto_match.py +104 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/filters.py +322 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_debug_magic.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_embed.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_interactivshell.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_pt_inputhooks.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/test_help.py +30 -0
- evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/test_interactivshell.py +255 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/__init__.py +4 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/__main__.py +12 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/cacert.pem +0 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/core.py +114 -0
- evalkit_tf437/lib/python3.10/site-packages/certifi/py.typed +0 -0
- evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/INSTALLER +1 -0
- evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/LICENCE.txt +25 -0
- evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/RECORD +181 -0
- evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/WHEEL +5 -0
- evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/top_level.txt +1 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/INSTALLER +1 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/LICENSE +13 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/METADATA +140 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/RECORD +20 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/REQUESTED +0 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/WHEEL +6 -0
- evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/top_level.txt +1 -0
- evalkit_tf437/lib/python3.10/site-packages/pandas/core/__pycache__/generic.cpython-310.pyc +3 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/lazy.py +172 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/tzinfo.py +580 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/EST +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/GB +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/GMT-0 +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/Iceland +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/Libya +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/MST7MDT +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/NZ-CHAT +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/PRC +0 -0
- evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/ROC +0 -0
- evalkit_tf437/lib/python3.10/site-packages/scipy/linalg/cython_lapack.cpython-310-x86_64-linux-gnu.so +3 -0
.gitattributes
CHANGED
|
@@ -1316,3 +1316,5 @@ evalkit_tf437/lib/python3.10/site-packages/scipy/io/matlab/_mio5_utils.cpython-3
|
|
| 1316 |
evalkit_tf437/lib/python3.10/site-packages/scipy/signal/_upfirdn_apply.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1317 |
evalkit_tf437/lib/python3.10/site-packages/scipy/stats/__pycache__/_mstats_basic.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1318 |
evalkit_tf437/lib/python3.10/site-packages/scipy/interpolate/_rgi_cython.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1316 |
evalkit_tf437/lib/python3.10/site-packages/scipy/signal/_upfirdn_apply.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1317 |
evalkit_tf437/lib/python3.10/site-packages/scipy/stats/__pycache__/_mstats_basic.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1318 |
evalkit_tf437/lib/python3.10/site-packages/scipy/interpolate/_rgi_cython.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1319 |
+
evalkit_tf437/lib/python3.10/site-packages/scipy/linalg/cython_lapack.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1320 |
+
evalkit_tf437/lib/python3.10/site-packages/pandas/core/__pycache__/generic.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
evalkit_tf437/lib/python3.10/site-packages/IPython/lib/tests/test.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cba3bce8287c39fcc17d789c3bcc86df50f26227c6a5830f2609fe3538f5392e
|
| 3 |
+
size 44144
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/console.cpython-310.pyc
ADDED
|
Binary file (643 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/debugger.cpython-310.pyc
ADDED
|
Binary file (6.16 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/__pycache__/prompts.cpython-310.pyc
ADDED
|
Binary file (4.78 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/pt_inputhooks/__pycache__/asyncio.cpython-310.pyc
ADDED
|
Binary file (1.68 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__init__.py
ADDED
|
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module to define and register Terminal IPython shortcuts with
|
| 3 |
+
:mod:`prompt_toolkit`
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
# Copyright (c) IPython Development Team.
|
| 7 |
+
# Distributed under the terms of the Modified BSD License.
|
| 8 |
+
|
| 9 |
+
import os
|
| 10 |
+
import signal
|
| 11 |
+
import sys
|
| 12 |
+
import warnings
|
| 13 |
+
from dataclasses import dataclass
|
| 14 |
+
from typing import Callable, Any, Optional, List
|
| 15 |
+
|
| 16 |
+
from prompt_toolkit.application.current import get_app
|
| 17 |
+
from prompt_toolkit.key_binding import KeyBindings
|
| 18 |
+
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
|
| 19 |
+
from prompt_toolkit.key_binding.bindings import named_commands as nc
|
| 20 |
+
from prompt_toolkit.key_binding.bindings.completion import (
|
| 21 |
+
display_completions_like_readline,
|
| 22 |
+
)
|
| 23 |
+
from prompt_toolkit.key_binding.vi_state import InputMode, ViState
|
| 24 |
+
from prompt_toolkit.filters import Condition
|
| 25 |
+
|
| 26 |
+
from IPython.core.getipython import get_ipython
|
| 27 |
+
from IPython.terminal.shortcuts import auto_match as match
|
| 28 |
+
from IPython.terminal.shortcuts import auto_suggest
|
| 29 |
+
from IPython.terminal.shortcuts.filters import filter_from_string
|
| 30 |
+
from IPython.utils.decorators import undoc
|
| 31 |
+
|
| 32 |
+
from prompt_toolkit.enums import DEFAULT_BUFFER
|
| 33 |
+
|
| 34 |
+
__all__ = ["create_ipython_shortcuts"]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
@dataclass
|
| 38 |
+
class BaseBinding:
|
| 39 |
+
command: Callable[[KeyPressEvent], Any]
|
| 40 |
+
keys: List[str]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@dataclass
|
| 44 |
+
class RuntimeBinding(BaseBinding):
|
| 45 |
+
filter: Condition
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@dataclass
|
| 49 |
+
class Binding(BaseBinding):
|
| 50 |
+
# while filter could be created by referencing variables directly (rather
|
| 51 |
+
# than created from strings), by using strings we ensure that users will
|
| 52 |
+
# be able to create filters in configuration (e.g. JSON) files too, which
|
| 53 |
+
# also benefits the documentation by enforcing human-readable filter names.
|
| 54 |
+
condition: Optional[str] = None
|
| 55 |
+
|
| 56 |
+
def __post_init__(self):
|
| 57 |
+
if self.condition:
|
| 58 |
+
self.filter = filter_from_string(self.condition)
|
| 59 |
+
else:
|
| 60 |
+
self.filter = None
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def create_identifier(handler: Callable):
|
| 64 |
+
parts = handler.__module__.split(".")
|
| 65 |
+
name = handler.__name__
|
| 66 |
+
package = parts[0]
|
| 67 |
+
if len(parts) > 1:
|
| 68 |
+
final_module = parts[-1]
|
| 69 |
+
return f"{package}:{final_module}.{name}"
|
| 70 |
+
else:
|
| 71 |
+
return f"{package}:{name}"
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
AUTO_MATCH_BINDINGS = [
|
| 75 |
+
*[
|
| 76 |
+
Binding(
|
| 77 |
+
cmd, [key], "focused_insert & auto_match & followed_by_closing_paren_or_end"
|
| 78 |
+
)
|
| 79 |
+
for key, cmd in match.auto_match_parens.items()
|
| 80 |
+
],
|
| 81 |
+
*[
|
| 82 |
+
# raw string
|
| 83 |
+
Binding(cmd, [key], "focused_insert & auto_match & preceded_by_raw_str_prefix")
|
| 84 |
+
for key, cmd in match.auto_match_parens_raw_string.items()
|
| 85 |
+
],
|
| 86 |
+
Binding(
|
| 87 |
+
match.double_quote,
|
| 88 |
+
['"'],
|
| 89 |
+
"focused_insert"
|
| 90 |
+
" & auto_match"
|
| 91 |
+
" & not_inside_unclosed_string"
|
| 92 |
+
" & preceded_by_paired_double_quotes"
|
| 93 |
+
" & followed_by_closing_paren_or_end",
|
| 94 |
+
),
|
| 95 |
+
Binding(
|
| 96 |
+
match.single_quote,
|
| 97 |
+
["'"],
|
| 98 |
+
"focused_insert"
|
| 99 |
+
" & auto_match"
|
| 100 |
+
" & not_inside_unclosed_string"
|
| 101 |
+
" & preceded_by_paired_single_quotes"
|
| 102 |
+
" & followed_by_closing_paren_or_end",
|
| 103 |
+
),
|
| 104 |
+
Binding(
|
| 105 |
+
match.docstring_double_quotes,
|
| 106 |
+
['"'],
|
| 107 |
+
"focused_insert"
|
| 108 |
+
" & auto_match"
|
| 109 |
+
" & not_inside_unclosed_string"
|
| 110 |
+
" & preceded_by_two_double_quotes",
|
| 111 |
+
),
|
| 112 |
+
Binding(
|
| 113 |
+
match.docstring_single_quotes,
|
| 114 |
+
["'"],
|
| 115 |
+
"focused_insert"
|
| 116 |
+
" & auto_match"
|
| 117 |
+
" & not_inside_unclosed_string"
|
| 118 |
+
" & preceded_by_two_single_quotes",
|
| 119 |
+
),
|
| 120 |
+
Binding(
|
| 121 |
+
match.skip_over,
|
| 122 |
+
[")"],
|
| 123 |
+
"focused_insert & auto_match & followed_by_closing_round_paren",
|
| 124 |
+
),
|
| 125 |
+
Binding(
|
| 126 |
+
match.skip_over,
|
| 127 |
+
["]"],
|
| 128 |
+
"focused_insert & auto_match & followed_by_closing_bracket",
|
| 129 |
+
),
|
| 130 |
+
Binding(
|
| 131 |
+
match.skip_over,
|
| 132 |
+
["}"],
|
| 133 |
+
"focused_insert & auto_match & followed_by_closing_brace",
|
| 134 |
+
),
|
| 135 |
+
Binding(
|
| 136 |
+
match.skip_over, ['"'], "focused_insert & auto_match & followed_by_double_quote"
|
| 137 |
+
),
|
| 138 |
+
Binding(
|
| 139 |
+
match.skip_over, ["'"], "focused_insert & auto_match & followed_by_single_quote"
|
| 140 |
+
),
|
| 141 |
+
Binding(
|
| 142 |
+
match.delete_pair,
|
| 143 |
+
["backspace"],
|
| 144 |
+
"focused_insert"
|
| 145 |
+
" & preceded_by_opening_round_paren"
|
| 146 |
+
" & auto_match"
|
| 147 |
+
" & followed_by_closing_round_paren",
|
| 148 |
+
),
|
| 149 |
+
Binding(
|
| 150 |
+
match.delete_pair,
|
| 151 |
+
["backspace"],
|
| 152 |
+
"focused_insert"
|
| 153 |
+
" & preceded_by_opening_bracket"
|
| 154 |
+
" & auto_match"
|
| 155 |
+
" & followed_by_closing_bracket",
|
| 156 |
+
),
|
| 157 |
+
Binding(
|
| 158 |
+
match.delete_pair,
|
| 159 |
+
["backspace"],
|
| 160 |
+
"focused_insert"
|
| 161 |
+
" & preceded_by_opening_brace"
|
| 162 |
+
" & auto_match"
|
| 163 |
+
" & followed_by_closing_brace",
|
| 164 |
+
),
|
| 165 |
+
Binding(
|
| 166 |
+
match.delete_pair,
|
| 167 |
+
["backspace"],
|
| 168 |
+
"focused_insert"
|
| 169 |
+
" & preceded_by_double_quote"
|
| 170 |
+
" & auto_match"
|
| 171 |
+
" & followed_by_double_quote",
|
| 172 |
+
),
|
| 173 |
+
Binding(
|
| 174 |
+
match.delete_pair,
|
| 175 |
+
["backspace"],
|
| 176 |
+
"focused_insert"
|
| 177 |
+
" & preceded_by_single_quote"
|
| 178 |
+
" & auto_match"
|
| 179 |
+
" & followed_by_single_quote",
|
| 180 |
+
),
|
| 181 |
+
]
|
| 182 |
+
|
| 183 |
+
AUTO_SUGGEST_BINDINGS = [
|
| 184 |
+
# there are two reasons for re-defining bindings defined upstream:
|
| 185 |
+
# 1) prompt-toolkit does not execute autosuggestion bindings in vi mode,
|
| 186 |
+
# 2) prompt-toolkit checks if we are at the end of text, not end of line
|
| 187 |
+
# hence it does not work in multi-line mode of navigable provider
|
| 188 |
+
Binding(
|
| 189 |
+
auto_suggest.accept_or_jump_to_end,
|
| 190 |
+
["end"],
|
| 191 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 192 |
+
),
|
| 193 |
+
Binding(
|
| 194 |
+
auto_suggest.accept_or_jump_to_end,
|
| 195 |
+
["c-e"],
|
| 196 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 197 |
+
),
|
| 198 |
+
Binding(
|
| 199 |
+
auto_suggest.accept,
|
| 200 |
+
["c-f"],
|
| 201 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 202 |
+
),
|
| 203 |
+
Binding(
|
| 204 |
+
auto_suggest.accept,
|
| 205 |
+
["right"],
|
| 206 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 207 |
+
),
|
| 208 |
+
Binding(
|
| 209 |
+
auto_suggest.accept_word,
|
| 210 |
+
["escape", "f"],
|
| 211 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 212 |
+
),
|
| 213 |
+
Binding(
|
| 214 |
+
auto_suggest.accept_token,
|
| 215 |
+
["c-right"],
|
| 216 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 217 |
+
),
|
| 218 |
+
Binding(
|
| 219 |
+
auto_suggest.discard,
|
| 220 |
+
["escape"],
|
| 221 |
+
# note this one is using `emacs_insert_mode`, not `emacs_like_insert_mode`
|
| 222 |
+
# as in `vi_insert_mode` we do not want `escape` to be shadowed (ever).
|
| 223 |
+
"has_suggestion & default_buffer_focused & emacs_insert_mode",
|
| 224 |
+
),
|
| 225 |
+
Binding(
|
| 226 |
+
auto_suggest.discard,
|
| 227 |
+
["delete"],
|
| 228 |
+
"has_suggestion & default_buffer_focused & emacs_insert_mode",
|
| 229 |
+
),
|
| 230 |
+
Binding(
|
| 231 |
+
auto_suggest.swap_autosuggestion_up,
|
| 232 |
+
["c-up"],
|
| 233 |
+
"navigable_suggestions"
|
| 234 |
+
" & ~has_line_above"
|
| 235 |
+
" & has_suggestion"
|
| 236 |
+
" & default_buffer_focused",
|
| 237 |
+
),
|
| 238 |
+
Binding(
|
| 239 |
+
auto_suggest.swap_autosuggestion_down,
|
| 240 |
+
["c-down"],
|
| 241 |
+
"navigable_suggestions"
|
| 242 |
+
" & ~has_line_below"
|
| 243 |
+
" & has_suggestion"
|
| 244 |
+
" & default_buffer_focused",
|
| 245 |
+
),
|
| 246 |
+
Binding(
|
| 247 |
+
auto_suggest.up_and_update_hint,
|
| 248 |
+
["c-up"],
|
| 249 |
+
"has_line_above & navigable_suggestions & default_buffer_focused",
|
| 250 |
+
),
|
| 251 |
+
Binding(
|
| 252 |
+
auto_suggest.down_and_update_hint,
|
| 253 |
+
["c-down"],
|
| 254 |
+
"has_line_below & navigable_suggestions & default_buffer_focused",
|
| 255 |
+
),
|
| 256 |
+
Binding(
|
| 257 |
+
auto_suggest.accept_character,
|
| 258 |
+
["escape", "right"],
|
| 259 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 260 |
+
),
|
| 261 |
+
Binding(
|
| 262 |
+
auto_suggest.accept_and_move_cursor_left,
|
| 263 |
+
["c-left"],
|
| 264 |
+
"has_suggestion & default_buffer_focused & emacs_like_insert_mode",
|
| 265 |
+
),
|
| 266 |
+
Binding(
|
| 267 |
+
auto_suggest.accept_and_keep_cursor,
|
| 268 |
+
["escape", "down"],
|
| 269 |
+
"has_suggestion & default_buffer_focused & emacs_insert_mode",
|
| 270 |
+
),
|
| 271 |
+
Binding(
|
| 272 |
+
auto_suggest.backspace_and_resume_hint,
|
| 273 |
+
["backspace"],
|
| 274 |
+
# no `has_suggestion` here to allow resuming if no suggestion
|
| 275 |
+
"default_buffer_focused & emacs_like_insert_mode",
|
| 276 |
+
),
|
| 277 |
+
Binding(
|
| 278 |
+
auto_suggest.resume_hinting,
|
| 279 |
+
["right"],
|
| 280 |
+
"is_cursor_at_the_end_of_line"
|
| 281 |
+
" & default_buffer_focused"
|
| 282 |
+
" & emacs_like_insert_mode"
|
| 283 |
+
" & pass_through",
|
| 284 |
+
),
|
| 285 |
+
]
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
SIMPLE_CONTROL_BINDINGS = [
|
| 289 |
+
Binding(cmd, [key], "vi_insert_mode & default_buffer_focused & ebivim")
|
| 290 |
+
for key, cmd in {
|
| 291 |
+
"c-a": nc.beginning_of_line,
|
| 292 |
+
"c-b": nc.backward_char,
|
| 293 |
+
"c-k": nc.kill_line,
|
| 294 |
+
"c-w": nc.backward_kill_word,
|
| 295 |
+
"c-y": nc.yank,
|
| 296 |
+
"c-_": nc.undo,
|
| 297 |
+
}.items()
|
| 298 |
+
]
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
ALT_AND_COMOBO_CONTROL_BINDINGS = [
|
| 302 |
+
Binding(cmd, list(keys), "vi_insert_mode & default_buffer_focused & ebivim")
|
| 303 |
+
for keys, cmd in {
|
| 304 |
+
# Control Combos
|
| 305 |
+
("c-x", "c-e"): nc.edit_and_execute,
|
| 306 |
+
("c-x", "e"): nc.edit_and_execute,
|
| 307 |
+
# Alt
|
| 308 |
+
("escape", "b"): nc.backward_word,
|
| 309 |
+
("escape", "c"): nc.capitalize_word,
|
| 310 |
+
("escape", "d"): nc.kill_word,
|
| 311 |
+
("escape", "h"): nc.backward_kill_word,
|
| 312 |
+
("escape", "l"): nc.downcase_word,
|
| 313 |
+
("escape", "u"): nc.uppercase_word,
|
| 314 |
+
("escape", "y"): nc.yank_pop,
|
| 315 |
+
("escape", "."): nc.yank_last_arg,
|
| 316 |
+
}.items()
|
| 317 |
+
]
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
def add_binding(bindings: KeyBindings, binding: Binding):
|
| 321 |
+
bindings.add(
|
| 322 |
+
*binding.keys,
|
| 323 |
+
**({"filter": binding.filter} if binding.filter is not None else {}),
|
| 324 |
+
)(binding.command)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def create_ipython_shortcuts(shell, skip=None) -> KeyBindings:
|
| 328 |
+
"""Set up the prompt_toolkit keyboard shortcuts for IPython.
|
| 329 |
+
|
| 330 |
+
Parameters
|
| 331 |
+
----------
|
| 332 |
+
shell: InteractiveShell
|
| 333 |
+
The current IPython shell Instance
|
| 334 |
+
skip: List[Binding]
|
| 335 |
+
Bindings to skip.
|
| 336 |
+
|
| 337 |
+
Returns
|
| 338 |
+
-------
|
| 339 |
+
KeyBindings
|
| 340 |
+
the keybinding instance for prompt toolkit.
|
| 341 |
+
|
| 342 |
+
"""
|
| 343 |
+
kb = KeyBindings()
|
| 344 |
+
skip = skip or []
|
| 345 |
+
for binding in KEY_BINDINGS:
|
| 346 |
+
skip_this_one = False
|
| 347 |
+
for to_skip in skip:
|
| 348 |
+
if (
|
| 349 |
+
to_skip.command == binding.command
|
| 350 |
+
and to_skip.filter == binding.filter
|
| 351 |
+
and to_skip.keys == binding.keys
|
| 352 |
+
):
|
| 353 |
+
skip_this_one = True
|
| 354 |
+
break
|
| 355 |
+
if skip_this_one:
|
| 356 |
+
continue
|
| 357 |
+
add_binding(kb, binding)
|
| 358 |
+
|
| 359 |
+
def get_input_mode(self):
|
| 360 |
+
app = get_app()
|
| 361 |
+
app.ttimeoutlen = shell.ttimeoutlen
|
| 362 |
+
app.timeoutlen = shell.timeoutlen
|
| 363 |
+
|
| 364 |
+
return self._input_mode
|
| 365 |
+
|
| 366 |
+
def set_input_mode(self, mode):
|
| 367 |
+
shape = {InputMode.NAVIGATION: 2, InputMode.REPLACE: 4}.get(mode, 6)
|
| 368 |
+
cursor = "\x1b[{} q".format(shape)
|
| 369 |
+
|
| 370 |
+
sys.stdout.write(cursor)
|
| 371 |
+
sys.stdout.flush()
|
| 372 |
+
|
| 373 |
+
self._input_mode = mode
|
| 374 |
+
|
| 375 |
+
if shell.editing_mode == "vi" and shell.modal_cursor:
|
| 376 |
+
ViState._input_mode = InputMode.INSERT # type: ignore
|
| 377 |
+
ViState.input_mode = property(get_input_mode, set_input_mode) # type: ignore
|
| 378 |
+
|
| 379 |
+
return kb
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
def reformat_and_execute(event):
|
| 383 |
+
"""Reformat code and execute it"""
|
| 384 |
+
shell = get_ipython()
|
| 385 |
+
reformat_text_before_cursor(
|
| 386 |
+
event.current_buffer, event.current_buffer.document, shell
|
| 387 |
+
)
|
| 388 |
+
event.current_buffer.validate_and_handle()
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
def reformat_text_before_cursor(buffer, document, shell):
|
| 392 |
+
text = buffer.delete_before_cursor(len(document.text[: document.cursor_position]))
|
| 393 |
+
try:
|
| 394 |
+
formatted_text = shell.reformat_handler(text)
|
| 395 |
+
buffer.insert_text(formatted_text)
|
| 396 |
+
except Exception as e:
|
| 397 |
+
buffer.insert_text(text)
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
def handle_return_or_newline_or_execute(event):
|
| 401 |
+
shell = get_ipython()
|
| 402 |
+
if getattr(shell, "handle_return", None):
|
| 403 |
+
return shell.handle_return(shell)(event)
|
| 404 |
+
else:
|
| 405 |
+
return newline_or_execute_outer(shell)(event)
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
def newline_or_execute_outer(shell):
|
| 409 |
+
def newline_or_execute(event):
|
| 410 |
+
"""When the user presses return, insert a newline or execute the code."""
|
| 411 |
+
b = event.current_buffer
|
| 412 |
+
d = b.document
|
| 413 |
+
|
| 414 |
+
if b.complete_state:
|
| 415 |
+
cc = b.complete_state.current_completion
|
| 416 |
+
if cc:
|
| 417 |
+
b.apply_completion(cc)
|
| 418 |
+
else:
|
| 419 |
+
b.cancel_completion()
|
| 420 |
+
return
|
| 421 |
+
|
| 422 |
+
# If there's only one line, treat it as if the cursor is at the end.
|
| 423 |
+
# See https://github.com/ipython/ipython/issues/10425
|
| 424 |
+
if d.line_count == 1:
|
| 425 |
+
check_text = d.text
|
| 426 |
+
else:
|
| 427 |
+
check_text = d.text[: d.cursor_position]
|
| 428 |
+
status, indent = shell.check_complete(check_text)
|
| 429 |
+
|
| 430 |
+
# if all we have after the cursor is whitespace: reformat current text
|
| 431 |
+
# before cursor
|
| 432 |
+
after_cursor = d.text[d.cursor_position :]
|
| 433 |
+
reformatted = False
|
| 434 |
+
if not after_cursor.strip():
|
| 435 |
+
reformat_text_before_cursor(b, d, shell)
|
| 436 |
+
reformatted = True
|
| 437 |
+
if not (
|
| 438 |
+
d.on_last_line
|
| 439 |
+
or d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
|
| 440 |
+
):
|
| 441 |
+
if shell.autoindent:
|
| 442 |
+
b.insert_text("\n" + indent)
|
| 443 |
+
else:
|
| 444 |
+
b.insert_text("\n")
|
| 445 |
+
return
|
| 446 |
+
|
| 447 |
+
if (status != "incomplete") and b.accept_handler:
|
| 448 |
+
if not reformatted:
|
| 449 |
+
reformat_text_before_cursor(b, d, shell)
|
| 450 |
+
b.validate_and_handle()
|
| 451 |
+
else:
|
| 452 |
+
if shell.autoindent:
|
| 453 |
+
b.insert_text("\n" + indent)
|
| 454 |
+
else:
|
| 455 |
+
b.insert_text("\n")
|
| 456 |
+
|
| 457 |
+
return newline_or_execute
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
def previous_history_or_previous_completion(event):
|
| 461 |
+
"""
|
| 462 |
+
Control-P in vi edit mode on readline is history next, unlike default prompt toolkit.
|
| 463 |
+
|
| 464 |
+
If completer is open this still select previous completion.
|
| 465 |
+
"""
|
| 466 |
+
event.current_buffer.auto_up()
|
| 467 |
+
|
| 468 |
+
|
| 469 |
+
def next_history_or_next_completion(event):
|
| 470 |
+
"""
|
| 471 |
+
Control-N in vi edit mode on readline is history previous, unlike default prompt toolkit.
|
| 472 |
+
|
| 473 |
+
If completer is open this still select next completion.
|
| 474 |
+
"""
|
| 475 |
+
event.current_buffer.auto_down()
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
def dismiss_completion(event):
|
| 479 |
+
"""Dismiss completion"""
|
| 480 |
+
b = event.current_buffer
|
| 481 |
+
if b.complete_state:
|
| 482 |
+
b.cancel_completion()
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
def reset_buffer(event):
|
| 486 |
+
"""Reset buffer"""
|
| 487 |
+
b = event.current_buffer
|
| 488 |
+
if b.complete_state:
|
| 489 |
+
b.cancel_completion()
|
| 490 |
+
else:
|
| 491 |
+
b.reset()
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
def reset_search_buffer(event):
|
| 495 |
+
"""Reset search buffer"""
|
| 496 |
+
if event.current_buffer.document.text:
|
| 497 |
+
event.current_buffer.reset()
|
| 498 |
+
else:
|
| 499 |
+
event.app.layout.focus(DEFAULT_BUFFER)
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
def suspend_to_bg(event):
|
| 503 |
+
"""Suspend to background"""
|
| 504 |
+
event.app.suspend_to_background()
|
| 505 |
+
|
| 506 |
+
|
| 507 |
+
def quit(event):
|
| 508 |
+
"""
|
| 509 |
+
Quit application with ``SIGQUIT`` if supported or ``sys.exit`` otherwise.
|
| 510 |
+
|
| 511 |
+
On platforms that support SIGQUIT, send SIGQUIT to the current process.
|
| 512 |
+
On other platforms, just exit the process with a message.
|
| 513 |
+
"""
|
| 514 |
+
sigquit = getattr(signal, "SIGQUIT", None)
|
| 515 |
+
if sigquit is not None:
|
| 516 |
+
os.kill(0, signal.SIGQUIT)
|
| 517 |
+
else:
|
| 518 |
+
sys.exit("Quit")
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
def indent_buffer(event):
|
| 522 |
+
"""Indent buffer"""
|
| 523 |
+
event.current_buffer.insert_text(" " * 4)
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
def newline_autoindent(event):
|
| 527 |
+
"""Insert a newline after the cursor indented appropriately.
|
| 528 |
+
|
| 529 |
+
Fancier version of former ``newline_with_copy_margin`` which should
|
| 530 |
+
compute the correct indentation of the inserted line. That is to say, indent
|
| 531 |
+
by 4 extra space after a function definition, class definition, context
|
| 532 |
+
manager... And dedent by 4 space after ``pass``, ``return``, ``raise ...``.
|
| 533 |
+
"""
|
| 534 |
+
shell = get_ipython()
|
| 535 |
+
inputsplitter = shell.input_transformer_manager
|
| 536 |
+
b = event.current_buffer
|
| 537 |
+
d = b.document
|
| 538 |
+
|
| 539 |
+
if b.complete_state:
|
| 540 |
+
b.cancel_completion()
|
| 541 |
+
text = d.text[: d.cursor_position] + "\n"
|
| 542 |
+
_, indent = inputsplitter.check_complete(text)
|
| 543 |
+
b.insert_text("\n" + (" " * (indent or 0)), move_cursor=False)
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
def open_input_in_editor(event):
|
| 547 |
+
"""Open code from input in external editor"""
|
| 548 |
+
event.app.current_buffer.open_in_editor()
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
if sys.platform == "win32":
|
| 552 |
+
from IPython.core.error import TryNext
|
| 553 |
+
from IPython.lib.clipboard import (
|
| 554 |
+
ClipboardEmpty,
|
| 555 |
+
tkinter_clipboard_get,
|
| 556 |
+
win32_clipboard_get,
|
| 557 |
+
)
|
| 558 |
+
|
| 559 |
+
@undoc
|
| 560 |
+
def win_paste(event):
|
| 561 |
+
try:
|
| 562 |
+
text = win32_clipboard_get()
|
| 563 |
+
except TryNext:
|
| 564 |
+
try:
|
| 565 |
+
text = tkinter_clipboard_get()
|
| 566 |
+
except (TryNext, ClipboardEmpty):
|
| 567 |
+
return
|
| 568 |
+
except ClipboardEmpty:
|
| 569 |
+
return
|
| 570 |
+
event.current_buffer.insert_text(text.replace("\t", " " * 4))
|
| 571 |
+
|
| 572 |
+
else:
|
| 573 |
+
|
| 574 |
+
@undoc
|
| 575 |
+
def win_paste(event):
|
| 576 |
+
"""Stub used on other platforms"""
|
| 577 |
+
pass
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
KEY_BINDINGS = [
|
| 581 |
+
Binding(
|
| 582 |
+
handle_return_or_newline_or_execute,
|
| 583 |
+
["enter"],
|
| 584 |
+
"default_buffer_focused & ~has_selection & insert_mode",
|
| 585 |
+
),
|
| 586 |
+
Binding(
|
| 587 |
+
reformat_and_execute,
|
| 588 |
+
["escape", "enter"],
|
| 589 |
+
"default_buffer_focused & ~has_selection & insert_mode & ebivim",
|
| 590 |
+
),
|
| 591 |
+
Binding(quit, ["c-\\"]),
|
| 592 |
+
Binding(
|
| 593 |
+
previous_history_or_previous_completion,
|
| 594 |
+
["c-p"],
|
| 595 |
+
"vi_insert_mode & default_buffer_focused",
|
| 596 |
+
),
|
| 597 |
+
Binding(
|
| 598 |
+
next_history_or_next_completion,
|
| 599 |
+
["c-n"],
|
| 600 |
+
"vi_insert_mode & default_buffer_focused",
|
| 601 |
+
),
|
| 602 |
+
Binding(dismiss_completion, ["c-g"], "default_buffer_focused & has_completions"),
|
| 603 |
+
Binding(reset_buffer, ["c-c"], "default_buffer_focused"),
|
| 604 |
+
Binding(reset_search_buffer, ["c-c"], "search_buffer_focused"),
|
| 605 |
+
Binding(suspend_to_bg, ["c-z"], "supports_suspend"),
|
| 606 |
+
Binding(
|
| 607 |
+
indent_buffer,
|
| 608 |
+
["tab"], # Ctrl+I == Tab
|
| 609 |
+
"default_buffer_focused"
|
| 610 |
+
" & ~has_selection"
|
| 611 |
+
" & insert_mode"
|
| 612 |
+
" & cursor_in_leading_ws",
|
| 613 |
+
),
|
| 614 |
+
Binding(newline_autoindent, ["c-o"], "default_buffer_focused & emacs_insert_mode"),
|
| 615 |
+
Binding(open_input_in_editor, ["f2"], "default_buffer_focused"),
|
| 616 |
+
*AUTO_MATCH_BINDINGS,
|
| 617 |
+
*AUTO_SUGGEST_BINDINGS,
|
| 618 |
+
Binding(
|
| 619 |
+
display_completions_like_readline,
|
| 620 |
+
["c-i"],
|
| 621 |
+
"readline_like_completions"
|
| 622 |
+
" & default_buffer_focused"
|
| 623 |
+
" & ~has_selection"
|
| 624 |
+
" & insert_mode"
|
| 625 |
+
" & ~cursor_in_leading_ws",
|
| 626 |
+
),
|
| 627 |
+
Binding(win_paste, ["c-v"], "default_buffer_focused & ~vi_mode & is_windows_os"),
|
| 628 |
+
*SIMPLE_CONTROL_BINDINGS,
|
| 629 |
+
*ALT_AND_COMOBO_CONTROL_BINDINGS,
|
| 630 |
+
]
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (14.6 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/auto_match.cpython-310.pyc
ADDED
|
Binary file (2.82 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/__pycache__/filters.cpython-310.pyc
ADDED
|
Binary file (8.82 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/auto_match.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Utilities function for keybinding with prompt toolkit.
|
| 3 |
+
|
| 4 |
+
This will be bound to specific key press and filter modes,
|
| 5 |
+
like whether we are in edit mode, and whether the completer is open.
|
| 6 |
+
"""
|
| 7 |
+
import re
|
| 8 |
+
from prompt_toolkit.key_binding import KeyPressEvent
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def parenthesis(event: KeyPressEvent):
|
| 12 |
+
"""Auto-close parenthesis"""
|
| 13 |
+
event.current_buffer.insert_text("()")
|
| 14 |
+
event.current_buffer.cursor_left()
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def brackets(event: KeyPressEvent):
|
| 18 |
+
"""Auto-close brackets"""
|
| 19 |
+
event.current_buffer.insert_text("[]")
|
| 20 |
+
event.current_buffer.cursor_left()
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def braces(event: KeyPressEvent):
|
| 24 |
+
"""Auto-close braces"""
|
| 25 |
+
event.current_buffer.insert_text("{}")
|
| 26 |
+
event.current_buffer.cursor_left()
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def double_quote(event: KeyPressEvent):
|
| 30 |
+
"""Auto-close double quotes"""
|
| 31 |
+
event.current_buffer.insert_text('""')
|
| 32 |
+
event.current_buffer.cursor_left()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def single_quote(event: KeyPressEvent):
|
| 36 |
+
"""Auto-close single quotes"""
|
| 37 |
+
event.current_buffer.insert_text("''")
|
| 38 |
+
event.current_buffer.cursor_left()
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def docstring_double_quotes(event: KeyPressEvent):
|
| 42 |
+
"""Auto-close docstring (double quotes)"""
|
| 43 |
+
event.current_buffer.insert_text('""""')
|
| 44 |
+
event.current_buffer.cursor_left(3)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def docstring_single_quotes(event: KeyPressEvent):
|
| 48 |
+
"""Auto-close docstring (single quotes)"""
|
| 49 |
+
event.current_buffer.insert_text("''''")
|
| 50 |
+
event.current_buffer.cursor_left(3)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def raw_string_parenthesis(event: KeyPressEvent):
|
| 54 |
+
"""Auto-close parenthesis in raw strings"""
|
| 55 |
+
matches = re.match(
|
| 56 |
+
r".*(r|R)[\"'](-*)",
|
| 57 |
+
event.current_buffer.document.current_line_before_cursor,
|
| 58 |
+
)
|
| 59 |
+
dashes = matches.group(2) if matches else ""
|
| 60 |
+
event.current_buffer.insert_text("()" + dashes)
|
| 61 |
+
event.current_buffer.cursor_left(len(dashes) + 1)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def raw_string_bracket(event: KeyPressEvent):
|
| 65 |
+
"""Auto-close bracker in raw strings"""
|
| 66 |
+
matches = re.match(
|
| 67 |
+
r".*(r|R)[\"'](-*)",
|
| 68 |
+
event.current_buffer.document.current_line_before_cursor,
|
| 69 |
+
)
|
| 70 |
+
dashes = matches.group(2) if matches else ""
|
| 71 |
+
event.current_buffer.insert_text("[]" + dashes)
|
| 72 |
+
event.current_buffer.cursor_left(len(dashes) + 1)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def raw_string_braces(event: KeyPressEvent):
|
| 76 |
+
"""Auto-close braces in raw strings"""
|
| 77 |
+
matches = re.match(
|
| 78 |
+
r".*(r|R)[\"'](-*)",
|
| 79 |
+
event.current_buffer.document.current_line_before_cursor,
|
| 80 |
+
)
|
| 81 |
+
dashes = matches.group(2) if matches else ""
|
| 82 |
+
event.current_buffer.insert_text("{}" + dashes)
|
| 83 |
+
event.current_buffer.cursor_left(len(dashes) + 1)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def skip_over(event: KeyPressEvent):
|
| 87 |
+
"""Skip over automatically added parenthesis/quote.
|
| 88 |
+
|
| 89 |
+
(rather than adding another parenthesis/quote)"""
|
| 90 |
+
event.current_buffer.cursor_right()
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def delete_pair(event: KeyPressEvent):
|
| 94 |
+
"""Delete auto-closed parenthesis"""
|
| 95 |
+
event.current_buffer.delete()
|
| 96 |
+
event.current_buffer.delete_before_cursor()
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
auto_match_parens = {"(": parenthesis, "[": brackets, "{": braces}
|
| 100 |
+
auto_match_parens_raw_string = {
|
| 101 |
+
"(": raw_string_parenthesis,
|
| 102 |
+
"[": raw_string_bracket,
|
| 103 |
+
"{": raw_string_braces,
|
| 104 |
+
}
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/shortcuts/filters.py
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Filters restricting scope of IPython Terminal shortcuts.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
# Copyright (c) IPython Development Team.
|
| 6 |
+
# Distributed under the terms of the Modified BSD License.
|
| 7 |
+
|
| 8 |
+
import ast
|
| 9 |
+
import re
|
| 10 |
+
import signal
|
| 11 |
+
import sys
|
| 12 |
+
from typing import Callable, Dict, Union
|
| 13 |
+
|
| 14 |
+
from prompt_toolkit.application.current import get_app
|
| 15 |
+
from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
|
| 16 |
+
from prompt_toolkit.key_binding import KeyPressEvent
|
| 17 |
+
from prompt_toolkit.filters import Condition, Filter, emacs_insert_mode, has_completions
|
| 18 |
+
from prompt_toolkit.filters import has_focus as has_focus_impl
|
| 19 |
+
from prompt_toolkit.filters import (
|
| 20 |
+
Always,
|
| 21 |
+
Never,
|
| 22 |
+
has_selection,
|
| 23 |
+
has_suggestion,
|
| 24 |
+
vi_insert_mode,
|
| 25 |
+
vi_mode,
|
| 26 |
+
)
|
| 27 |
+
from prompt_toolkit.layout.layout import FocusableElement
|
| 28 |
+
|
| 29 |
+
from IPython.core.getipython import get_ipython
|
| 30 |
+
from IPython.core.guarded_eval import _find_dunder, BINARY_OP_DUNDERS, UNARY_OP_DUNDERS
|
| 31 |
+
from IPython.terminal.shortcuts import auto_suggest
|
| 32 |
+
from IPython.utils.decorators import undoc
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@undoc
|
| 36 |
+
@Condition
|
| 37 |
+
def cursor_in_leading_ws():
|
| 38 |
+
before = get_app().current_buffer.document.current_line_before_cursor
|
| 39 |
+
return (not before) or before.isspace()
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def has_focus(value: FocusableElement):
|
| 43 |
+
"""Wrapper around has_focus adding a nice `__name__` to tester function"""
|
| 44 |
+
tester = has_focus_impl(value).func
|
| 45 |
+
tester.__name__ = f"is_focused({value})"
|
| 46 |
+
return Condition(tester)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
@undoc
|
| 50 |
+
@Condition
|
| 51 |
+
def has_line_below() -> bool:
|
| 52 |
+
document = get_app().current_buffer.document
|
| 53 |
+
return document.cursor_position_row < len(document.lines) - 1
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
@undoc
|
| 57 |
+
@Condition
|
| 58 |
+
def is_cursor_at_the_end_of_line() -> bool:
|
| 59 |
+
document = get_app().current_buffer.document
|
| 60 |
+
return document.is_cursor_at_the_end_of_line
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
@undoc
|
| 64 |
+
@Condition
|
| 65 |
+
def has_line_above() -> bool:
|
| 66 |
+
document = get_app().current_buffer.document
|
| 67 |
+
return document.cursor_position_row != 0
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
@Condition
|
| 71 |
+
def ebivim():
|
| 72 |
+
shell = get_ipython()
|
| 73 |
+
return shell.emacs_bindings_in_vi_insert_mode
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
@Condition
|
| 77 |
+
def supports_suspend():
|
| 78 |
+
return hasattr(signal, "SIGTSTP")
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
@Condition
|
| 82 |
+
def auto_match():
|
| 83 |
+
shell = get_ipython()
|
| 84 |
+
return shell.auto_match
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def all_quotes_paired(quote, buf):
|
| 88 |
+
paired = True
|
| 89 |
+
i = 0
|
| 90 |
+
while i < len(buf):
|
| 91 |
+
c = buf[i]
|
| 92 |
+
if c == quote:
|
| 93 |
+
paired = not paired
|
| 94 |
+
elif c == "\\":
|
| 95 |
+
i += 1
|
| 96 |
+
i += 1
|
| 97 |
+
return paired
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
_preceding_text_cache: Dict[Union[str, Callable], Condition] = {}
|
| 101 |
+
_following_text_cache: Dict[Union[str, Callable], Condition] = {}
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def preceding_text(pattern: Union[str, Callable]):
|
| 105 |
+
if pattern in _preceding_text_cache:
|
| 106 |
+
return _preceding_text_cache[pattern]
|
| 107 |
+
|
| 108 |
+
if callable(pattern):
|
| 109 |
+
|
| 110 |
+
def _preceding_text():
|
| 111 |
+
app = get_app()
|
| 112 |
+
before_cursor = app.current_buffer.document.current_line_before_cursor
|
| 113 |
+
# mypy can't infer if(callable): https://github.com/python/mypy/issues/3603
|
| 114 |
+
return bool(pattern(before_cursor)) # type: ignore[operator]
|
| 115 |
+
|
| 116 |
+
else:
|
| 117 |
+
m = re.compile(pattern)
|
| 118 |
+
|
| 119 |
+
def _preceding_text():
|
| 120 |
+
app = get_app()
|
| 121 |
+
before_cursor = app.current_buffer.document.current_line_before_cursor
|
| 122 |
+
return bool(m.match(before_cursor))
|
| 123 |
+
|
| 124 |
+
_preceding_text.__name__ = f"preceding_text({pattern!r})"
|
| 125 |
+
|
| 126 |
+
condition = Condition(_preceding_text)
|
| 127 |
+
_preceding_text_cache[pattern] = condition
|
| 128 |
+
return condition
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def following_text(pattern):
|
| 132 |
+
try:
|
| 133 |
+
return _following_text_cache[pattern]
|
| 134 |
+
except KeyError:
|
| 135 |
+
pass
|
| 136 |
+
m = re.compile(pattern)
|
| 137 |
+
|
| 138 |
+
def _following_text():
|
| 139 |
+
app = get_app()
|
| 140 |
+
return bool(m.match(app.current_buffer.document.current_line_after_cursor))
|
| 141 |
+
|
| 142 |
+
_following_text.__name__ = f"following_text({pattern!r})"
|
| 143 |
+
|
| 144 |
+
condition = Condition(_following_text)
|
| 145 |
+
_following_text_cache[pattern] = condition
|
| 146 |
+
return condition
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
@Condition
|
| 150 |
+
def not_inside_unclosed_string():
|
| 151 |
+
app = get_app()
|
| 152 |
+
s = app.current_buffer.document.text_before_cursor
|
| 153 |
+
# remove escaped quotes
|
| 154 |
+
s = s.replace('\\"', "").replace("\\'", "")
|
| 155 |
+
# remove triple-quoted string literals
|
| 156 |
+
s = re.sub(r"(?:\"\"\"[\s\S]*\"\"\"|'''[\s\S]*''')", "", s)
|
| 157 |
+
# remove single-quoted string literals
|
| 158 |
+
s = re.sub(r"""(?:"[^"]*["\n]|'[^']*['\n])""", "", s)
|
| 159 |
+
return not ('"' in s or "'" in s)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
@Condition
|
| 163 |
+
def navigable_suggestions():
|
| 164 |
+
shell = get_ipython()
|
| 165 |
+
return isinstance(shell.auto_suggest, auto_suggest.NavigableAutoSuggestFromHistory)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
@Condition
|
| 169 |
+
def readline_like_completions():
|
| 170 |
+
shell = get_ipython()
|
| 171 |
+
return shell.display_completions == "readlinelike"
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
@Condition
|
| 175 |
+
def is_windows_os():
|
| 176 |
+
return sys.platform == "win32"
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
class PassThrough(Filter):
|
| 180 |
+
"""A filter allowing to implement pass-through behaviour of keybindings.
|
| 181 |
+
|
| 182 |
+
Prompt toolkit key processor dispatches only one event per binding match,
|
| 183 |
+
which means that adding a new shortcut will suppress the old shortcut
|
| 184 |
+
if the keybindings are the same (unless one is filtered out).
|
| 185 |
+
|
| 186 |
+
To stop a shortcut binding from suppressing other shortcuts:
|
| 187 |
+
- add the `pass_through` filter to list of filter, and
|
| 188 |
+
- call `pass_through.reply(event)` in the shortcut handler.
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
def __init__(self):
|
| 192 |
+
self._is_replying = False
|
| 193 |
+
|
| 194 |
+
def reply(self, event: KeyPressEvent):
|
| 195 |
+
self._is_replying = True
|
| 196 |
+
try:
|
| 197 |
+
event.key_processor.reset()
|
| 198 |
+
event.key_processor.feed_multiple(event.key_sequence)
|
| 199 |
+
event.key_processor.process_keys()
|
| 200 |
+
finally:
|
| 201 |
+
self._is_replying = False
|
| 202 |
+
|
| 203 |
+
def __call__(self):
|
| 204 |
+
return not self._is_replying
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
pass_through = PassThrough()
|
| 208 |
+
|
| 209 |
+
# these one is callable and re-used multiple times hence needs to be
|
| 210 |
+
# only defined once beforehand so that transforming back to human-readable
|
| 211 |
+
# names works well in the documentation.
|
| 212 |
+
default_buffer_focused = has_focus(DEFAULT_BUFFER)
|
| 213 |
+
|
| 214 |
+
KEYBINDING_FILTERS = {
|
| 215 |
+
"always": Always(),
|
| 216 |
+
# never is used for exposing commands which have no default keybindings
|
| 217 |
+
"never": Never(),
|
| 218 |
+
"has_line_below": has_line_below,
|
| 219 |
+
"has_line_above": has_line_above,
|
| 220 |
+
"is_cursor_at_the_end_of_line": is_cursor_at_the_end_of_line,
|
| 221 |
+
"has_selection": has_selection,
|
| 222 |
+
"has_suggestion": has_suggestion,
|
| 223 |
+
"vi_mode": vi_mode,
|
| 224 |
+
"vi_insert_mode": vi_insert_mode,
|
| 225 |
+
"emacs_insert_mode": emacs_insert_mode,
|
| 226 |
+
# https://github.com/ipython/ipython/pull/12603 argued for inclusion of
|
| 227 |
+
# emacs key bindings with a configurable `emacs_bindings_in_vi_insert_mode`
|
| 228 |
+
# toggle; when the toggle is on user can access keybindigns like `ctrl + e`
|
| 229 |
+
# in vi insert mode. Because some of the emacs bindings involve `escape`
|
| 230 |
+
# followed by another key, e.g. `escape` followed by `f`, prompt-toolkit
|
| 231 |
+
# needs to wait to see if there will be another character typed in before
|
| 232 |
+
# executing pure `escape` keybinding; in vi insert mode `escape` switches to
|
| 233 |
+
# command mode which is common and performance critical action for vi users.
|
| 234 |
+
# To avoid the delay users employ a workaround:
|
| 235 |
+
# https://github.com/ipython/ipython/issues/13443#issuecomment-1032753703
|
| 236 |
+
# which involves switching `emacs_bindings_in_vi_insert_mode` off.
|
| 237 |
+
#
|
| 238 |
+
# For the workaround to work:
|
| 239 |
+
# 1) end users need to toggle `emacs_bindings_in_vi_insert_mode` off
|
| 240 |
+
# 2) all keybindings which would involve `escape` need to respect that
|
| 241 |
+
# toggle by including either:
|
| 242 |
+
# - `vi_insert_mode & ebivim` for actions which have emacs keybindings
|
| 243 |
+
# predefined upstream in prompt-toolkit, or
|
| 244 |
+
# - `emacs_like_insert_mode` for actions which do not have existing
|
| 245 |
+
# emacs keybindings predefined upstream (or need overriding of the
|
| 246 |
+
# upstream bindings to modify behaviour), defined below.
|
| 247 |
+
"emacs_like_insert_mode": (vi_insert_mode & ebivim) | emacs_insert_mode,
|
| 248 |
+
"has_completions": has_completions,
|
| 249 |
+
"insert_mode": vi_insert_mode | emacs_insert_mode,
|
| 250 |
+
"default_buffer_focused": default_buffer_focused,
|
| 251 |
+
"search_buffer_focused": has_focus(SEARCH_BUFFER),
|
| 252 |
+
# `ebivim` stands for emacs bindings in vi insert mode
|
| 253 |
+
"ebivim": ebivim,
|
| 254 |
+
"supports_suspend": supports_suspend,
|
| 255 |
+
"is_windows_os": is_windows_os,
|
| 256 |
+
"auto_match": auto_match,
|
| 257 |
+
"focused_insert": (vi_insert_mode | emacs_insert_mode) & default_buffer_focused,
|
| 258 |
+
"not_inside_unclosed_string": not_inside_unclosed_string,
|
| 259 |
+
"readline_like_completions": readline_like_completions,
|
| 260 |
+
"preceded_by_paired_double_quotes": preceding_text(
|
| 261 |
+
lambda line: all_quotes_paired('"', line)
|
| 262 |
+
),
|
| 263 |
+
"preceded_by_paired_single_quotes": preceding_text(
|
| 264 |
+
lambda line: all_quotes_paired("'", line)
|
| 265 |
+
),
|
| 266 |
+
"preceded_by_raw_str_prefix": preceding_text(r".*(r|R)[\"'](-*)$"),
|
| 267 |
+
"preceded_by_two_double_quotes": preceding_text(r'^.*""$'),
|
| 268 |
+
"preceded_by_two_single_quotes": preceding_text(r"^.*''$"),
|
| 269 |
+
"followed_by_closing_paren_or_end": following_text(r"[,)}\]]|$"),
|
| 270 |
+
"preceded_by_opening_round_paren": preceding_text(r".*\($"),
|
| 271 |
+
"preceded_by_opening_bracket": preceding_text(r".*\[$"),
|
| 272 |
+
"preceded_by_opening_brace": preceding_text(r".*\{$"),
|
| 273 |
+
"preceded_by_double_quote": preceding_text('.*"$'),
|
| 274 |
+
"preceded_by_single_quote": preceding_text(r".*'$"),
|
| 275 |
+
"followed_by_closing_round_paren": following_text(r"^\)"),
|
| 276 |
+
"followed_by_closing_bracket": following_text(r"^\]"),
|
| 277 |
+
"followed_by_closing_brace": following_text(r"^\}"),
|
| 278 |
+
"followed_by_double_quote": following_text('^"'),
|
| 279 |
+
"followed_by_single_quote": following_text("^'"),
|
| 280 |
+
"navigable_suggestions": navigable_suggestions,
|
| 281 |
+
"cursor_in_leading_ws": cursor_in_leading_ws,
|
| 282 |
+
"pass_through": pass_through,
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
def eval_node(node: Union[ast.AST, None]):
|
| 287 |
+
if node is None:
|
| 288 |
+
return None
|
| 289 |
+
if isinstance(node, ast.Expression):
|
| 290 |
+
return eval_node(node.body)
|
| 291 |
+
if isinstance(node, ast.BinOp):
|
| 292 |
+
left = eval_node(node.left)
|
| 293 |
+
right = eval_node(node.right)
|
| 294 |
+
dunders = _find_dunder(node.op, BINARY_OP_DUNDERS)
|
| 295 |
+
if dunders:
|
| 296 |
+
return getattr(left, dunders[0])(right)
|
| 297 |
+
raise ValueError(f"Unknown binary operation: {node.op}")
|
| 298 |
+
if isinstance(node, ast.UnaryOp):
|
| 299 |
+
value = eval_node(node.operand)
|
| 300 |
+
dunders = _find_dunder(node.op, UNARY_OP_DUNDERS)
|
| 301 |
+
if dunders:
|
| 302 |
+
return getattr(value, dunders[0])()
|
| 303 |
+
raise ValueError(f"Unknown unary operation: {node.op}")
|
| 304 |
+
if isinstance(node, ast.Name):
|
| 305 |
+
if node.id in KEYBINDING_FILTERS:
|
| 306 |
+
return KEYBINDING_FILTERS[node.id]
|
| 307 |
+
else:
|
| 308 |
+
sep = "\n - "
|
| 309 |
+
known_filters = sep.join(sorted(KEYBINDING_FILTERS))
|
| 310 |
+
raise NameError(
|
| 311 |
+
f"{node.id} is not a known shortcut filter."
|
| 312 |
+
f" Known filters are: {sep}{known_filters}."
|
| 313 |
+
)
|
| 314 |
+
raise ValueError("Unhandled node", ast.dump(node))
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
def filter_from_string(code: str):
|
| 318 |
+
expression = ast.parse(code, mode="eval")
|
| 319 |
+
return eval_node(expression)
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
__all__ = ["KEYBINDING_FILTERS", "filter_from_string"]
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (181 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_debug_magic.cpython-310.pyc
ADDED
|
Binary file (1.63 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_embed.cpython-310.pyc
ADDED
|
Binary file (3.03 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_interactivshell.cpython-310.pyc
ADDED
|
Binary file (8.94 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/__pycache__/test_pt_inputhooks.cpython-310.pyc
ADDED
|
Binary file (1.37 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/test_help.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Test help output of various IPython entry points"""
|
| 2 |
+
|
| 3 |
+
# Copyright (c) IPython Development Team.
|
| 4 |
+
# Distributed under the terms of the Modified BSD License.
|
| 5 |
+
|
| 6 |
+
import pytest
|
| 7 |
+
import IPython.testing.tools as tt
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def test_ipython_help():
|
| 11 |
+
tt.help_all_output_test()
|
| 12 |
+
|
| 13 |
+
def test_profile_help():
|
| 14 |
+
tt.help_all_output_test("profile")
|
| 15 |
+
|
| 16 |
+
def test_profile_list_help():
|
| 17 |
+
tt.help_all_output_test("profile list")
|
| 18 |
+
|
| 19 |
+
def test_profile_create_help():
|
| 20 |
+
tt.help_all_output_test("profile create")
|
| 21 |
+
|
| 22 |
+
def test_locate_help():
|
| 23 |
+
tt.help_all_output_test("locate")
|
| 24 |
+
|
| 25 |
+
def test_locate_profile_help():
|
| 26 |
+
tt.help_all_output_test("locate profile")
|
| 27 |
+
|
| 28 |
+
def test_trust_help():
|
| 29 |
+
pytest.importorskip("nbformat")
|
| 30 |
+
tt.help_all_output_test("trust")
|
evalkit_tf437/lib/python3.10/site-packages/IPython/terminal/tests/test_interactivshell.py
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""Tests for the TerminalInteractiveShell and related pieces."""
|
| 3 |
+
# Copyright (c) IPython Development Team.
|
| 4 |
+
# Distributed under the terms of the Modified BSD License.
|
| 5 |
+
|
| 6 |
+
import sys
|
| 7 |
+
import unittest
|
| 8 |
+
import os
|
| 9 |
+
|
| 10 |
+
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
from IPython.testing import tools as tt
|
| 14 |
+
|
| 15 |
+
from IPython.terminal.ptutils import _elide, _adjust_completion_text_based_on_context
|
| 16 |
+
from IPython.terminal.shortcuts.auto_suggest import NavigableAutoSuggestFromHistory
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class TestAutoSuggest(unittest.TestCase):
|
| 20 |
+
def test_changing_provider(self):
|
| 21 |
+
ip = get_ipython()
|
| 22 |
+
ip.autosuggestions_provider = None
|
| 23 |
+
self.assertEqual(ip.auto_suggest, None)
|
| 24 |
+
ip.autosuggestions_provider = "AutoSuggestFromHistory"
|
| 25 |
+
self.assertIsInstance(ip.auto_suggest, AutoSuggestFromHistory)
|
| 26 |
+
ip.autosuggestions_provider = "NavigableAutoSuggestFromHistory"
|
| 27 |
+
self.assertIsInstance(ip.auto_suggest, NavigableAutoSuggestFromHistory)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class TestElide(unittest.TestCase):
|
| 31 |
+
def test_elide(self):
|
| 32 |
+
_elide("concatenate((a1, a2, ...), axis", "") # do not raise
|
| 33 |
+
_elide("concatenate((a1, a2, ..), . axis", "") # do not raise
|
| 34 |
+
self.assertEqual(
|
| 35 |
+
_elide("aaaa.bbbb.ccccc.dddddd.eeeee.fffff.gggggg.hhhhhh", ""),
|
| 36 |
+
"aaaa.b…g.hhhhhh",
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
test_string = os.sep.join(["", 10 * "a", 10 * "b", 10 * "c", ""])
|
| 40 |
+
expect_string = (
|
| 41 |
+
os.sep + "a" + "\N{HORIZONTAL ELLIPSIS}" + "b" + os.sep + 10 * "c"
|
| 42 |
+
)
|
| 43 |
+
self.assertEqual(_elide(test_string, ""), expect_string)
|
| 44 |
+
|
| 45 |
+
def test_elide_typed_normal(self):
|
| 46 |
+
self.assertEqual(
|
| 47 |
+
_elide(
|
| 48 |
+
"the quick brown fox jumped over the lazy dog",
|
| 49 |
+
"the quick brown fox",
|
| 50 |
+
min_elide=10,
|
| 51 |
+
),
|
| 52 |
+
"the…fox jumped over the lazy dog",
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
def test_elide_typed_short_match(self):
|
| 56 |
+
"""
|
| 57 |
+
if the match is too short we don't elide.
|
| 58 |
+
avoid the "the...the"
|
| 59 |
+
"""
|
| 60 |
+
self.assertEqual(
|
| 61 |
+
_elide("the quick brown fox jumped over the lazy dog", "the", min_elide=10),
|
| 62 |
+
"the quick brown fox jumped over the lazy dog",
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
def test_elide_typed_no_match(self):
|
| 66 |
+
"""
|
| 67 |
+
if the match is too short we don't elide.
|
| 68 |
+
avoid the "the...the"
|
| 69 |
+
"""
|
| 70 |
+
# here we typed red instead of brown
|
| 71 |
+
self.assertEqual(
|
| 72 |
+
_elide(
|
| 73 |
+
"the quick brown fox jumped over the lazy dog",
|
| 74 |
+
"the quick red fox",
|
| 75 |
+
min_elide=10,
|
| 76 |
+
),
|
| 77 |
+
"the quick brown fox jumped over the lazy dog",
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class TestContextAwareCompletion(unittest.TestCase):
|
| 82 |
+
def test_adjust_completion_text_based_on_context(self):
|
| 83 |
+
# Adjusted case
|
| 84 |
+
self.assertEqual(
|
| 85 |
+
_adjust_completion_text_based_on_context("arg1=", "func1(a=)", 7), "arg1"
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
# Untouched cases
|
| 89 |
+
self.assertEqual(
|
| 90 |
+
_adjust_completion_text_based_on_context("arg1=", "func1(a)", 7), "arg1="
|
| 91 |
+
)
|
| 92 |
+
self.assertEqual(
|
| 93 |
+
_adjust_completion_text_based_on_context("arg1=", "func1(a", 7), "arg1="
|
| 94 |
+
)
|
| 95 |
+
self.assertEqual(
|
| 96 |
+
_adjust_completion_text_based_on_context("%magic", "func1(a=)", 7), "%magic"
|
| 97 |
+
)
|
| 98 |
+
self.assertEqual(
|
| 99 |
+
_adjust_completion_text_based_on_context("func2", "func1(a=)", 7), "func2"
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
# Decorator for interaction loop tests -----------------------------------------
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class mock_input_helper(object):
|
| 107 |
+
"""Machinery for tests of the main interact loop.
|
| 108 |
+
|
| 109 |
+
Used by the mock_input decorator.
|
| 110 |
+
"""
|
| 111 |
+
def __init__(self, testgen):
|
| 112 |
+
self.testgen = testgen
|
| 113 |
+
self.exception = None
|
| 114 |
+
self.ip = get_ipython()
|
| 115 |
+
|
| 116 |
+
def __enter__(self):
|
| 117 |
+
self.orig_prompt_for_code = self.ip.prompt_for_code
|
| 118 |
+
self.ip.prompt_for_code = self.fake_input
|
| 119 |
+
return self
|
| 120 |
+
|
| 121 |
+
def __exit__(self, etype, value, tb):
|
| 122 |
+
self.ip.prompt_for_code = self.orig_prompt_for_code
|
| 123 |
+
|
| 124 |
+
def fake_input(self):
|
| 125 |
+
try:
|
| 126 |
+
return next(self.testgen)
|
| 127 |
+
except StopIteration:
|
| 128 |
+
self.ip.keep_running = False
|
| 129 |
+
return u''
|
| 130 |
+
except:
|
| 131 |
+
self.exception = sys.exc_info()
|
| 132 |
+
self.ip.keep_running = False
|
| 133 |
+
return u''
|
| 134 |
+
|
| 135 |
+
def mock_input(testfunc):
|
| 136 |
+
"""Decorator for tests of the main interact loop.
|
| 137 |
+
|
| 138 |
+
Write the test as a generator, yield-ing the input strings, which IPython
|
| 139 |
+
will see as if they were typed in at the prompt.
|
| 140 |
+
"""
|
| 141 |
+
def test_method(self):
|
| 142 |
+
testgen = testfunc(self)
|
| 143 |
+
with mock_input_helper(testgen) as mih:
|
| 144 |
+
mih.ip.interact()
|
| 145 |
+
|
| 146 |
+
if mih.exception is not None:
|
| 147 |
+
# Re-raise captured exception
|
| 148 |
+
etype, value, tb = mih.exception
|
| 149 |
+
import traceback
|
| 150 |
+
traceback.print_tb(tb, file=sys.stdout)
|
| 151 |
+
del tb # Avoid reference loop
|
| 152 |
+
raise value
|
| 153 |
+
|
| 154 |
+
return test_method
|
| 155 |
+
|
| 156 |
+
# Test classes -----------------------------------------------------------------
|
| 157 |
+
|
| 158 |
+
class InteractiveShellTestCase(unittest.TestCase):
|
| 159 |
+
def rl_hist_entries(self, rl, n):
|
| 160 |
+
"""Get last n readline history entries as a list"""
|
| 161 |
+
return [rl.get_history_item(rl.get_current_history_length() - x)
|
| 162 |
+
for x in range(n - 1, -1, -1)]
|
| 163 |
+
|
| 164 |
+
@mock_input
|
| 165 |
+
def test_inputtransformer_syntaxerror(self):
|
| 166 |
+
ip = get_ipython()
|
| 167 |
+
ip.input_transformers_post.append(syntax_error_transformer)
|
| 168 |
+
|
| 169 |
+
try:
|
| 170 |
+
#raise Exception
|
| 171 |
+
with tt.AssertPrints('4', suppress=False):
|
| 172 |
+
yield u'print(2*2)'
|
| 173 |
+
|
| 174 |
+
with tt.AssertPrints('SyntaxError: input contains', suppress=False):
|
| 175 |
+
yield u'print(2345) # syntaxerror'
|
| 176 |
+
|
| 177 |
+
with tt.AssertPrints('16', suppress=False):
|
| 178 |
+
yield u'print(4*4)'
|
| 179 |
+
|
| 180 |
+
finally:
|
| 181 |
+
ip.input_transformers_post.remove(syntax_error_transformer)
|
| 182 |
+
|
| 183 |
+
def test_repl_not_plain_text(self):
|
| 184 |
+
ip = get_ipython()
|
| 185 |
+
formatter = ip.display_formatter
|
| 186 |
+
assert formatter.active_types == ['text/plain']
|
| 187 |
+
|
| 188 |
+
# terminal may have arbitrary mimetype handler to open external viewer
|
| 189 |
+
# or inline images.
|
| 190 |
+
assert formatter.ipython_display_formatter.enabled
|
| 191 |
+
|
| 192 |
+
class Test(object):
|
| 193 |
+
def __repr__(self):
|
| 194 |
+
return "<Test %i>" % id(self)
|
| 195 |
+
|
| 196 |
+
def _repr_html_(self):
|
| 197 |
+
return '<html>'
|
| 198 |
+
|
| 199 |
+
# verify that HTML repr isn't computed
|
| 200 |
+
obj = Test()
|
| 201 |
+
data, _ = formatter.format(obj)
|
| 202 |
+
self.assertEqual(data, {'text/plain': repr(obj)})
|
| 203 |
+
|
| 204 |
+
class Test2(Test):
|
| 205 |
+
def _ipython_display_(self):
|
| 206 |
+
from IPython.display import display, HTML
|
| 207 |
+
|
| 208 |
+
display(HTML("<custom>"))
|
| 209 |
+
|
| 210 |
+
# verify that mimehandlers are called
|
| 211 |
+
called = False
|
| 212 |
+
|
| 213 |
+
def handler(data, metadata):
|
| 214 |
+
print("Handler called")
|
| 215 |
+
nonlocal called
|
| 216 |
+
called = True
|
| 217 |
+
|
| 218 |
+
ip.display_formatter.active_types.append("text/html")
|
| 219 |
+
ip.display_formatter.formatters["text/html"].enabled = True
|
| 220 |
+
ip.mime_renderers["text/html"] = handler
|
| 221 |
+
try:
|
| 222 |
+
obj = Test()
|
| 223 |
+
display(obj)
|
| 224 |
+
finally:
|
| 225 |
+
ip.display_formatter.formatters["text/html"].enabled = False
|
| 226 |
+
del ip.mime_renderers["text/html"]
|
| 227 |
+
|
| 228 |
+
assert called == True
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def syntax_error_transformer(lines):
|
| 232 |
+
"""Transformer that throws SyntaxError if 'syntaxerror' is in the code."""
|
| 233 |
+
for line in lines:
|
| 234 |
+
pos = line.find('syntaxerror')
|
| 235 |
+
if pos >= 0:
|
| 236 |
+
e = SyntaxError('input contains "syntaxerror"')
|
| 237 |
+
e.text = line
|
| 238 |
+
e.offset = pos + 1
|
| 239 |
+
raise e
|
| 240 |
+
return lines
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class TerminalMagicsTestCase(unittest.TestCase):
|
| 244 |
+
def test_paste_magics_blankline(self):
|
| 245 |
+
"""Test that code with a blank line doesn't get split (gh-3246)."""
|
| 246 |
+
ip = get_ipython()
|
| 247 |
+
s = ('def pasted_func(a):\n'
|
| 248 |
+
' b = a+1\n'
|
| 249 |
+
'\n'
|
| 250 |
+
' return b')
|
| 251 |
+
|
| 252 |
+
tm = ip.magics_manager.registry['TerminalMagics']
|
| 253 |
+
tm.store_or_execute(s, name=None)
|
| 254 |
+
|
| 255 |
+
self.assertEqual(ip.user_ns['pasted_func'](54), 55)
|
evalkit_tf437/lib/python3.10/site-packages/certifi/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import contents, where
|
| 2 |
+
|
| 3 |
+
__all__ = ["contents", "where"]
|
| 4 |
+
__version__ = "2024.08.30"
|
evalkit_tf437/lib/python3.10/site-packages/certifi/__main__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
|
| 3 |
+
from certifi import contents, where
|
| 4 |
+
|
| 5 |
+
parser = argparse.ArgumentParser()
|
| 6 |
+
parser.add_argument("-c", "--contents", action="store_true")
|
| 7 |
+
args = parser.parse_args()
|
| 8 |
+
|
| 9 |
+
if args.contents:
|
| 10 |
+
print(contents())
|
| 11 |
+
else:
|
| 12 |
+
print(where())
|
evalkit_tf437/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (279 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/certifi/cacert.pem
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
evalkit_tf437/lib/python3.10/site-packages/certifi/core.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
certifi.py
|
| 3 |
+
~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
This module returns the installation location of cacert.pem or its contents.
|
| 6 |
+
"""
|
| 7 |
+
import sys
|
| 8 |
+
import atexit
|
| 9 |
+
|
| 10 |
+
def exit_cacert_ctx() -> None:
|
| 11 |
+
_CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
if sys.version_info >= (3, 11):
|
| 15 |
+
|
| 16 |
+
from importlib.resources import as_file, files
|
| 17 |
+
|
| 18 |
+
_CACERT_CTX = None
|
| 19 |
+
_CACERT_PATH = None
|
| 20 |
+
|
| 21 |
+
def where() -> str:
|
| 22 |
+
# This is slightly terrible, but we want to delay extracting the file
|
| 23 |
+
# in cases where we're inside of a zipimport situation until someone
|
| 24 |
+
# actually calls where(), but we don't want to re-extract the file
|
| 25 |
+
# on every call of where(), so we'll do it once then store it in a
|
| 26 |
+
# global variable.
|
| 27 |
+
global _CACERT_CTX
|
| 28 |
+
global _CACERT_PATH
|
| 29 |
+
if _CACERT_PATH is None:
|
| 30 |
+
# This is slightly janky, the importlib.resources API wants you to
|
| 31 |
+
# manage the cleanup of this file, so it doesn't actually return a
|
| 32 |
+
# path, it returns a context manager that will give you the path
|
| 33 |
+
# when you enter it and will do any cleanup when you leave it. In
|
| 34 |
+
# the common case of not needing a temporary file, it will just
|
| 35 |
+
# return the file system location and the __exit__() is a no-op.
|
| 36 |
+
#
|
| 37 |
+
# We also have to hold onto the actual context manager, because
|
| 38 |
+
# it will do the cleanup whenever it gets garbage collected, so
|
| 39 |
+
# we will also store that at the global level as well.
|
| 40 |
+
_CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
|
| 41 |
+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
|
| 42 |
+
atexit.register(exit_cacert_ctx)
|
| 43 |
+
|
| 44 |
+
return _CACERT_PATH
|
| 45 |
+
|
| 46 |
+
def contents() -> str:
|
| 47 |
+
return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
|
| 48 |
+
|
| 49 |
+
elif sys.version_info >= (3, 7):
|
| 50 |
+
|
| 51 |
+
from importlib.resources import path as get_path, read_text
|
| 52 |
+
|
| 53 |
+
_CACERT_CTX = None
|
| 54 |
+
_CACERT_PATH = None
|
| 55 |
+
|
| 56 |
+
def where() -> str:
|
| 57 |
+
# This is slightly terrible, but we want to delay extracting the
|
| 58 |
+
# file in cases where we're inside of a zipimport situation until
|
| 59 |
+
# someone actually calls where(), but we don't want to re-extract
|
| 60 |
+
# the file on every call of where(), so we'll do it once then store
|
| 61 |
+
# it in a global variable.
|
| 62 |
+
global _CACERT_CTX
|
| 63 |
+
global _CACERT_PATH
|
| 64 |
+
if _CACERT_PATH is None:
|
| 65 |
+
# This is slightly janky, the importlib.resources API wants you
|
| 66 |
+
# to manage the cleanup of this file, so it doesn't actually
|
| 67 |
+
# return a path, it returns a context manager that will give
|
| 68 |
+
# you the path when you enter it and will do any cleanup when
|
| 69 |
+
# you leave it. In the common case of not needing a temporary
|
| 70 |
+
# file, it will just return the file system location and the
|
| 71 |
+
# __exit__() is a no-op.
|
| 72 |
+
#
|
| 73 |
+
# We also have to hold onto the actual context manager, because
|
| 74 |
+
# it will do the cleanup whenever it gets garbage collected, so
|
| 75 |
+
# we will also store that at the global level as well.
|
| 76 |
+
_CACERT_CTX = get_path("certifi", "cacert.pem")
|
| 77 |
+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
|
| 78 |
+
atexit.register(exit_cacert_ctx)
|
| 79 |
+
|
| 80 |
+
return _CACERT_PATH
|
| 81 |
+
|
| 82 |
+
def contents() -> str:
|
| 83 |
+
return read_text("certifi", "cacert.pem", encoding="ascii")
|
| 84 |
+
|
| 85 |
+
else:
|
| 86 |
+
import os
|
| 87 |
+
import types
|
| 88 |
+
from typing import Union
|
| 89 |
+
|
| 90 |
+
Package = Union[types.ModuleType, str]
|
| 91 |
+
Resource = Union[str, "os.PathLike"]
|
| 92 |
+
|
| 93 |
+
# This fallback will work for Python versions prior to 3.7 that lack the
|
| 94 |
+
# importlib.resources module but relies on the existing `where` function
|
| 95 |
+
# so won't address issues with environments like PyOxidizer that don't set
|
| 96 |
+
# __file__ on modules.
|
| 97 |
+
def read_text(
|
| 98 |
+
package: Package,
|
| 99 |
+
resource: Resource,
|
| 100 |
+
encoding: str = 'utf-8',
|
| 101 |
+
errors: str = 'strict'
|
| 102 |
+
) -> str:
|
| 103 |
+
with open(where(), encoding=encoding) as data:
|
| 104 |
+
return data.read()
|
| 105 |
+
|
| 106 |
+
# If we don't have importlib.resources, then we will just do the old logic
|
| 107 |
+
# of assuming we're on the filesystem and munge the path directly.
|
| 108 |
+
def where() -> str:
|
| 109 |
+
f = os.path.dirname(__file__)
|
| 110 |
+
|
| 111 |
+
return os.path.join(f, "cacert.pem")
|
| 112 |
+
|
| 113 |
+
def contents() -> str:
|
| 114 |
+
return read_text("certifi", "cacert.pem", encoding="ascii")
|
evalkit_tf437/lib/python3.10/site-packages/certifi/py.typed
ADDED
|
File without changes
|
evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/LICENCE.txt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
[OSI Approved License]
|
| 3 |
+
|
| 4 |
+
The MIT License (MIT)
|
| 5 |
+
|
| 6 |
+
Copyright (c) 2015 Zulko
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 9 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 10 |
+
in the Software without restriction, including without limitation the rights
|
| 11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 12 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 13 |
+
furnished to do so, subject to the following conditions:
|
| 14 |
+
|
| 15 |
+
The above copyright notice and this permission notice shall be included in
|
| 16 |
+
all copies or substantial portions of the Software.
|
| 17 |
+
|
| 18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 21 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 22 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 23 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 24 |
+
THE SOFTWARE.
|
| 25 |
+
|
evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/RECORD
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
moviepy-1.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
moviepy-1.0.3.dist-info/LICENCE.txt,sha256=AdwAlHG0Q8vAzROYN8BFt1Em-GmUii725Bno1yGvUho,1119
|
| 3 |
+
moviepy-1.0.3.dist-info/METADATA,sha256=UsjskN_5CrDz4MFazB_8Wqvbe_GO_l5W3UFkrapKbgg,12503
|
| 4 |
+
moviepy-1.0.3.dist-info/RECORD,,
|
| 5 |
+
moviepy-1.0.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
moviepy-1.0.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
| 7 |
+
moviepy-1.0.3.dist-info/top_level.txt,sha256=2AuAzBHXS1RtsoIY43fmVUdf9ZmzoOHlkkBOmciPVBU,8
|
| 8 |
+
moviepy/Clip.py,sha256=T5J4kgcTrOlRtpROEUWtNkZmeHanTOHWcAXtaN11J88,16025
|
| 9 |
+
moviepy/__init__.py,sha256=Jzb_RfgvXCrm_SQ4AfeGVi1N36YybxnM5mpyxrnihgI,33
|
| 10 |
+
moviepy/__pycache__/Clip.cpython-310.pyc,,
|
| 11 |
+
moviepy/__pycache__/__init__.cpython-310.pyc,,
|
| 12 |
+
moviepy/__pycache__/compat.cpython-310.pyc,,
|
| 13 |
+
moviepy/__pycache__/config.cpython-310.pyc,,
|
| 14 |
+
moviepy/__pycache__/config_defaults.cpython-310.pyc,,
|
| 15 |
+
moviepy/__pycache__/decorators.cpython-310.pyc,,
|
| 16 |
+
moviepy/__pycache__/editor.cpython-310.pyc,,
|
| 17 |
+
moviepy/__pycache__/tools.cpython-310.pyc,,
|
| 18 |
+
moviepy/__pycache__/utils.cpython-310.pyc,,
|
| 19 |
+
moviepy/__pycache__/version.cpython-310.pyc,,
|
| 20 |
+
moviepy/audio/AudioClip.py,sha256=blce9zksB5CgOwkBzzbiqsuAuNr2YSmUczJNbMHuIYk,10899
|
| 21 |
+
moviepy/audio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 22 |
+
moviepy/audio/__pycache__/AudioClip.cpython-310.pyc,,
|
| 23 |
+
moviepy/audio/__pycache__/__init__.cpython-310.pyc,,
|
| 24 |
+
moviepy/audio/fx/__init__.py,sha256=QiLpB-Tq7n8ywyj769E67G47_TIF8uW7SICHSb3BZc4,121
|
| 25 |
+
moviepy/audio/fx/__pycache__/__init__.cpython-310.pyc,,
|
| 26 |
+
moviepy/audio/fx/__pycache__/audio_fadein.cpython-310.pyc,,
|
| 27 |
+
moviepy/audio/fx/__pycache__/audio_fadeout.cpython-310.pyc,,
|
| 28 |
+
moviepy/audio/fx/__pycache__/audio_left_right.cpython-310.pyc,,
|
| 29 |
+
moviepy/audio/fx/__pycache__/audio_loop.cpython-310.pyc,,
|
| 30 |
+
moviepy/audio/fx/__pycache__/audio_normalize.cpython-310.pyc,,
|
| 31 |
+
moviepy/audio/fx/__pycache__/volumex.cpython-310.pyc,,
|
| 32 |
+
moviepy/audio/fx/all/__init__.py,sha256=65Vuie1xarBAaMlJ-Ej4MqvVtSF-KOqE2hh0bmqKUus,318
|
| 33 |
+
moviepy/audio/fx/all/__pycache__/__init__.cpython-310.pyc,,
|
| 34 |
+
moviepy/audio/fx/audio_fadein.py,sha256=c5LXJow5UmuAD32L9nwMXfMmgdaN2zf2Tq4i0pCLkYc,632
|
| 35 |
+
moviepy/audio/fx/audio_fadeout.py,sha256=zR61frbcZ1lDmMa04JNpgru7HA1oS7F3XkL5LQFMWjk,703
|
| 36 |
+
moviepy/audio/fx/audio_left_right.py,sha256=nIY9aEyCJVZLBJEyOiUDv490RY-1qdsjzWMkC4oN4j0,501
|
| 37 |
+
moviepy/audio/fx/audio_loop.py,sha256=_CYIkNHVGEToWDaEt8fv8yNLkRAEkB6g9BDop8W3mbo,761
|
| 38 |
+
moviepy/audio/fx/audio_normalize.py,sha256=YybQD5AFBjm_dEe3aZ5Se7LCc010lbojPCaZpiWv_KE,530
|
| 39 |
+
moviepy/audio/fx/volumex.py,sha256=-iL2D2rmwJQ39BwqJ1iXitPoEBkNME62USW-3d4Za78,657
|
| 40 |
+
moviepy/audio/io/AudioFileClip.py,sha256=o7_uluimUOXWwXCVpij68yspmEkUC8R64AGti66DrM4,2801
|
| 41 |
+
moviepy/audio/io/__init__.py,sha256=ozgif9QB2xrWan5VQoAMRbxql6T2RaNA9bNDq6kUtsM,62
|
| 42 |
+
moviepy/audio/io/__pycache__/AudioFileClip.cpython-310.pyc,,
|
| 43 |
+
moviepy/audio/io/__pycache__/__init__.cpython-310.pyc,,
|
| 44 |
+
moviepy/audio/io/__pycache__/ffmpeg_audiowriter.cpython-310.pyc,,
|
| 45 |
+
moviepy/audio/io/__pycache__/preview.cpython-310.pyc,,
|
| 46 |
+
moviepy/audio/io/__pycache__/readers.cpython-310.pyc,,
|
| 47 |
+
moviepy/audio/io/ffmpeg_audiowriter.py,sha256=ssVCDxoR9ZE5pV7ZrkYDHVm7_A0I4k1s0k_wGoL17xc,6265
|
| 48 |
+
moviepy/audio/io/preview.py,sha256=MFotqzyd40vtJEJB4x0F8wR7RyXUWIhMGw7Ag5fahC0,2187
|
| 49 |
+
moviepy/audio/io/readers.py,sha256=YPdZOlhpXUfy16SJUKEM1JVkSgSG8fxbLOnGvEH02k8,8557
|
| 50 |
+
moviepy/audio/tools/__init__.py,sha256=ngcg4cOdZb-tTf72nTMGavfAUK0IhHOB1mMW4dQCkn0,48
|
| 51 |
+
moviepy/audio/tools/__pycache__/__init__.cpython-310.pyc,,
|
| 52 |
+
moviepy/audio/tools/__pycache__/cuts.cpython-310.pyc,,
|
| 53 |
+
moviepy/audio/tools/cuts.py,sha256=_YGlGWBXJIe7oBfhCUHk8mjvEajha7Mev8feVoVKjMs,686
|
| 54 |
+
moviepy/compat.py,sha256=Nba-F62uAuVOv1EJTuwwGqWhr1VyMPW0b2uxS_qVV0Y,303
|
| 55 |
+
moviepy/config.py,sha256=HwS1uQxirlCuDOxuaXLYAYImI0fpubiiPlikqrhGVU4,3474
|
| 56 |
+
moviepy/config_defaults.py,sha256=zHwjL-u7p2TDABWkEE7NUsP-1WM9Hr2uZ-Xs85j7VdU,1571
|
| 57 |
+
moviepy/decorators.py,sha256=mBQ6kz8FRNpIh6xjOQtPW3UVoINZ6M-hlb_VeIHhBq8,3868
|
| 58 |
+
moviepy/editor.py,sha256=lnpUJqk42qfYhL1ReAOMsnGxVapgZi2psKTh8Y8uya8,4108
|
| 59 |
+
moviepy/tools.py,sha256=mUC5IBvpBNacXZZ6gC2G76CnhzKeyxN6fV9VSQJogu8,5260
|
| 60 |
+
moviepy/utils.py,sha256=cLVYHsLxHi1ffLeTl7lYhz-GME5m9Juu5AvmgG1HTSM,609
|
| 61 |
+
moviepy/version.py,sha256=2plzdEEb24FLjE2I2XyBBcJEPYWHccNL4SgtLC_6erg,22
|
| 62 |
+
moviepy/video/VideoClip.py,sha256=nUr7jDP-c2CgjRFw_ImDFqW8ObJEHhdsre1HlQhQ6vE,41252
|
| 63 |
+
moviepy/video/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 64 |
+
moviepy/video/__pycache__/VideoClip.cpython-310.pyc,,
|
| 65 |
+
moviepy/video/__pycache__/__init__.cpython-310.pyc,,
|
| 66 |
+
moviepy/video/compositing/CompositeVideoClip.py,sha256=3U5OoeAaWokpsbLLmY-VwgyUthsbYF7h-pXZV2ufTEg,5657
|
| 67 |
+
moviepy/video/compositing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 68 |
+
moviepy/video/compositing/__pycache__/CompositeVideoClip.cpython-310.pyc,,
|
| 69 |
+
moviepy/video/compositing/__pycache__/__init__.cpython-310.pyc,,
|
| 70 |
+
moviepy/video/compositing/__pycache__/concatenate.cpython-310.pyc,,
|
| 71 |
+
moviepy/video/compositing/__pycache__/on_color.cpython-310.pyc,,
|
| 72 |
+
moviepy/video/compositing/__pycache__/positioning.cpython-310.pyc,,
|
| 73 |
+
moviepy/video/compositing/__pycache__/transitions.cpython-310.pyc,,
|
| 74 |
+
moviepy/video/compositing/concatenate.py,sha256=YVQnt4GlZYIYYtIGFfsF64pDsUu1JHCMpAEueo7QZv4,4604
|
| 75 |
+
moviepy/video/compositing/on_color.py,sha256=DjXkm8y8-vmUo2QfkNFjVr5SP8T7IhYoIDJv1KJzOtM,1053
|
| 76 |
+
moviepy/video/compositing/positioning.py,sha256=6fk_iD_juI-cuReU92JgBE8PImPogfeJ4vUhhW9vx84,87
|
| 77 |
+
moviepy/video/compositing/transitions.py,sha256=bZWjbjVkYhBCVRIeGT8ydha9XES-YUguVZLCik1Uzv4,3926
|
| 78 |
+
moviepy/video/fx/__init__.py,sha256=QiLpB-Tq7n8ywyj769E67G47_TIF8uW7SICHSb3BZc4,121
|
| 79 |
+
moviepy/video/fx/__pycache__/__init__.cpython-310.pyc,,
|
| 80 |
+
moviepy/video/fx/__pycache__/accel_decel.cpython-310.pyc,,
|
| 81 |
+
moviepy/video/fx/__pycache__/blackwhite.cpython-310.pyc,,
|
| 82 |
+
moviepy/video/fx/__pycache__/blink.cpython-310.pyc,,
|
| 83 |
+
moviepy/video/fx/__pycache__/colorx.cpython-310.pyc,,
|
| 84 |
+
moviepy/video/fx/__pycache__/crop.cpython-310.pyc,,
|
| 85 |
+
moviepy/video/fx/__pycache__/even_size.cpython-310.pyc,,
|
| 86 |
+
moviepy/video/fx/__pycache__/fadein.cpython-310.pyc,,
|
| 87 |
+
moviepy/video/fx/__pycache__/fadeout.cpython-310.pyc,,
|
| 88 |
+
moviepy/video/fx/__pycache__/freeze.cpython-310.pyc,,
|
| 89 |
+
moviepy/video/fx/__pycache__/freeze_region.cpython-310.pyc,,
|
| 90 |
+
moviepy/video/fx/__pycache__/gamma_corr.cpython-310.pyc,,
|
| 91 |
+
moviepy/video/fx/__pycache__/headblur.cpython-310.pyc,,
|
| 92 |
+
moviepy/video/fx/__pycache__/invert_colors.cpython-310.pyc,,
|
| 93 |
+
moviepy/video/fx/__pycache__/loop.cpython-310.pyc,,
|
| 94 |
+
moviepy/video/fx/__pycache__/lum_contrast.cpython-310.pyc,,
|
| 95 |
+
moviepy/video/fx/__pycache__/make_loopable.cpython-310.pyc,,
|
| 96 |
+
moviepy/video/fx/__pycache__/margin.cpython-310.pyc,,
|
| 97 |
+
moviepy/video/fx/__pycache__/mask_and.cpython-310.pyc,,
|
| 98 |
+
moviepy/video/fx/__pycache__/mask_color.cpython-310.pyc,,
|
| 99 |
+
moviepy/video/fx/__pycache__/mask_or.cpython-310.pyc,,
|
| 100 |
+
moviepy/video/fx/__pycache__/mirror_x.cpython-310.pyc,,
|
| 101 |
+
moviepy/video/fx/__pycache__/mirror_y.cpython-310.pyc,,
|
| 102 |
+
moviepy/video/fx/__pycache__/painting.cpython-310.pyc,,
|
| 103 |
+
moviepy/video/fx/__pycache__/resize.cpython-310.pyc,,
|
| 104 |
+
moviepy/video/fx/__pycache__/rotate.cpython-310.pyc,,
|
| 105 |
+
moviepy/video/fx/__pycache__/scroll.cpython-310.pyc,,
|
| 106 |
+
moviepy/video/fx/__pycache__/speedx.cpython-310.pyc,,
|
| 107 |
+
moviepy/video/fx/__pycache__/supersample.cpython-310.pyc,,
|
| 108 |
+
moviepy/video/fx/__pycache__/time_mirror.cpython-310.pyc,,
|
| 109 |
+
moviepy/video/fx/__pycache__/time_symmetrize.cpython-310.pyc,,
|
| 110 |
+
moviepy/video/fx/accel_decel.py,sha256=n-jIw5KDWcMcOyC7xJf7VD5ZHKc-lXOjpeLqFUEkRf0,1225
|
| 111 |
+
moviepy/video/fx/all/__init__.py,sha256=qetnjhZ2DBMOcy5HcnDVWdbQ8imohA1a_vulUSOD4F8,348
|
| 112 |
+
moviepy/video/fx/all/__pycache__/__init__.cpython-310.pyc,,
|
| 113 |
+
moviepy/video/fx/blackwhite.py,sha256=eEFRFRKPSTYtxE9BlwZ-VUlXuWkaJZHz-jyHopUgo00,678
|
| 114 |
+
moviepy/video/fx/blink.py,sha256=2KST8bscD_MCoYf8z4Vv1_czrnQmJDuwYk29OPMywtM,424
|
| 115 |
+
moviepy/video/fx/colorx.py,sha256=01d1qya5Rcy8d4yWWFsDWQpMMVq6QdPxWuWYCFQtYjM,356
|
| 116 |
+
moviepy/video/fx/crop.py,sha256=T4UIUbFKzgLX1xdJhAX4dswcrasZBpaiVGHaKeomCa0,1618
|
| 117 |
+
moviepy/video/fx/even_size.py,sha256=deRjldfdEnoCjwCBkq8GBUPkwWmSlSxl7zqoYQMC_1E,486
|
| 118 |
+
moviepy/video/fx/fadein.py,sha256=7sgU5i4z4ixoNsH1bY5CPF6nfTFA1DHQdW6AH-5Qegk,778
|
| 119 |
+
moviepy/video/fx/fadeout.py,sha256=bEcSvtQJW0dR1e51FVfBtphNQH9UEgJbBa2-3apMRSA,859
|
| 120 |
+
moviepy/video/fx/freeze.py,sha256=rMNZ-YHcM5pSsLjLV86mpp74kOfjy0avNkw5aXflwwM,1117
|
| 121 |
+
moviepy/video/fx/freeze_region.py,sha256=AQLGDUfOaqxgvhbneK1hrruITPO9e_ymSPnyBVREquo,1921
|
| 122 |
+
moviepy/video/fx/gamma_corr.py,sha256=R57Qpadustr91V2fuH6-9D-GJkrvGWvrc2K80DUpgos,212
|
| 123 |
+
moviepy/video/fx/headblur.py,sha256=_slnQ6EX2llHtR6yYT9E_F626g647t2hLxixxVxz0MQ,1816
|
| 124 |
+
moviepy/video/fx/invert_colors.py,sha256=zJ8GxaICGxLYhUmHOs0_4HqCpVCstoq3GE26ilbE0-k,289
|
| 125 |
+
moviepy/video/fx/loop.py,sha256=2zahdRTzmQTeFvIQOgEYiwD4__0uwbuGiE3QYQEjEWA,727
|
| 126 |
+
moviepy/video/fx/lum_contrast.py,sha256=ET2S1qMd5kEIh5tFpL-sTWxtU6LHGx1jtGw_NW16FeM,406
|
| 127 |
+
moviepy/video/fx/make_loopable.py,sha256=DrfqEj48DH1yxQwEEtFKLzlWtWR21oGqQjOrCwpt_6w,532
|
| 128 |
+
moviepy/video/fx/margin.py,sha256=az1ZIfz3NE67JSCtnrw5RIrL9Z6ADP11tU2BIpr5TNQ,1726
|
| 129 |
+
moviepy/video/fx/mask_and.py,sha256=Pr-osWikjIQp9Re5MT3ufezOL25Ttz8r-KuAAHLlyTU,662
|
| 130 |
+
moviepy/video/fx/mask_color.py,sha256=3ertiUdcgbna8d6rkY7Vo8ylz2ilkegiIGsK0sNAOu8,903
|
| 131 |
+
moviepy/video/fx/mask_or.py,sha256=72oxhZe1jM04JpR0osezDtPvUWb7PJMdr0Sc7diZrcc,666
|
| 132 |
+
moviepy/video/fx/mirror_x.py,sha256=GlRCyuatW7bCgZC0HtrUxKOf2gilhGhf-jT1W3uzPpA,177
|
| 133 |
+
moviepy/video/fx/mirror_y.py,sha256=wY5njXDVmGx8ewVIbDSJ-TXgG1XvE2k0Et8B4lh412E,173
|
| 134 |
+
moviepy/video/fx/painting.py,sha256=KEcbIiqcTGlI3TqAGWhLs48YIO_QgHAQH328-GwaN8Q,1412
|
| 135 |
+
moviepy/video/fx/resize.py,sha256=4iPt0l28IUE1HipdS1D8g90YASHxgi73aM5FDa_Xdp4,4942
|
| 136 |
+
moviepy/video/fx/rotate.py,sha256=oRvXl9yMDTuorfjMDZDY5Sr5c4AMkbE-LMkJo9nnBkE,2195
|
| 137 |
+
moviepy/video/fx/scroll.py,sha256=bXUtgi8OlOLOMkW4CWZUvlArbfjqMjfixtIXuQJnj7I,526
|
| 138 |
+
moviepy/video/fx/speedx.py,sha256=hKUhAWXSsmN8uhM4tPz4P-506jNl_j0hy5gW2F6rSIY,723
|
| 139 |
+
moviepy/video/fx/supersample.py,sha256=W31r8T7uwKQrqx6VTSqsRex7EZViTuuKSCf_0o1ePVg,421
|
| 140 |
+
moviepy/video/fx/time_mirror.py,sha256=-cs7r_XevuoDF1TV7dM7jCmmFhnHwjaXeM2_dV0y7eU,425
|
| 141 |
+
moviepy/video/fx/time_symmetrize.py,sha256=KpKB97vnBheYTrWMaoqbTkZEPniBVb_pt40I2UJw2H8,602
|
| 142 |
+
moviepy/video/io/ImageSequenceClip.py,sha256=H4yZBUmzKXdxUeAlN8lF52sRG3SXgNUp-5geyWEZp78,4956
|
| 143 |
+
moviepy/video/io/VideoFileClip.py,sha256=Z2Qq7MPzu8Ng8ZNkkwUmrBvrabjSfv6nIPrXHQuDu_E,4500
|
| 144 |
+
moviepy/video/io/__init__.py,sha256=f_CLHkRt4wh9sMTfcORcoU_XhM5hYwQF6beNXYxbVAA,77
|
| 145 |
+
moviepy/video/io/__pycache__/ImageSequenceClip.cpython-310.pyc,,
|
| 146 |
+
moviepy/video/io/__pycache__/VideoFileClip.cpython-310.pyc,,
|
| 147 |
+
moviepy/video/io/__pycache__/__init__.cpython-310.pyc,,
|
| 148 |
+
moviepy/video/io/__pycache__/bindings.cpython-310.pyc,,
|
| 149 |
+
moviepy/video/io/__pycache__/downloader.cpython-310.pyc,,
|
| 150 |
+
moviepy/video/io/__pycache__/ffmpeg_reader.cpython-310.pyc,,
|
| 151 |
+
moviepy/video/io/__pycache__/ffmpeg_tools.cpython-310.pyc,,
|
| 152 |
+
moviepy/video/io/__pycache__/ffmpeg_writer.cpython-310.pyc,,
|
| 153 |
+
moviepy/video/io/__pycache__/gif_writers.cpython-310.pyc,,
|
| 154 |
+
moviepy/video/io/__pycache__/html_tools.cpython-310.pyc,,
|
| 155 |
+
moviepy/video/io/__pycache__/preview.cpython-310.pyc,,
|
| 156 |
+
moviepy/video/io/__pycache__/sliders.cpython-310.pyc,,
|
| 157 |
+
moviepy/video/io/bindings.py,sha256=ZPmk4nhs3p9a5UOc0vPAzJqz4r_Dm_8gFMt9UxsSasA,1079
|
| 158 |
+
moviepy/video/io/downloader.py,sha256=Ya8-QGdqMrv_RSkqweNDDOPwFuOmX_U4fPIfUw7u7FI,1054
|
| 159 |
+
moviepy/video/io/ffmpeg_reader.py,sha256=MiLqJ13MMKmgQnuW3S9NUCMBzjKW4bwuRgFFw08S6lA,13326
|
| 160 |
+
moviepy/video/io/ffmpeg_tools.py,sha256=MDoPLL3J7XU-I8_FxFvLG_3DHHQArHAl7Su3TIrO9Y8,2321
|
| 161 |
+
moviepy/video/io/ffmpeg_writer.py,sha256=olpaK8FHdxOf3zIkx72vger9VCtyF80JirtFOm3yz4w,9064
|
| 162 |
+
moviepy/video/io/gif_writers.py,sha256=8MDwrW62IP5inW7hJBkgphWYpxeNa5fPPWwqcGotXhs,8933
|
| 163 |
+
moviepy/video/io/html_tools.py,sha256=8-YCJCClZl0Dfna6elFzXvQrNWWKbv79_XIqvPjHAto,7591
|
| 164 |
+
moviepy/video/io/preview.py,sha256=fcmW6gx4aqFlm6Pdj7GGRlv6-xfP98KnApXi7GRiWuI,4794
|
| 165 |
+
moviepy/video/io/sliders.py,sha256=CcUGXVMnP2kgtdtODs52m9xT7LQdndrhAuHb-X7-q5Y,2116
|
| 166 |
+
moviepy/video/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 167 |
+
moviepy/video/tools/__pycache__/__init__.cpython-310.pyc,,
|
| 168 |
+
moviepy/video/tools/__pycache__/credits.cpython-310.pyc,,
|
| 169 |
+
moviepy/video/tools/__pycache__/cuts.cpython-310.pyc,,
|
| 170 |
+
moviepy/video/tools/__pycache__/drawing.cpython-310.pyc,,
|
| 171 |
+
moviepy/video/tools/__pycache__/interpolators.cpython-310.pyc,,
|
| 172 |
+
moviepy/video/tools/__pycache__/segmenting.cpython-310.pyc,,
|
| 173 |
+
moviepy/video/tools/__pycache__/subtitles.cpython-310.pyc,,
|
| 174 |
+
moviepy/video/tools/__pycache__/tracking.cpython-310.pyc,,
|
| 175 |
+
moviepy/video/tools/credits.py,sha256=8bBkmGZCVdcuXgaXlHHnpQ7ztwWwEe7zFvojam5vJdk,3414
|
| 176 |
+
moviepy/video/tools/cuts.py,sha256=lYFNvXl0fZeU5GwhDO5Eg8ql_VrAHjDelK9B-TQypgM,10757
|
| 177 |
+
moviepy/video/tools/drawing.py,sha256=7obNphKPUGLwyHzsw-KI-3vpVxsv4ZA9rdp507ce5P4,8760
|
| 178 |
+
moviepy/video/tools/interpolators.py,sha256=0ZJItLPf0AKOvPH1quVjQ0nhESrezqK8G_rjq-72vQs,2122
|
| 179 |
+
moviepy/video/tools/segmenting.py,sha256=ELePrd_Zr0uOnpraYww_P5kjCzE_anG2gfnRdQCIf1E,1821
|
| 180 |
+
moviepy/video/tools/subtitles.py,sha256=QgBRfXJ7_GjRARV_NWewBEXjNP5KoKY9ZWbGWUjHHrA,5215
|
| 181 |
+
moviepy/video/tools/tracking.py,sha256=s5TMgCwun1vuLbqZnWrergSKTY4-rYql3WcFcuoZB_E,6066
|
evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (75.8.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
evalkit_tf437/lib/python3.10/site-packages/moviepy-1.0.3.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
moviepy
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2016 Andrew Svetlov and aio-libs contributors
|
| 2 |
+
|
| 3 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
you may not use this file except in compliance with the License.
|
| 5 |
+
You may obtain a copy of the License at
|
| 6 |
+
|
| 7 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
|
| 9 |
+
Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
See the License for the specific language governing permissions and
|
| 13 |
+
limitations under the License.
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: multidict
|
| 3 |
+
Version: 6.1.0
|
| 4 |
+
Summary: multidict implementation
|
| 5 |
+
Home-page: https://github.com/aio-libs/multidict
|
| 6 |
+
Author: Andrew Svetlov
|
| 7 |
+
Author-email: andrew.svetlov@gmail.com
|
| 8 |
+
License: Apache 2
|
| 9 |
+
Project-URL: Chat: Matrix, https://matrix.to/#/#aio-libs:matrix.org
|
| 10 |
+
Project-URL: Chat: Matrix Space, https://matrix.to/#/#aio-libs-space:matrix.org
|
| 11 |
+
Project-URL: CI: GitHub, https://github.com/aio-libs/multidict/actions
|
| 12 |
+
Project-URL: Code of Conduct, https://github.com/aio-libs/.github/blob/master/CODE_OF_CONDUCT.md
|
| 13 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/multidict
|
| 14 |
+
Project-URL: Docs: Changelog, https://multidict.aio-libs.org/en/latest/changes/
|
| 15 |
+
Project-URL: Docs: RTD, https://multidict.aio-libs.org
|
| 16 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/multidict/issues
|
| 17 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/multidict
|
| 18 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 19 |
+
Classifier: Intended Audience :: Developers
|
| 20 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 21 |
+
Classifier: Programming Language :: Python
|
| 22 |
+
Classifier: Programming Language :: Python :: 3
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 28 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 29 |
+
Requires-Python: >=3.8
|
| 30 |
+
Description-Content-Type: text/x-rst
|
| 31 |
+
License-File: LICENSE
|
| 32 |
+
Requires-Dist: typing-extensions >=4.1.0 ; python_version < "3.11"
|
| 33 |
+
|
| 34 |
+
=========
|
| 35 |
+
multidict
|
| 36 |
+
=========
|
| 37 |
+
|
| 38 |
+
.. image:: https://github.com/aio-libs/multidict/actions/workflows/ci-cd.yml/badge.svg
|
| 39 |
+
:target: https://github.com/aio-libs/multidict/actions
|
| 40 |
+
:alt: GitHub status for master branch
|
| 41 |
+
|
| 42 |
+
.. image:: https://codecov.io/gh/aio-libs/multidict/branch/master/graph/badge.svg
|
| 43 |
+
:target: https://codecov.io/gh/aio-libs/multidict
|
| 44 |
+
:alt: Coverage metrics
|
| 45 |
+
|
| 46 |
+
.. image:: https://img.shields.io/pypi/v/multidict.svg
|
| 47 |
+
:target: https://pypi.org/project/multidict
|
| 48 |
+
:alt: PyPI
|
| 49 |
+
|
| 50 |
+
.. image:: https://readthedocs.org/projects/multidict/badge/?version=latest
|
| 51 |
+
:target: https://multidict.aio-libs.org
|
| 52 |
+
:alt: Read The Docs build status badge
|
| 53 |
+
|
| 54 |
+
.. image:: https://img.shields.io/pypi/pyversions/multidict.svg
|
| 55 |
+
:target: https://pypi.org/project/multidict
|
| 56 |
+
:alt: Python versions
|
| 57 |
+
|
| 58 |
+
.. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
|
| 59 |
+
:target: https://matrix.to/#/%23aio-libs:matrix.org
|
| 60 |
+
:alt: Matrix Room — #aio-libs:matrix.org
|
| 61 |
+
|
| 62 |
+
.. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
|
| 63 |
+
:target: https://matrix.to/#/%23aio-libs-space:matrix.org
|
| 64 |
+
:alt: Matrix Space — #aio-libs-space:matrix.org
|
| 65 |
+
|
| 66 |
+
Multidict is dict-like collection of *key-value pairs* where key
|
| 67 |
+
might occur more than once in the container.
|
| 68 |
+
|
| 69 |
+
Introduction
|
| 70 |
+
------------
|
| 71 |
+
|
| 72 |
+
*HTTP Headers* and *URL query string* require specific data structure:
|
| 73 |
+
*multidict*. It behaves mostly like a regular ``dict`` but it may have
|
| 74 |
+
several *values* for the same *key* and *preserves insertion ordering*.
|
| 75 |
+
|
| 76 |
+
The *key* is ``str`` (or ``istr`` for case-insensitive dictionaries).
|
| 77 |
+
|
| 78 |
+
``multidict`` has four multidict classes:
|
| 79 |
+
``MultiDict``, ``MultiDictProxy``, ``CIMultiDict``
|
| 80 |
+
and ``CIMultiDictProxy``.
|
| 81 |
+
|
| 82 |
+
Immutable proxies (``MultiDictProxy`` and
|
| 83 |
+
``CIMultiDictProxy``) provide a dynamic view for the
|
| 84 |
+
proxied multidict, the view reflects underlying collection changes. They
|
| 85 |
+
implement the ``collections.abc.Mapping`` interface.
|
| 86 |
+
|
| 87 |
+
Regular mutable (``MultiDict`` and ``CIMultiDict``) classes
|
| 88 |
+
implement ``collections.abc.MutableMapping`` and allows them to change
|
| 89 |
+
their own content.
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
*Case insensitive* (``CIMultiDict`` and
|
| 93 |
+
``CIMultiDictProxy``) assume the *keys* are case
|
| 94 |
+
insensitive, e.g.::
|
| 95 |
+
|
| 96 |
+
>>> dct = CIMultiDict(key='val')
|
| 97 |
+
>>> 'Key' in dct
|
| 98 |
+
True
|
| 99 |
+
>>> dct['Key']
|
| 100 |
+
'val'
|
| 101 |
+
|
| 102 |
+
*Keys* should be ``str`` or ``istr`` instances.
|
| 103 |
+
|
| 104 |
+
The library has optional C Extensions for speed.
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
License
|
| 108 |
+
-------
|
| 109 |
+
|
| 110 |
+
Apache 2
|
| 111 |
+
|
| 112 |
+
Library Installation
|
| 113 |
+
--------------------
|
| 114 |
+
|
| 115 |
+
.. code-block:: bash
|
| 116 |
+
|
| 117 |
+
$ pip install multidict
|
| 118 |
+
|
| 119 |
+
The library is Python 3 only!
|
| 120 |
+
|
| 121 |
+
PyPI contains binary wheels for Linux, Windows and MacOS. If you want to install
|
| 122 |
+
``multidict`` on another operating system (or *Alpine Linux* inside a Docker) the
|
| 123 |
+
tarball will be used to compile the library from source. It requires a C compiler and
|
| 124 |
+
Python headers to be installed.
|
| 125 |
+
|
| 126 |
+
To skip the compilation, please use the `MULTIDICT_NO_EXTENSIONS` environment variable,
|
| 127 |
+
e.g.:
|
| 128 |
+
|
| 129 |
+
.. code-block:: bash
|
| 130 |
+
|
| 131 |
+
$ MULTIDICT_NO_EXTENSIONS=1 pip install multidict
|
| 132 |
+
|
| 133 |
+
Please note, the pure Python (uncompiled) version is about 20-50 times slower depending on
|
| 134 |
+
the usage scenario!!!
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
Changelog
|
| 139 |
+
---------
|
| 140 |
+
See `RTD page <http://multidict.aio-libs.org/en/latest/changes>`_.
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
multidict-6.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
multidict-6.1.0.dist-info/LICENSE,sha256=k9Ealo4vDzY3PECBH_bSDhc_WMPKtYhM1mF7v9eVSSo,611
|
| 3 |
+
multidict-6.1.0.dist-info/METADATA,sha256=OnCx5DR4XPf64GIDK4XmcA2e7HLQ_784vMfEQy287kM,4979
|
| 4 |
+
multidict-6.1.0.dist-info/RECORD,,
|
| 5 |
+
multidict-6.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
multidict-6.1.0.dist-info/WHEEL,sha256=K6ps4aVUsEay-13wCJy8H3VKOTWNlXTmCBW4TF80uCE,151
|
| 7 |
+
multidict-6.1.0.dist-info/top_level.txt,sha256=-euDElkk5_qkmfIJ7WiqCab02ZlSFZWynejKg59qZQQ,10
|
| 8 |
+
multidict/__init__.py,sha256=p60Ag5UVACSli1txazSi85foCmHN-cg3qZDCuWdOKng,928
|
| 9 |
+
multidict/__init__.pyi,sha256=SbgC2ew1NvNXWlRKs9o0KhW4moozgMqgQ0OA4Re5JQQ,4840
|
| 10 |
+
multidict/__pycache__/__init__.cpython-310.pyc,,
|
| 11 |
+
multidict/__pycache__/_abc.cpython-310.pyc,,
|
| 12 |
+
multidict/__pycache__/_compat.cpython-310.pyc,,
|
| 13 |
+
multidict/__pycache__/_multidict_base.cpython-310.pyc,,
|
| 14 |
+
multidict/__pycache__/_multidict_py.cpython-310.pyc,,
|
| 15 |
+
multidict/_abc.py,sha256=Zvnrn4SBkrv4QTD7-ZzqNcoxw0f8KStLMPzGvBuGT2w,1190
|
| 16 |
+
multidict/_compat.py,sha256=uCNUpVHJSFOiKUJmRcz3SDqMpkb37C_csc29ijr8Evo,352
|
| 17 |
+
multidict/_multidict.cpython-310-x86_64-linux-gnu.so,sha256=PM5Jz9d2OytBpQNf2J2rbDXasWF9b9M4abzFOc3c5xI,394656
|
| 18 |
+
multidict/_multidict_base.py,sha256=ZndtnZ5oc1sODKmXsv6F9kWvVNCda9xAEEFXkaPoFoA,3979
|
| 19 |
+
multidict/_multidict_py.py,sha256=57h4sYrRIu7EjMX4YpHVIZVrV9-q1KCW3F6rao10D3U,15050
|
| 20 |
+
multidict/py.typed,sha256=e9bmbH3UFxsabQrnNFPG9qxIXztwbcM6IKDYnvZwprY,15
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/REQUESTED
ADDED
|
File without changes
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (74.1.2)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp310-cp310-manylinux_2_17_x86_64
|
| 5 |
+
Tag: cp310-cp310-manylinux2014_x86_64
|
| 6 |
+
|
evalkit_tf437/lib/python3.10/site-packages/multidict-6.1.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
multidict
|
evalkit_tf437/lib/python3.10/site-packages/pandas/core/__pycache__/generic.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4796c6f77fbf773f140e8d11b56b053aa12f46718e00d67455063c464e6e5507
|
| 3 |
+
size 385660
|
evalkit_tf437/lib/python3.10/site-packages/pytz/lazy.py
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from threading import RLock
|
| 2 |
+
try:
|
| 3 |
+
from collections.abc import Mapping as DictMixin
|
| 4 |
+
except ImportError: # Python < 3.3
|
| 5 |
+
try:
|
| 6 |
+
from UserDict import DictMixin # Python 2
|
| 7 |
+
except ImportError: # Python 3.0-3.3
|
| 8 |
+
from collections import Mapping as DictMixin
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# With lazy loading, we might end up with multiple threads triggering
|
| 12 |
+
# it at the same time. We need a lock.
|
| 13 |
+
_fill_lock = RLock()
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class LazyDict(DictMixin):
|
| 17 |
+
"""Dictionary populated on first use."""
|
| 18 |
+
data = None
|
| 19 |
+
|
| 20 |
+
def __getitem__(self, key):
|
| 21 |
+
if self.data is None:
|
| 22 |
+
_fill_lock.acquire()
|
| 23 |
+
try:
|
| 24 |
+
if self.data is None:
|
| 25 |
+
self._fill()
|
| 26 |
+
finally:
|
| 27 |
+
_fill_lock.release()
|
| 28 |
+
return self.data[key.upper()]
|
| 29 |
+
|
| 30 |
+
def __contains__(self, key):
|
| 31 |
+
if self.data is None:
|
| 32 |
+
_fill_lock.acquire()
|
| 33 |
+
try:
|
| 34 |
+
if self.data is None:
|
| 35 |
+
self._fill()
|
| 36 |
+
finally:
|
| 37 |
+
_fill_lock.release()
|
| 38 |
+
return key in self.data
|
| 39 |
+
|
| 40 |
+
def __iter__(self):
|
| 41 |
+
if self.data is None:
|
| 42 |
+
_fill_lock.acquire()
|
| 43 |
+
try:
|
| 44 |
+
if self.data is None:
|
| 45 |
+
self._fill()
|
| 46 |
+
finally:
|
| 47 |
+
_fill_lock.release()
|
| 48 |
+
return iter(self.data)
|
| 49 |
+
|
| 50 |
+
def __len__(self):
|
| 51 |
+
if self.data is None:
|
| 52 |
+
_fill_lock.acquire()
|
| 53 |
+
try:
|
| 54 |
+
if self.data is None:
|
| 55 |
+
self._fill()
|
| 56 |
+
finally:
|
| 57 |
+
_fill_lock.release()
|
| 58 |
+
return len(self.data)
|
| 59 |
+
|
| 60 |
+
def keys(self):
|
| 61 |
+
if self.data is None:
|
| 62 |
+
_fill_lock.acquire()
|
| 63 |
+
try:
|
| 64 |
+
if self.data is None:
|
| 65 |
+
self._fill()
|
| 66 |
+
finally:
|
| 67 |
+
_fill_lock.release()
|
| 68 |
+
return self.data.keys()
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
class LazyList(list):
|
| 72 |
+
"""List populated on first use."""
|
| 73 |
+
|
| 74 |
+
_props = [
|
| 75 |
+
'__str__', '__repr__', '__unicode__',
|
| 76 |
+
'__hash__', '__sizeof__', '__cmp__',
|
| 77 |
+
'__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__',
|
| 78 |
+
'append', 'count', 'index', 'extend', 'insert', 'pop', 'remove',
|
| 79 |
+
'reverse', 'sort', '__add__', '__radd__', '__iadd__', '__mul__',
|
| 80 |
+
'__rmul__', '__imul__', '__contains__', '__len__', '__nonzero__',
|
| 81 |
+
'__getitem__', '__setitem__', '__delitem__', '__iter__',
|
| 82 |
+
'__reversed__', '__getslice__', '__setslice__', '__delslice__']
|
| 83 |
+
|
| 84 |
+
def __new__(cls, fill_iter=None):
|
| 85 |
+
|
| 86 |
+
if fill_iter is None:
|
| 87 |
+
return list()
|
| 88 |
+
|
| 89 |
+
# We need a new class as we will be dynamically messing with its
|
| 90 |
+
# methods.
|
| 91 |
+
class LazyList(list):
|
| 92 |
+
pass
|
| 93 |
+
|
| 94 |
+
fill_iter = [fill_iter]
|
| 95 |
+
|
| 96 |
+
def lazy(name):
|
| 97 |
+
def _lazy(self, *args, **kw):
|
| 98 |
+
_fill_lock.acquire()
|
| 99 |
+
try:
|
| 100 |
+
if len(fill_iter) > 0:
|
| 101 |
+
list.extend(self, fill_iter.pop())
|
| 102 |
+
for method_name in cls._props:
|
| 103 |
+
delattr(LazyList, method_name)
|
| 104 |
+
finally:
|
| 105 |
+
_fill_lock.release()
|
| 106 |
+
return getattr(list, name)(self, *args, **kw)
|
| 107 |
+
return _lazy
|
| 108 |
+
|
| 109 |
+
for name in cls._props:
|
| 110 |
+
setattr(LazyList, name, lazy(name))
|
| 111 |
+
|
| 112 |
+
new_list = LazyList()
|
| 113 |
+
return new_list
|
| 114 |
+
|
| 115 |
+
# Not all versions of Python declare the same magic methods.
|
| 116 |
+
# Filter out properties that don't exist in this version of Python
|
| 117 |
+
# from the list.
|
| 118 |
+
LazyList._props = [prop for prop in LazyList._props if hasattr(list, prop)]
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
class LazySet(set):
|
| 122 |
+
"""Set populated on first use."""
|
| 123 |
+
|
| 124 |
+
_props = (
|
| 125 |
+
'__str__', '__repr__', '__unicode__',
|
| 126 |
+
'__hash__', '__sizeof__', '__cmp__',
|
| 127 |
+
'__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__',
|
| 128 |
+
'__contains__', '__len__', '__nonzero__',
|
| 129 |
+
'__getitem__', '__setitem__', '__delitem__', '__iter__',
|
| 130 |
+
'__sub__', '__and__', '__xor__', '__or__',
|
| 131 |
+
'__rsub__', '__rand__', '__rxor__', '__ror__',
|
| 132 |
+
'__isub__', '__iand__', '__ixor__', '__ior__',
|
| 133 |
+
'add', 'clear', 'copy', 'difference', 'difference_update',
|
| 134 |
+
'discard', 'intersection', 'intersection_update', 'isdisjoint',
|
| 135 |
+
'issubset', 'issuperset', 'pop', 'remove',
|
| 136 |
+
'symmetric_difference', 'symmetric_difference_update',
|
| 137 |
+
'union', 'update')
|
| 138 |
+
|
| 139 |
+
def __new__(cls, fill_iter=None):
|
| 140 |
+
|
| 141 |
+
if fill_iter is None:
|
| 142 |
+
return set()
|
| 143 |
+
|
| 144 |
+
class LazySet(set):
|
| 145 |
+
pass
|
| 146 |
+
|
| 147 |
+
fill_iter = [fill_iter]
|
| 148 |
+
|
| 149 |
+
def lazy(name):
|
| 150 |
+
def _lazy(self, *args, **kw):
|
| 151 |
+
_fill_lock.acquire()
|
| 152 |
+
try:
|
| 153 |
+
if len(fill_iter) > 0:
|
| 154 |
+
for i in fill_iter.pop():
|
| 155 |
+
set.add(self, i)
|
| 156 |
+
for method_name in cls._props:
|
| 157 |
+
delattr(LazySet, method_name)
|
| 158 |
+
finally:
|
| 159 |
+
_fill_lock.release()
|
| 160 |
+
return getattr(set, name)(self, *args, **kw)
|
| 161 |
+
return _lazy
|
| 162 |
+
|
| 163 |
+
for name in cls._props:
|
| 164 |
+
setattr(LazySet, name, lazy(name))
|
| 165 |
+
|
| 166 |
+
new_set = LazySet()
|
| 167 |
+
return new_set
|
| 168 |
+
|
| 169 |
+
# Not all versions of Python declare the same magic methods.
|
| 170 |
+
# Filter out properties that don't exist in this version of Python
|
| 171 |
+
# from the list.
|
| 172 |
+
LazySet._props = [prop for prop in LazySet._props if hasattr(set, prop)]
|
evalkit_tf437/lib/python3.10/site-packages/pytz/tzinfo.py
ADDED
|
@@ -0,0 +1,580 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''Base classes and helpers for building zone specific tzinfo classes'''
|
| 2 |
+
|
| 3 |
+
from datetime import datetime, timedelta, tzinfo
|
| 4 |
+
from bisect import bisect_right
|
| 5 |
+
try:
|
| 6 |
+
set
|
| 7 |
+
except NameError:
|
| 8 |
+
from sets import Set as set
|
| 9 |
+
|
| 10 |
+
import pytz
|
| 11 |
+
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
|
| 12 |
+
|
| 13 |
+
__all__ = []
|
| 14 |
+
|
| 15 |
+
_timedelta_cache = {}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def memorized_timedelta(seconds):
|
| 19 |
+
'''Create only one instance of each distinct timedelta'''
|
| 20 |
+
try:
|
| 21 |
+
return _timedelta_cache[seconds]
|
| 22 |
+
except KeyError:
|
| 23 |
+
delta = timedelta(seconds=seconds)
|
| 24 |
+
_timedelta_cache[seconds] = delta
|
| 25 |
+
return delta
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
_epoch = datetime(1970, 1, 1, 0, 0) # datetime.utcfromtimestamp(0)
|
| 29 |
+
_datetime_cache = {0: _epoch}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def memorized_datetime(seconds):
|
| 33 |
+
'''Create only one instance of each distinct datetime'''
|
| 34 |
+
try:
|
| 35 |
+
return _datetime_cache[seconds]
|
| 36 |
+
except KeyError:
|
| 37 |
+
# NB. We can't just do datetime.fromtimestamp(seconds, tz=timezone.utc).replace(tzinfo=None)
|
| 38 |
+
# as this fails with negative values under Windows (Bug #90096)
|
| 39 |
+
dt = _epoch + timedelta(seconds=seconds)
|
| 40 |
+
_datetime_cache[seconds] = dt
|
| 41 |
+
return dt
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
_ttinfo_cache = {}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def memorized_ttinfo(*args):
|
| 48 |
+
'''Create only one instance of each distinct tuple'''
|
| 49 |
+
try:
|
| 50 |
+
return _ttinfo_cache[args]
|
| 51 |
+
except KeyError:
|
| 52 |
+
ttinfo = (
|
| 53 |
+
memorized_timedelta(args[0]),
|
| 54 |
+
memorized_timedelta(args[1]),
|
| 55 |
+
args[2]
|
| 56 |
+
)
|
| 57 |
+
_ttinfo_cache[args] = ttinfo
|
| 58 |
+
return ttinfo
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
_notime = memorized_timedelta(0)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _to_seconds(td):
|
| 65 |
+
'''Convert a timedelta to seconds'''
|
| 66 |
+
return td.seconds + td.days * 24 * 60 * 60
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class BaseTzInfo(tzinfo):
|
| 70 |
+
# Overridden in subclass
|
| 71 |
+
_utcoffset = None
|
| 72 |
+
_tzname = None
|
| 73 |
+
zone = None
|
| 74 |
+
|
| 75 |
+
def __str__(self):
|
| 76 |
+
return self.zone
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
class StaticTzInfo(BaseTzInfo):
|
| 80 |
+
'''A timezone that has a constant offset from UTC
|
| 81 |
+
|
| 82 |
+
These timezones are rare, as most locations have changed their
|
| 83 |
+
offset at some point in their history
|
| 84 |
+
'''
|
| 85 |
+
def fromutc(self, dt):
|
| 86 |
+
'''See datetime.tzinfo.fromutc'''
|
| 87 |
+
if dt.tzinfo is not None and dt.tzinfo is not self:
|
| 88 |
+
raise ValueError('fromutc: dt.tzinfo is not self')
|
| 89 |
+
return (dt + self._utcoffset).replace(tzinfo=self)
|
| 90 |
+
|
| 91 |
+
def utcoffset(self, dt, is_dst=None):
|
| 92 |
+
'''See datetime.tzinfo.utcoffset
|
| 93 |
+
|
| 94 |
+
is_dst is ignored for StaticTzInfo, and exists only to
|
| 95 |
+
retain compatibility with DstTzInfo.
|
| 96 |
+
'''
|
| 97 |
+
return self._utcoffset
|
| 98 |
+
|
| 99 |
+
def dst(self, dt, is_dst=None):
|
| 100 |
+
'''See datetime.tzinfo.dst
|
| 101 |
+
|
| 102 |
+
is_dst is ignored for StaticTzInfo, and exists only to
|
| 103 |
+
retain compatibility with DstTzInfo.
|
| 104 |
+
'''
|
| 105 |
+
return _notime
|
| 106 |
+
|
| 107 |
+
def tzname(self, dt, is_dst=None):
|
| 108 |
+
'''See datetime.tzinfo.tzname
|
| 109 |
+
|
| 110 |
+
is_dst is ignored for StaticTzInfo, and exists only to
|
| 111 |
+
retain compatibility with DstTzInfo.
|
| 112 |
+
'''
|
| 113 |
+
return self._tzname
|
| 114 |
+
|
| 115 |
+
def localize(self, dt, is_dst=False):
|
| 116 |
+
'''Convert naive time to local time'''
|
| 117 |
+
if dt.tzinfo is not None:
|
| 118 |
+
raise ValueError('Not naive datetime (tzinfo is already set)')
|
| 119 |
+
return dt.replace(tzinfo=self)
|
| 120 |
+
|
| 121 |
+
def normalize(self, dt, is_dst=False):
|
| 122 |
+
'''Correct the timezone information on the given datetime.
|
| 123 |
+
|
| 124 |
+
This is normally a no-op, as StaticTzInfo timezones never have
|
| 125 |
+
ambiguous cases to correct:
|
| 126 |
+
|
| 127 |
+
>>> from pytz import timezone
|
| 128 |
+
>>> gmt = timezone('GMT')
|
| 129 |
+
>>> isinstance(gmt, StaticTzInfo)
|
| 130 |
+
True
|
| 131 |
+
>>> dt = datetime(2011, 5, 8, 1, 2, 3, tzinfo=gmt)
|
| 132 |
+
>>> gmt.normalize(dt) is dt
|
| 133 |
+
True
|
| 134 |
+
|
| 135 |
+
The supported method of converting between timezones is to use
|
| 136 |
+
datetime.astimezone(). Currently normalize() also works:
|
| 137 |
+
|
| 138 |
+
>>> la = timezone('America/Los_Angeles')
|
| 139 |
+
>>> dt = la.localize(datetime(2011, 5, 7, 1, 2, 3))
|
| 140 |
+
>>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
|
| 141 |
+
>>> gmt.normalize(dt).strftime(fmt)
|
| 142 |
+
'2011-05-07 08:02:03 GMT (+0000)'
|
| 143 |
+
'''
|
| 144 |
+
if dt.tzinfo is self:
|
| 145 |
+
return dt
|
| 146 |
+
if dt.tzinfo is None:
|
| 147 |
+
raise ValueError('Naive time - no tzinfo set')
|
| 148 |
+
return dt.astimezone(self)
|
| 149 |
+
|
| 150 |
+
def __repr__(self):
|
| 151 |
+
return '<StaticTzInfo %r>' % (self.zone,)
|
| 152 |
+
|
| 153 |
+
def __reduce__(self):
|
| 154 |
+
# Special pickle to zone remains a singleton and to cope with
|
| 155 |
+
# database changes.
|
| 156 |
+
return pytz._p, (self.zone,)
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
class DstTzInfo(BaseTzInfo):
|
| 160 |
+
'''A timezone that has a variable offset from UTC
|
| 161 |
+
|
| 162 |
+
The offset might change if daylight saving time comes into effect,
|
| 163 |
+
or at a point in history when the region decides to change their
|
| 164 |
+
timezone definition.
|
| 165 |
+
'''
|
| 166 |
+
# Overridden in subclass
|
| 167 |
+
|
| 168 |
+
# Sorted list of DST transition times, UTC
|
| 169 |
+
_utc_transition_times = None
|
| 170 |
+
|
| 171 |
+
# [(utcoffset, dstoffset, tzname)] corresponding to
|
| 172 |
+
# _utc_transition_times entries
|
| 173 |
+
_transition_info = None
|
| 174 |
+
|
| 175 |
+
zone = None
|
| 176 |
+
|
| 177 |
+
# Set in __init__
|
| 178 |
+
|
| 179 |
+
_tzinfos = None
|
| 180 |
+
_dst = None # DST offset
|
| 181 |
+
|
| 182 |
+
def __init__(self, _inf=None, _tzinfos=None):
|
| 183 |
+
if _inf:
|
| 184 |
+
self._tzinfos = _tzinfos
|
| 185 |
+
self._utcoffset, self._dst, self._tzname = _inf
|
| 186 |
+
else:
|
| 187 |
+
_tzinfos = {}
|
| 188 |
+
self._tzinfos = _tzinfos
|
| 189 |
+
self._utcoffset, self._dst, self._tzname = (
|
| 190 |
+
self._transition_info[0])
|
| 191 |
+
_tzinfos[self._transition_info[0]] = self
|
| 192 |
+
for inf in self._transition_info[1:]:
|
| 193 |
+
if inf not in _tzinfos:
|
| 194 |
+
_tzinfos[inf] = self.__class__(inf, _tzinfos)
|
| 195 |
+
|
| 196 |
+
def fromutc(self, dt):
|
| 197 |
+
'''See datetime.tzinfo.fromutc'''
|
| 198 |
+
if (dt.tzinfo is not None and
|
| 199 |
+
getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos):
|
| 200 |
+
raise ValueError('fromutc: dt.tzinfo is not self')
|
| 201 |
+
dt = dt.replace(tzinfo=None)
|
| 202 |
+
idx = max(0, bisect_right(self._utc_transition_times, dt) - 1)
|
| 203 |
+
inf = self._transition_info[idx]
|
| 204 |
+
return (dt + inf[0]).replace(tzinfo=self._tzinfos[inf])
|
| 205 |
+
|
| 206 |
+
def normalize(self, dt):
|
| 207 |
+
'''Correct the timezone information on the given datetime
|
| 208 |
+
|
| 209 |
+
If date arithmetic crosses DST boundaries, the tzinfo
|
| 210 |
+
is not magically adjusted. This method normalizes the
|
| 211 |
+
tzinfo to the correct one.
|
| 212 |
+
|
| 213 |
+
To test, first we need to do some setup
|
| 214 |
+
|
| 215 |
+
>>> from pytz import timezone
|
| 216 |
+
>>> utc = timezone('UTC')
|
| 217 |
+
>>> eastern = timezone('US/Eastern')
|
| 218 |
+
>>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
|
| 219 |
+
|
| 220 |
+
We next create a datetime right on an end-of-DST transition point,
|
| 221 |
+
the instant when the wallclocks are wound back one hour.
|
| 222 |
+
|
| 223 |
+
>>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)
|
| 224 |
+
>>> loc_dt = utc_dt.astimezone(eastern)
|
| 225 |
+
>>> loc_dt.strftime(fmt)
|
| 226 |
+
'2002-10-27 01:00:00 EST (-0500)'
|
| 227 |
+
|
| 228 |
+
Now, if we subtract a few minutes from it, note that the timezone
|
| 229 |
+
information has not changed.
|
| 230 |
+
|
| 231 |
+
>>> before = loc_dt - timedelta(minutes=10)
|
| 232 |
+
>>> before.strftime(fmt)
|
| 233 |
+
'2002-10-27 00:50:00 EST (-0500)'
|
| 234 |
+
|
| 235 |
+
But we can fix that by calling the normalize method
|
| 236 |
+
|
| 237 |
+
>>> before = eastern.normalize(before)
|
| 238 |
+
>>> before.strftime(fmt)
|
| 239 |
+
'2002-10-27 01:50:00 EDT (-0400)'
|
| 240 |
+
|
| 241 |
+
The supported method of converting between timezones is to use
|
| 242 |
+
datetime.astimezone(). Currently, normalize() also works:
|
| 243 |
+
|
| 244 |
+
>>> th = timezone('Asia/Bangkok')
|
| 245 |
+
>>> am = timezone('Europe/Amsterdam')
|
| 246 |
+
>>> dt = th.localize(datetime(2011, 5, 7, 1, 2, 3))
|
| 247 |
+
>>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
|
| 248 |
+
>>> am.normalize(dt).strftime(fmt)
|
| 249 |
+
'2011-05-06 20:02:03 CEST (+0200)'
|
| 250 |
+
'''
|
| 251 |
+
if dt.tzinfo is None:
|
| 252 |
+
raise ValueError('Naive time - no tzinfo set')
|
| 253 |
+
|
| 254 |
+
# Convert dt in localtime to UTC
|
| 255 |
+
offset = dt.tzinfo._utcoffset
|
| 256 |
+
dt = dt.replace(tzinfo=None)
|
| 257 |
+
dt = dt - offset
|
| 258 |
+
# convert it back, and return it
|
| 259 |
+
return self.fromutc(dt)
|
| 260 |
+
|
| 261 |
+
def localize(self, dt, is_dst=False):
|
| 262 |
+
'''Convert naive time to local time.
|
| 263 |
+
|
| 264 |
+
This method should be used to construct localtimes, rather
|
| 265 |
+
than passing a tzinfo argument to a datetime constructor.
|
| 266 |
+
|
| 267 |
+
is_dst is used to determine the correct timezone in the ambigous
|
| 268 |
+
period at the end of daylight saving time.
|
| 269 |
+
|
| 270 |
+
>>> from pytz import timezone
|
| 271 |
+
>>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
|
| 272 |
+
>>> amdam = timezone('Europe/Amsterdam')
|
| 273 |
+
>>> dt = datetime(2004, 10, 31, 2, 0, 0)
|
| 274 |
+
>>> loc_dt1 = amdam.localize(dt, is_dst=True)
|
| 275 |
+
>>> loc_dt2 = amdam.localize(dt, is_dst=False)
|
| 276 |
+
>>> loc_dt1.strftime(fmt)
|
| 277 |
+
'2004-10-31 02:00:00 CEST (+0200)'
|
| 278 |
+
>>> loc_dt2.strftime(fmt)
|
| 279 |
+
'2004-10-31 02:00:00 CET (+0100)'
|
| 280 |
+
>>> str(loc_dt2 - loc_dt1)
|
| 281 |
+
'1:00:00'
|
| 282 |
+
|
| 283 |
+
Use is_dst=None to raise an AmbiguousTimeError for ambiguous
|
| 284 |
+
times at the end of daylight saving time
|
| 285 |
+
|
| 286 |
+
>>> try:
|
| 287 |
+
... loc_dt1 = amdam.localize(dt, is_dst=None)
|
| 288 |
+
... except AmbiguousTimeError:
|
| 289 |
+
... print('Ambiguous')
|
| 290 |
+
Ambiguous
|
| 291 |
+
|
| 292 |
+
is_dst defaults to False
|
| 293 |
+
|
| 294 |
+
>>> amdam.localize(dt) == amdam.localize(dt, False)
|
| 295 |
+
True
|
| 296 |
+
|
| 297 |
+
is_dst is also used to determine the correct timezone in the
|
| 298 |
+
wallclock times jumped over at the start of daylight saving time.
|
| 299 |
+
|
| 300 |
+
>>> pacific = timezone('US/Pacific')
|
| 301 |
+
>>> dt = datetime(2008, 3, 9, 2, 0, 0)
|
| 302 |
+
>>> ploc_dt1 = pacific.localize(dt, is_dst=True)
|
| 303 |
+
>>> ploc_dt2 = pacific.localize(dt, is_dst=False)
|
| 304 |
+
>>> ploc_dt1.strftime(fmt)
|
| 305 |
+
'2008-03-09 02:00:00 PDT (-0700)'
|
| 306 |
+
>>> ploc_dt2.strftime(fmt)
|
| 307 |
+
'2008-03-09 02:00:00 PST (-0800)'
|
| 308 |
+
>>> str(ploc_dt2 - ploc_dt1)
|
| 309 |
+
'1:00:00'
|
| 310 |
+
|
| 311 |
+
Use is_dst=None to raise a NonExistentTimeError for these skipped
|
| 312 |
+
times.
|
| 313 |
+
|
| 314 |
+
>>> try:
|
| 315 |
+
... loc_dt1 = pacific.localize(dt, is_dst=None)
|
| 316 |
+
... except NonExistentTimeError:
|
| 317 |
+
... print('Non-existent')
|
| 318 |
+
Non-existent
|
| 319 |
+
'''
|
| 320 |
+
if dt.tzinfo is not None:
|
| 321 |
+
raise ValueError('Not naive datetime (tzinfo is already set)')
|
| 322 |
+
|
| 323 |
+
# Find the two best possibilities.
|
| 324 |
+
possible_loc_dt = set()
|
| 325 |
+
for delta in [timedelta(days=-1), timedelta(days=1)]:
|
| 326 |
+
loc_dt = dt + delta
|
| 327 |
+
idx = max(0, bisect_right(
|
| 328 |
+
self._utc_transition_times, loc_dt) - 1)
|
| 329 |
+
inf = self._transition_info[idx]
|
| 330 |
+
tzinfo = self._tzinfos[inf]
|
| 331 |
+
loc_dt = tzinfo.normalize(dt.replace(tzinfo=tzinfo))
|
| 332 |
+
if loc_dt.replace(tzinfo=None) == dt:
|
| 333 |
+
possible_loc_dt.add(loc_dt)
|
| 334 |
+
|
| 335 |
+
if len(possible_loc_dt) == 1:
|
| 336 |
+
return possible_loc_dt.pop()
|
| 337 |
+
|
| 338 |
+
# If there are no possibly correct timezones, we are attempting
|
| 339 |
+
# to convert a time that never happened - the time period jumped
|
| 340 |
+
# during the start-of-DST transition period.
|
| 341 |
+
if len(possible_loc_dt) == 0:
|
| 342 |
+
# If we refuse to guess, raise an exception.
|
| 343 |
+
if is_dst is None:
|
| 344 |
+
raise NonExistentTimeError(dt)
|
| 345 |
+
|
| 346 |
+
# If we are forcing the pre-DST side of the DST transition, we
|
| 347 |
+
# obtain the correct timezone by winding the clock forward a few
|
| 348 |
+
# hours.
|
| 349 |
+
elif is_dst:
|
| 350 |
+
return self.localize(
|
| 351 |
+
dt + timedelta(hours=6), is_dst=True) - timedelta(hours=6)
|
| 352 |
+
|
| 353 |
+
# If we are forcing the post-DST side of the DST transition, we
|
| 354 |
+
# obtain the correct timezone by winding the clock back.
|
| 355 |
+
else:
|
| 356 |
+
return self.localize(
|
| 357 |
+
dt - timedelta(hours=6),
|
| 358 |
+
is_dst=False) + timedelta(hours=6)
|
| 359 |
+
|
| 360 |
+
# If we get this far, we have multiple possible timezones - this
|
| 361 |
+
# is an ambiguous case occurring during the end-of-DST transition.
|
| 362 |
+
|
| 363 |
+
# If told to be strict, raise an exception since we have an
|
| 364 |
+
# ambiguous case
|
| 365 |
+
if is_dst is None:
|
| 366 |
+
raise AmbiguousTimeError(dt)
|
| 367 |
+
|
| 368 |
+
# Filter out the possiblilities that don't match the requested
|
| 369 |
+
# is_dst
|
| 370 |
+
filtered_possible_loc_dt = [
|
| 371 |
+
p for p in possible_loc_dt if bool(p.tzinfo._dst) == is_dst
|
| 372 |
+
]
|
| 373 |
+
|
| 374 |
+
# Hopefully we only have one possibility left. Return it.
|
| 375 |
+
if len(filtered_possible_loc_dt) == 1:
|
| 376 |
+
return filtered_possible_loc_dt[0]
|
| 377 |
+
|
| 378 |
+
if len(filtered_possible_loc_dt) == 0:
|
| 379 |
+
filtered_possible_loc_dt = list(possible_loc_dt)
|
| 380 |
+
|
| 381 |
+
# If we get this far, we have in a wierd timezone transition
|
| 382 |
+
# where the clocks have been wound back but is_dst is the same
|
| 383 |
+
# in both (eg. Europe/Warsaw 1915 when they switched to CET).
|
| 384 |
+
# At this point, we just have to guess unless we allow more
|
| 385 |
+
# hints to be passed in (such as the UTC offset or abbreviation),
|
| 386 |
+
# but that is just getting silly.
|
| 387 |
+
#
|
| 388 |
+
# Choose the earliest (by UTC) applicable timezone if is_dst=True
|
| 389 |
+
# Choose the latest (by UTC) applicable timezone if is_dst=False
|
| 390 |
+
# i.e., behave like end-of-DST transition
|
| 391 |
+
dates = {} # utc -> local
|
| 392 |
+
for local_dt in filtered_possible_loc_dt:
|
| 393 |
+
utc_time = (
|
| 394 |
+
local_dt.replace(tzinfo=None) - local_dt.tzinfo._utcoffset)
|
| 395 |
+
assert utc_time not in dates
|
| 396 |
+
dates[utc_time] = local_dt
|
| 397 |
+
return dates[[min, max][not is_dst](dates)]
|
| 398 |
+
|
| 399 |
+
def utcoffset(self, dt, is_dst=None):
|
| 400 |
+
'''See datetime.tzinfo.utcoffset
|
| 401 |
+
|
| 402 |
+
The is_dst parameter may be used to remove ambiguity during DST
|
| 403 |
+
transitions.
|
| 404 |
+
|
| 405 |
+
>>> from pytz import timezone
|
| 406 |
+
>>> tz = timezone('America/St_Johns')
|
| 407 |
+
>>> ambiguous = datetime(2009, 10, 31, 23, 30)
|
| 408 |
+
|
| 409 |
+
>>> str(tz.utcoffset(ambiguous, is_dst=False))
|
| 410 |
+
'-1 day, 20:30:00'
|
| 411 |
+
|
| 412 |
+
>>> str(tz.utcoffset(ambiguous, is_dst=True))
|
| 413 |
+
'-1 day, 21:30:00'
|
| 414 |
+
|
| 415 |
+
>>> try:
|
| 416 |
+
... tz.utcoffset(ambiguous)
|
| 417 |
+
... except AmbiguousTimeError:
|
| 418 |
+
... print('Ambiguous')
|
| 419 |
+
Ambiguous
|
| 420 |
+
|
| 421 |
+
'''
|
| 422 |
+
if dt is None:
|
| 423 |
+
return None
|
| 424 |
+
elif dt.tzinfo is not self:
|
| 425 |
+
dt = self.localize(dt, is_dst)
|
| 426 |
+
return dt.tzinfo._utcoffset
|
| 427 |
+
else:
|
| 428 |
+
return self._utcoffset
|
| 429 |
+
|
| 430 |
+
def dst(self, dt, is_dst=None):
|
| 431 |
+
'''See datetime.tzinfo.dst
|
| 432 |
+
|
| 433 |
+
The is_dst parameter may be used to remove ambiguity during DST
|
| 434 |
+
transitions.
|
| 435 |
+
|
| 436 |
+
>>> from pytz import timezone
|
| 437 |
+
>>> tz = timezone('America/St_Johns')
|
| 438 |
+
|
| 439 |
+
>>> normal = datetime(2009, 9, 1)
|
| 440 |
+
|
| 441 |
+
>>> str(tz.dst(normal))
|
| 442 |
+
'1:00:00'
|
| 443 |
+
>>> str(tz.dst(normal, is_dst=False))
|
| 444 |
+
'1:00:00'
|
| 445 |
+
>>> str(tz.dst(normal, is_dst=True))
|
| 446 |
+
'1:00:00'
|
| 447 |
+
|
| 448 |
+
>>> ambiguous = datetime(2009, 10, 31, 23, 30)
|
| 449 |
+
|
| 450 |
+
>>> str(tz.dst(ambiguous, is_dst=False))
|
| 451 |
+
'0:00:00'
|
| 452 |
+
>>> str(tz.dst(ambiguous, is_dst=True))
|
| 453 |
+
'1:00:00'
|
| 454 |
+
>>> try:
|
| 455 |
+
... tz.dst(ambiguous)
|
| 456 |
+
... except AmbiguousTimeError:
|
| 457 |
+
... print('Ambiguous')
|
| 458 |
+
Ambiguous
|
| 459 |
+
|
| 460 |
+
'''
|
| 461 |
+
if dt is None:
|
| 462 |
+
return None
|
| 463 |
+
elif dt.tzinfo is not self:
|
| 464 |
+
dt = self.localize(dt, is_dst)
|
| 465 |
+
return dt.tzinfo._dst
|
| 466 |
+
else:
|
| 467 |
+
return self._dst
|
| 468 |
+
|
| 469 |
+
def tzname(self, dt, is_dst=None):
|
| 470 |
+
'''See datetime.tzinfo.tzname
|
| 471 |
+
|
| 472 |
+
The is_dst parameter may be used to remove ambiguity during DST
|
| 473 |
+
transitions.
|
| 474 |
+
|
| 475 |
+
>>> from pytz import timezone
|
| 476 |
+
>>> tz = timezone('America/St_Johns')
|
| 477 |
+
|
| 478 |
+
>>> normal = datetime(2009, 9, 1)
|
| 479 |
+
|
| 480 |
+
>>> tz.tzname(normal)
|
| 481 |
+
'NDT'
|
| 482 |
+
>>> tz.tzname(normal, is_dst=False)
|
| 483 |
+
'NDT'
|
| 484 |
+
>>> tz.tzname(normal, is_dst=True)
|
| 485 |
+
'NDT'
|
| 486 |
+
|
| 487 |
+
>>> ambiguous = datetime(2009, 10, 31, 23, 30)
|
| 488 |
+
|
| 489 |
+
>>> tz.tzname(ambiguous, is_dst=False)
|
| 490 |
+
'NST'
|
| 491 |
+
>>> tz.tzname(ambiguous, is_dst=True)
|
| 492 |
+
'NDT'
|
| 493 |
+
>>> try:
|
| 494 |
+
... tz.tzname(ambiguous)
|
| 495 |
+
... except AmbiguousTimeError:
|
| 496 |
+
... print('Ambiguous')
|
| 497 |
+
Ambiguous
|
| 498 |
+
'''
|
| 499 |
+
if dt is None:
|
| 500 |
+
return self.zone
|
| 501 |
+
elif dt.tzinfo is not self:
|
| 502 |
+
dt = self.localize(dt, is_dst)
|
| 503 |
+
return dt.tzinfo._tzname
|
| 504 |
+
else:
|
| 505 |
+
return self._tzname
|
| 506 |
+
|
| 507 |
+
def __repr__(self):
|
| 508 |
+
if self._dst:
|
| 509 |
+
dst = 'DST'
|
| 510 |
+
else:
|
| 511 |
+
dst = 'STD'
|
| 512 |
+
if self._utcoffset > _notime:
|
| 513 |
+
return '<DstTzInfo %r %s+%s %s>' % (
|
| 514 |
+
self.zone, self._tzname, self._utcoffset, dst
|
| 515 |
+
)
|
| 516 |
+
else:
|
| 517 |
+
return '<DstTzInfo %r %s%s %s>' % (
|
| 518 |
+
self.zone, self._tzname, self._utcoffset, dst
|
| 519 |
+
)
|
| 520 |
+
|
| 521 |
+
def __reduce__(self):
|
| 522 |
+
# Special pickle to zone remains a singleton and to cope with
|
| 523 |
+
# database changes.
|
| 524 |
+
return pytz._p, (
|
| 525 |
+
self.zone,
|
| 526 |
+
_to_seconds(self._utcoffset),
|
| 527 |
+
_to_seconds(self._dst),
|
| 528 |
+
self._tzname
|
| 529 |
+
)
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None):
|
| 533 |
+
"""Factory function for unpickling pytz tzinfo instances.
|
| 534 |
+
|
| 535 |
+
This is shared for both StaticTzInfo and DstTzInfo instances, because
|
| 536 |
+
database changes could cause a zones implementation to switch between
|
| 537 |
+
these two base classes and we can't break pickles on a pytz version
|
| 538 |
+
upgrade.
|
| 539 |
+
"""
|
| 540 |
+
# Raises a KeyError if zone no longer exists, which should never happen
|
| 541 |
+
# and would be a bug.
|
| 542 |
+
tz = pytz.timezone(zone)
|
| 543 |
+
|
| 544 |
+
# A StaticTzInfo - just return it
|
| 545 |
+
if utcoffset is None:
|
| 546 |
+
return tz
|
| 547 |
+
|
| 548 |
+
# This pickle was created from a DstTzInfo. We need to
|
| 549 |
+
# determine which of the list of tzinfo instances for this zone
|
| 550 |
+
# to use in order to restore the state of any datetime instances using
|
| 551 |
+
# it correctly.
|
| 552 |
+
utcoffset = memorized_timedelta(utcoffset)
|
| 553 |
+
dstoffset = memorized_timedelta(dstoffset)
|
| 554 |
+
try:
|
| 555 |
+
return tz._tzinfos[(utcoffset, dstoffset, tzname)]
|
| 556 |
+
except KeyError:
|
| 557 |
+
# The particular state requested in this timezone no longer exists.
|
| 558 |
+
# This indicates a corrupt pickle, or the timezone database has been
|
| 559 |
+
# corrected violently enough to make this particular
|
| 560 |
+
# (utcoffset,dstoffset) no longer exist in the zone, or the
|
| 561 |
+
# abbreviation has been changed.
|
| 562 |
+
pass
|
| 563 |
+
|
| 564 |
+
# See if we can find an entry differing only by tzname. Abbreviations
|
| 565 |
+
# get changed from the initial guess by the database maintainers to
|
| 566 |
+
# match reality when this information is discovered.
|
| 567 |
+
for localized_tz in tz._tzinfos.values():
|
| 568 |
+
if (localized_tz._utcoffset == utcoffset and
|
| 569 |
+
localized_tz._dst == dstoffset):
|
| 570 |
+
return localized_tz
|
| 571 |
+
|
| 572 |
+
# This (utcoffset, dstoffset) information has been removed from the
|
| 573 |
+
# zone. Add it back. This might occur when the database maintainers have
|
| 574 |
+
# corrected incorrect information. datetime instances using this
|
| 575 |
+
# incorrect information will continue to do so, exactly as they were
|
| 576 |
+
# before being pickled. This is purely an overly paranoid safety net - I
|
| 577 |
+
# doubt this will ever been needed in real life.
|
| 578 |
+
inf = (utcoffset, dstoffset, tzname)
|
| 579 |
+
tz._tzinfos[inf] = tz.__class__(inf, tz._tzinfos)
|
| 580 |
+
return tz._tzinfos[inf]
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/EST
ADDED
|
Binary file (182 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/GB
ADDED
|
Binary file (3.66 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/GMT-0
ADDED
|
Binary file (114 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/Iceland
ADDED
|
Binary file (148 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/Libya
ADDED
|
Binary file (625 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/MST7MDT
ADDED
|
Binary file (2.46 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/NZ-CHAT
ADDED
|
Binary file (2.05 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/PRC
ADDED
|
Binary file (561 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/pytz/zoneinfo/ROC
ADDED
|
Binary file (761 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/scipy/linalg/cython_lapack.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad39731009436ee2530dd76854a13ca80e7f0b542eb4ab6bcc59e06987d8b1ac
|
| 3 |
+
size 879585
|