We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[combiners.lspci] KeyError: '00:00.0
Error:
```
  File "/home/psachin/source/insights/insights-core/insights/combiners/lspci.py", line 122, in __init__
    dev_k = lspci_k.data[dev['Slot']].copy()
KeyError: '00:00.0'
```

The key **dev[Slot]** from `lspci_vmmkn` is not the entire value found in `lspci_k`

```
>>> lspci_k.data
{'0000:00:00.0': {'Dev_Details': 'Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)'}, '0000:00:07.0': {'Dev_Details': 'ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 01)', 'Subsystem': 'Microsoft Corporation Device 0000'}, '0000:00:07.1': {'Dev_Details': 'IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)', 'Kernel driver in use': 'ata_piix', 'Kernel modules': 'ata_piix, pata_acpi, ata_generic'}, '0000:00:07.3': {'Dev_Details': 'Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)', 'Kernel modules': 'i2c_piix4'}, '0000:00:08.0': {'Dev_Details': 'VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA', 'Kernel driver in use': 'hyperv_fb', 'Kernel modules': 'hyperv_fb'}, '1a06:00:02.0': {'Dev_Details': 'Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx Virtual Function] (rev 80)', 'Subsystem': 'Mellanox Technologies Device 0190', 'Kernel driver in use': 'mlx5_core', 'Kernel modules': 'mlx5_core'}}

>>> lspci_vmmkn
[{'Slot': '00:00.0', 'Class': '0600', 'Vendor': '8086', 'Device': '7192', 'Rev': '03'}, {'Slot': '00:07.0', 'Class': '0601', 'Vendor': '8086', 'Device': '7110', 'SVendor': '1414', 'SDevice': '0000', 'Rev': '01'}, {'Slot': '00:07.1', 'Class': '0101', 'Vendor': '8086', 'Device': '7111', 'Rev': '01', 'ProgIf': '80', 'Driver': 'ata_piix', 'Module': ['ata_piix', 'pata_acpi', 'ata_generic']}, {'Slot': '00:07.3', 'Class': '0680', 'Vendor': '8086', 'Device': '7113', 'Rev': '02', 'Module': ['i2c_piix4']}, {'Slot': '00:08.0', 'Class': '0300', 'Vendor': '1414', 'Device': '5353', 'Driver': 'hyperv_fb', 'Module': ['hyperv_fb']}, {'Slot': '1a06:00:02.0', 'Class': '0200', 'Vendor': '15b3', 'Device': '1016', 'SVendor': '15b3', 'SDevice': '0190', 'PhySlot': '1', 'Rev': '80', 'Driver': 'mlx5_core', 'Module': ['mlx5_core'], 'NUMANode': '0'}]
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `insights/combiners/lspci.py`
Content:
```
1 """
2 LsPci - Commands ``lspci``
3 ==========================
4 
5 This combiner combines the following Parsers to a list.
6 - LsPci - the output of command ``lspci -k``
7 - LsPciVmmkn - the output of command ``lspci -vmmkn``
8 """
9 from insights import combiner
10 from insights.parsers import keyword_search
11 from insights.parsers.lspci import LsPci, LsPciVmmkn
12 
13 
14 @combiner([LsPci, LsPciVmmkn])
15 class LsPci(list):
16     """
17     Combines the Parser LsPci of ``/sbin/lspci -k`` command and Parser
18     LsPciVmmkn of ``/sbin/lspci -vmmkn`` command.
19 
20     Typical output of the ``lspci -k`` command is::
21 
22         00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
23                 Subsystem: Lenovo ThinkPad X240
24                 Kernel driver in use: hsw_uncore
25         00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
26                 Subsystem: Lenovo ThinkPad X240
27                 Kernel driver in use: i915
28                 Kernel modules: i915
29         00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)
30                 Subsystem: Lenovo ThinkPad X240
31                 Kernel driver in use: snd_hda_intel
32                 Kernel modules: snd_hda_intel
33         00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
34                 Subsystem: Lenovo ThinkPad X240
35                 Kernel driver in use: mei_me
36                 Kernel modules: mei_me
37         00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I218-LM (rev 04)
38                 Subsystem: Lenovo ThinkPad X240
39                 Kernel driver in use: e1000e
40                 Kernel modules: e1000e
41         00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
42                 Subsystem: Lenovo ThinkPad X240
43                 Kernel driver in use: snd_hda_intel
44                 Kernel modules: snd_hda_intel
45 
46     Typical output of the ``lspci -vmmkn`` command is::
47 
48         Slot:   00:00.0
49         Class:  0600
50         Vendor: 8086
51         Device: 0a04
52         SVendor:        17aa
53         SDevice:        2214
54         Rev:    09
55         Driver: hsw_uncore
56 
57         Slot:   00:02.0
58         Class:  0300
59         Vendor: 8086
60         Device: 0a16
61         SVendor:        17aa
62         SDevice:        2214
63         Rev:    09
64         Driver: i915
65         Module: i915
66 
67         Slot:   00:03.0
68         Class:  0403
69         Vendor: 8086
70         Device: 0a0c
71         SVendor:        17aa
72         SDevice:        2214
73         Rev:    09
74         Driver: snd_hda_intel
75         Module: snd_hda_intel
76 
77         Slot:   00:16.0
78         Class:  0780
79         Vendor: 8086
80         Device: 9c3a
81         SVendor:        17aa
82         SDevice:        2214
83         Rev:    04
84         Driver: mei_me
85         Module: mei_me
86 
87         Slot:   00:19.0
88         Class:  0200
89         Vendor: 8086
90         Device: 155a
91         SVendor:        17aa
92         SDevice:        2214
93         Rev:    04
94         Driver: e1000e
95         Module: e1000e
96 
97         Slot:   00:1b.0
98         Class:  0403
99         Vendor: 8086
100         Device: 9c20
101         SVendor:        17aa
102         SDevice:        2214
103         Rev:    04
104         Driver: snd_hda_intel
105         Module: snd_hda_intel
106 
107     Examples:
108         >>> type(lspci)
109         <class 'insights.combiners.lspci.LsPci'>
110         >>> sorted(lspci.pci_dev_list)
111         ['00:00.0', '00:02.0', '00:03.0', '00:16.0', '00:19.0', '00:1b.0']
112         >>> lspci.search(Dev_Details__contains='I218')[0]['Slot']
113         '00:19.0'
114     """
115     def __init__(self, lspci_k, lspci_vmmkn):
116         if lspci_vmmkn:
117             for dev in lspci_vmmkn:
118                 # use the local copy to prevent from writing back to the parser
119                 dev = dev.copy()
120                 if lspci_k and dev['Slot'] in lspci_k:
121                     # use the local copy to prevent from writing back to the parser
122                     dev_k = lspci_k.data[dev['Slot']].copy()
123                     dev_k.pop('Kernel driver in use') if 'Kernel driver in use' in dev_k else None
124                     dev_k.pop('Kernel modules') if 'Kernel modules' in dev_k else None
125                     dev.update(dev_k)
126                 self.append(dev)
127             self._pci_dev_list = lspci_vmmkn.pci_dev_list
128         else:
129             for dev in lspci_k.data.values():
130                 # use the local copy to prevent from writing back to the parser
131                 dev = dev.copy()
132                 dev.update(Driver=dev.pop('Kernel driver in use')) if 'Kernel driver in use' in dev else None
133                 dev.update(Module=[i.strip() for i in dev.pop('Kernel modules').split(',')]) if 'Kernel modules' in dev else None
134                 self.append(dev)
135             self._pci_dev_list = lspci_k.pci_dev_list
136 
137     @property
138     def pci_dev_list(self):
139         """
140         The list of PCI devices.
141         """
142         return self._pci_dev_list
143 
144     def search(self, **kwargs):
145         """
146         Get the details of PCI devices by searching the table with kwargs.
147 
148         This uses the :py:func:`insights.parsers.keyword_search` function for
149         searching; see its documentation for usage details. If no search
150         parameters are given, no rows are returned.
151 
152         It simplify the value of the column according to actual usage.
153 
154         Returns:
155             list: A list of dictionaries of PCI devices that match the given
156             search criteria.
157 
158         Examples:
159             >>> len(lspci.search(Subsystem__startswith='Lenovo'))
160             6
161             >>> len(lspci.search(Subsystem__startswith='Lenovo', Dev_Details__startswith='Audio device'))
162             2
163             >>> lspci.search(Driver='snd_hda_intel', Dev_Details__contains='8') == [
164             ... {'Slot': '00:1b.0', 'Class': '0403', 'Vendor': '8086',
165             ...  'Device': '9c20', 'SVendor': '17aa', 'SDevice': '2214',
166             ...  'Rev': '04', 'Driver': 'snd_hda_intel',
167             ...  'Module': ['snd_hda_intel'], 'Subsystem': 'Lenovo ThinkPad X240',
168             ...  'Dev_Details': 'Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)'}]
169             True
170         """
171         return keyword_search(self, **kwargs)
172
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/insights/combiners/lspci.py b/insights/combiners/lspci.py
--- a/insights/combiners/lspci.py
+++ b/insights/combiners/lspci.py
@@ -17,6 +17,12 @@
     Combines the Parser LsPci of ``/sbin/lspci -k`` command and Parser
     LsPciVmmkn of ``/sbin/lspci -vmmkn`` command.
 
