mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-12-08 08:23:47 +03:00
sanitytest: Use 3-tuple for basicklassmap
Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
@@ -185,7 +185,7 @@ for cname in wantfunctions:
|
|||||||
if name[0:8] == "virEvent":
|
if name[0:8] == "virEvent":
|
||||||
if name[-4:] == "Func":
|
if name[-4:] == "Func":
|
||||||
continue
|
continue
|
||||||
basicklassmap[name] = ["libvirt", name, cname]
|
basicklassmap[name] = ("libvirt", name, cname)
|
||||||
else:
|
else:
|
||||||
found = False
|
found = False
|
||||||
# To start with map APIs to classes based on the
|
# To start with map APIs to classes based on the
|
||||||
@@ -196,24 +196,20 @@ for cname in wantfunctions:
|
|||||||
if name[0:klen] == klassname:
|
if name[0:klen] == klassname:
|
||||||
found = True
|
found = True
|
||||||
if name not in basicklassmap:
|
if name not in basicklassmap:
|
||||||
basicklassmap[name] = [klassname, name[klen:], cname]
|
basicklassmap[name] = (klassname, name[klen:], cname)
|
||||||
elif len(basicklassmap[name]) < klen:
|
elif len(basicklassmap[name]) < klen:
|
||||||
basicklassmap[name] = [klassname, name[klen:], cname]
|
basicklassmap[name] = (klassname, name[klen:], cname)
|
||||||
|
|
||||||
# Anything which can't map to a class goes into the
|
# Anything which can't map to a class goes into the
|
||||||
# global namespaces
|
# global namespaces
|
||||||
if not found:
|
if not found:
|
||||||
basicklassmap[name] = ["libvirt", name[3:], cname]
|
basicklassmap[name] = ("libvirt", name[3:], cname)
|
||||||
|
|
||||||
|
|
||||||
# Phase 4: Deal with oh so many special cases in C -> python mapping
|
# Phase 4: Deal with oh so many special cases in C -> python mapping
|
||||||
finalklassmap = {} # type: Dict[str, Tuple[str, str, str]]
|
finalklassmap = {} # type: Dict[str, Tuple[str, str, str]]
|
||||||
|
|
||||||
for name in sorted(basicklassmap):
|
for name, (klass, func, cname) in sorted(basicklassmap.items()):
|
||||||
klass = basicklassmap[name][0]
|
|
||||||
func = basicklassmap[name][1]
|
|
||||||
cname = basicklassmap[name][2]
|
|
||||||
|
|
||||||
# The object lifecycle APIs are irrelevant since they're
|
# The object lifecycle APIs are irrelevant since they're
|
||||||
# used inside the object constructors/destructors.
|
# used inside the object constructors/destructors.
|
||||||
if func in ["Ref", "Free", "New", "GetConnect", "GetDomain", "GetNetwork"]:
|
if func in ["Ref", "Free", "New", "GetConnect", "GetDomain", "GetNetwork"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user