From c25f39768fb918f3b614c9bdd4118e338166953b Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Fri, 13 Nov 2026 23:04:18 +0100 Subject: [PATCH] refactor(system-identity): keep SystemIdentityDict with its mixin models.py is over its line limit and may not grow; the dict has no other user than system_identity.py, as clusters.py and apt_proxy.py keep theirs. NetOrk/netork#2518 --- napalm_device_types/models.py | 15 --------------- napalm_device_types/system_identity.py | 17 +++++++++++++++-- tests/quality_baseline.json | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/napalm_device_types/models.py b/napalm_device_types/models.py index 3185226..8355a18 100644 --- a/napalm_device_types/models.py +++ b/napalm_device_types/models.py @@ -1440,18 +1440,3 @@ class ManagementProtocolsDict(TypedDict): snmp: ProtocolStateDict kvm: ProtocolStateDict virtual_media: ProtocolStateDict - - -class SystemIdentityDict(TypedDict): - """A host's SMBIOS identity, what ties it to its BMC, and its system firmware. - - See :mod:`napalm_device_types.system_identity`. - - Each value is empty when unknown or a vendor placeholder.""" - - system_uuid: str # lowercase - product_serial: str - board_serial: str - bios_vendor: str # the system firmware (BIOS or UEFI): its vendor, - bios_version: str # its version, - bios_date: str # its release date, YYYY-MM-DD diff --git a/napalm_device_types/system_identity.py b/napalm_device_types/system_identity.py index 325a551..a32a89c 100644 --- a/napalm_device_types/system_identity.py +++ b/napalm_device_types/system_identity.py @@ -25,11 +25,24 @@ from __future__ import annotations import re from datetime import date -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, TypedDict -from napalm_device_types.models import SystemIdentityDict from napalm_device_types.terminal import strip_terminal_codes + +class SystemIdentityDict(TypedDict): + """A host's SMBIOS identity, what ties it to its BMC, and its system firmware. + + Each value is empty when unknown or a vendor placeholder.""" + + system_uuid: str # lowercase + product_serial: str + board_serial: str + bios_vendor: str # the system firmware (BIOS or UEFI): its vendor, + bios_version: str # its version, + bios_date: str # its release date, YYYY-MM-DD + + _BEGIN = "IDBEGIN" _END = "IDEND" _DMI = "/sys/class/dmi/id" diff --git a/tests/quality_baseline.json b/tests/quality_baseline.json index 4065f83..06714cf 100644 --- a/tests/quality_baseline.json +++ b/tests/quality_baseline.json @@ -31,7 +31,7 @@ }, "mypy_relaxed": [], "python_file_lines": { - "napalm_device_types/models.py": 1454 + "napalm_device_types/models.py": 1442 }, "untyped_public": [] }