ADAPT-Chase commited on
Commit
8d1427d
·
verified ·
1 Parent(s): 9c75870

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +3 -21
  2. tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/__init__.cpython-312.pyc +0 -0
  3. tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/comparator.cpython-312.pyc +0 -0
  4. tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/fsm.cpython-312.pyc +0 -0
  5. tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/patterns.cpython-312.pyc +0 -0
  6. tool_server/.venv/lib/python3.12/site-packages/interegular/utils/__init__.py +15 -0
  7. tool_server/.venv/lib/python3.12/site-packages/interegular/utils/__pycache__/__init__.cpython-312.pyc +0 -0
  8. tool_server/.venv/lib/python3.12/site-packages/interegular/utils/simple_parser.py +165 -0
  9. tool_server/.venv/lib/python3.12/site-packages/jiter/__pycache__/__init__.cpython-312.pyc +0 -0
  10. tool_server/.venv/lib/python3.12/site-packages/llguidance-0.7.30.dist-info/licenses/LICENSE +21 -0
  11. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/__init__.cpython-312.pyc +0 -0
  12. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_grammar_from.cpython-312.pyc +0 -0
  13. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_struct_tag.cpython-312.pyc +0 -0
  14. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_tokenizer.cpython-312.pyc +0 -0
  15. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_util.cpython-312.pyc +0 -0
  16. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/cli.cpython-312.pyc +0 -0
  17. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/gbnf_to_lark.cpython-312.pyc +0 -0
  18. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/hf.cpython-312.pyc +0 -0
  19. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/llamacpp.cpython-312.pyc +0 -0
  20. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/mlx.cpython-312.pyc +0 -0
  21. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/numpy.cpython-312.pyc +0 -0
  22. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/tiktoken.cpython-312.pyc +0 -0
  23. tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/torch.cpython-312.pyc +0 -0
  24. tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/__init__.cpython-312.pyc +0 -0
  25. tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/_version.cpython-312.pyc +0 -0
  26. tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/utils.cpython-312.pyc +0 -0
  27. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__init__.py +19 -0
  28. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/__init__.cpython-312.pyc +0 -0
  29. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/analysis.cpython-312.pyc +0 -0
  30. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/common.cpython-312.pyc +0 -0
  31. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/context.cpython-312.pyc +0 -0
  32. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/dylib.cpython-312.pyc +0 -0
  33. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/executionengine.cpython-312.pyc +0 -0
  34. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/ffi.cpython-312.pyc +0 -0
  35. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/initfini.cpython-312.pyc +0 -0
  36. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/linker.cpython-312.pyc +0 -0
  37. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/module.cpython-312.pyc +0 -0
  38. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/newpassmanagers.cpython-312.pyc +0 -0
  39. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/object_file.cpython-312.pyc +0 -0
  40. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/options.cpython-312.pyc +0 -0
  41. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/orcjit.cpython-312.pyc +0 -0
  42. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/passmanagers.cpython-312.pyc +0 -0
  43. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/targets.cpython-312.pyc +0 -0
  44. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/transforms.cpython-312.pyc +0 -0
  45. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/typeref.cpython-312.pyc +0 -0
  46. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/value.cpython-312.pyc +0 -0
  47. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/analysis.py +69 -0
  48. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/common.py +34 -0
  49. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/context.py +39 -0
  50. tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/dylib.py +45 -0
