lib.Types: Accept bare string in LoadTypes()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m4s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m14s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m24s
CI / Packaging test (push) Successful in 0s
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m4s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m14s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m24s
CI / Packaging test (push) Successful in 0s
LoadTypes() declares mod_names as Iterable[str], so passing a single module name as a bare string is not caught at call time and the string is iterated character by character at load time, producing a ModuleNotFoundError for the first character instead of a clear error. Normalize a bare string to a one-element list in __init__() and widen the annotation accordingly, so that both forms work. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
7f841e991e
commit
6308fb2690
1 changed files with 5 additions and 1 deletions
|
|
@ -44,11 +44,15 @@ class LoadTypes(Types[T]): # export
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
mod_names: Iterable[str],
|
||||
mod_names: str | Iterable[str],
|
||||
type_name_filter: str | None = None,
|
||||
type_filter: Sequence[type[Any]] | None = None,
|
||||
debug_level: int | None = None,
|
||||
) -> None:
|
||||
# -- Accept a single module name as well, so that the common
|
||||
# case does not require wrapping the name in a list.
|
||||
if isinstance(mod_names, str):
|
||||
mod_names = [mod_names]
|
||||
if debug_level is None:
|
||||
val = os.getenv('JW_LOG_LEVEL_LOAD_TYPES')
|
||||
if val is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue