Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_api.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_error.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_soft.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_util.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/version.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/triton-2.3.0.dist-info/RECORD +97 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__init__.py +63 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/__version__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_common.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_const.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_function.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_typecode.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/error.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/_common.py +17 -0
- llmeval-env/lib/python3.10/site-packages/typepy/_const.py +20 -0
- llmeval-env/lib/python3.10/site-packages/typepy/_typecode.py +22 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__init__.py +35 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_bool.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_bytes.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_checker.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_common.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_datetime.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_dictionary.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_infinity.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_integer.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_interface.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_ipaddress.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_list.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_nan.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_none.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_realnumber.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_string.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_bool.py +41 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_bytes.py +21 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_checker.py +90 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_datetime.py +40 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_integer.py +72 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_nan.py +29 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_none.py +21 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_realnumber.py +61 -0
- llmeval-env/lib/python3.10/site-packages/typepy/checker/_string.py +74 -0
- llmeval-env/lib/python3.10/site-packages/typepy/converter/__init__.py +31 -0
- llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_bool.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_bytes.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_datetime.cpython-310.pyc +0 -0
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (1.08 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_api.cpython-310.pyc
ADDED
Binary file (11.9 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_error.cpython-310.pyc
ADDED
Binary file (1.46 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_soft.cpython-310.pyc
ADDED
Binary file (1.57 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc
ADDED
Binary file (2.14 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/_util.cpython-310.pyc
ADDED
Binary file (1.52 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/filelock/__pycache__/version.cpython-310.pyc
ADDED
Binary file (504 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/triton-2.3.0.dist-info/RECORD
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
triton-2.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
triton-2.3.0.dist-info/METADATA,sha256=X7Hrombllw4vphg7r5oMD_XqWzOiCvUW8fVeHAcZoqU,1356
|
3 |
+
triton-2.3.0.dist-info/RECORD,,
|
4 |
+
triton-2.3.0.dist-info/WHEEL,sha256=CzQQWV-lNyM92gr3iaBk8dvO35YDHRxgzkZ-dxumUIM,152
|
5 |
+
triton-2.3.0.dist-info/top_level.txt,sha256=ARhLOkJAljg76TsEmSMHjBPsK7s8_Wl35owptkuBcLg,215
|
6 |
+
triton/_C/libtriton.so,sha256=1cHVAy52BQW6VbvwpbPlT_0BFstSMRN_nUFlcKW7i2c,356418800
|
7 |
+
triton/__init__.py,sha256=u1W7_xsCfGjZiL_QJcSIK7dWyKX1bJGLyFn-Lcc-lJ4,1250
|
8 |
+
triton/__pycache__/__init__.cpython-310.pyc,,
|
9 |
+
triton/__pycache__/testing.cpython-310.pyc,,
|
10 |
+
triton/common/__init__.py,sha256=oif2rQjHnXXQpRzxm5vylRNQL2fQNhHvPo0XaO0z208,116
|
11 |
+
triton/common/__pycache__/__init__.cpython-310.pyc,,
|
12 |
+
triton/common/__pycache__/backend.cpython-310.pyc,,
|
13 |
+
triton/common/__pycache__/build.cpython-310.pyc,,
|
14 |
+
triton/common/backend.py,sha256=VtiLWVUaCgsSvDqFfirqroeNjiiI8fbmrKbWruxzFCI,5414
|
15 |
+
triton/common/build.py,sha256=TAn38HAtBrT4ykPUN87980jUbNH-Ajgho8oFrpXt29Y,4675
|
16 |
+
triton/compiler/__init__.py,sha256=4g0l1zeqxnZJxa5kLE3idegnMzjHR4cbxyr-07RhCd8,277
|
17 |
+
triton/compiler/__pycache__/__init__.cpython-310.pyc,,
|
18 |
+
triton/compiler/__pycache__/code_generator.cpython-310.pyc,,
|
19 |
+
triton/compiler/__pycache__/compiler.cpython-310.pyc,,
|
20 |
+
triton/compiler/__pycache__/errors.cpython-310.pyc,,
|
21 |
+
triton/compiler/__pycache__/make_launcher.cpython-310.pyc,,
|
22 |
+
triton/compiler/__pycache__/utils.cpython-310.pyc,,
|
23 |
+
triton/compiler/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24 |
+
triton/compiler/backends/__pycache__/__init__.cpython-310.pyc,,
|
25 |
+
triton/compiler/backends/__pycache__/cuda.cpython-310.pyc,,
|
26 |
+
triton/compiler/backends/cuda.py,sha256=S-ESfJfPisOSXZ3A3OiDUfFqjy19RvC8XBOU9cDVafM,9423
|
27 |
+
triton/compiler/code_generator.py,sha256=pDTfAYIuuhfm2ZEraT8j6T7noFuqFwj0zqLJQ3xL7xA,53867
|
28 |
+
triton/compiler/compiler.py,sha256=1Q6qF-KP4P12cF6dynzIRuhCFgQ14WdcxoxGjQ5XzHc,11094
|
29 |
+
triton/compiler/errors.py,sha256=PiquMxHuHayRvdH3hMXSQlOnDswK3TGNWENB29YX_FU,1666
|
30 |
+
triton/compiler/make_launcher.py,sha256=zdNyb-4DzyRp7_wdwfaHojCOjCnSlO3rirLEmN050k4,10118
|
31 |
+
triton/compiler/utils.py,sha256=uIUSjjztBUA7TdQkaqfj9uX655fGKAitpQJDzk0rLGE,11949
|
32 |
+
triton/language/__init__.py,sha256=Mqgkv832S-wdYMhTLEFLQ5-5Ms037E0yUji9KMEmD1c,3241
|
33 |
+
triton/language/__pycache__/__init__.cpython-310.pyc,,
|
34 |
+
triton/language/__pycache__/core.cpython-310.pyc,,
|
35 |
+
triton/language/__pycache__/math.cpython-310.pyc,,
|
36 |
+
triton/language/__pycache__/random.cpython-310.pyc,,
|
37 |
+
triton/language/__pycache__/semantic.cpython-310.pyc,,
|
38 |
+
triton/language/__pycache__/standard.cpython-310.pyc,,
|
39 |
+
triton/language/core.py,sha256=Z-Xa_gQkuC5DXLCvuJlTpZcjpXhGp3mAdYqs3db4vQA,61915
|
40 |
+
triton/language/extra/__init__.py,sha256=zyhlj6Mo9_KD7E5szGxI18Ko3b31E00-s1ybOM5KzkQ,39
|
41 |
+
triton/language/extra/__pycache__/__init__.cpython-310.pyc,,
|
42 |
+
triton/language/extra/__pycache__/cuda.cpython-310.pyc,,
|
43 |
+
triton/language/extra/cuda.py,sha256=t3NYFMyfX6L1eC17zio8fKZj2rJ8GjkMD5sI0rc-YOU,560
|
44 |
+
triton/language/math.py,sha256=oyoAeuEyjhQ9_2QLtEapITAWyZDBUqtIsFQUac3gLcY,62306
|
45 |
+
triton/language/random.py,sha256=28hJYR1YNE8Hz8c8yCmKHb7YRRuhkZW5qJyD9yoJyws,6567
|
46 |
+
triton/language/semantic.py,sha256=B-Wz-1tqktn62oM6CF5tz-IA8TDJG-3FvdeS0nxeHhE,68138
|
47 |
+
triton/language/standard.py,sha256=HhLVz4G5XUnZPz4VoKzEH9b35w6a-SdjCF_jPV83pHM,10986
|
48 |
+
triton/ops/__init__.py,sha256=NL5fhIJywJWOsSHMDA6JvjGhS7xA4-Z6CYIAQRy1FRU,313
|
49 |
+
triton/ops/__pycache__/__init__.cpython-310.pyc,,
|
50 |
+
triton/ops/__pycache__/cross_entropy.cpython-310.pyc,,
|
51 |
+
triton/ops/__pycache__/flash_attention.cpython-310.pyc,,
|
52 |
+
triton/ops/__pycache__/matmul.cpython-310.pyc,,
|
53 |
+
triton/ops/__pycache__/matmul_perf_model.cpython-310.pyc,,
|
54 |
+
triton/ops/blocksparse/__init__.py,sha256=6YEVQNzipgQCpoO_7B8H7ckaSW2Idt1244s7IyLWAwc,100
|
55 |
+
triton/ops/blocksparse/__pycache__/__init__.cpython-310.pyc,,
|
56 |
+
triton/ops/blocksparse/__pycache__/matmul.cpython-310.pyc,,
|
57 |
+
triton/ops/blocksparse/__pycache__/softmax.cpython-310.pyc,,
|
58 |
+
triton/ops/blocksparse/matmul.py,sha256=S29Wv0X47AUoCMfSw7A7-Lt6lUyGPzy63Q8pcD41O1w,15920
|
59 |
+
triton/ops/blocksparse/softmax.py,sha256=2jfmu1Bn9XsM4PyBsSRaSi3-XK0bJABxwQ-XsTwo7fg,8243
|
60 |
+
triton/ops/cross_entropy.py,sha256=Jr-iQ6oZQir8gh4WRmlPoh_CY4fM8x9c9dDsuavyFyQ,3451
|
61 |
+
triton/ops/flash_attention.py,sha256=cwzNu7vlVnfS1J4dXiIrmDHLtfQBa-PIpsnn-OKmiH4,17945
|
62 |
+
triton/ops/matmul.py,sha256=c37U9tqBnaUdt1OyFdGZwZpG3KR6IXNz0cveJIx-Uuc,8902
|
63 |
+
triton/ops/matmul_perf_model.py,sha256=WoDhHVD0VwAISJ8ZqMJqmK0dpEMk4Xrxur4vwIJ9VWw,6543
|
64 |
+
triton/runtime/__init__.py,sha256=Y4QxhfVrpiu8PtJFWR5DU1yj6RSxzwUbrpyCi2hCZNc,440
|
65 |
+
triton/runtime/__pycache__/__init__.cpython-310.pyc,,
|
66 |
+
triton/runtime/__pycache__/autotuner.cpython-310.pyc,,
|
67 |
+
triton/runtime/__pycache__/cache.cpython-310.pyc,,
|
68 |
+
triton/runtime/__pycache__/driver.cpython-310.pyc,,
|
69 |
+
triton/runtime/__pycache__/errors.cpython-310.pyc,,
|
70 |
+
triton/runtime/__pycache__/interpreter.cpython-310.pyc,,
|
71 |
+
triton/runtime/__pycache__/jit.cpython-310.pyc,,
|
72 |
+
triton/runtime/autotuner.py,sha256=sWzpi-a0qPaspGaCyg3yVAsiy8QzEJ9bFtgJ3uM8zkg,13612
|
73 |
+
triton/runtime/backends/cuda.c,sha256=XHNGYvyjAs-JLB_SeN0RDJYgFC2_wtmoR-BNIm-V3eA,22730
|
74 |
+
triton/runtime/backends/hip.c,sha256=j3sgv1Qm9vZu-KVpXL4fH01eLtWSMQB7bHUay7jCmAE,4121
|
75 |
+
triton/runtime/cache.py,sha256=0Pz5G_gE5ekFr0wBCkPzzYf50hsJm-CJNKWszqtgnd8,9408
|
76 |
+
triton/runtime/driver.py,sha256=ULI__Mco_StXXjjjufM-kFc3Wo5_fc5416w719iDvwg,7713
|
77 |
+
triton/runtime/errors.py,sha256=hjdNdL7xZRFyt7TUMbTBwEWe5yitLkMkWlPW-HCVLlI,543
|
78 |
+
triton/runtime/interpreter.py,sha256=bg8De0KpKwoe3DKiLbZ9Fq4jBkf1mnRoKBSPb5MXs5s,21582
|
79 |
+
triton/runtime/jit.py,sha256=PCujhbVzjaYeev_TLm5-ONetURlCJp1mB2x80NA5n0M,21992
|
80 |
+
triton/testing.py,sha256=t6fAnZlikUJUMOrQCT0nn2PCPGHuDyhjON_VYUpQ48g,18258
|
81 |
+
triton/third_party/cuda/bin/cuobjdump,sha256=M3aisp1Sv424T0BOqhn3rI92P0K-KEcBnB3qD1KQh64,540144
|
82 |
+
triton/third_party/cuda/bin/nvdisasm,sha256=vxrhwuck1PI4_RQ2lidzhaIKqxLqPBB_1bh0nP2VSEs,50678760
|
83 |
+
triton/third_party/cuda/bin/ptxas,sha256=641SCj3yUiIP_edDSDLDK6c7LHkSMF8IOrHVLxa7lwQ,29429360
|
84 |
+
triton/third_party/cuda/include/cuda.h,sha256=J1YRiXq0IN6GG3ZLLk1T7oQsQtY2wFgES9LCG3Tte0g,932912
|
85 |
+
triton/third_party/cuda/lib/libdevice.10.bc,sha256=XC-uN8huaMOjhgWpX1EtfRLV89uYYxC-R_VzBKpype4,473728
|
86 |
+
triton/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
87 |
+
triton/tools/__pycache__/__init__.cpython-310.pyc,,
|
88 |
+
triton/tools/__pycache__/build_extern.cpython-310.pyc,,
|
89 |
+
triton/tools/__pycache__/compile.cpython-310.pyc,,
|
90 |
+
triton/tools/__pycache__/disasm.cpython-310.pyc,,
|
91 |
+
triton/tools/__pycache__/link.cpython-310.pyc,,
|
92 |
+
triton/tools/build_extern.py,sha256=9v5Lz1vwksR0xqY9_oT5KltuKVXls-O7GqebAfZauoc,14363
|
93 |
+
triton/tools/compile.c,sha256=rjuAQ8b-2DTtbj29SgK1NxJI5BSU2P9ccp9wa5p8Iyc,2090
|
94 |
+
triton/tools/compile.h,sha256=n9QKIFZTL4RSsiXtAxBP9XGSnxjyaevQQ9bBpwDsvAg,332
|
95 |
+
triton/tools/compile.py,sha256=f-KTg8-qo9lbxJoj_1XoWrFkMX8HJGTgZRU_m2pNv2k,6523
|
96 |
+
triton/tools/disasm.py,sha256=U58GRL7v14hu4-B_kWkciHaY9jVIkTKg7DtioH4LTHo,5080
|
97 |
+
triton/tools/link.py,sha256=EODqTTEk8N4kjJkU099X--0dGwviFjJNiLcBxUUukhw,11824
|
llmeval-env/lib/python3.10/site-packages/typepy/__init__.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
import typepy.type
|
6 |
+
|
7 |
+
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
|
8 |
+
from ._const import ParamKey, StrictLevel
|
9 |
+
from ._function import (
|
10 |
+
extract_typepy_from_dtype,
|
11 |
+
is_empty_sequence,
|
12 |
+
is_hex,
|
13 |
+
is_not_empty_sequence,
|
14 |
+
is_not_null_string,
|
15 |
+
is_null_string,
|
16 |
+
)
|
17 |
+
from ._typecode import Typecode
|
18 |
+
from .error import TypeConversionError
|
19 |
+
from .type import (
|
20 |
+
Binary,
|
21 |
+
Bool,
|
22 |
+
Bytes,
|
23 |
+
DateTime,
|
24 |
+
Dictionary,
|
25 |
+
Infinity,
|
26 |
+
Integer,
|
27 |
+
IpAddress,
|
28 |
+
List,
|
29 |
+
Nan,
|
30 |
+
NoneType,
|
31 |
+
NullString,
|
32 |
+
RealNumber,
|
33 |
+
String,
|
34 |
+
)
|
35 |
+
|
36 |
+
|
37 |
+
__all__ = (
|
38 |
+
"ParamKey",
|
39 |
+
"StrictLevel",
|
40 |
+
"Typecode",
|
41 |
+
"TypeConversionError",
|
42 |
+
"Binary",
|
43 |
+
"Bool",
|
44 |
+
"Bytes",
|
45 |
+
"DateTime",
|
46 |
+
"Dictionary",
|
47 |
+
"Infinity",
|
48 |
+
"Integer",
|
49 |
+
"IpAddress",
|
50 |
+
"List",
|
51 |
+
"Nan",
|
52 |
+
"NoneType",
|
53 |
+
"NullString",
|
54 |
+
"RealNumber",
|
55 |
+
"String",
|
56 |
+
"extract_typepy_from_dtype",
|
57 |
+
"is_empty_sequence",
|
58 |
+
"is_hex",
|
59 |
+
"is_not_empty_sequence",
|
60 |
+
"is_not_null_string",
|
61 |
+
"is_null_string",
|
62 |
+
"typepy",
|
63 |
+
)
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (1.17 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/__version__.cpython-310.pyc
ADDED
Binary file (385 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_common.cpython-310.pyc
ADDED
Binary file (704 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_const.cpython-310.pyc
ADDED
Binary file (833 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_function.cpython-310.pyc
ADDED
Binary file (1.61 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/_typecode.cpython-310.pyc
ADDED
Binary file (719 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/__pycache__/error.cpython-310.pyc
ADDED
Binary file (500 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/_common.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from typing import Any
|
3 |
+
|
4 |
+
|
5 |
+
ansi_escape = re.compile(r"(\x9b|\x1b\[)[0-?]*[ -\/]*[@-~]", re.IGNORECASE)
|
6 |
+
REGEXP_THOUSAND_SEP = re.compile(r"\d{1,3}(,\d{1,3})+")
|
7 |
+
|
8 |
+
|
9 |
+
def strip_ansi_escape(value: Any) -> str:
|
10 |
+
return ansi_escape.sub("", value)
|
11 |
+
|
12 |
+
|
13 |
+
def remove_thousand_sep(value: str) -> str:
|
14 |
+
if REGEXP_THOUSAND_SEP.search(value) is None:
|
15 |
+
return value
|
16 |
+
|
17 |
+
return value.replace(",", "")
|
llmeval-env/lib/python3.10/site-packages/typepy/_const.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from decimal import Decimal
|
6 |
+
|
7 |
+
|
8 |
+
class DefaultValue:
|
9 |
+
FLOAT_TYPE = Decimal
|
10 |
+
STRIP_ANSI_ESCAPE = True
|
11 |
+
|
12 |
+
|
13 |
+
class StrictLevel:
|
14 |
+
MIN = 0
|
15 |
+
MAX = 100
|
16 |
+
|
17 |
+
|
18 |
+
class ParamKey:
|
19 |
+
STRIP_ANSI_ESCAPE = "strip_ansi_escape"
|
20 |
+
TIMEZONE = "timezone"
|
llmeval-env/lib/python3.10/site-packages/typepy/_typecode.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
import enum
|
6 |
+
|
7 |
+
|
8 |
+
@enum.unique
|
9 |
+
class Typecode(enum.Enum):
|
10 |
+
NONE = 0
|
11 |
+
INTEGER = 1 << 0
|
12 |
+
REAL_NUMBER = 1 << 1
|
13 |
+
STRING = 1 << 2
|
14 |
+
NULL_STRING = 1 << 3
|
15 |
+
DATETIME = 1 << 4
|
16 |
+
INFINITY = 1 << 5
|
17 |
+
NAN = 1 << 6
|
18 |
+
BOOL = 1 << 7
|
19 |
+
DICTIONARY = 1 << 8
|
20 |
+
LIST = 1 << 9
|
21 |
+
IP_ADDRESS = 1 << 10
|
22 |
+
BYTES = 1 << 11
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__init__.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._bool import BoolTypeChecker
|
6 |
+
from ._bytes import BytesTypeChecker
|
7 |
+
from ._datetime import DateTimeTypeChecker
|
8 |
+
from ._dictionary import DictionaryTypeChecker
|
9 |
+
from ._infinity import InfinityTypeChecker
|
10 |
+
from ._integer import IntegerTypeChecker
|
11 |
+
from ._interface import TypeCheckerInterface
|
12 |
+
from ._ipaddress import IpAddressTypeChecker
|
13 |
+
from ._list import ListTypeChecker
|
14 |
+
from ._nan import NanTypeChecker
|
15 |
+
from ._none import NoneTypeChecker
|
16 |
+
from ._realnumber import RealNumberTypeChecker
|
17 |
+
from ._string import NullStringTypeChecker, StringTypeChecker
|
18 |
+
|
19 |
+
|
20 |
+
__all__ = (
|
21 |
+
"BoolTypeChecker",
|
22 |
+
"BytesTypeChecker",
|
23 |
+
"DateTimeTypeChecker",
|
24 |
+
"DictionaryTypeChecker",
|
25 |
+
"InfinityTypeChecker",
|
26 |
+
"IntegerTypeChecker",
|
27 |
+
"IpAddressTypeChecker",
|
28 |
+
"ListTypeChecker",
|
29 |
+
"NanTypeChecker",
|
30 |
+
"NoneTypeChecker",
|
31 |
+
"NullStringTypeChecker",
|
32 |
+
"RealNumberTypeChecker",
|
33 |
+
"StringTypeChecker",
|
34 |
+
"TypeCheckerInterface",
|
35 |
+
)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (1.04 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_bool.cpython-310.pyc
ADDED
Binary file (2.19 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_bytes.cpython-310.pyc
ADDED
Binary file (1.36 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_checker.cpython-310.pyc
ADDED
Binary file (3.87 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_common.cpython-310.pyc
ADDED
Binary file (881 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_datetime.cpython-310.pyc
ADDED
Binary file (2.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_dictionary.cpython-310.pyc
ADDED
Binary file (1.74 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_infinity.cpython-310.pyc
ADDED
Binary file (1.78 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_integer.cpython-310.pyc
ADDED
Binary file (2.8 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_interface.cpython-310.pyc
ADDED
Binary file (803 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_ipaddress.cpython-310.pyc
ADDED
Binary file (2.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_list.cpython-310.pyc
ADDED
Binary file (1.9 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_nan.cpython-310.pyc
ADDED
Binary file (1.71 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_none.cpython-310.pyc
ADDED
Binary file (1.31 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_realnumber.cpython-310.pyc
ADDED
Binary file (3.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/__pycache__/_string.cpython-310.pyc
ADDED
Binary file (3.35 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_bool.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from .._const import StrictLevel
|
6 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
7 |
+
from ._common import isstring
|
8 |
+
|
9 |
+
|
10 |
+
class BoolTypeCheckerStrictLevel0(TypeCheckerBase):
|
11 |
+
def is_instance(self):
|
12 |
+
return isinstance(self._value, bool)
|
13 |
+
|
14 |
+
def is_valid_after_convert(self, converted_value):
|
15 |
+
return isinstance(converted_value, bool)
|
16 |
+
|
17 |
+
|
18 |
+
class BoolTypeCheckerStrictLevel1(BoolTypeCheckerStrictLevel0):
|
19 |
+
def is_exclude_instance(self):
|
20 |
+
from ..type._integer import Integer
|
21 |
+
|
22 |
+
return Integer(self._value, strict_level=StrictLevel.MAX).is_type()
|
23 |
+
|
24 |
+
|
25 |
+
class BoolTypeCheckerStrictLevel2(BoolTypeCheckerStrictLevel1):
|
26 |
+
def is_exclude_instance(self):
|
27 |
+
return super().is_exclude_instance() or isstring(self._value)
|
28 |
+
|
29 |
+
|
30 |
+
_factory = CheckerFactory(
|
31 |
+
checker_mapping={
|
32 |
+
0: BoolTypeCheckerStrictLevel0,
|
33 |
+
1: BoolTypeCheckerStrictLevel1,
|
34 |
+
2: BoolTypeCheckerStrictLevel2,
|
35 |
+
}
|
36 |
+
)
|
37 |
+
|
38 |
+
|
39 |
+
class BoolTypeChecker(TypeCheckerDelegator):
|
40 |
+
def __init__(self, value, strict_level):
|
41 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_bytes.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
6 |
+
|
7 |
+
|
8 |
+
class BytesTypeCheckerStrictLevel0(TypeCheckerBase):
|
9 |
+
def is_instance(self):
|
10 |
+
return isinstance(self._value, bytes)
|
11 |
+
|
12 |
+
def is_valid_after_convert(self, converted_value):
|
13 |
+
return isinstance(converted_value, bytes)
|
14 |
+
|
15 |
+
|
16 |
+
_factory = CheckerFactory(checker_mapping={0: BytesTypeCheckerStrictLevel0})
|
17 |
+
|
18 |
+
|
19 |
+
class BytesTypeChecker(TypeCheckerDelegator):
|
20 |
+
def __init__(self, value, strict_level):
|
21 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_checker.py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
import abc
|
6 |
+
|
7 |
+
from ._interface import TypeCheckerInterface
|
8 |
+
|
9 |
+
|
10 |
+
class CheckerFactory:
|
11 |
+
__slots__ = ("__min_strict_level", "__max_strict_level", "__checker_mapping")
|
12 |
+
|
13 |
+
@property
|
14 |
+
def min_strict_level(self):
|
15 |
+
return self.__min_strict_level
|
16 |
+
|
17 |
+
@property
|
18 |
+
def max_strict_level(self):
|
19 |
+
return self.__max_strict_level
|
20 |
+
|
21 |
+
def __init__(self, checker_mapping):
|
22 |
+
self.__checker_mapping = checker_mapping
|
23 |
+
|
24 |
+
self.__min_strict_level = min(checker_mapping)
|
25 |
+
self.__max_strict_level = max(checker_mapping)
|
26 |
+
self.__checker_mapping[None] = self.__max_strict_level
|
27 |
+
|
28 |
+
def get_checker_class(self, strict_level=None):
|
29 |
+
checker_class = self.__checker_mapping.get(strict_level)
|
30 |
+
if checker_class:
|
31 |
+
return checker_class
|
32 |
+
if strict_level < self.min_strict_level:
|
33 |
+
return self.__checker_mapping[self.min_strict_level]
|
34 |
+
if strict_level > self.max_strict_level:
|
35 |
+
return self.__checker_mapping[self.max_strict_level]
|
36 |
+
|
37 |
+
raise ValueError(f"unexpected strict level: {strict_level}")
|
38 |
+
|
39 |
+
|
40 |
+
class TypeCheckerBase(TypeCheckerInterface):
|
41 |
+
__slots__ = ("_value",)
|
42 |
+
|
43 |
+
def __init__(self, value):
|
44 |
+
self._value = value
|
45 |
+
|
46 |
+
@abc.abstractmethod
|
47 |
+
def is_instance(self):
|
48 |
+
pass
|
49 |
+
|
50 |
+
def is_type(self) -> bool:
|
51 |
+
return self.is_instance() and not self.is_exclude_instance()
|
52 |
+
|
53 |
+
def validate(self) -> None:
|
54 |
+
"""
|
55 |
+
:raises TypeError:
|
56 |
+
If the value is not matched the type to be expected.
|
57 |
+
"""
|
58 |
+
|
59 |
+
if self.is_type():
|
60 |
+
return
|
61 |
+
|
62 |
+
raise TypeError(f"invalid value type: actual={type(self._value)}")
|
63 |
+
|
64 |
+
def is_exclude_instance(self):
|
65 |
+
return False
|
66 |
+
|
67 |
+
def is_valid_after_convert(self, converted_value):
|
68 |
+
return True
|
69 |
+
|
70 |
+
|
71 |
+
class TypeCheckerDelegator(TypeCheckerInterface):
|
72 |
+
__slots__ = ("__checker",)
|
73 |
+
|
74 |
+
def __init__(self, value, checker_factory, strict_level):
|
75 |
+
self.__checker = checker_factory.get_checker_class(strict_level)(value)
|
76 |
+
|
77 |
+
def is_type(self) -> bool:
|
78 |
+
return self.__checker.is_type()
|
79 |
+
|
80 |
+
def is_valid_after_convert(self, value):
|
81 |
+
return self.__checker.is_valid_after_convert(value)
|
82 |
+
|
83 |
+
def is_instance(self):
|
84 |
+
return self.__checker.is_instance()
|
85 |
+
|
86 |
+
def is_exclude_instance(self):
|
87 |
+
return self.__checker.is_exclude_instance()
|
88 |
+
|
89 |
+
def validate(self) -> None:
|
90 |
+
self.__checker.validate()
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_datetime.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from datetime import date, datetime
|
6 |
+
|
7 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
8 |
+
from ._common import isstring
|
9 |
+
|
10 |
+
|
11 |
+
class DateTimeTypeCheckerStrictLevel0(TypeCheckerBase):
|
12 |
+
def is_instance(self):
|
13 |
+
return isinstance(self._value, (date, datetime))
|
14 |
+
|
15 |
+
|
16 |
+
class DateTimeTypeCheckerStrictLevel1(DateTimeTypeCheckerStrictLevel0):
|
17 |
+
def is_exclude_instance(self):
|
18 |
+
from ..type._integer import Integer
|
19 |
+
|
20 |
+
# exclude timestamp
|
21 |
+
return Integer(self._value, strict_level=1).is_type()
|
22 |
+
|
23 |
+
|
24 |
+
class DateTimeTypeCheckerStrictLevel2(DateTimeTypeCheckerStrictLevel1):
|
25 |
+
def is_exclude_instance(self):
|
26 |
+
return isstring(self._value) or super().is_exclude_instance()
|
27 |
+
|
28 |
+
|
29 |
+
_factory = CheckerFactory(
|
30 |
+
checker_mapping={
|
31 |
+
0: DateTimeTypeCheckerStrictLevel0,
|
32 |
+
1: DateTimeTypeCheckerStrictLevel1,
|
33 |
+
2: DateTimeTypeCheckerStrictLevel2,
|
34 |
+
}
|
35 |
+
)
|
36 |
+
|
37 |
+
|
38 |
+
class DateTimeTypeChecker(TypeCheckerDelegator):
|
39 |
+
def __init__(self, value, strict_level):
|
40 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_integer.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
import re
|
6 |
+
from decimal import Decimal
|
7 |
+
|
8 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
9 |
+
from ._common import isinf, isnan
|
10 |
+
|
11 |
+
|
12 |
+
RE_SCIENTIFIC_NOTATION = re.compile(r"^-?\d+(?:\.\d*)?[eE][+\-]?\d{3,}$")
|
13 |
+
|
14 |
+
|
15 |
+
class IntegerTypeCheckerStrictLevel0(TypeCheckerBase):
|
16 |
+
def is_instance(self):
|
17 |
+
if isinstance(self._value, int):
|
18 |
+
return not isinstance(self._value, bool)
|
19 |
+
|
20 |
+
if isinstance(self._value, (float, Decimal)):
|
21 |
+
return True
|
22 |
+
|
23 |
+
return False
|
24 |
+
|
25 |
+
def is_exclude_instance(self):
|
26 |
+
return isnan(self._value) or isinf(self._value)
|
27 |
+
|
28 |
+
|
29 |
+
class IntegerTypeCheckerStrictLevel1(IntegerTypeCheckerStrictLevel0):
|
30 |
+
def is_instance(self):
|
31 |
+
if not super().is_instance():
|
32 |
+
return False
|
33 |
+
|
34 |
+
if isinstance(self._value, (float, Decimal)):
|
35 |
+
if float(self._value).is_integer():
|
36 |
+
return True
|
37 |
+
|
38 |
+
try:
|
39 |
+
return self._value.is_integer()
|
40 |
+
except AttributeError:
|
41 |
+
pass
|
42 |
+
|
43 |
+
return False
|
44 |
+
|
45 |
+
def is_exclude_instance(self):
|
46 |
+
from ..type._realnumber import RealNumber
|
47 |
+
|
48 |
+
return (
|
49 |
+
super().is_exclude_instance()
|
50 |
+
or isinstance(self._value, bool)
|
51 |
+
or RealNumber(self._value, strict_level=1).is_type()
|
52 |
+
or (isinstance(self._value, str) and RE_SCIENTIFIC_NOTATION.search(self._value))
|
53 |
+
)
|
54 |
+
|
55 |
+
|
56 |
+
class IntegerTypeCheckerStrictLevel2(IntegerTypeCheckerStrictLevel1):
|
57 |
+
def is_exclude_instance(self):
|
58 |
+
return isinstance(self._value, (str,) + (bool, float, Decimal))
|
59 |
+
|
60 |
+
|
61 |
+
_factory = CheckerFactory(
|
62 |
+
checker_mapping={
|
63 |
+
0: IntegerTypeCheckerStrictLevel0,
|
64 |
+
1: IntegerTypeCheckerStrictLevel1,
|
65 |
+
2: IntegerTypeCheckerStrictLevel2,
|
66 |
+
}
|
67 |
+
)
|
68 |
+
|
69 |
+
|
70 |
+
class IntegerTypeChecker(TypeCheckerDelegator):
|
71 |
+
def __init__(self, value, strict_level):
|
72 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_nan.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
6 |
+
from ._common import isnan, isstring
|
7 |
+
|
8 |
+
|
9 |
+
class NanTypeCheckerStrictLevel0(TypeCheckerBase):
|
10 |
+
def is_instance(self):
|
11 |
+
return isnan(self._value)
|
12 |
+
|
13 |
+
def is_valid_after_convert(self, converted_value):
|
14 |
+
return isnan(converted_value)
|
15 |
+
|
16 |
+
|
17 |
+
class NanTypeCheckerStrictLevel1(NanTypeCheckerStrictLevel0):
|
18 |
+
def is_exclude_instance(self):
|
19 |
+
return isstring(self._value)
|
20 |
+
|
21 |
+
|
22 |
+
_factory = CheckerFactory(
|
23 |
+
checker_mapping={0: NanTypeCheckerStrictLevel0, 1: NanTypeCheckerStrictLevel1}
|
24 |
+
)
|
25 |
+
|
26 |
+
|
27 |
+
class NanTypeChecker(TypeCheckerDelegator):
|
28 |
+
def __init__(self, value, strict_level):
|
29 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_none.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
6 |
+
|
7 |
+
|
8 |
+
class NoneTypeCheckerStrictLevel0(TypeCheckerBase):
|
9 |
+
def is_instance(self):
|
10 |
+
return self._value is None
|
11 |
+
|
12 |
+
def is_valid_after_convert(self, converted_value):
|
13 |
+
return self._value is None
|
14 |
+
|
15 |
+
|
16 |
+
_factory = CheckerFactory(checker_mapping={0: NoneTypeCheckerStrictLevel0})
|
17 |
+
|
18 |
+
|
19 |
+
class NoneTypeChecker(TypeCheckerDelegator):
|
20 |
+
def __init__(self, value, strict_level):
|
21 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_realnumber.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
import re
|
6 |
+
from decimal import Decimal
|
7 |
+
|
8 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
9 |
+
from ._common import isinf, isnan, isstring
|
10 |
+
|
11 |
+
|
12 |
+
RE_E = re.compile("[eE]")
|
13 |
+
RE_SCIENTIFIC_NOTATION = re.compile(r"^-?\d+(?:\.\d*)?[eE][+\-]?\d{,2}$")
|
14 |
+
|
15 |
+
|
16 |
+
class RealNumberTypeCheckerStrictLevel0(TypeCheckerBase):
|
17 |
+
def is_instance(self):
|
18 |
+
return isinstance(self._value, (float, Decimal))
|
19 |
+
|
20 |
+
def is_exclude_instance(self):
|
21 |
+
return isinstance(self._value, bool) or isnan(self._value) or isinf(self._value)
|
22 |
+
|
23 |
+
def is_valid_after_convert(self, converted_value):
|
24 |
+
return not isinf(converted_value) and not isnan(converted_value)
|
25 |
+
|
26 |
+
|
27 |
+
class RealNumberTypeCheckerStrictLevel1(RealNumberTypeCheckerStrictLevel0):
|
28 |
+
def is_instance(self):
|
29 |
+
return super().is_instance() and not float(self._value).is_integer()
|
30 |
+
|
31 |
+
def is_exclude_instance(self):
|
32 |
+
if (
|
33 |
+
isinstance(self._value, str)
|
34 |
+
and RE_E.search(self._value)
|
35 |
+
and RE_SCIENTIFIC_NOTATION.search(self._value) is None
|
36 |
+
):
|
37 |
+
return True
|
38 |
+
|
39 |
+
return isinstance(self._value, int) or super().is_exclude_instance()
|
40 |
+
|
41 |
+
def is_valid_after_convert(self, converted_value):
|
42 |
+
return not float(converted_value).is_integer()
|
43 |
+
|
44 |
+
|
45 |
+
class RealNumberTypeCheckerStrictLevel2(RealNumberTypeCheckerStrictLevel1):
|
46 |
+
def is_exclude_instance(self):
|
47 |
+
return super().is_exclude_instance() or isstring(self._value)
|
48 |
+
|
49 |
+
|
50 |
+
_factory = CheckerFactory(
|
51 |
+
checker_mapping={
|
52 |
+
0: RealNumberTypeCheckerStrictLevel0,
|
53 |
+
1: RealNumberTypeCheckerStrictLevel1,
|
54 |
+
2: RealNumberTypeCheckerStrictLevel2,
|
55 |
+
}
|
56 |
+
)
|
57 |
+
|
58 |
+
|
59 |
+
class RealNumberTypeChecker(TypeCheckerDelegator):
|
60 |
+
def __init__(self, value, strict_level):
|
61 |
+
super().__init__(value=value, checker_factory=_factory, strict_level=strict_level)
|
llmeval-env/lib/python3.10/site-packages/typepy/checker/_string.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
|
6 |
+
from ._common import isstring
|
7 |
+
|
8 |
+
|
9 |
+
class StringTypeCheckerStrictLevel0(TypeCheckerBase):
|
10 |
+
def is_instance(self):
|
11 |
+
return isstring(self._value)
|
12 |
+
|
13 |
+
def is_valid_after_convert(self, converted_value):
|
14 |
+
return isstring(converted_value)
|
15 |
+
|
16 |
+
def _is_null_string(self, value):
|
17 |
+
try:
|
18 |
+
value = value.strip()
|
19 |
+
except AttributeError:
|
20 |
+
return False
|
21 |
+
|
22 |
+
return len(value) == 0
|
23 |
+
|
24 |
+
|
25 |
+
class StringTypeCheckerStrictLevel1(StringTypeCheckerStrictLevel0):
|
26 |
+
def is_exclude_instance(self):
|
27 |
+
return not isstring(self._value)
|
28 |
+
|
29 |
+
|
30 |
+
class StringTypeCheckerStrictLevel2(StringTypeCheckerStrictLevel1):
|
31 |
+
def is_exclude_instance(self):
|
32 |
+
if super().is_exclude_instance():
|
33 |
+
return True
|
34 |
+
|
35 |
+
return self._is_null_string(self._value)
|
36 |
+
|
37 |
+
|
38 |
+
_string_factory = CheckerFactory(
|
39 |
+
checker_mapping={
|
40 |
+
0: StringTypeCheckerStrictLevel0,
|
41 |
+
1: StringTypeCheckerStrictLevel1,
|
42 |
+
2: StringTypeCheckerStrictLevel2,
|
43 |
+
}
|
44 |
+
)
|
45 |
+
|
46 |
+
|
47 |
+
class StringTypeChecker(TypeCheckerDelegator):
|
48 |
+
def __init__(self, value, strict_level):
|
49 |
+
super().__init__(value=value, checker_factory=_string_factory, strict_level=strict_level)
|
50 |
+
|
51 |
+
|
52 |
+
class NullStringTypeCheckerStrictLevel0(StringTypeCheckerStrictLevel0):
|
53 |
+
def is_instance(self):
|
54 |
+
return self._value is None
|
55 |
+
|
56 |
+
def is_valid_after_convert(self, converted_value):
|
57 |
+
return self._is_null_string(converted_value)
|
58 |
+
|
59 |
+
|
60 |
+
class NullStringTypeCheckerStrictLevel1(NullStringTypeCheckerStrictLevel0):
|
61 |
+
def is_instance(self):
|
62 |
+
return False
|
63 |
+
|
64 |
+
|
65 |
+
_null_string_factory = CheckerFactory(
|
66 |
+
checker_mapping={0: NullStringTypeCheckerStrictLevel0, 1: NullStringTypeCheckerStrictLevel1}
|
67 |
+
)
|
68 |
+
|
69 |
+
|
70 |
+
class NullStringTypeChecker(TypeCheckerDelegator):
|
71 |
+
def __init__(self, value, strict_level):
|
72 |
+
super().__init__(
|
73 |
+
value=value, checker_factory=_null_string_factory, strict_level=strict_level
|
74 |
+
)
|
llmeval-env/lib/python3.10/site-packages/typepy/converter/__init__.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
|
3 |
+
"""
|
4 |
+
|
5 |
+
from ._bool import BoolConverter
|
6 |
+
from ._bytes import BytesConverter
|
7 |
+
from ._datetime import DateTimeConverter
|
8 |
+
from ._dictionary import DictionaryConverter
|
9 |
+
from ._integer import IntegerConverter
|
10 |
+
from ._interface import ValueConverterInterface
|
11 |
+
from ._ipaddress import IpAddressConverter
|
12 |
+
from ._list import ListConverter
|
13 |
+
from ._nop import NopConverter
|
14 |
+
from ._realnumber import FloatConverter
|
15 |
+
from ._string import NullStringConverter, StringConverter
|
16 |
+
|
17 |
+
|
18 |
+
__all__ = (
|
19 |
+
"BoolConverter",
|
20 |
+
"BytesConverter",
|
21 |
+
"DateTimeConverter",
|
22 |
+
"DictionaryConverter",
|
23 |
+
"FloatConverter",
|
24 |
+
"IntegerConverter",
|
25 |
+
"IpAddressConverter",
|
26 |
+
"ListConverter",
|
27 |
+
"NopConverter",
|
28 |
+
"NullStringConverter",
|
29 |
+
"StringConverter",
|
30 |
+
"ValueConverterInterface",
|
31 |
+
)
|
llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (913 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_bool.cpython-310.pyc
ADDED
Binary file (1.51 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_bytes.cpython-310.pyc
ADDED
Binary file (701 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/typepy/converter/__pycache__/_datetime.cpython-310.pyc
ADDED
Binary file (4.85 kB). View file
|
|