mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
apibuild: Use isinstance for type checking
The isinstance() function [1] returns true if an object argument is an instance of a classinfo argument or of a direct, indirect subclass thereof. 1: https://docs.python.org/3/library/functions.html#isinstance Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
parent
1554eafbe6
commit
80559e4879
@ -742,7 +742,7 @@ class CParser:
|
|||||||
return line
|
return line
|
||||||
|
|
||||||
def cleanupComment(self):
|
def cleanupComment(self):
|
||||||
if type(self.comment) != type(""):
|
if not isinstance(self.comment, str):
|
||||||
return
|
return
|
||||||
# remove the leading * on multi-line comments
|
# remove the leading * on multi-line comments
|
||||||
lines = self.comment.splitlines(True)
|
lines = self.comment.splitlines(True)
|
||||||
@ -2223,9 +2223,8 @@ class docBuilder:
|
|||||||
output.write(" <struct name='%s' file='%s' type='%s'" % (
|
output.write(" <struct name='%s' file='%s' type='%s'" % (
|
||||||
name, self.modulename_file(id.header), id.info))
|
name, self.modulename_file(id.header), id.info))
|
||||||
name = id.info[7:]
|
name = id.info[7:]
|
||||||
if name in self.idx.structs and ( \
|
if (name in self.idx.structs and
|
||||||
type(self.idx.structs[name].info) == type(()) or
|
isinstance(self.idx.structs[name].info, (list, tuple))):
|
||||||
type(self.idx.structs[name].info) == type([])):
|
|
||||||
output.write(">\n")
|
output.write(">\n")
|
||||||
try:
|
try:
|
||||||
for field in self.idx.structs[name].info:
|
for field in self.idx.structs[name].info:
|
||||||
|
Loading…
Reference in New Issue
Block a user