+    .. note::
+        In case the ``lspci -k`` sometimes outputs the `Slot` in the full
+        format of ``domain:bus:device.function``, and the ``lspci -k`` is more
+        common than ``lspci -vmmkn``, so this combiner will take the `Slot` of
+        the `lspci -k` as the key.
+
     Typical output of the ``lspci -k`` command is::
 
         00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
@@ -119,12 +125,17 @@
                 dev = dev.copy()
                 if lspci_k and dev['Slot'] in lspci_k:
                     # use the local copy to prevent from writing back to the parser
-                    dev_k = lspci_k.data[dev['Slot']].copy()
+                    dev_k = [v for v in lspci_k.data.values() if v['Slot'].endswith(dev['Slot'])][0].copy()
+                    # Since the 'lspci -k' is a more common command than the
+                    #  'lspci -vmmkn', the following line should be commented
+                    #  out to use the 'Slot' in 'lspci -k' as the 'Slot' in
+                    #  this combiner:
+                    # dev_k.pop('Slot') if 'Slot' in dev_k else None
                     dev_k.pop('Kernel driver in use') if 'Kernel driver in use' in dev_k else None
                     dev_k.pop('Kernel modules') if 'Kernel modules' in dev_k else None
                     dev.update(dev_k)
                 self.append(dev)
