@@ -117,39 +117,21 @@ def inventory_dmidecode(section: Section) -> InventoryResult:
117117 # by multiple "Memory Device" sections. Keep track of which belongs where:
118118 counter : Counter [Literal ["physical_memory_array" , "memory_device" ]] = Counter ()
119119 for title , lines in section :
120- yield from _dispatch_subsection (title , lines , counter )
121-
122-
123- def _dispatch_subsection (
124- title : str ,
125- lines : list [list [str ]],
126- counter : Counter [Literal ["physical_memory_array" , "memory_device" ]],
127- ) -> InventoryResult :
128- if title == "BIOS Information" :
129- yield _make_inventory_bios (lines )
130- return
131-
132- if title == "System Information" :
133- yield _make_inventory_system (lines )
134- return
135-
136- if title == "Chassis Information" :
137- yield _make_inventory_chassis (lines )
138- return
139-
140- if title == "Processor Information" :
141- yield from _make_inventory_processor (lines )
142- return
143-
144- if title == "Physical Memory Array" :
145- counter .update ({"physical_memory_array" : 1 })
146- yield _make_inventory_physical_mem_array (lines , counter )
147- return
148-
149- if title == "Memory Device" :
150- counter .update ({"memory_device" : 1 })
151- yield from _make_inventory_mem_device (lines , counter )
152- return
120+ match title :
121+ case "BIOS Information" :
122+ yield _make_inventory_bios (lines )
123+ case "System Information" :
124+ yield _make_inventory_system (lines )
125+ case "Chassis Information" :
126+ yield _make_inventory_chassis (lines )
127+ case "Processor Information" :
128+ yield from _make_inventory_processor (lines )
129+ case "Physical Memory Array" :
130+ counter .update ({"physical_memory_array" : 1 })
131+ yield _make_inventory_physical_mem_array (lines , counter )
132+ case "Memory Device" :
133+ counter .update ({"memory_device" : 1 })
134+ yield from _make_inventory_mem_device (lines , counter )
153135
154136
155137def _make_inventory_bios (lines : list [list [str ]]) -> Attributes :
0 commit comments