Skip to content

Commit 0d8d2af

Browse files
authored
werror for examples (#2756)
* werror for examples * Address initial warnings in examples * read_next? * oops * isort
1 parent 186b741 commit 0d8d2af

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

examples/daal4py/readcsv.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@
1414
# limitations under the License.
1515
# ==============================================================================
1616

17-
from importlib.machinery import SourceFileLoader
17+
from importlib.util import module_from_spec, spec_from_file_location
1818
from pathlib import Path
1919

2020
utils_path = Path(__file__).parent.parent / "utils"
2121

22-
readcsv = SourceFileLoader("readcsv", str(utils_path / "readcsv.py")).load_module()
22+
spec = spec_from_file_location("readcsv", str(utils_path / "readcsv.py"))
23+
readcsv = module_from_spec(spec)
24+
spec.loader.exec_module(readcsv)
2325

2426
np_read_csv = readcsv.np_read_csv
2527
pd_read_csv = readcsv.pd_read_csv
2628
csr_read_csv = readcsv.csr_read_csv
29+
read_next = readcsv.read_next
2730

2831
__all__ = [
2932
"np_read_csv",
3033
"pd_read_csv",
3134
"csr_read_csv",
35+
"read_next",
3236
]

examples/mb/readcsv.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
# limitations under the License.
1515
# ==============================================================================
1616

17-
from importlib.machinery import SourceFileLoader
17+
from importlib.util import module_from_spec, spec_from_file_location
1818
from pathlib import Path
1919

2020
utils_path = Path(__file__).parent.parent / "utils"
2121

22-
readcsv = SourceFileLoader("readcsv", str(utils_path / "readcsv.py")).load_module()
22+
spec = spec_from_file_location("readcsv", str(utils_path / "readcsv.py"))
23+
readcsv = module_from_spec(spec)
24+
spec.loader.exec_module(readcsv)
2325

2426
np_read_csv = readcsv.np_read_csv
2527
pd_read_csv = readcsv.pd_read_csv

examples/sklearnex/knn_bf_classification_spmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def generate_X_y(par, seed):
4747
"SPMD execution mode is implemented only for this device type."
4848
)
4949

50-
params_train = {"ns": 100000, "nf": 8}
51-
params_test = {"ns": 100, "nf": 8}
50+
params_train = {"ns": 100000, "nf": 3}
51+
params_test = {"ns": 100, "nf": 3}
5252

5353
X_train, y_train = generate_X_y(params_train, rank)
5454
X_test, y_test = generate_X_y(params_test, rank + 99)

onedal/_device_offload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def wrapper_impl(*args, **kwargs):
131131
self
132132
and self.__class__.__name__ in ("KNeighborsClassifier", "KNeighborsRegressor")
133133
and func.__name__ == "fit"
134+
and _get_config()["use_raw_input"] is True
134135
)
135136
if override_raw_input:
136137
pretty_name = f"{self.__class__.__name__}.{func.__name__}"

tests/run_examples.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,12 @@ def get_exe_cmd(ex, args):
221221
return None
222222
if not args.nodist and ex.endswith("spmd.py"):
223223
if IS_WIN:
224-
return 'mpiexec -localonly -n 4 "' + sys.executable + '" "' + ex + '"'
225-
return 'mpirun -n 4 "' + sys.executable + '" "' + ex + '"'
224+
return (
225+
'mpiexec -localonly -n 4 "' + sys.executable + '" -W error "' + ex + '"'
226+
)
227+
return 'mpirun -n 4 "' + sys.executable + '" -W error "' + ex + '"'
226228
else:
227-
return '"' + sys.executable + '" "' + ex + '"'
229+
return '"' + sys.executable + '" -W error "' + ex + '"'
228230

229231

230232
def run(exdir, logdir, args):

0 commit comments

Comments
 (0)