napalm_device_types/kernel_models.py declares live_patches: NotRequired[LivePatchesDict] under from __future__ import annotations. With string annotations, TypedDict does not see the NotRequired wrapper, so at runtime:
>>> from napalm_device_types.models import KernelFactsDict
>>> KernelFactsDict.__optional_keys__
frozenset()
mypy reads the source and is not affected, so type checking is right; runtime introspection (__optional_keys__, __required_keys__) is wrong. Found while adding HostFirewallDict.windows (NetOrk/netork#2894), where the same thing happened; host_firewall_models.py therefore has no from __future__ import annotations.
Fix: drop the future import from kernel_models.py (its annotations need no forward references), and a test on KernelFactsDict.__optional_keys__.
Priority: P4: no known consumer introspects the keys.
`napalm_device_types/kernel_models.py` declares `live_patches: NotRequired[LivePatchesDict]` under `from __future__ import annotations`. With string annotations, `TypedDict` does not see the `NotRequired` wrapper, so at runtime:
```
>>> from napalm_device_types.models import KernelFactsDict
>>> KernelFactsDict.__optional_keys__
frozenset()
```
mypy reads the source and is not affected, so type checking is right; runtime introspection (`__optional_keys__`, `__required_keys__`) is wrong. Found while adding `HostFirewallDict.windows` (NetOrk/netork#2894), where the same thing happened; `host_firewall_models.py` therefore has no `from __future__ import annotations`.
Fix: drop the future import from `kernel_models.py` (its annotations need no forward references), and a test on `KernelFactsDict.__optional_keys__`.
**Priority:** P4: no known consumer introspects the keys.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
napalm_device_types/kernel_models.pydeclareslive_patches: NotRequired[LivePatchesDict]underfrom __future__ import annotations. With string annotations,TypedDictdoes not see theNotRequiredwrapper, so at runtime:mypy reads the source and is not affected, so type checking is right; runtime introspection (
__optional_keys__,__required_keys__) is wrong. Found while addingHostFirewallDict.windows(NetOrk/netork#2894), where the same thing happened;host_firewall_models.pytherefore has nofrom __future__ import annotations.Fix: drop the future import from
kernel_models.py(its annotations need no forward references), and a test onKernelFactsDict.__optional_keys__.Priority: P4: no known consumer introspects the keys.