.gitattributes CHANGED
@@ -4059,24 +4059,6 @@ tool_server/.venv/lib/python3.12/site-packages/nvidia/cufile/lib/libcufile.so.0
4059
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_runtime/lib/libcudart.so.12 filter=lfs diff=lfs merge=lfs -text
4060
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc-builtins.so.12.6 filter=lfs diff=lfs merge=lfs -text
4061
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.12 filter=lfs diff=lfs merge=lfs -text
4062
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_cupti/lib/libcheckpoint.so filter=lfs diff=lfs merge=lfs -text
4063
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_cupti/lib/libcupti.so.12 filter=lfs diff=lfs merge=lfs -text
4064
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_cupti/lib/libnvperf_host.so filter=lfs diff=lfs merge=lfs -text
4065
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_cupti/lib/libnvperf_target.so filter=lfs diff=lfs merge=lfs -text
4066
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_cupti/lib/libpcsamplingutil.so filter=lfs diff=lfs merge=lfs -text
4067
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cublas/lib/libcublas.so.12 filter=lfs diff=lfs merge=lfs -text
4068
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cublas/lib/libcublasLt.so.12 filter=lfs diff=lfs merge=lfs -text
4069
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cublas/lib/libnvblas.so.12 filter=lfs diff=lfs merge=lfs -text
4070
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cusparse/lib/libcusparse.so.12 filter=lfs diff=lfs merge=lfs -text
4071
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cufft/lib/libcufft.so.11 filter=lfs diff=lfs merge=lfs -text
4072
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cufft/lib/libcufftw.so.11 filter=lfs diff=lfs merge=lfs -text
4073
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn.so.9 filter=lfs diff=lfs merge=lfs -text
4074
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_adv.so.9 filter=lfs diff=lfs merge=lfs -text
4075
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_cnn.so.9 filter=lfs diff=lfs merge=lfs -text
4076
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_engines_precompiled.so.9 filter=lfs diff=lfs merge=lfs -text
4077
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_engines_runtime_compiled.so.9 filter=lfs diff=lfs merge=lfs -text
4078
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_graph.so.9 filter=lfs diff=lfs merge=lfs -text
4079
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_heuristic.so.9 filter=lfs diff=lfs merge=lfs -text
4080
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cudnn/lib/libcudnn_ops.so.9 filter=lfs diff=lfs merge=lfs -text
4081
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cusolver/lib/libcusolver.so.11 filter=lfs diff=lfs merge=lfs -text
4082
- tool_server/.venv/lib/python3.12/site-packages/nvidia/cusolver/lib/libcusolverMg.so.11 filter=lfs diff=lfs merge=lfs -text
 
4059
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_runtime/lib/libcudart.so.12 filter=lfs diff=lfs merge=lfs -text
4060
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc-builtins.so.12.6 filter=lfs diff=lfs merge=lfs -text
4061
  tool_server/.venv/lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.12 filter=lfs diff=lfs merge=lfs -text
