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 +1 -0
- llmeval-env/lib/python3.10/site-packages/accelerate/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/accelerate/utils/__pycache__/constants.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/certifi/__init__.py +4 -0
- llmeval-env/lib/python3.10/site-packages/certifi/__main__.py +12 -0
- llmeval-env/lib/python3.10/site-packages/certifi/cacert.pem +0 -0
- llmeval-env/lib/python3.10/site-packages/certifi/core.py +114 -0
- llmeval-env/lib/python3.10/site-packages/certifi/py.typed +0 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/__init__.py +332 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/__pycache__/_native.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/_native.py +63 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.c +320 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so +0 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.pyi +9 -0
- llmeval-env/lib/python3.10/site-packages/markupsafe/py.typed +0 -0
- llmeval-env/lib/python3.10/site-packages/mbstrdecoder-1.1.3.dist-info/RECORD +17 -0
- llmeval-env/lib/python3.10/site-packages/mbstrdecoder-1.1.3.dist-info/WHEEL +5 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/classic.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/cographs.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/community.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/degree_seq.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/directed.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/duplication.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/expanders.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/geometric.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/harary_graph.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/intersection.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/interval_graph.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/lattice.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/nonisomorphic_trees.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/random_clustered.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/random_graphs.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/spectral_graph_forge.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/stochastic.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/sudoku.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/trees.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_atlas.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_classic.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_cographs.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_community.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_degree_seq.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_directed.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_duplication.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_ego.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_expanders.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_geometric.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_harary_graph.cpython-310.pyc +0 -0
.gitattributes
CHANGED
@@ -67,3 +67,4 @@ llmeval-env/lib/python3.10/site-packages/scipy/spatial/_qhull.cpython-310-x86_64
|
|
67 |
llmeval-env/lib/python3.10/site-packages/scipy/misc/face.dat filter=lfs diff=lfs merge=lfs -text
|
68 |
llmeval-env/lib/python3.10/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
69 |
llmeval-env/lib/python3.10/site-packages/aiohttp/_http_parser.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
67 |
llmeval-env/lib/python3.10/site-packages/scipy/misc/face.dat filter=lfs diff=lfs merge=lfs -text
|
68 |
llmeval-env/lib/python3.10/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
69 |
llmeval-env/lib/python3.10/site-packages/aiohttp/_http_parser.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
70 |
+
llmeval-env/lib/python3.10/site-packages/triton/third_party/cuda/bin/ptxas filter=lfs diff=lfs merge=lfs -text
|
llmeval-env/lib/python3.10/site-packages/accelerate/utils/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (6.67 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/accelerate/utils/__pycache__/constants.cpython-310.pyc
ADDED
Binary file (1.96 kB). View file
|
|
llmeval-env/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.02.02"
|
llmeval-env/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())
|
llmeval-env/lib/python3.10/site-packages/certifi/cacert.pem
ADDED
The diff for this file is too large to render.
See raw diff
|
|
llmeval-env/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")
|
llmeval-env/lib/python3.10/site-packages/certifi/py.typed
ADDED
File without changes
|
llmeval-env/lib/python3.10/site-packages/markupsafe/__init__.py
ADDED
@@ -0,0 +1,332 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import functools
|
2 |
+
import string
|
3 |
+
import sys
|
4 |
+
import typing as t
|
5 |
+
|
6 |
+
if t.TYPE_CHECKING:
|
7 |
+
import typing_extensions as te
|
8 |
+
|
9 |
+
class HasHTML(te.Protocol):
|
10 |
+
def __html__(self) -> str:
|
11 |
+
pass
|
12 |
+
|
13 |
+
_P = te.ParamSpec("_P")
|
14 |
+
|
15 |
+
|
16 |
+
__version__ = "2.1.5"
|
17 |
+
|
18 |
+
|
19 |
+
def _simple_escaping_wrapper(func: "t.Callable[_P, str]") -> "t.Callable[_P, Markup]":
|
20 |
+
@functools.wraps(func)
|
21 |
+
def wrapped(self: "Markup", *args: "_P.args", **kwargs: "_P.kwargs") -> "Markup":
|
22 |
+
arg_list = _escape_argspec(list(args), enumerate(args), self.escape)
|
23 |
+
_escape_argspec(kwargs, kwargs.items(), self.escape)
|
24 |
+
return self.__class__(func(self, *arg_list, **kwargs)) # type: ignore[arg-type]
|
25 |
+
|
26 |
+
return wrapped # type: ignore[return-value]
|
27 |
+
|
28 |
+
|
29 |
+
class Markup(str):
|
30 |
+
"""A string that is ready to be safely inserted into an HTML or XML
|
31 |
+
document, either because it was escaped or because it was marked
|
32 |
+
safe.
|
33 |
+
|
34 |
+
Passing an object to the constructor converts it to text and wraps
|
35 |
+
it to mark it safe without escaping. To escape the text, use the
|
36 |
+
:meth:`escape` class method instead.
|
37 |
+
|
38 |
+
>>> Markup("Hello, <em>World</em>!")
|
39 |
+
Markup('Hello, <em>World</em>!')
|
40 |
+
>>> Markup(42)
|
41 |
+
Markup('42')
|
42 |
+
>>> Markup.escape("Hello, <em>World</em>!")
|
43 |
+
Markup('Hello <em>World</em>!')
|
44 |
+
|
45 |
+
This implements the ``__html__()`` interface that some frameworks
|
46 |
+
use. Passing an object that implements ``__html__()`` will wrap the
|
47 |
+
output of that method, marking it safe.
|
48 |
+
|
49 |
+
>>> class Foo:
|
50 |
+
... def __html__(self):
|
51 |
+
... return '<a href="/foo">foo</a>'
|
52 |
+
...
|
53 |
+
>>> Markup(Foo())
|
54 |
+
Markup('<a href="/foo">foo</a>')
|
55 |
+
|
56 |
+
This is a subclass of :class:`str`. It has the same methods, but
|
57 |
+
escapes their arguments and returns a ``Markup`` instance.
|
58 |
+
|
59 |
+
>>> Markup("<em>%s</em>") % ("foo & bar",)
|
60 |
+
Markup('<em>foo & bar</em>')
|
61 |
+
>>> Markup("<em>Hello</em> ") + "<foo>"
|
62 |
+
Markup('<em>Hello</em> <foo>')
|
63 |
+
"""
|
64 |
+
|
65 |
+
__slots__ = ()
|
66 |
+
|
67 |
+
def __new__(
|
68 |
+
cls, base: t.Any = "", encoding: t.Optional[str] = None, errors: str = "strict"
|
69 |
+
) -> "te.Self":
|
70 |
+
if hasattr(base, "__html__"):
|
71 |
+
base = base.__html__()
|
72 |
+
|
73 |
+
if encoding is None:
|
74 |
+
return super().__new__(cls, base)
|
75 |
+
|
76 |
+
return super().__new__(cls, base, encoding, errors)
|
77 |
+
|
78 |
+
def __html__(self) -> "te.Self":
|
79 |
+
return self
|
80 |
+
|
81 |
+
def __add__(self, other: t.Union[str, "HasHTML"]) -> "te.Self":
|
82 |
+
if isinstance(other, str) or hasattr(other, "__html__"):
|
83 |
+
return self.__class__(super().__add__(self.escape(other)))
|
84 |
+
|
85 |
+
return NotImplemented
|
86 |
+
|
87 |
+
def __radd__(self, other: t.Union[str, "HasHTML"]) -> "te.Self":
|
88 |
+
if isinstance(other, str) or hasattr(other, "__html__"):
|
89 |
+
return self.escape(other).__add__(self)
|
90 |
+
|
91 |
+
return NotImplemented
|
92 |
+
|
93 |
+
def __mul__(self, num: "te.SupportsIndex") -> "te.Self":
|
94 |
+
if isinstance(num, int):
|
95 |
+
return self.__class__(super().__mul__(num))
|
96 |
+
|
97 |
+
return NotImplemented
|
98 |
+
|
99 |
+
__rmul__ = __mul__
|
100 |
+
|
101 |
+
def __mod__(self, arg: t.Any) -> "te.Self":
|
102 |
+
if isinstance(arg, tuple):
|
103 |
+
# a tuple of arguments, each wrapped
|
104 |
+
arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
|
105 |
+
elif hasattr(type(arg), "__getitem__") and not isinstance(arg, str):
|
106 |
+
# a mapping of arguments, wrapped
|
107 |
+
arg = _MarkupEscapeHelper(arg, self.escape)
|
108 |
+
else:
|
109 |
+
# a single argument, wrapped with the helper and a tuple
|
110 |
+
arg = (_MarkupEscapeHelper(arg, self.escape),)
|
111 |
+
|
112 |
+
return self.__class__(super().__mod__(arg))
|
113 |
+
|
114 |
+
def __repr__(self) -> str:
|
115 |
+
return f"{self.__class__.__name__}({super().__repr__()})"
|
116 |
+
|
117 |
+
def join(self, seq: t.Iterable[t.Union[str, "HasHTML"]]) -> "te.Self":
|
118 |
+
return self.__class__(super().join(map(self.escape, seq)))
|
119 |
+
|
120 |
+
join.__doc__ = str.join.__doc__
|
121 |
+
|
122 |
+
def split( # type: ignore[override]
|
123 |
+
self, sep: t.Optional[str] = None, maxsplit: int = -1
|
124 |
+
) -> t.List["te.Self"]:
|
125 |
+
return [self.__class__(v) for v in super().split(sep, maxsplit)]
|
126 |
+
|
127 |
+
split.__doc__ = str.split.__doc__
|
128 |
+
|
129 |
+
def rsplit( # type: ignore[override]
|
130 |
+
self, sep: t.Optional[str] = None, maxsplit: int = -1
|
131 |
+
) -> t.List["te.Self"]:
|
132 |
+
return [self.__class__(v) for v in super().rsplit(sep, maxsplit)]
|
133 |
+
|
134 |
+
rsplit.__doc__ = str.rsplit.__doc__
|
135 |
+
|
136 |
+
def splitlines( # type: ignore[override]
|
137 |
+
self, keepends: bool = False
|
138 |
+
) -> t.List["te.Self"]:
|
139 |
+
return [self.__class__(v) for v in super().splitlines(keepends)]
|
140 |
+
|
141 |
+
splitlines.__doc__ = str.splitlines.__doc__
|
142 |
+
|
143 |
+
def unescape(self) -> str:
|
144 |
+
"""Convert escaped markup back into a text string. This replaces
|
145 |
+
HTML entities with the characters they represent.
|
146 |
+
|
147 |
+
>>> Markup("Main » <em>About</em>").unescape()
|
148 |
+
'Main » <em>About</em>'
|
149 |
+
"""
|
150 |
+
from html import unescape
|
151 |
+
|
152 |
+
return unescape(str(self))
|
153 |
+
|
154 |
+
def striptags(self) -> str:
|
155 |
+
""":meth:`unescape` the markup, remove tags, and normalize
|
156 |
+
whitespace to single spaces.
|
157 |
+
|
158 |
+
>>> Markup("Main »\t<em>About</em>").striptags()
|
159 |
+
'Main » About'
|
160 |
+
"""
|
161 |
+
value = str(self)
|
162 |
+
|
163 |
+
# Look for comments then tags separately. Otherwise, a comment that
|
164 |
+
# contains a tag would end early, leaving some of the comment behind.
|
165 |
+
|
166 |
+
while True:
|
167 |
+
# keep finding comment start marks
|
168 |
+
start = value.find("<!--")
|
169 |
+
|
170 |
+
if start == -1:
|
171 |
+
break
|
172 |
+
|
173 |
+
# find a comment end mark beyond the start, otherwise stop
|
174 |
+
end = value.find("-->", start)
|
175 |
+
|
176 |
+
if end == -1:
|
177 |
+
break
|
178 |
+
|
179 |
+
value = f"{value[:start]}{value[end + 3:]}"
|
180 |
+
|
181 |
+
# remove tags using the same method
|
182 |
+
while True:
|
183 |
+
start = value.find("<")
|
184 |
+
|
185 |
+
if start == -1:
|
186 |
+
break
|
187 |
+
|
188 |
+
end = value.find(">", start)
|
189 |
+
|
190 |
+
if end == -1:
|
191 |
+
break
|
192 |
+
|
193 |
+
value = f"{value[:start]}{value[end + 1:]}"
|
194 |
+
|
195 |
+
# collapse spaces
|
196 |
+
value = " ".join(value.split())
|
197 |
+
return self.__class__(value).unescape()
|
198 |
+
|
199 |
+
@classmethod
|
200 |
+
def escape(cls, s: t.Any) -> "te.Self":
|
201 |
+
"""Escape a string. Calls :func:`escape` and ensures that for
|
202 |
+
subclasses the correct type is returned.
|
203 |
+
"""
|
204 |
+
rv = escape(s)
|
205 |
+
|
206 |
+
if rv.__class__ is not cls:
|
207 |
+
return cls(rv)
|
208 |
+
|
209 |
+
return rv # type: ignore[return-value]
|
210 |
+
|
211 |
+
__getitem__ = _simple_escaping_wrapper(str.__getitem__)
|
212 |
+
capitalize = _simple_escaping_wrapper(str.capitalize)
|
213 |
+
title = _simple_escaping_wrapper(str.title)
|
214 |
+
lower = _simple_escaping_wrapper(str.lower)
|
215 |
+
upper = _simple_escaping_wrapper(str.upper)
|
216 |
+
replace = _simple_escaping_wrapper(str.replace)
|
217 |
+
ljust = _simple_escaping_wrapper(str.ljust)
|
218 |
+
rjust = _simple_escaping_wrapper(str.rjust)
|
219 |
+
lstrip = _simple_escaping_wrapper(str.lstrip)
|
220 |
+
rstrip = _simple_escaping_wrapper(str.rstrip)
|
221 |
+
center = _simple_escaping_wrapper(str.center)
|
222 |
+
strip = _simple_escaping_wrapper(str.strip)
|
223 |
+
translate = _simple_escaping_wrapper(str.translate)
|
224 |
+
expandtabs = _simple_escaping_wrapper(str.expandtabs)
|
225 |
+
swapcase = _simple_escaping_wrapper(str.swapcase)
|
226 |
+
zfill = _simple_escaping_wrapper(str.zfill)
|
227 |
+
casefold = _simple_escaping_wrapper(str.casefold)
|
228 |
+
|
229 |
+
if sys.version_info >= (3, 9):
|
230 |
+
removeprefix = _simple_escaping_wrapper(str.removeprefix)
|
231 |
+
removesuffix = _simple_escaping_wrapper(str.removesuffix)
|
232 |
+
|
233 |
+
def partition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]:
|
234 |
+
l, s, r = super().partition(self.escape(sep))
|
235 |
+
cls = self.__class__
|
236 |
+
return cls(l), cls(s), cls(r)
|
237 |
+
|
238 |
+
def rpartition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]:
|
239 |
+
l, s, r = super().rpartition(self.escape(sep))
|
240 |
+
cls = self.__class__
|
241 |
+
return cls(l), cls(s), cls(r)
|
242 |
+
|
243 |
+
def format(self, *args: t.Any, **kwargs: t.Any) -> "te.Self":
|
244 |
+
formatter = EscapeFormatter(self.escape)
|
245 |
+
return self.__class__(formatter.vformat(self, args, kwargs))
|
246 |
+
|
247 |
+
def format_map( # type: ignore[override]
|
248 |
+
self, map: t.Mapping[str, t.Any]
|
249 |
+
) -> "te.Self":
|
250 |
+
formatter = EscapeFormatter(self.escape)
|
251 |
+
return self.__class__(formatter.vformat(self, (), map))
|
252 |
+
|
253 |
+
def __html_format__(self, format_spec: str) -> "te.Self":
|
254 |
+
if format_spec:
|
255 |
+
raise ValueError("Unsupported format specification for Markup.")
|
256 |
+
|
257 |
+
return self
|
258 |
+
|
259 |
+
|
260 |
+
class EscapeFormatter(string.Formatter):
|
261 |
+
__slots__ = ("escape",)
|
262 |
+
|
263 |
+
def __init__(self, escape: t.Callable[[t.Any], Markup]) -> None:
|
264 |
+
self.escape = escape
|
265 |
+
super().__init__()
|
266 |
+
|
267 |
+
def format_field(self, value: t.Any, format_spec: str) -> str:
|
268 |
+
if hasattr(value, "__html_format__"):
|
269 |
+
rv = value.__html_format__(format_spec)
|
270 |
+
elif hasattr(value, "__html__"):
|
271 |
+
if format_spec:
|
272 |
+
raise ValueError(
|
273 |
+
f"Format specifier {format_spec} given, but {type(value)} does not"
|
274 |
+
" define __html_format__. A class that defines __html__ must define"
|
275 |
+
" __html_format__ to work with format specifiers."
|
276 |
+
)
|
277 |
+
rv = value.__html__()
|
278 |
+
else:
|
279 |
+
# We need to make sure the format spec is str here as
|
280 |
+
# otherwise the wrong callback methods are invoked.
|
281 |
+
rv = string.Formatter.format_field(self, value, str(format_spec))
|
282 |
+
return str(self.escape(rv))
|
283 |
+
|
284 |
+
|
285 |
+
_ListOrDict = t.TypeVar("_ListOrDict", list, dict)
|
286 |
+
|
287 |
+
|
288 |
+
def _escape_argspec(
|
289 |
+
obj: _ListOrDict, iterable: t.Iterable[t.Any], escape: t.Callable[[t.Any], Markup]
|
290 |
+
) -> _ListOrDict:
|
291 |
+
"""Helper for various string-wrapped functions."""
|
292 |
+
for key, value in iterable:
|
293 |
+
if isinstance(value, str) or hasattr(value, "__html__"):
|
294 |
+
obj[key] = escape(value)
|
295 |
+
|
296 |
+
return obj
|
297 |
+
|
298 |
+
|
299 |
+
class _MarkupEscapeHelper:
|
300 |
+
"""Helper for :meth:`Markup.__mod__`."""
|
301 |
+
|
302 |
+
__slots__ = ("obj", "escape")
|
303 |
+
|
304 |
+
def __init__(self, obj: t.Any, escape: t.Callable[[t.Any], Markup]) -> None:
|
305 |
+
self.obj = obj
|
306 |
+
self.escape = escape
|
307 |
+
|
308 |
+
def __getitem__(self, item: t.Any) -> "te.Self":
|
309 |
+
return self.__class__(self.obj[item], self.escape)
|
310 |
+
|
311 |
+
def __str__(self) -> str:
|
312 |
+
return str(self.escape(self.obj))
|
313 |
+
|
314 |
+
def __repr__(self) -> str:
|
315 |
+
return str(self.escape(repr(self.obj)))
|
316 |
+
|
317 |
+
def __int__(self) -> int:
|
318 |
+
return int(self.obj)
|
319 |
+
|
320 |
+
def __float__(self) -> float:
|
321 |
+
return float(self.obj)
|
322 |
+
|
323 |
+
|
324 |
+
# circular import
|
325 |
+
try:
|
326 |
+
from ._speedups import escape as escape
|
327 |
+
from ._speedups import escape_silent as escape_silent
|
328 |
+
from ._speedups import soft_str as soft_str
|
329 |
+
except ImportError:
|
330 |
+
from ._native import escape as escape
|
331 |
+
from ._native import escape_silent as escape_silent # noqa: F401
|
332 |
+
from ._native import soft_str as soft_str # noqa: F401
|
llmeval-env/lib/python3.10/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (11.4 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/markupsafe/__pycache__/_native.cpython-310.pyc
ADDED
Binary file (2.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/markupsafe/_native.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import typing as t
|
2 |
+
|
3 |
+
from . import Markup
|
4 |
+
|
5 |
+
|
6 |
+
def escape(s: t.Any) -> Markup:
|
7 |
+
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
|
8 |
+
the string with HTML-safe sequences. Use this if you need to display
|
9 |
+
text that might contain such characters in HTML.
|
10 |
+
|
11 |
+
If the object has an ``__html__`` method, it is called and the
|
12 |
+
return value is assumed to already be safe for HTML.
|
13 |
+
|
14 |
+
:param s: An object to be converted to a string and escaped.
|
15 |
+
:return: A :class:`Markup` string with the escaped text.
|
16 |
+
"""
|
17 |
+
if hasattr(s, "__html__"):
|
18 |
+
return Markup(s.__html__())
|
19 |
+
|
20 |
+
return Markup(
|
21 |
+
str(s)
|
22 |
+
.replace("&", "&")
|
23 |
+
.replace(">", ">")
|
24 |
+
.replace("<", "<")
|
25 |
+
.replace("'", "'")
|
26 |
+
.replace('"', """)
|
27 |
+
)
|
28 |
+
|
29 |
+
|
30 |
+
def escape_silent(s: t.Optional[t.Any]) -> Markup:
|
31 |
+
"""Like :func:`escape` but treats ``None`` as the empty string.
|
32 |
+
Useful with optional values, as otherwise you get the string
|
33 |
+
``'None'`` when the value is ``None``.
|
34 |
+
|
35 |
+
>>> escape(None)
|
36 |
+
Markup('None')
|
37 |
+
>>> escape_silent(None)
|
38 |
+
Markup('')
|
39 |
+
"""
|
40 |
+
if s is None:
|
41 |
+
return Markup()
|
42 |
+
|
43 |
+
return escape(s)
|
44 |
+
|
45 |
+
|
46 |
+
def soft_str(s: t.Any) -> str:
|
47 |
+
"""Convert an object to a string if it isn't already. This preserves
|
48 |
+
a :class:`Markup` string rather than converting it back to a basic
|
49 |
+
string, so it will still be marked as safe and won't be escaped
|
50 |
+
again.
|
51 |
+
|
52 |
+
>>> value = escape("<User 1>")
|
53 |
+
>>> value
|
54 |
+
Markup('<User 1>')
|
55 |
+
>>> escape(str(value))
|
56 |
+
Markup('&lt;User 1&gt;')
|
57 |
+
>>> escape(soft_str(value))
|
58 |
+
Markup('<User 1>')
|
59 |
+
"""
|
60 |
+
if not isinstance(s, str):
|
61 |
+
return str(s)
|
62 |
+
|
63 |
+
return s
|
llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.c
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <Python.h>
|
2 |
+
|
3 |
+
static PyObject* markup;
|
4 |
+
|
5 |
+
static int
|
6 |
+
init_constants(void)
|
7 |
+
{
|
8 |
+
PyObject *module;
|
9 |
+
|
10 |
+
/* import markup type so that we can mark the return value */
|
11 |
+
module = PyImport_ImportModule("markupsafe");
|
12 |
+
if (!module)
|
13 |
+
return 0;
|
14 |
+
markup = PyObject_GetAttrString(module, "Markup");
|
15 |
+
Py_DECREF(module);
|
16 |
+
|
17 |
+
return 1;
|
18 |
+
}
|
19 |
+
|
20 |
+
#define GET_DELTA(inp, inp_end, delta) \
|
21 |
+
while (inp < inp_end) { \
|
22 |
+
switch (*inp++) { \
|
23 |
+
case '"': \
|
24 |
+
case '\'': \
|
25 |
+
case '&': \
|
26 |
+
delta += 4; \
|
27 |
+
break; \
|
28 |
+
case '<': \
|
29 |
+
case '>': \
|
30 |
+
delta += 3; \
|
31 |
+
break; \
|
32 |
+
} \
|
33 |
+
}
|
34 |
+
|
35 |
+
#define DO_ESCAPE(inp, inp_end, outp) \
|
36 |
+
{ \
|
37 |
+
Py_ssize_t ncopy = 0; \
|
38 |
+
while (inp < inp_end) { \
|
39 |
+
switch (*inp) { \
|
40 |
+
case '"': \
|
41 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
42 |
+
outp += ncopy; ncopy = 0; \
|
43 |
+
*outp++ = '&'; \
|
44 |
+
*outp++ = '#'; \
|
45 |
+
*outp++ = '3'; \
|
46 |
+
*outp++ = '4'; \
|
47 |
+
*outp++ = ';'; \
|
48 |
+
break; \
|
49 |
+
case '\'': \
|
50 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
51 |
+
outp += ncopy; ncopy = 0; \
|
52 |
+
*outp++ = '&'; \
|
53 |
+
*outp++ = '#'; \
|
54 |
+
*outp++ = '3'; \
|
55 |
+
*outp++ = '9'; \
|
56 |
+
*outp++ = ';'; \
|
57 |
+
break; \
|
58 |
+
case '&': \
|
59 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
60 |
+
outp += ncopy; ncopy = 0; \
|
61 |
+
*outp++ = '&'; \
|
62 |
+
*outp++ = 'a'; \
|
63 |
+
*outp++ = 'm'; \
|
64 |
+
*outp++ = 'p'; \
|
65 |
+
*outp++ = ';'; \
|
66 |
+
break; \
|
67 |
+
case '<': \
|
68 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
69 |
+
outp += ncopy; ncopy = 0; \
|
70 |
+
*outp++ = '&'; \
|
71 |
+
*outp++ = 'l'; \
|
72 |
+
*outp++ = 't'; \
|
73 |
+
*outp++ = ';'; \
|
74 |
+
break; \
|
75 |
+
case '>': \
|
76 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
77 |
+
outp += ncopy; ncopy = 0; \
|
78 |
+
*outp++ = '&'; \
|
79 |
+
*outp++ = 'g'; \
|
80 |
+
*outp++ = 't'; \
|
81 |
+
*outp++ = ';'; \
|
82 |
+
break; \
|
83 |
+
default: \
|
84 |
+
ncopy++; \
|
85 |
+
} \
|
86 |
+
inp++; \
|
87 |
+
} \
|
88 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
89 |
+
}
|
90 |
+
|
91 |
+
static PyObject*
|
92 |
+
escape_unicode_kind1(PyUnicodeObject *in)
|
93 |
+
{
|
94 |
+
Py_UCS1 *inp = PyUnicode_1BYTE_DATA(in);
|
95 |
+
Py_UCS1 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
96 |
+
Py_UCS1 *outp;
|
97 |
+
PyObject *out;
|
98 |
+
Py_ssize_t delta = 0;
|
99 |
+
|
100 |
+
GET_DELTA(inp, inp_end, delta);
|
101 |
+
if (!delta) {
|
102 |
+
Py_INCREF(in);
|
103 |
+
return (PyObject*)in;
|
104 |
+
}
|
105 |
+
|
106 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta,
|
107 |
+
PyUnicode_IS_ASCII(in) ? 127 : 255);
|
108 |
+
if (!out)
|
109 |
+
return NULL;
|
110 |
+
|
111 |
+
inp = PyUnicode_1BYTE_DATA(in);
|
112 |
+
outp = PyUnicode_1BYTE_DATA(out);
|
113 |
+
DO_ESCAPE(inp, inp_end, outp);
|
114 |
+
return out;
|
115 |
+
}
|
116 |
+
|
117 |
+
static PyObject*
|
118 |
+
escape_unicode_kind2(PyUnicodeObject *in)
|
119 |
+
{
|
120 |
+
Py_UCS2 *inp = PyUnicode_2BYTE_DATA(in);
|
121 |
+
Py_UCS2 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
122 |
+
Py_UCS2 *outp;
|
123 |
+
PyObject *out;
|
124 |
+
Py_ssize_t delta = 0;
|
125 |
+
|
126 |
+
GET_DELTA(inp, inp_end, delta);
|
127 |
+
if (!delta) {
|
128 |
+
Py_INCREF(in);
|
129 |
+
return (PyObject*)in;
|
130 |
+
}
|
131 |
+
|
132 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 65535);
|
133 |
+
if (!out)
|
134 |
+
return NULL;
|
135 |
+
|
136 |
+
inp = PyUnicode_2BYTE_DATA(in);
|
137 |
+
outp = PyUnicode_2BYTE_DATA(out);
|
138 |
+
DO_ESCAPE(inp, inp_end, outp);
|
139 |
+
return out;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
static PyObject*
|
144 |
+
escape_unicode_kind4(PyUnicodeObject *in)
|
145 |
+
{
|
146 |
+
Py_UCS4 *inp = PyUnicode_4BYTE_DATA(in);
|
147 |
+
Py_UCS4 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
148 |
+
Py_UCS4 *outp;
|
149 |
+
PyObject *out;
|
150 |
+
Py_ssize_t delta = 0;
|
151 |
+
|
152 |
+
GET_DELTA(inp, inp_end, delta);
|
153 |
+
if (!delta) {
|
154 |
+
Py_INCREF(in);
|
155 |
+
return (PyObject*)in;
|
156 |
+
}
|
157 |
+
|
158 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 1114111);
|
159 |
+
if (!out)
|
160 |
+
return NULL;
|
161 |
+
|
162 |
+
inp = PyUnicode_4BYTE_DATA(in);
|
163 |
+
outp = PyUnicode_4BYTE_DATA(out);
|
164 |
+
DO_ESCAPE(inp, inp_end, outp);
|
165 |
+
return out;
|
166 |
+
}
|
167 |
+
|
168 |
+
static PyObject*
|
169 |
+
escape_unicode(PyUnicodeObject *in)
|
170 |
+
{
|
171 |
+
if (PyUnicode_READY(in))
|
172 |
+
return NULL;
|
173 |
+
|
174 |
+
switch (PyUnicode_KIND(in)) {
|
175 |
+
case PyUnicode_1BYTE_KIND:
|
176 |
+
return escape_unicode_kind1(in);
|
177 |
+
case PyUnicode_2BYTE_KIND:
|
178 |
+
return escape_unicode_kind2(in);
|
179 |
+
case PyUnicode_4BYTE_KIND:
|
180 |
+
return escape_unicode_kind4(in);
|
181 |
+
}
|
182 |
+
assert(0); /* shouldn't happen */
|
183 |
+
return NULL;
|
184 |
+
}
|
185 |
+
|
186 |
+
static PyObject*
|
187 |
+
escape(PyObject *self, PyObject *text)
|
188 |
+
{
|
189 |
+
static PyObject *id_html;
|
190 |
+
PyObject *s = NULL, *rv = NULL, *html;
|
191 |
+
|
192 |
+
if (id_html == NULL) {
|
193 |
+
id_html = PyUnicode_InternFromString("__html__");
|
194 |
+
if (id_html == NULL) {
|
195 |
+
return NULL;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
/* we don't have to escape integers, bools or floats */
|
200 |
+
if (PyLong_CheckExact(text) ||
|
201 |
+
PyFloat_CheckExact(text) || PyBool_Check(text) ||
|
202 |
+
text == Py_None)
|
203 |
+
return PyObject_CallFunctionObjArgs(markup, text, NULL);
|
204 |
+
|
205 |
+
/* if the object has an __html__ method that performs the escaping */
|
206 |
+
html = PyObject_GetAttr(text ,id_html);
|
207 |
+
if (html) {
|
208 |
+
s = PyObject_CallObject(html, NULL);
|
209 |
+
Py_DECREF(html);
|
210 |
+
if (s == NULL) {
|
211 |
+
return NULL;
|
212 |
+
}
|
213 |
+
/* Convert to Markup object */
|
214 |
+
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
|
215 |
+
Py_DECREF(s);
|
216 |
+
return rv;
|
217 |
+
}
|
218 |
+
|
219 |
+
/* otherwise make the object unicode if it isn't, then escape */
|
220 |
+
PyErr_Clear();
|
221 |
+
if (!PyUnicode_Check(text)) {
|
222 |
+
PyObject *unicode = PyObject_Str(text);
|
223 |
+
if (!unicode)
|
224 |
+
return NULL;
|
225 |
+
s = escape_unicode((PyUnicodeObject*)unicode);
|
226 |
+
Py_DECREF(unicode);
|
227 |
+
}
|
228 |
+
else
|
229 |
+
s = escape_unicode((PyUnicodeObject*)text);
|
230 |
+
|
231 |
+
/* convert the unicode string into a markup object. */
|
232 |
+
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
|
233 |
+
Py_DECREF(s);
|
234 |
+
return rv;
|
235 |
+
}
|
236 |
+
|
237 |
+
|
238 |
+
static PyObject*
|
239 |
+
escape_silent(PyObject *self, PyObject *text)
|
240 |
+
{
|
241 |
+
if (text != Py_None)
|
242 |
+
return escape(self, text);
|
243 |
+
return PyObject_CallFunctionObjArgs(markup, NULL);
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
static PyObject*
|
248 |
+
soft_str(PyObject *self, PyObject *s)
|
249 |
+
{
|
250 |
+
if (!PyUnicode_Check(s))
|
251 |
+
return PyObject_Str(s);
|
252 |
+
Py_INCREF(s);
|
253 |
+
return s;
|
254 |
+
}
|
255 |
+
|
256 |
+
|
257 |
+
static PyMethodDef module_methods[] = {
|
258 |
+
{
|
259 |
+
"escape",
|
260 |
+
(PyCFunction)escape,
|
261 |
+
METH_O,
|
262 |
+
"Replace the characters ``&``, ``<``, ``>``, ``'``, and ``\"`` in"
|
263 |
+
" the string with HTML-safe sequences. Use this if you need to display"
|
264 |
+
" text that might contain such characters in HTML.\n\n"
|
265 |
+
"If the object has an ``__html__`` method, it is called and the"
|
266 |
+
" return value is assumed to already be safe for HTML.\n\n"
|
267 |
+
":param s: An object to be converted to a string and escaped.\n"
|
268 |
+
":return: A :class:`Markup` string with the escaped text.\n"
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"escape_silent",
|
272 |
+
(PyCFunction)escape_silent,
|
273 |
+
METH_O,
|
274 |
+
"Like :func:`escape` but treats ``None`` as the empty string."
|
275 |
+
" Useful with optional values, as otherwise you get the string"
|
276 |
+
" ``'None'`` when the value is ``None``.\n\n"
|
277 |
+
">>> escape(None)\n"
|
278 |
+
"Markup('None')\n"
|
279 |
+
">>> escape_silent(None)\n"
|
280 |
+
"Markup('')\n"
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"soft_str",
|
284 |
+
(PyCFunction)soft_str,
|
285 |
+
METH_O,
|
286 |
+
"Convert an object to a string if it isn't already. This preserves"
|
287 |
+
" a :class:`Markup` string rather than converting it back to a basic"
|
288 |
+
" string, so it will still be marked as safe and won't be escaped"
|
289 |
+
" again.\n\n"
|
290 |
+
">>> value = escape(\"<User 1>\")\n"
|
291 |
+
">>> value\n"
|
292 |
+
"Markup('<User 1>')\n"
|
293 |
+
">>> escape(str(value))\n"
|
294 |
+
"Markup('&lt;User 1&gt;')\n"
|
295 |
+
">>> escape(soft_str(value))\n"
|
296 |
+
"Markup('<User 1>')\n"
|
297 |
+
},
|
298 |
+
{NULL, NULL, 0, NULL} /* Sentinel */
|
299 |
+
};
|
300 |
+
|
301 |
+
static struct PyModuleDef module_definition = {
|
302 |
+
PyModuleDef_HEAD_INIT,
|
303 |
+
"markupsafe._speedups",
|
304 |
+
NULL,
|
305 |
+
-1,
|
306 |
+
module_methods,
|
307 |
+
NULL,
|
308 |
+
NULL,
|
309 |
+
NULL,
|
310 |
+
NULL
|
311 |
+
};
|
312 |
+
|
313 |
+
PyMODINIT_FUNC
|
314 |
+
PyInit__speedups(void)
|
315 |
+
{
|
316 |
+
if (!init_constants())
|
317 |
+
return NULL;
|
318 |
+
|
319 |
+
return PyModule_Create(&module_definition);
|
320 |
+
}
|
llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so
ADDED
Binary file (44.2 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/markupsafe/_speedups.pyi
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any
|
2 |
+
from typing import Optional
|
3 |
+
|
4 |
+
from . import Markup
|
5 |
+
|
6 |
+
def escape(s: Any) -> Markup: ...
|
7 |
+
def escape_silent(s: Optional[Any]) -> Markup: ...
|
8 |
+
def soft_str(s: Any) -> str: ...
|
9 |
+
def soft_unicode(s: Any) -> str: ...
|
llmeval-env/lib/python3.10/site-packages/markupsafe/py.typed
ADDED
File without changes
|
llmeval-env/lib/python3.10/site-packages/mbstrdecoder-1.1.3.dist-info/RECORD
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mbstrdecoder-1.1.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
mbstrdecoder-1.1.3.dist-info/LICENSE,sha256=dYgmUILu1en0r9UJDFfmELdA7FR7Fqqqtzm6B8Xu-xU,1074
|
3 |
+
mbstrdecoder-1.1.3.dist-info/METADATA,sha256=9lORe-Y9UfVKWcZD7ixWLOCIMQ_BBLOcJ2ajYVIjUn4,4040
|
4 |
+
mbstrdecoder-1.1.3.dist-info/RECORD,,
|
5 |
+
mbstrdecoder-1.1.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
6 |
+
mbstrdecoder-1.1.3.dist-info/top_level.txt,sha256=3y6PBjWqWXF9e7O35XqgW93XW_H9qgTn9hAdzSurYi8,13
|
7 |
+
mbstrdecoder/__init__.py,sha256=8ZS23B2ej3sHJm3ymloaxRVECxJrEwDcmu-NUtHq_SM,319
|
8 |
+
mbstrdecoder/__pycache__/__init__.cpython-310.pyc,,
|
9 |
+
mbstrdecoder/__pycache__/__version__.cpython-310.pyc,,
|
10 |
+
mbstrdecoder/__pycache__/_binary_ext_checker.cpython-310.pyc,,
|
11 |
+
mbstrdecoder/__pycache__/_func.cpython-310.pyc,,
|
12 |
+
mbstrdecoder/__pycache__/_mbstrdecoder.cpython-310.pyc,,
|
13 |
+
mbstrdecoder/__version__.py,sha256=0o6gm2vXDCEgmEsQ2mGPrdbJkyuj_mdTcg9r8dpV0W4,201
|
14 |
+
mbstrdecoder/_binary_ext_checker.py,sha256=8RAZoptcppQjjQeA3C0PP4PYc60YuDg7BLaswiA_TJ8,3113
|
15 |
+
mbstrdecoder/_func.py,sha256=hKIuRBCMFedtn4dJ5xlA2CNTxCDTZ5-0OK_kKWTL4Ug,1355
|
16 |
+
mbstrdecoder/_mbstrdecoder.py,sha256=lyrt3vQw7Lt1kjNiLbxoDSiL_p7Bg3Q-3Z3PyF2SReQ,7377
|
17 |
+
mbstrdecoder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
llmeval-env/lib/python3.10/site-packages/mbstrdecoder-1.1.3.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.37.1)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (1.49 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/classic.cpython-310.pyc
ADDED
Binary file (29.4 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/cographs.cpython-310.pyc
ADDED
Binary file (2.24 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/community.cpython-310.pyc
ADDED
Binary file (31.2 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/degree_seq.cpython-310.pyc
ADDED
Binary file (25.7 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/directed.cpython-310.pyc
ADDED
Binary file (15 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/duplication.cpython-310.pyc
ADDED
Binary file (4.42 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/expanders.cpython-310.pyc
ADDED
Binary file (12.4 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/geometric.cpython-310.pyc
ADDED
Binary file (38.9 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/harary_graph.cpython-310.pyc
ADDED
Binary file (4.81 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/intersection.cpython-310.pyc
ADDED
Binary file (4.28 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/interval_graph.cpython-310.pyc
ADDED
Binary file (2.34 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/lattice.cpython-310.pyc
ADDED
Binary file (15 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/nonisomorphic_trees.cpython-310.pyc
ADDED
Binary file (5.66 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/random_clustered.cpython-310.pyc
ADDED
Binary file (4.14 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/random_graphs.cpython-310.pyc
ADDED
Binary file (35.5 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/spectral_graph_forge.cpython-310.pyc
ADDED
Binary file (4.24 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/stochastic.cpython-310.pyc
ADDED
Binary file (2.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/sudoku.cpython-310.pyc
ADDED
Binary file (4.06 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/__pycache__/trees.cpython-310.pyc
ADDED
Binary file (36.7 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (198 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_atlas.cpython-310.pyc
ADDED
Binary file (3.59 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_classic.cpython-310.pyc
ADDED
Binary file (21.4 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_cographs.cpython-310.pyc
ADDED
Binary file (663 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_community.cpython-310.pyc
ADDED
Binary file (10.3 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_degree_seq.cpython-310.pyc
ADDED
Binary file (8.65 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_directed.cpython-310.pyc
ADDED
Binary file (7.02 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_duplication.cpython-310.pyc
ADDED
Binary file (3.58 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_ego.cpython-310.pyc
ADDED
Binary file (1.58 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_expanders.cpython-310.pyc
ADDED
Binary file (5.86 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_geometric.cpython-310.pyc
ADDED
Binary file (20.1 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/networkx/generators/tests/__pycache__/test_harary_graph.cpython-310.pyc
ADDED
Binary file (2.84 kB). View file
|
|