| 1 | class Ethernet: |
2 | def __init__(self, name, mac_address): |
3 | self.name = name |
4 | self.mac_address = mac_address |
5 | |
6 | |
7 | class Wireless(Ethernet): |
8 | def __init__(self, name, mac_address): |
9 | Ethernet.__init__(self, name, mac_address) |
10 | |
11 | |
12 | class PCI: |
13 | def __init__(self, bus, manufacturer): |
14 | self.bus = bus |
15 | self.manufacturer = manufacturer |
16 | |
17 | |
18 | class USB: |
19 | def __init__(self, device): |
20 | self.device = device |
21 | |
22 | |
23 | class PCIEthernet(PCI, Ethernet): |
24 | def __init__(self, bus, manufacturer, name, mac_address): |
25 | PCI.__init__(self, bus, manufacturer) |
26 | Ethernet.__init__(self, name, mac_address) |
27 | |
28 | |
29 | class USBWireless(USB, Wireless): |
30 | def __init__(self, device, name, mac_address): |
31 | USB.__init__(self, device) |
32 | Wireless.__init__(self, name, mac_address) |
33 | |
34 | |
35 | wlan0 = USBWireless("usb0", "wlan0", "00:33:44:55:66") |
36 | eth0 = PCIEthernet("pci :0:0:1", "realtek", "eth0", "00:11:22:33:44") |
37 | |
38 | |
39 | print(isinstance(wlan0, Ethernet)) |
40 | print(isinstance(eth0, PCI)) |
41 | print(isinstance(eth0, USB)) |