Skip to content

Commit 6a91f12

Browse files
committed
add missing files
1 parent e165d52 commit 6a91f12

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

_cmake/targets/common.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# module: common C++ libraries
3+
#
4+
# message(STATUS "+ mlinsights.common")
5+
# add_library(common STATIC ../onnx_extended/cpp/onnx_extended_helpers.cpp)
6+
# target_compile_definitions(common PRIVATE PYTHON_MANYLINUX=${PYTHON_MANYLINUX})
7+
# target_include_directories(common PRIVATE "${ROOT_INCLUDE_PATH}")

mlinsights/ext_test_case.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import zipfile
66
from io import BytesIO
77
from urllib.request import urlopen
8-
from argparse import ArgumentParser
8+
from argparse import ArgumentParser, Namespace
99
from contextlib import redirect_stderr, redirect_stdout
1010
from io import StringIO
1111
from timeit import Timer
@@ -107,7 +107,7 @@ def measure_time(
107107
"div_by_number must be set to True of max_time is defined."
108108
)
109109
i = 1
110-
total_time = 0
110+
total_time = 0.0
111111
results = []
112112
while True:
113113
for j in (1, 2):
@@ -168,7 +168,7 @@ def measure_time(
168168

169169

170170
class ExtTestCase(unittest.TestCase):
171-
_warns = []
171+
_warns: List[type] = []
172172

173173
def assertExists(self, name):
174174
if not os.path.exists(name):
@@ -245,7 +245,7 @@ def assertAlmostEqual(
245245
self.assertEqualArray(expected, value, atol=atol, rtol=rtol)
246246

247247
def assertRaise(
248-
self, fct: Callable, exc_type: Exception, msg: Optional[str] = None
248+
self, fct: Callable, exc_type: type[Exception], msg: Optional[str] = None
249249
):
250250
try:
251251
fct()
@@ -340,7 +340,7 @@ def get_parsed_args(
340340
tries: int = 2,
341341
expose: Optional[str] = None,
342342
**kwargs: Dict[str, Tuple[Union[int, str, float], str]],
343-
) -> ArgumentParser:
343+
) -> Namespace:
344344
"""
345345
Returns parsed arguments for examples in this package.
346346
@@ -428,7 +428,7 @@ def unzip_files(
428428
fvalid: Optional[Callable] = None,
429429
fail_if_error=True,
430430
verbose: int = 0,
431-
):
431+
) -> List[Union[str, Tuple[str, Any]]]:
432432
"""
433433
Unzips files from a zip archive.
434434
@@ -445,6 +445,8 @@ def unzip_files(
445445
:return: list of unzipped files
446446
"""
447447
if zipf.startswith("https:"):
448+
if where_to is None:
449+
raise ValueError(f"where_to must be specified for url {zipf!r}.")
448450
filename = zipf.split("/")[-1]
449451
dest_zip = os.path.join(where_to, filename)
450452
if not os.path.exists(dest_zip):
@@ -469,7 +471,7 @@ def unzip_files(
469471
raise e
470472
raise IOError(f"Unable to read file '{zipf}'") from e
471473

472-
files = []
474+
files: List[Union[str, Tuple[str, Any]]] = []
473475
with zipfile.ZipFile(zipf, "r") as file:
474476
for info in file.infolist():
475477
if verbose > 1:

pyproject.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,8 @@ exclude = [
139139
]
140140

141141
[[tool.mypy.overrides]]
142-
module = ["onnx_extended._command_lines"]
143-
disable_error_code = [
144-
"attr-defined",
145-
"operator",
146-
"arg-type",
147-
"assignment",
148-
"var-annotated",
149-
"return-value",
150-
"name-defined",
151-
]
142+
module = ["mlinsights.ext_test_case"]
143+
disable_error_code = ["override", "index"]
152144

153145
[tool.ruff]
154146
exclude = [".eggs", ".git", "build", "dist"]

setup.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ def initialize_options(self):
260260
self.cuda_version = None
261261
self.parallel = None
262262
self.manylinux = None
263-
self.ort_version = DEFAULT_ORT_VERSION
264263
self.cuda_build = "DEFAULT"
265264
self.cuda_link = "STATIC"
266265

@@ -281,10 +280,6 @@ def initialize_options(self):
281280
print(f"-- setup: use env {att.upper()}={v in t_values}")
282281
setattr(self, att, v in t_values)
283282

284-
if self.ort_version is None:
285-
self.ort_version = os.environ.get("ORT_VERSION", None)
286-
if self.ort_version not in ("", None):
287-
print(f"-- setup: use env ORT_VERSION={self.ort_version}")
288283
if self.cuda_build is None:
289284
self.cuda_build = os.environ.get("CUDA_BUILD", None)
290285
if self.cuda_build not in ("", None):
@@ -382,7 +377,6 @@ def get_cmake_args(self, cfg: str) -> List[str]:
382377
f"-DPYTHON_VERSION={vers}",
383378
f"-DPYTHON_VERSION_MM={versmm}",
384379
f"-DPYTHON_MODULE_EXTENSION={module_ext}",
385-
f"-DORT_VERSION={self.ort_version}",
386380
f"-DMLINSIGHTS_VERSION={get_version_str(here, None)}",
387381
f"-DPYTHON_MANYLINUX={1 if is_manylinux else 0}",
388382
]
@@ -391,7 +385,7 @@ def get_cmake_args(self, cfg: str) -> List[str]:
391385

392386
if self.use_nvtx:
393387
cmake_args.append("-DUSE_NVTX=1")
394-
cmake_args.append(f"-DUSE_CUDA={1 if self.use_cuda else 0}")
388+
cmake_args.append("-DUSE_CUDA=0") # {1 if self.use_cuda else 0}")
395389
if self.use_cuda:
396390
cmake_args.append(f"-DCUDA_BUILD={self.cuda_build}")
397391
cmake_args.append(f"-DCUDA_LINK={self.cuda_link}")

0 commit comments

Comments
 (0)