4062
+ tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/libllvmlite.so filter=lfs diff=lfs merge=lfs -text
4063
+ tool_server/.venv/lib/python3.12/site-packages/llvmlite/tests/__pycache__/test_binding.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4064
+ tool_server/.venv/lib/python3.12/site-packages/llvmlite/tests/__pycache__/test_ir.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (1.76 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/comparator.cpython-312.pyc ADDED
Binary file (10.9 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/fsm.cpython-312.pyc ADDED
Binary file (48.8 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/interegular/__pycache__/patterns.cpython-312.pyc ADDED
Binary file (40.1 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/interegular/utils/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ from typing import Iterable
3
+
4
+ logger = logging.getLogger('interegular')
5
+ logger.addHandler(logging.StreamHandler())
6
+ logger.setLevel(logging.CRITICAL)
7
+
8
+
9
+ def soft_repr(s: str):
10
+ """
11
+ joins together the repr of each char in the string, while throwing away the repr
12
+ This for example turns `"'\""` into `'"` instead of `\'"` like the normal repr
13
+ would do.
14
+ """
15
+ return ''.join(repr(c)[1:-1] for c in str(s))
tool_server/.venv/lib/python3.12/site-packages/interegular/utils/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (1.17 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/interegular/utils/simple_parser.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A small util to simplify the creation of Parsers for simple context-free-grammars.
3
+
4
+ """
5
+
6
+ from abc import ABC, abstractmethod
7
+ from collections import defaultdict
8
+ from functools import wraps
9
+ from types import FunctionType, MethodType
10
+ from typing import Generic, TypeVar, Optional, List
11
+
12
+ __all__ = ['nomatch', 'NoMatch', 'SimpleParser']
13
+
14
+
15
+ class nomatch(BaseException):
16
+ def __init__(self):
17
+ pass
18
+
19
+
20
+ class NoMatch(ValueError):
21
+ def __init__(self, data: str, index: int, expected: List[str]):
22
+ self.data = data
23
+ self.index = index
24
+ self.expected = expected
25
+ super(NoMatch, self).__init__(f"Can not match at index {index}. Got {data[index:index + 5]!r},"
26
+ f" expected any of {expected}.\n"
27
+ f"Context(data[-10:+10]): {data[index - 10: index + 10]!r}")
28
+
29
+
30
+ T = TypeVar('T')
31
+
32
+
33
+ def _wrap_reset(m):
34
+ @wraps(m)
35
+ def w(self, *args, **kwargs):
36
+ p = self.index
37
+ try:
38
+ return m(self, *args, **kwargs)
39
+ except nomatch:
40
+ self.index = p
41
+ raise
42
+
43
+ return w
44
+
45
+
46
+ class SimpleParser(Generic[T], ABC):
47
+ def __init__(self, data: str):
48
+ self.data = data
49
+ self.index = 0
50
+ self._expected = defaultdict(list)
51
+
52
+ def __init_subclass__(cls, **kwargs):
53
+ for n, v in cls.__dict__.items():
54
+ if isinstance(v, FunctionType) and not n.startswith('_'):
55
+ setattr(cls, n, _wrap_reset(v))
56
+
57
+ def parse(self) -> T:
58
+ try:
59
+ result = self.start()
60
+ except nomatch:
61
+ raise NoMatch(self.data, max(self._expected), self._expected[max(self._expected)]) from None
62
+ if self.index < len(self.data):
63
+ raise NoMatch(self.data, max(self._expected), self._expected[max(self._expected)])
64
+ return result
65
+
66
+ @abstractmethod
67
+ def start(self) -> T:
68
+ raise NotImplementedError
69
+
70
+ def peek_static(self, expected: str) -> bool:
71
+ l = len(expected)
72
+ if self.data[self.index:self.index + l] == expected:
73
+ return True
74
+ else:
75
+ self._expected[self.index].append(expected)
76
+ return False
77
+
78
+ def static(self, expected: str):
79
+ length = len(expected)
80
+ if self.data[self.index:self.index + length] == expected:
81
+ self.index += length
82
+ else:
83
+ self._expected[self.index].append(expected)
84
+ raise nomatch
85
+
86
+ def static_b(self, expected: str) -> bool:
87
+ l = len(expected)
88
+ if self.data[self.index:self.index + l] == expected:
89
+ self.index += l
90
+ return True
91
+ else:
92
+ self._expected[self.index].append(expected)
93
+ return False
94
+
95
+ def anyof(self, *strings: str) -> str:
96
+ for s in strings:
97
+ if self.static_b(s):
98
+ return s
99
+ else:
100
+ raise nomatch
101
+
102
+ def anyof_b(self, *strings: str) -> bool:
103
+ for s in strings:
104
+ if self.static_b(s):
105
+ return True
106
+ else:
107
+ return False
108
+
109
+ def any(self, length: int = 1) -> str:
110
+ if self.index + length <= len(self.data):
111
+ res = self.data[self.index:self.index + length]
112
+ self.index += length
113
+ return res
114
+ else:
115
+ self._expected[self.index].append(f"<Any {length}>")
116
+ raise nomatch
117
+
118
+ def any_but(self, *strings, length: int = 1) -> str:
119
+ if self.index + length <= len(self.data):
120
+ res = self.data[self.index:self.index + length]
121
+ if res not in strings:
122
+ self.index += length
123
+ return res
124
+ else:
125
+ self._expected[self.index].append(f"<Any {length} except {strings}>")
126
+ raise nomatch
127
+ else:
128
+ self._expected[self.index].append(f"<Any {length} except {strings}>")
129
+ raise nomatch
130
+
131
+ def multiple(self, chars: str, mi: int, ma: Optional[int]) -> str:
132
+ result = []
133
+ try:
134
+ for off in range(mi):
135
+ if self.data[self.index + off] in chars:
136
+ result.append(self.data[self.index + off])
137
+ else:
138
+ self._expected[self.index + off].extend(chars)
139
+ raise nomatch
140
+ except IndexError:
141
+ raise nomatch
142
+ self.index += mi
143
+ if ma is None:
144
+ try:
145
+ while True:
146
+ if self.data[self.index] in chars:
147
+ result.append(self.data[self.index])
148
+ self.index += 1
149
+ else:
150
+ self._expected[self.index].extend(chars)
151
+ break
152
+ except IndexError:
153
+ pass
154
+ else:
155
+ try:
156
+ for _ in range(ma - mi):
157
+ if self.data[self.index] in chars:
158
+ result.append(self.data[self.index])
159
+ self.index += 1
160
+ else:
161
+ self._expected[self.index].extend(chars)
162
+ break
163
+ except IndexError:
164
+ pass
165
+ return ''.join(result)
tool_server/.venv/lib/python3.12/site-packages/jiter/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (335 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance-0.7.30.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (685 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_grammar_from.cpython-312.pyc ADDED
Binary file (3.12 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_struct_tag.cpython-312.pyc ADDED
Binary file (5.96 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_tokenizer.cpython-312.pyc ADDED
Binary file (1.75 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/_util.cpython-312.pyc ADDED
Binary file (420 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/cli.cpython-312.pyc ADDED
Binary file (4.14 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/gbnf_to_lark.cpython-312.pyc ADDED
Binary file (30.3 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/hf.cpython-312.pyc ADDED
Binary file (1.68 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/llamacpp.cpython-312.pyc ADDED
Binary file (2.71 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/mlx.cpython-312.pyc ADDED
Binary file (3.52 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/numpy.cpython-312.pyc ADDED
Binary file (4.6 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/tiktoken.cpython-312.pyc ADDED
Binary file (1.5 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llguidance/__pycache__/torch.cpython-312.pyc ADDED
Binary file (4.83 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (617 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/_version.cpython-312.pyc ADDED
Binary file (468 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/__pycache__/utils.cpython-312.pyc ADDED
Binary file (1.03 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Things that rely on the LLVM library
3
+ """
4
+ from .dylib import *
5
+ from .executionengine import *
6
+ from .initfini import *
7
+ from .linker import *
8
+ from .module import *
9
+ from .options import *
10
+ from .newpassmanagers import *
11
+ from .passmanagers import *
12
+ from .targets import *
13
+ from .transforms import *
14
+ from .value import *
15
+ from .typeref import *
16
+ from .analysis import *
17
+ from .object_file import *
18
+ from .context import *
19
+ from .orcjit import *
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (628 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/analysis.cpython-312.pyc ADDED
Binary file (2.99 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/common.cpython-312.pyc ADDED
Binary file (1.32 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/context.cpython-312.pyc ADDED
Binary file (2.35 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/dylib.cpython-312.pyc ADDED
Binary file (2.19 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/executionengine.cpython-312.pyc ADDED
Binary file (15.5 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/ffi.cpython-312.pyc ADDED
Binary file (19 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/initfini.cpython-312.pyc ADDED
Binary file (3.15 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/linker.cpython-312.pyc ADDED
Binary file (1.11 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/module.cpython-312.pyc ADDED
Binary file (19.1 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/newpassmanagers.cpython-312.pyc ADDED
Binary file (19.2 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/object_file.cpython-312.pyc ADDED
Binary file (6.14 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/options.cpython-312.pyc ADDED
Binary file (901 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/orcjit.cpython-312.pyc ADDED
Binary file (17.1 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/passmanagers.cpython-312.pyc ADDED
Binary file (50.8 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/targets.cpython-312.pyc ADDED
Binary file (24.2 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/transforms.cpython-312.pyc ADDED
Binary file (8.32 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/typeref.cpython-312.pyc ADDED
Binary file (15.1 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/__pycache__/value.cpython-312.pyc ADDED
Binary file (33.3 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/analysis.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A collection of analysis utilities
3
+ """
4
+
5
+ from ctypes import POINTER, c_char_p, c_int
6
+
7
+ from llvmlite.binding import ffi
8
+ from llvmlite.binding.module import parse_assembly
9
+
10
+
11
+ def get_function_cfg(func, show_inst=True):
12
+ """Return a string of the control-flow graph of the function in DOT
13
+ format. If the input `func` is not a materialized function, the module
14
+ containing the function is parsed to create an actual LLVM module.
15
+ The `show_inst` flag controls whether the instructions of each block
16
+ are printed.
17
+ """
18
+ assert func is not None
19
+ from llvmlite import ir
20
+ if isinstance(func, ir.Function):
21
+ mod = parse_assembly(str(func.module))
22
+ func = mod.get_function(func.name)
23
+
24
+ # Assume func is a materialized function
25
+ with ffi.OutputString() as dotstr:
26
+ ffi.lib.LLVMPY_WriteCFG(func, dotstr, show_inst)
27
+ return str(dotstr)
28
+
29
+
30
+ def view_dot_graph(graph, filename=None, view=False):
31
+ """
32
+ View the given DOT source. If view is True, the image is rendered
33
+ and viewed by the default application in the system. The file path of
34
+ the output is returned. If view is False, a graphviz.Source object is
35
+ returned. If view is False and the environment is in a IPython session,
36
+ an IPython image object is returned and can be displayed inline in the
37
+ notebook.
38
+
39
+ This function requires the graphviz package.
40
+
41
+ Args
42
+ ----
43
+ - graph [str]: a DOT source code
44
+ - filename [str]: optional. if given and view is True, this specifies
45
+ the file path for the rendered output to write to.
46
+ - view [bool]: if True, opens the rendered output file.
47
+
48
+ """
49
+ # Optionally depends on graphviz package
50
+ import graphviz as gv
51
+
52
+ src = gv.Source(graph)
53
+ if view:
54
+ # Returns the output file path
55
+ return src.render(filename, view=view)
56
+ else:
57
+ # Attempts to show the graph in IPython notebook
58
+ try:
59
+ __IPYTHON__
60
+ except NameError:
61
+ return src
62
+ else:
63
+ import IPython.display as display
64
+ format = 'svg'
65
+ return display.SVG(data=src.pipe(format))
66
+
67
+
68
+ # Ctypes binding
69
+ ffi.lib.LLVMPY_WriteCFG.argtypes = [ffi.LLVMValueRef, POINTER(c_char_p), c_int]
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/common.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import atexit
2
+
3
+
4
+ def _encode_string(s):
5
+ encoded = s.encode('utf-8')
6
+ return encoded
7
+
8
+
9
+ def _decode_string(b):
10
+ return b.decode('utf-8')
11
+
12
+
13
+ _encode_string.__doc__ = """Encode a string for use by LLVM."""
14
+ _decode_string.__doc__ = """Decode a LLVM character (byte)string."""
15
+
16
+
17
+ _shutting_down = [False]
18
+
19
+
20
+ def _at_shutdown():
21
+ _shutting_down[0] = True
22
+
23
+
24
+ atexit.register(_at_shutdown)
25
+
26
+
27
+ def _is_shutting_down(_shutting_down=_shutting_down):
28
+ """
29
+ Whether the interpreter is currently shutting down.
30
+ For use in finalizers, __del__ methods, and similar; it is advised
31
+ to early bind this function rather than look it up when calling it,
32
+ since at shutdown module globals may be cleared.
33
+ """
34
+ return _shutting_down[0]
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/context.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llvmlite.binding import ffi
2
+
3
+ # FIXME: Remove me once typed pointers are no longer supported.
4
+ from llvmlite import opaque_pointers_enabled
5
+ from ctypes import c_bool
6
+
7
+
8
+ def create_context():
9
+ return ContextRef(
10
+ ffi.lib.LLVMPY_ContextCreate(opaque_pointers_enabled))
11
+
12
+
13
+ def get_global_context():
14
+ return GlobalContextRef(
15
+ ffi.lib.LLVMPY_GetGlobalContext(opaque_pointers_enabled))
16
+
17
+
18
+ class ContextRef(ffi.ObjectRef):
19
+ def __init__(self, context_ptr):
20
+ super(ContextRef, self).__init__(context_ptr)
21
+
22
+ def _dispose(self):
23
+ ffi.lib.LLVMPY_ContextDispose(self)
24
+
25
+
26
+ class GlobalContextRef(ContextRef):
27
+ def _dispose(self):
28
+ pass
29
+
30
+
31
+ # FIXME: Remove argtypes once typed pointers are no longer supported.
32
+ ffi.lib.LLVMPY_GetGlobalContext.argtypes = [c_bool]
33
+ ffi.lib.LLVMPY_GetGlobalContext.restype = ffi.LLVMContextRef
34
+
35
+ # FIXME: Remove argtypes once typed pointers are no longer supported.
36
+ ffi.lib.LLVMPY_ContextCreate.argtypes = [c_bool]
37
+ ffi.lib.LLVMPY_ContextCreate.restype = ffi.LLVMContextRef
38
+
39
+ ffi.lib.LLVMPY_ContextDispose.argtypes = [ffi.LLVMContextRef]
tool_server/.venv/lib/python3.12/site-packages/llvmlite/binding/dylib.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ctypes import c_void_p, c_char_p, c_bool, POINTER
2
+
3
+ from llvmlite.binding import ffi
4
+ from llvmlite.binding.common import _encode_string
5
+
6
+
7
+ def address_of_symbol(name):
8
+ """
9
+ Get the in-process address of symbol named *name*.
10
+ An integer is returned, or None if the symbol isn't found.
11
+ """
12
+ return ffi.lib.LLVMPY_SearchAddressOfSymbol(_encode_string(name))
13
+
14
+
15
+ def add_symbol(name, address):
16
+ """
17
+ Register the *address* of global symbol *name*. This will make
18
+ it usable (e.g. callable) from LLVM-compiled functions.
19
+ """
20
+ ffi.lib.LLVMPY_AddSymbol(_encode_string(name), c_void_p(address))
21
+
22
+
23
+ def load_library_permanently(filename):
24
+ """
25
+ Load an external library
26
+ """
27
+ with ffi.OutputString() as outerr:
28
+ if ffi.lib.LLVMPY_LoadLibraryPermanently(
29
+ _encode_string(filename), outerr):
30
+ raise RuntimeError(str(outerr))
31
+
32
+ # ============================================================================
33
+ # FFI
34
+
35
+
36
+ ffi.lib.LLVMPY_AddSymbol.argtypes = [
37
+ c_char_p,
38
+ c_void_p,
39
+ ]
40
+
41
+ ffi.lib.LLVMPY_SearchAddressOfSymbol.argtypes = [c_char_p]
42
+ ffi.lib.LLVMPY_SearchAddressOfSymbol.restype = c_void_p
43
+
44
+ ffi.lib.LLVMPY_LoadLibraryPermanently.argtypes = [c_char_p, POINTER(c_char_p)]
45
+ ffi.lib.LLVMPY_LoadLibraryPermanently.restype = c_bool