code-intelligence 3.3.0__py3-none-win_amd64.whl → 3.3.2__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 +1 -1
- code_intelligence/goober.py +31 -26
- code_intelligence/libcode_intelligence.so +0 -0
- {code_intelligence-3.3.0.dist-info → code_intelligence-3.3.2.dist-info}/METADATA +1 -1
- code_intelligence-3.3.2.dist-info/RECORD +8 -0
- code_intelligence-3.3.0.dist-info/RECORD +0 -8
- {code_intelligence-3.3.0.dist-info → code_intelligence-3.3.2.dist-info}/WHEEL +0 -0
code_intelligence/__init__.py
CHANGED
code_intelligence/goober.py
CHANGED
|
@@ -50,12 +50,6 @@ _lib.get_pending_tasks_count.restype = C.c_uint64
|
|
|
50
50
|
_lib.free_memory.argtypes = [C.c_void_p]
|
|
51
51
|
_lib.free_memory.restype = None
|
|
52
52
|
|
|
53
|
-
# --- CPYTHON C API ACCESS ---
|
|
54
|
-
C.pythonapi.Py_IncRef.argtypes = [C.py_object]
|
|
55
|
-
C.pythonapi.Py_IncRef.restype = None
|
|
56
|
-
C.pythonapi.Py_DecRef.argtypes = [C.py_object]
|
|
57
|
-
C.pythonapi.Py_DecRef.restype = None
|
|
58
|
-
|
|
59
53
|
|
|
60
54
|
def positional_repr(cls):
|
|
61
55
|
def __repr__(self):
|
|
@@ -77,35 +71,46 @@ class Definition_Link:
|
|
|
77
71
|
|
|
78
72
|
# IMPORTANT: KEEP THIS ALIVE FOR GO THREAD WORKER
|
|
79
73
|
C_NO_CALLBACK = SCAN_CALLBACK(0)
|
|
74
|
+
_KEEPALIVE = dict[int, tuple]()
|
|
80
75
|
|
|
81
76
|
|
|
82
|
-
def _wrap_data_ptr(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# We are now responsible for its lifetime
|
|
87
|
-
C.pythonapi.Py_IncRef(full_data)
|
|
88
|
-
|
|
89
|
-
return id(full_data)
|
|
90
|
-
|
|
77
|
+
def _wrap_data_ptr(tup: tuple):
|
|
78
|
+
ptr = id(tup)
|
|
79
|
+
_KEEPALIVE[ptr] = tup
|
|
80
|
+
return ptr
|
|
91
81
|
|
|
92
|
-
def _unwrap_data_ptr(data_ptr):
|
|
93
|
-
assert data_ptr != 0, "we got NULL"
|
|
94
82
|
|
|
95
|
-
|
|
83
|
+
def _unwrap_data_ptr(ptr) -> tuple:
|
|
84
|
+
tup = _KEEPALIVE.pop(ptr, None)
|
|
85
|
+
assert tup is not None, "keepalive missing for callback"
|
|
86
|
+
return tup
|
|
96
87
|
|
|
97
|
-
# MANUALLY DECREMENT THE REFERENCE COUNT.
|
|
98
|
-
# We are fulfilling our promise
|
|
99
|
-
C.pythonapi.Py_DecRef(full_data)
|
|
100
88
|
|
|
101
|
-
|
|
89
|
+
# def _wrap_data_ptr(tup: tuple):
|
|
90
|
+
# # MANUALLY INCREMENT THE REFERENCE COUNT
|
|
91
|
+
# # We are now responsible for its lifetime
|
|
92
|
+
# C.pythonapi.Py_IncRef(C.py_object(tup))
|
|
93
|
+
#
|
|
94
|
+
# return id(tup) # C.cast(obj, C.c_void_p)
|
|
95
|
+
#
|
|
96
|
+
#
|
|
97
|
+
# def _unwrap_data_ptr(data_ptr) -> tuple:
|
|
98
|
+
# assert data_ptr != 0, "we got NULL"
|
|
99
|
+
#
|
|
100
|
+
# tup = C.cast(data_ptr, C.py_object).value
|
|
101
|
+
#
|
|
102
|
+
# # MANUALLY DECREMENT THE REFERENCE COUNT.
|
|
103
|
+
# # We are fulfilling our promise
|
|
104
|
+
# C.pythonapi.Py_DecRef(C.py_object(tup))
|
|
105
|
+
#
|
|
106
|
+
# return tup
|
|
102
107
|
|
|
103
108
|
|
|
104
109
|
def scan_file(file, language: Language, callback=None, data=None) -> bool:
|
|
105
110
|
if callback is None:
|
|
106
111
|
c_callback, data_ptr = C_NO_CALLBACK, 0
|
|
107
112
|
else:
|
|
108
|
-
c_callback, data_ptr = C_AFTER_SCAN, _wrap_data_ptr(callback, data)
|
|
113
|
+
c_callback, data_ptr = C_AFTER_SCAN, _wrap_data_ptr((callback, data))
|
|
109
114
|
|
|
110
115
|
# print(f"[PY] sending next request {file}")
|
|
111
116
|
_lib.enqueue_scan_file(c_callback, data_ptr, os.fsencode(file), language)
|
|
@@ -125,7 +130,7 @@ def find_symbols_in_text(text: str, callback=None, data=None) -> bool:
|
|
|
125
130
|
if callback is None:
|
|
126
131
|
c_callback, data_ptr = C_NO_CALLBACK, 0
|
|
127
132
|
else:
|
|
128
|
-
c_callback, data_ptr = C_AFTER_FIND, _wrap_data_ptr(callback, data)
|
|
133
|
+
c_callback, data_ptr = C_AFTER_FIND, _wrap_data_ptr((callback, data))
|
|
129
134
|
|
|
130
135
|
# print("[PY] sending find_symbols_in_text")
|
|
131
136
|
_lib.enqueue_find_symbols_in_text(c_callback, data_ptr, text.encode())
|
|
@@ -206,9 +211,9 @@ if __name__ == "__main__":
|
|
|
206
211
|
path = Path(folder)
|
|
207
212
|
if path.is_dir():
|
|
208
213
|
for file in path.rglob("*.py"):
|
|
209
|
-
scan_file(file, scan_callback, file)
|
|
214
|
+
scan_file(file, Language.PYTHON, scan_callback, file)
|
|
210
215
|
else:
|
|
211
|
-
scan_file(path, scan_callback, path)
|
|
216
|
+
scan_file(path, Language.PYTHON, scan_callback, path)
|
|
212
217
|
|
|
213
218
|
text = sys.argv[1]
|
|
214
219
|
find_symbols_in_text(text, find_callback, data=(text, "before"))
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
code_intelligence-3.3.2.dist-info/METADATA,sha256=8CbUIUnddfvjcSVE89vgiuoqj4Rgsg6qLJSzxFdnwaI,100
|
|
2
|
+
code_intelligence-3.3.2.dist-info/RECORD,,
|
|
3
|
+
code_intelligence-3.3.2.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
|
|
4
|
+
code_intelligence/__init__.py,sha256=OqMfhLblRbAVpTR0VKo2Ap-J4XKuDY-PaiqEv9N3zCU,587
|
|
5
|
+
code_intelligence/goober.py,sha256=CGwX8hulLbiJFx05u0hMYGXnbQnfYBmyyFildhj0ziQ,6622
|
|
6
|
+
code_intelligence/libcode_intelligence.h,sha256=9iy0xXcOpq366DuiKw1cw4-7VNz-QPAYBNJGZKEh12M,3169
|
|
7
|
+
code_intelligence/libcode_intelligence.so,sha256=Ls1qokhJ_5xlgUNDu4xBRjMeJIWL1ySiNz0yE_Pfh1w,2840576
|
|
8
|
+
code_intelligence/symdb.py,sha256=gRq3-xr2oYIzudgwDwMj3Zl5Pb0B8tDdnGKUB0WIV_o,32427
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
code_intelligence-3.3.0.dist-info/METADATA,sha256=GjydZJisD2oYo8E4VkOSw7GKxskpnITRxtFGRurGncU,100
|
|
2
|
-
code_intelligence-3.3.0.dist-info/RECORD,,
|
|
3
|
-
code_intelligence-3.3.0.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
|
|
4
|
-
code_intelligence/__init__.py,sha256=oIXxSmeNFJScnUsKG8r906r1ur34-SwvbN8gGGkb_D8,587
|
|
5
|
-
code_intelligence/goober.py,sha256=yelM919e_n3nI2NnYx3qGgAS74J2-zkdp3x-GIz_gVI,6481
|
|
6
|
-
code_intelligence/libcode_intelligence.h,sha256=9iy0xXcOpq366DuiKw1cw4-7VNz-QPAYBNJGZKEh12M,3169
|
|
7
|
-
code_intelligence/libcode_intelligence.so,sha256=wQ0AyR2z7GvHf6kZVntMmRAE-E4yT4VgZkcdFQ7G8Lo,2840064
|
|
8
|
-
code_intelligence/symdb.py,sha256=gRq3-xr2oYIzudgwDwMj3Zl5Pb0B8tDdnGKUB0WIV_o,32427
|
|
File without changes
|