mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-08 16:07:39 -06:00
qapi: linter fixups
Fix minor irritants to pylint/flake8 et al. (Yes, these need to be guarded by the Python tests. That's a work in progress, a series that's quite likely to follow once I finish this Sphinx project. Please pardon the temporary irritation.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240626222128.406106-3-jsnow@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
f2cb4026fc
commit
f64e753149
3 changed files with 10 additions and 9 deletions
|
@ -27,8 +27,8 @@ from .gen import QAPISchemaMonolithicCVisitor
|
||||||
from .schema import (
|
from .schema import (
|
||||||
QAPISchema,
|
QAPISchema,
|
||||||
QAPISchemaAlternatives,
|
QAPISchemaAlternatives,
|
||||||
QAPISchemaBranches,
|
|
||||||
QAPISchemaArrayType,
|
QAPISchemaArrayType,
|
||||||
|
QAPISchemaBranches,
|
||||||
QAPISchemaBuiltinType,
|
QAPISchemaBuiltinType,
|
||||||
QAPISchemaEntity,
|
QAPISchemaEntity,
|
||||||
QAPISchemaEnumMember,
|
QAPISchemaEnumMember,
|
||||||
|
@ -233,9 +233,9 @@ const QLitObject %(c_name)s = %(c_string)s;
|
||||||
typ = type_int
|
typ = type_int
|
||||||
elif (isinstance(typ, QAPISchemaArrayType) and
|
elif (isinstance(typ, QAPISchemaArrayType) and
|
||||||
typ.element_type.json_type() == 'int'):
|
typ.element_type.json_type() == 'int'):
|
||||||
type_intList = self._schema.lookup_type('intList')
|
type_intlist = self._schema.lookup_type('intList')
|
||||||
assert type_intList
|
assert type_intlist
|
||||||
typ = type_intList
|
typ = type_intlist
|
||||||
# Add type to work queue if new
|
# Add type to work queue if new
|
||||||
if typ not in self._used_types:
|
if typ not in self._used_types:
|
||||||
self._used_types.append(typ)
|
self._used_types.append(typ)
|
||||||
|
|
|
@ -730,6 +730,7 @@ class QAPISchemaVariants:
|
||||||
for v in self.variants:
|
for v in self.variants:
|
||||||
v.set_defined_in(name)
|
v.set_defined_in(name)
|
||||||
|
|
||||||
|
# pylint: disable=unused-argument
|
||||||
def check(
|
def check(
|
||||||
self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember]
|
self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember]
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -1166,7 +1167,7 @@ class QAPISchema:
|
||||||
defn.info, "%s is already defined" % other_defn.describe())
|
defn.info, "%s is already defined" % other_defn.describe())
|
||||||
self._entity_dict[defn.name] = defn
|
self._entity_dict[defn.name] = defn
|
||||||
|
|
||||||
def lookup_entity(self,name: str) -> Optional[QAPISchemaEntity]:
|
def lookup_entity(self, name: str) -> Optional[QAPISchemaEntity]:
|
||||||
return self._entity_dict.get(name)
|
return self._entity_dict.get(name)
|
||||||
|
|
||||||
def lookup_type(self, name: str) -> Optional[QAPISchemaType]:
|
def lookup_type(self, name: str) -> Optional[QAPISchemaType]:
|
||||||
|
@ -1302,11 +1303,10 @@ class QAPISchema:
|
||||||
name = 'q_obj_%s-%s' % (name, role)
|
name = 'q_obj_%s-%s' % (name, role)
|
||||||
typ = self.lookup_entity(name)
|
typ = self.lookup_entity(name)
|
||||||
if typ:
|
if typ:
|
||||||
assert(isinstance(typ, QAPISchemaObjectType))
|
assert isinstance(typ, QAPISchemaObjectType)
|
||||||
# The implicit object type has multiple users. This can
|
# The implicit object type has multiple users. This can
|
||||||
# only be a duplicate definition, which will be flagged
|
# only be a duplicate definition, which will be flagged
|
||||||
# later.
|
# later.
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
self._def_definition(QAPISchemaObjectType(
|
self._def_definition(QAPISchemaObjectType(
|
||||||
name, info, None, ifcond, None, None, members, None))
|
name, info, None, ifcond, None, None, members, None))
|
||||||
|
|
|
@ -280,7 +280,8 @@ bool visit_type_%(c_name)s(Visitor *v, const char *name,
|
||||||
abort();
|
abort();
|
||||||
default:
|
default:
|
||||||
assert(visit_is_input(v));
|
assert(visit_is_input(v));
|
||||||
error_setg(errp, "Invalid parameter type for '%%s', expected: %(name)s",
|
error_setg(errp,
|
||||||
|
"Invalid parameter type for '%%s', expected: %(name)s",
|
||||||
name ? name : "null");
|
name ? name : "null");
|
||||||
/* Avoid passing invalid *obj to qapi_free_%(c_name)s() */
|
/* Avoid passing invalid *obj to qapi_free_%(c_name)s() */
|
||||||
g_free(*obj);
|
g_free(*obj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue