mirror of
https://github.com/JonathanSalwan/Triton
synced 2026-08-17 10:23:04 -04:00
Small python autocomplete related changes
This commit is contained in:
parent
c6bb33d599
commit
6ea044868a
3 changed files with 9 additions and 11 deletions
|
|
@ -180,5 +180,9 @@ else()
|
|||
set(TRITON_BOOST_INTERFACE OFF)
|
||||
endif()
|
||||
|
||||
if(PYTHON_BINDINGS_AUTOCOMPLETE)
|
||||
message(STATUS "Compiling with Python autocomplete stub")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(doc)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
from __future__ import print_function
|
||||
# triton_autocomplete will raise an import error.
|
||||
# IDEs should still provide autocomplete based on
|
||||
# the triton_autocomplete module
|
||||
# The triton_autocomplete module has been replaced with a .pyi stub file
|
||||
# which is automatically installed when using a precompiled Triton package
|
||||
# IDEs should detect it and provide autocomplete without any extra imports
|
||||
from triton import *
|
||||
try:
|
||||
from triton_autocomplete import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
ctx = TritonContext()
|
||||
|
|
|
|||
|
|
@ -276,15 +276,13 @@ def get_namespaces(namespace_dir):
|
|||
def gen_init_file(modules):
|
||||
# type: (List[str]) -> str
|
||||
global args
|
||||
mod_str = """
|
||||
from typing import List, Union, Callable, Tuple
|
||||
mod_str = """from typing import List, Union, Callable, Tuple
|
||||
import triton
|
||||
{z3}
|
||||
|
||||
{modules}
|
||||
|
||||
raise ImportError
|
||||
""".format(z3='import z3' if args.z3_enabled else '', modules='\n\n'.join(modules))
|
||||
""".format(z3='import z3\n' if args.z3_enabled else '', modules='\n\n'.join(modules))
|
||||
return mod_str
|
||||
|
||||
args = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue