python deprecated behavior.

This commit is contained in:
Kelvin Sherlock 2024-02-29 18:21:37 -05:00
parent 8283a3beec
commit b7149a0b0d
1 changed files with 7 additions and 7 deletions

View File

@ -94,7 +94,7 @@ def load_machine_recursive(name):
rootname = name rootname = name
m = load_machine(name) m = load_machine(name)
if not m: return None if m is None: return None
processed = set() processed = set()
pending = { rootname } pending = { rootname }
@ -103,7 +103,7 @@ def load_machine_recursive(name):
name = pending.pop() name = pending.pop()
m = load_machine(name) m = load_machine(name)
processed.add(name) processed.add(name)
if not m: if m is None:
print(" *{}".format(name)) print(" *{}".format(name))
continue continue
count = 0 count = 0
@ -379,7 +379,7 @@ def make_device_options(slot):
if devname in machine_cache: device = machine_cache[devname] if devname in machine_cache: device = machine_cache[devname]
if name in DEVICE_REMAP: if name in DEVICE_REMAP:
desc = DEVICE_REMAP[name] desc = DEVICE_REMAP[name]
elif device: elif device is not None:
desc = device.find("description").text desc = device.find("description").text
else: else:
# print("{} - {}".format(name, devname)) # print("{} - {}".format(name, devname))
@ -390,8 +390,8 @@ def make_device_options(slot):
media = None media = None
if name in DEVICE_MEDIA: media = { DEVICE_MEDIA[name]: 1 } if name in DEVICE_MEDIA: media = { DEVICE_MEDIA[name]: 1 }
elif device and device.find("./device_ref[@name='bitbanger']") != None: media = { 'bitbanger': 1 } elif device is not None and device.find("./device_ref[@name='bitbanger']") != None: media = { 'bitbanger': 1 }
elif device and device.find("./device_ref[@name='picture_image']") != None: media = { 'picture': 1 } elif device is not None and device.find("./device_ref[@name='picture_image']") != None: media = { 'picture': 1 }
# elif device and device.find("./device_ref[@name='printer_image']") != None: media = { 'printout': 1 } # elif device and device.find("./device_ref[@name='printer_image']") != None: media = { 'printout': 1 }
@ -540,7 +540,7 @@ def make_smartport(machine):
for s in SLOTS: for s in SLOTS:
path = 'slot[@name="{}"]'.format(s) path = 'slot[@name="{}"]'.format(s)
slot = machine.find(path) slot = machine.find(path)
if not slot: continue if slot is None: continue
slotname = slot.get("name") slotname = slot.get("name")
options = make_device_options(slot) options = make_device_options(slot)
@ -676,7 +676,7 @@ for m in machines:
print(m) print(m)
machine = load_machine_recursive(m) machine = load_machine_recursive(m)
if not machine: if machine is None:
exit(1) exit(1)
data = { } data = { }