-            self._pci_dev_list = lspci_vmmkn.pci_dev_list
+            self._pci_dev_list = (lspci_k if lspci_k else lspci_vmmkn).pci_dev_list
         else:
             for dev in lspci_k.data.values():
                 # use the local copy to prevent from writing back to the parser

{"golden_diff": "diff --git a/insights/combiners/lspci.py b/insights/combiners/lspci.py\n--- a/insights/combiners/lspci.py\n+++ b/insights/combiners/lspci.py\n@@ -17,6 +17,12 @@\n     Combines the Parser LsPci of ``/sbin/lspci -k`` command and Parser\n     LsPciVmmkn of ``/sbin/lspci -vmmkn`` command.\n \n+    .. note::\n+        In case the ``lspci -k`` sometimes outputs the `Slot` in the full\n+        format of ``domain:bus:device.function``, and the ``lspci -k`` is more\n+        common than ``lspci -vmmkn``, so this combiner will take the `Slot` of\n+        the `lspci -k` as the key.\n+\n     Typical output of the ``lspci -k`` command is::\n \n         00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)\n@@ -119,12 +125,17 @@\n                 dev = dev.copy()\n                 if lspci_k and dev['Slot'] in lspci_k:\n                     # use the local copy to prevent from writing back to the parser\n-                    dev_k = lspci_k.data[dev['Slot']].copy()\n+                    dev_k = [v for v in lspci_k.data.values() if v['Slot'].endswith(dev['Slot'])][0].copy()\n+                    # Since the 'lspci -k' is a more common command than the\n+                    #  'lspci -vmmkn', the following line should be commented\n+                    #  out to use the 'Slot' in 'lspci -k' as the 'Slot' in\n+                    #  this combiner:\n+                    # dev_k.pop('Slot') if 'Slot' in dev_k else None\n                     dev_k.pop('Kernel driver in use') if 'Kernel driver in use' in dev_k else None\n                     dev_k.pop('Kernel modules') if 'Kernel modules' in dev_k else None\n                     dev.update(dev_k)\n                 self.append(dev)\n-            self._pci_dev_list = lspci_vmmkn.pci_dev_list\n+            self._pci_dev_list = (lspci_k if lspci_k else lspci_vmmkn).pci_dev_list\n         else:\n             for dev in lspci_k.data.values():\n                 # use the local copy to prevent from writing back to the parser\n", "issue": "[combiners.lspci] KeyError: '00:00.0\nError:\r\n```\r\n  File \"/home/psachin/source/insights/insights-core/insights/combiners/lspci.py\", line 122, in __init__\r\n    dev_k = lspci_k.data[dev['Slot']].copy()\r\nKeyError: '00:00.0'\r\n```\r\n\r\nThe key **dev[Slot]** from `lspci_vmmkn` is not the entire value found in `lspci_k`\r\n\r\n```\r\n>>> lspci_k.data\r\n{'0000:00:00.0': {'Dev_Details': 'Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)'}, '0000:00:07.0': {'Dev_Details': 'ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 01)', 'Subsystem': 'Microsoft Corporation Device 0000'}, '0000:00:07.1': {'Dev_Details': 'IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)', 'Kernel driver in use': 'ata_piix', 'Kernel modules': 'ata_piix, pata_acpi, ata_generic'}, '0000:00:07.3': {'Dev_Details': 'Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)', 'Kernel modules': 'i2c_piix4'}, '0000:00:08.0': {'Dev_Details': 'VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA', 'Kernel driver in use': 'hyperv_fb', 'Kernel modules': 'hyperv_fb'}, '1a06:00:02.0': {'Dev_Details': 'Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx Virtual Function] (rev 80)', 'Subsystem': 'Mellanox Technologies Device 0190', 'Kernel driver in use': 'mlx5_core', 'Kernel modules': 'mlx5_core'}}\r\n\r\n>>> lspci_vmmkn\r\n[{'Slot': '00:00.0', 'Class': '0600', 'Vendor': '8086', 'Device': '7192', 'Rev': '03'}, {'Slot': '00:07.0', 'Class': '0601', 'Vendor': '8086', 'Device': '7110', 'SVendor': '1414', 'SDevice': '0000', 'Rev': '01'}, {'Slot': '00:07.1', 'Class': '0101', 'Vendor': '8086', 'Device': '7111', 'Rev': '01', 'ProgIf': '80', 'Driver': 'ata_piix', 'Module': ['ata_piix', 'pata_acpi', 'ata_generic']}, {'Slot': '00:07.3', 'Class': '0680', 'Vendor': '8086', 'Device': '7113', 'Rev': '02', 'Module': ['i2c_piix4']}, {'Slot': '00:08.0', 'Class': '0300', 'Vendor': '1414', 'Device': '5353', 'Driver': 'hyperv_fb', 'Module': ['hyperv_fb']}, {'Slot': '1a06:00:02.0', 'Class': '0200', 'Vendor': '15b3', 'Device': '1016', 'SVendor': '15b3', 'SDevice': '0190', 'PhySlot': '1', 'Rev': '80', 'Driver': 'mlx5_core', 'Module': ['mlx5_core'], 'NUMANode': '0'}]\r\n```\n", "before_files": [{"content": "\"\"\"\nLsPci - Commands ``lspci``\n==========================\n\nThis combiner combines the following Parsers to a list.\n- LsPci - the output of command ``lspci -k``\n- LsPciVmmkn - the output of command ``lspci -vmmkn``\n\"\"\"\nfrom insights import combiner\nfrom insights.parsers import keyword_search\nfrom insights.parsers.lspci import LsPci, LsPciVmmkn\n\n\n@combiner([LsPci, LsPciVmmkn])\nclass LsPci(list):\n    \"\"\"\n    Combines the Parser LsPci of ``/sbin/lspci -k`` command and Parser\n    LsPciVmmkn of ``/sbin/lspci -vmmkn`` command.\n\n    Typical output of the ``lspci -k`` command is::\n\n        00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: hsw_uncore\n        00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: i915\n                Kernel modules: i915\n        00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: snd_hda_intel\n                Kernel modules: snd_hda_intel\n        00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: mei_me\n                Kernel modules: mei_me\n        00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I218-LM (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: e1000e\n                Kernel modules: e1000e\n        00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: snd_hda_intel\n                Kernel modules: snd_hda_intel\n\n    Typical output of the ``lspci -vmmkn`` command is::\n\n        Slot:   00:00.0\n        Class:  0600\n        Vendor: 8086\n        Device: 0a04\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: hsw_uncore\n\n        Slot:   00:02.0\n        Class:  0300\n        Vendor: 8086\n        Device: 0a16\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: i915\n        Module: i915\n\n        Slot:   00:03.0\n        Class:  0403\n        Vendor: 8086\n        Device: 0a0c\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: snd_hda_intel\n        Module: snd_hda_intel\n\n        Slot:   00:16.0\n        Class:  0780\n        Vendor: 8086\n        Device: 9c3a\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: mei_me\n        Module: mei_me\n\n        Slot:   00:19.0\n        Class:  0200\n        Vendor: 8086\n        Device: 155a\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: e1000e\n        Module: e1000e\n\n        Slot:   00:1b.0\n        Class:  0403\n        Vendor: 8086\n        Device: 9c20\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: snd_hda_intel\n        Module: snd_hda_intel\n\n    Examples:\n        >>> type(lspci)\n        <class 'insights.combiners.lspci.LsPci'>\n        >>> sorted(lspci.pci_dev_list)\n        ['00:00.0', '00:02.0', '00:03.0', '00:16.0', '00:19.0', '00:1b.0']\n        >>> lspci.search(Dev_Details__contains='I218')[0]['Slot']\n        '00:19.0'\n    \"\"\"\n    def __init__(self, lspci_k, lspci_vmmkn):\n        if lspci_vmmkn:\n            for dev in lspci_vmmkn:\n                # use the local copy to prevent from writing back to the parser\n                dev = dev.copy()\n                if lspci_k and dev['Slot'] in lspci_k:\n                    # use the local copy to prevent from writing back to the parser\n                    dev_k = lspci_k.data[dev['Slot']].copy()\n                    dev_k.pop('Kernel driver in use') if 'Kernel driver in use' in dev_k else None\n                    dev_k.pop('Kernel modules') if 'Kernel modules' in dev_k else None\n                    dev.update(dev_k)\n                self.append(dev)\n            self._pci_dev_list = lspci_vmmkn.pci_dev_list\n        else:\n            for dev in lspci_k.data.values():\n                # use the local copy to prevent from writing back to the parser\n                dev = dev.copy()\n                dev.update(Driver=dev.pop('Kernel driver in use')) if 'Kernel driver in use' in dev else None\n                dev.update(Module=[i.strip() for i in dev.pop('Kernel modules').split(',')]) if 'Kernel modules' in dev else None\n                self.append(dev)\n            self._pci_dev_list = lspci_k.pci_dev_list\n\n    @property\n    def pci_dev_list(self):\n        \"\"\"\n        The list of PCI devices.\n        \"\"\"\n        return self._pci_dev_list\n\n    def search(self, **kwargs):\n        \"\"\"\n        Get the details of PCI devices by searching the table with kwargs.\n\n        This uses the :py:func:`insights.parsers.keyword_search` function for\n        searching; see its documentation for usage details. If no search\n        parameters are given, no rows are returned.\n\n        It simplify the value of the column according to actual usage.\n\n        Returns:\n            list: A list of dictionaries of PCI devices that match the given\n            search criteria.\n\n        Examples:\n            >>> len(lspci.search(Subsystem__startswith='Lenovo'))\n            6\n            >>> len(lspci.search(Subsystem__startswith='Lenovo', Dev_Details__startswith='Audio device'))\n            2\n            >>> lspci.search(Driver='snd_hda_intel', Dev_Details__contains='8') == [\n            ... {'Slot': '00:1b.0', 'Class': '0403', 'Vendor': '8086',\n            ...  'Device': '9c20', 'SVendor': '17aa', 'SDevice': '2214',\n            ...  'Rev': '04', 'Driver': 'snd_hda_intel',\n            ...  'Module': ['snd_hda_intel'], 'Subsystem': 'Lenovo ThinkPad X240',\n            ...  'Dev_Details': 'Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)'}]\n            True\n        \"\"\"\n        return keyword_search(self, **kwargs)\n", "path": "insights/combiners/lspci.py"}], "after_files": [{"content": "\"\"\"\nLsPci - Commands ``lspci``\n==========================\n\nThis combiner combines the following Parsers to a list.\n- LsPci - the output of command ``lspci -k``\n- LsPciVmmkn - the output of command ``lspci -vmmkn``\n\"\"\"\nfrom insights import combiner\nfrom insights.parsers import keyword_search\nfrom insights.parsers.lspci import LsPci, LsPciVmmkn\n\n\n@combiner([LsPci, LsPciVmmkn])\nclass LsPci(list):\n    \"\"\"\n    Combines the Parser LsPci of ``/sbin/lspci -k`` command and Parser\n    LsPciVmmkn of ``/sbin/lspci -vmmkn`` command.\n\n    .. note::\n        In case the ``lspci -k`` sometimes outputs the `Slot` in the full\n        format of ``domain:bus:device.function``, and the ``lspci -k`` is more\n        common than ``lspci -vmmkn``, so this combiner will take the `Slot` of\n        the `lspci -k` as the key.\n\n    Typical output of the ``lspci -k`` command is::\n\n        00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: hsw_uncore\n        00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: i915\n                Kernel modules: i915\n        00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: snd_hda_intel\n                Kernel modules: snd_hda_intel\n        00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: mei_me\n                Kernel modules: mei_me\n        00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I218-LM (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: e1000e\n                Kernel modules: e1000e\n        00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)\n                Subsystem: Lenovo ThinkPad X240\n                Kernel driver in use: snd_hda_intel\n                Kernel modules: snd_hda_intel\n\n    Typical output of the ``lspci -vmmkn`` command is::\n\n        Slot:   00:00.0\n        Class:  0600\n        Vendor: 8086\n        Device: 0a04\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: hsw_uncore\n\n        Slot:   00:02.0\n        Class:  0300\n        Vendor: 8086\n        Device: 0a16\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: i915\n        Module: i915\n\n        Slot:   00:03.0\n        Class:  0403\n        Vendor: 8086\n        Device: 0a0c\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    09\n        Driver: snd_hda_intel\n        Module: snd_hda_intel\n\n        Slot:   00:16.0\n        Class:  0780\n        Vendor: 8086\n        Device: 9c3a\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: mei_me\n        Module: mei_me\n\n        Slot:   00:19.0\n        Class:  0200\n        Vendor: 8086\n        Device: 155a\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: e1000e\n        Module: e1000e\n\n        Slot:   00:1b.0\n        Class:  0403\n        Vendor: 8086\n        Device: 9c20\n        SVendor:        17aa\n        SDevice:        2214\n        Rev:    04\n        Driver: snd_hda_intel\n        Module: snd_hda_intel\n\n    Examples:\n        >>> type(lspci)\n        <class 'insights.combiners.lspci.LsPci'>\n        >>> sorted(lspci.pci_dev_list)\n        ['00:00.0', '00:02.0', '00:03.0', '00:16.0', '00:19.0', '00:1b.0']\n        >>> lspci.search(Dev_Details__contains='I218')[0]['Slot']\n        '00:19.0'\n    \"\"\"\n    def __init__(self, lspci_k, lspci_vmmkn):\n        if lspci_vmmkn:\n            for dev in lspci_vmmkn:\n                # use the local copy to prevent from writing back to the parser\n                dev = dev.copy()\n                if lspci_k and dev['Slot'] in lspci_k:\n                    # use the local copy to prevent from writing back to the parser\n                    dev_k = [v for v in lspci_k.data.values() if v['Slot'].endswith(dev['Slot'])][0].copy()\n                    # Since the 'lspci -k' is a more common command than the\n                    #  'lspci -vmmkn', the following line should be commented\n                    #  out to use the 'Slot' in 'lspci -k' as the 'Slot' in\n                    #  this combiner:\n                    # dev_k.pop('Slot') if 'Slot' in dev_k else None\n                    dev_k.pop('Kernel driver in use') if 'Kernel driver in use' in dev_k else None\n                    dev_k.pop('Kernel modules') if 'Kernel modules' in dev_k else None\n                    dev.update(dev_k)\n                self.append(dev)\n            self._pci_dev_list = (lspci_k if lspci_k else lspci_vmmkn).pci_dev_list\n        else:\n            for dev in lspci_k.data.values():\n                # use the local copy to prevent from writing back to the parser\n                dev = dev.copy()\n                dev.update(Driver=dev.pop('Kernel driver in use')) if 'Kernel driver in use' in dev else None\n                dev.update(Module=[i.strip() for i in dev.pop('Kernel modules').split(',')]) if 'Kernel modules' in dev else None\n                self.append(dev)\n            self._pci_dev_list = lspci_k.pci_dev_list\n\n    @property\n    def pci_dev_list(self):\n        \"\"\"\n        The list of PCI devices.\n        \"\"\"\n        return self._pci_dev_list\n\n    def search(self, **kwargs):\n        \"\"\"\n        Get the details of PCI devices by searching the table with kwargs.\n\n        This uses the :py:func:`insights.parsers.keyword_search` function for\n        searching; see its documentation for usage details. If no search\n        parameters are given, no rows are returned.\n\n        It simplify the value of the column according to actual usage.\n\n        Returns:\n            list: A list of dictionaries of PCI devices that match the given\n            search criteria.\n\n        Examples:\n            >>> len(lspci.search(Subsystem__startswith='Lenovo'))\n            6\n            >>> len(lspci.search(Subsystem__startswith='Lenovo', Dev_Details__startswith='Audio device'))\n            2\n            >>> lspci.search(Driver='snd_hda_intel', Dev_Details__contains='8') == [\n            ... {'Slot': '00:1b.0', 'Class': '0403', 'Vendor': '8086',\n            ...  'Device': '9c20', 'SVendor': '17aa', 'SDevice': '2214',\n            ...  'Rev': '04', 'Driver': 'snd_hda_intel',\n            ...  'Module': ['snd_hda_intel'], 'Subsystem': 'Lenovo ThinkPad X240',\n            ...  'Dev_Details': 'Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)'}]\n            True\n        \"\"\"\n        return keyword_search(self, **kwargs)\n", "path": "insights/combiners/lspci.py"}]}