code-intelligence 3.2.0__py3-none-win_amd64.whl → 3.3.1__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- code_intelligence/__init__.py +3 -1
- code_intelligence/goober.py +18 -13
- code_intelligence/libcode_intelligence.h +1 -0
- code_intelligence/libcode_intelligence.so +0 -0
- {code_intelligence-3.2.0.dist-info → code_intelligence-3.3.1.dist-info}/METADATA +1 -1
- code_intelligence-3.3.1.dist-info/RECORD +8 -0
- code_intelligence-3.2.0.dist-info/RECORD +0 -8
- {code_intelligence-3.2.0.dist-info → code_intelligence-3.3.1.dist-info}/WHEEL +0 -0
code_intelligence/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@ from .goober import (
|
|
|
3
3
|
Definition_Link,
|
|
4
4
|
scan_file,
|
|
5
5
|
find_symbols_in_text,
|
|
6
|
+
init,
|
|
6
7
|
stop,
|
|
7
8
|
clear,
|
|
8
9
|
)
|
|
@@ -12,7 +13,7 @@ from .goober import (
|
|
|
12
13
|
# SHAME - Bump when fixing things too embarrassing to admit.
|
|
13
14
|
# PROUD.DEFAULT.SHAME
|
|
14
15
|
# \ | /
|
|
15
|
-
__version__ = "3.
|
|
16
|
+
__version__ = "3.3.1"
|
|
16
17
|
__version_info__ = tuple(int(i) for i in __version__.split('.'))
|
|
17
18
|
|
|
18
19
|
__all__ = [
|
|
@@ -20,6 +21,7 @@ __all__ = [
|
|
|
20
21
|
"Definition_Link",
|
|
21
22
|
"scan_file",
|
|
22
23
|
"find_symbols_in_text",
|
|
24
|
+
"init",
|
|
23
25
|
"stop",
|
|
24
26
|
"clear",
|
|
25
27
|
]
|
code_intelligence/goober.py
CHANGED
|
@@ -41,6 +41,9 @@ _lib.enqueue_stop.restype = None
|
|
|
41
41
|
_lib.enqueue_clear.argtypes = []
|
|
42
42
|
_lib.enqueue_clear.restype = None
|
|
43
43
|
|
|
44
|
+
_lib.start_workers.argtypes = []
|
|
45
|
+
_lib.start_workers.restype = None
|
|
46
|
+
|
|
44
47
|
_lib.get_pending_tasks_count.argtypes = []
|
|
45
48
|
_lib.get_pending_tasks_count.restype = C.c_uint64
|
|
46
49
|
|
|
@@ -76,33 +79,31 @@ class Definition_Link:
|
|
|
76
79
|
C_NO_CALLBACK = SCAN_CALLBACK(0)
|
|
77
80
|
|
|
78
81
|
|
|
79
|
-
def _wrap_data_ptr(
|
|
80
|
-
full_data = (callback, data)
|
|
81
|
-
|
|
82
|
+
def _wrap_data_ptr(tup: tuple):
|
|
82
83
|
# MANUALLY INCREMENT THE REFERENCE COUNT
|
|
83
84
|
# We are now responsible for its lifetime
|
|
84
|
-
C.pythonapi.Py_IncRef(
|
|
85
|
+
C.pythonapi.Py_IncRef(C.py_object(tup))
|
|
85
86
|
|
|
86
|
-
return id(
|
|
87
|
+
return id(tup) # C.cast(obj, C.c_void_p)
|
|
87
88
|
|
|
88
89
|
|
|
89
|
-
def _unwrap_data_ptr(data_ptr):
|
|
90
|
+
def _unwrap_data_ptr(data_ptr) -> tuple:
|
|
90
91
|
assert data_ptr != 0, "we got NULL"
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
tup = C.cast(data_ptr, C.py_object).value
|
|
93
94
|
|
|
94
95
|
# MANUALLY DECREMENT THE REFERENCE COUNT.
|
|
95
96
|
# We are fulfilling our promise
|
|
96
|
-
C.pythonapi.Py_DecRef(
|
|
97
|
+
C.pythonapi.Py_DecRef(C.py_object(tup))
|
|
97
98
|
|
|
98
|
-
return
|
|
99
|
+
return tup
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
def scan_file(file, language: Language, callback=None, data=None) -> bool:
|
|
102
103
|
if callback is None:
|
|
103
104
|
c_callback, data_ptr = C_NO_CALLBACK, 0
|
|
104
105
|
else:
|
|
105
|
-
c_callback, data_ptr = C_AFTER_SCAN, _wrap_data_ptr(callback, data)
|
|
106
|
+
c_callback, data_ptr = C_AFTER_SCAN, _wrap_data_ptr((callback, data))
|
|
106
107
|
|
|
107
108
|
# print(f"[PY] sending next request {file}")
|
|
108
109
|
_lib.enqueue_scan_file(c_callback, data_ptr, os.fsencode(file), language)
|
|
@@ -122,7 +123,7 @@ def find_symbols_in_text(text: str, callback=None, data=None) -> bool:
|
|
|
122
123
|
if callback is None:
|
|
123
124
|
c_callback, data_ptr = C_NO_CALLBACK, 0
|
|
124
125
|
else:
|
|
125
|
-
c_callback, data_ptr = C_AFTER_FIND, _wrap_data_ptr(callback, data)
|
|
126
|
+
c_callback, data_ptr = C_AFTER_FIND, _wrap_data_ptr((callback, data))
|
|
126
127
|
|
|
127
128
|
# print("[PY] sending find_symbols_in_text")
|
|
128
129
|
_lib.enqueue_find_symbols_in_text(c_callback, data_ptr, text.encode())
|
|
@@ -156,6 +157,10 @@ def pending_tasks() -> int:
|
|
|
156
157
|
return _lib.get_pending_tasks_count()
|
|
157
158
|
|
|
158
159
|
|
|
160
|
+
def init():
|
|
161
|
+
_lib.start_workers()
|
|
162
|
+
|
|
163
|
+
|
|
159
164
|
def stop():
|
|
160
165
|
_lib.enqueue_stop()
|
|
161
166
|
|
|
@@ -199,9 +204,9 @@ if __name__ == "__main__":
|
|
|
199
204
|
path = Path(folder)
|
|
200
205
|
if path.is_dir():
|
|
201
206
|
for file in path.rglob("*.py"):
|
|
202
|
-
scan_file(file, scan_callback, file)
|
|
207
|
+
scan_file(file, Language.PYTHON, scan_callback, file)
|
|
203
208
|
else:
|
|
204
|
-
scan_file(path, scan_callback, path)
|
|
209
|
+
scan_file(path, Language.PYTHON, scan_callback, path)
|
|
205
210
|
|
|
206
211
|
text = sys.argv[1]
|
|
207
212
|
find_symbols_in_text(text, find_callback, data=(text, "before"))
|
|
@@ -108,6 +108,7 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
|
108
108
|
extern "C" {
|
|
109
109
|
#endif
|
|
110
110
|
|
|
111
|
+
extern __declspec(dllexport) void start_workers(void);
|
|
111
112
|
extern __declspec(dllexport) void enqueue_scan_file(scan_callback_t callback, uintptr_t data, char* c_path, GoUint64 language);
|
|
112
113
|
extern __declspec(dllexport) void enqueue_find_symbols_in_text(find_callback_t callback, uintptr_t data, char* c_text);
|
|
113
114
|
extern __declspec(dllexport) void enqueue_stop(void);
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
code_intelligence-3.3.1.dist-info/METADATA,sha256=w-DvM6pR4uWVpKsguom5rlXqeWBYdtudT4Rrf5-_AFg,100
|
|
2
|
+
code_intelligence-3.3.1.dist-info/RECORD,,
|
|
3
|
+
code_intelligence-3.3.1.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
|
|
4
|
+
code_intelligence/__init__.py,sha256=iG0BcJz8lbGitiiOrnzZ7R9fIY9blHehoQ9Kmpu1PBw,587
|
|
5
|
+
code_intelligence/goober.py,sha256=4MYEegk26-GfaOOsd8ufREYqFRq0nNmDs6jiBq-kD6s,6510
|
|
6
|
+
code_intelligence/libcode_intelligence.h,sha256=9iy0xXcOpq366DuiKw1cw4-7VNz-QPAYBNJGZKEh12M,3169
|
|
7
|
+
code_intelligence/libcode_intelligence.so,sha256=gbNPCTEzVkKwp1m7h16dQqyWvnhosxpXCWEUbRTqwh0,2840576
|
|
8
|
+
code_intelligence/symdb.py,sha256=gRq3-xr2oYIzudgwDwMj3Zl5Pb0B8tDdnGKUB0WIV_o,32427
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
code_intelligence-3.2.0.dist-info/METADATA,sha256=V1bD7fBzmNxapeMHm7mj6uXPfKdeZkUut0CMoFw08K4,100
|
|
2
|
-
code_intelligence-3.2.0.dist-info/RECORD,,
|
|
3
|
-
code_intelligence-3.2.0.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
|
|
4
|
-
code_intelligence/__init__.py,sha256=GeMGefLs44gKys7KF9QBqaUKip-vahzACFkgAQ1WO50,563
|
|
5
|
-
code_intelligence/goober.py,sha256=oKCO03I8_f68xf8E068dL5WCl7JeFhnlS_NrRVyzSA0,6367
|
|
6
|
-
code_intelligence/libcode_intelligence.h,sha256=GE8YrqsyrBQbWRIb0FfiWPRCG5W6c5HcZ3sjIOlp2bU,3114
|
|
7
|
-
code_intelligence/libcode_intelligence.so,sha256=eyZbp26Dt45Zoj-Kzgr9lsoylOzZzVqZI4xu0ht2bLM,2839552
|
|
8
|
-
code_intelligence/symdb.py,sha256=gRq3-xr2oYIzudgwDwMj3Zl5Pb0B8tDdnGKUB0WIV_o,32427
|
|
File without changes
|