Skip to content

Commit 450efff

Browse files
committed
Use more specialized imports in config utils
1 parent 3599257 commit 450efff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pytensor/configdefaults.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import os
44
import platform
55
import re
6-
import shutil
76
import sys
87
import textwrap
98
from pathlib import Path
9+
from shutil import which
1010

1111
import numpy as np
1212

@@ -348,7 +348,7 @@ def add_compile_configvars():
348348

349349
# Try to find the full compiler path from the name
350350
if param != "":
351-
newp = shutil.which(param)
351+
newp = which(param)
352352
if newp is not None:
353353
param = newp
354354
del newp

pytensor/configparser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
import os
3-
import shlex
43
import sys
54
import warnings
65
from collections.abc import Callable, Sequence
@@ -14,6 +13,7 @@
1413
from functools import wraps
1514
from io import StringIO
1615
from pathlib import Path
16+
from shlex import shlex
1717

1818
from pytensor.utils import hash_from_code
1919

@@ -541,7 +541,7 @@ def parse_config_string(
541541
Parses a config string (comma-separated key=value components) into a dict.
542542
"""
543543
config_dict = {}
544-
my_splitter = shlex.shlex(config_string, posix=True)
544+
my_splitter = shlex(config_string, posix=True)
545545
my_splitter.whitespace = ","
546546
my_splitter.whitespace_split = True
547547
for kv_pair in my_splitter:

0 commit comments

Comments
 (0)