Replace Optional[X] with X | None and typing.Dict with builtin dict
throughout the module. Add "from __future__ import annotations" to
enable deferred evaluation, removing all quoted forward references.
Add missing return type annotations to __setitem__(), parent, root,
set(), get(), value(), and name. Remove Optional and Dict from the
typing import since cast() is the only runtime typing helper needed.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
The __load() method has no type annotations for any of its three
parameters, making it inconsistent with __init__ and harder for type
checkers to verify correctness. Add type annotations to all __load()
parameters and the paths_buf local variable.
The paths_buf variable needs an explicit list[str] annotation because
mypy cannot infer the type of an empty list literal when passed as
a mutable buffer argument to serdes.read().
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
The bare assert (len(paths_buf)) relies on truthiness which, while
correct, is misleading — readers might expect "assert len(paths_buf)
> 0" instead. Replace with an explicit comparison and add a diagnostic
message showing the actual length for easier debugging.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
The branch() method returns either None or a Config but has no
return type annotation — just a "# type: ignore" comment with a
FIXME. Add the proper Optional[Config] annotation (written as
Config | None in modern syntax) and remove the workaround.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
Extract the magic 0o0027 default for refuse_mode_mask into a module-
level constant with a docstring. This makes the default parameter
self-documenting and prevents duplication if the value ever changes.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
The __is_abs() helper duplicates os.path.isabs() logic. Replace it
with the standard library function, guarding for None/empty strings
to match the original helper safety behavior.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
When search_dirs comes from an environment variable, the __load()
method iterates over each character of the colon-separated string
instead of treating it as a list of directory paths. This produces
nonsensical glob paths like "h/", "o/", "m/", etc.
Fix by splitting the env var value into a list before assigning it
to the search_dirs variable.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
Move all implementation source code from the jwutils module to
jw.util. For compatibility with existing Python modules, keep a thin,
autogenerated compatibility shim under jwutils.
Signed-off-by: Jan Lindemann <jan@janware.com>