qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qapi: Brush off some (py)lint

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200304155932.20452-5-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>

+15 -18
+1 -1
scripts/qapi/commands.py
··· 274 274 275 275 void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds); 276 276 ''', 277 - c_prefix=c_name(self._prefix, protect=False))) 277 + c_prefix=c_name(self._prefix, protect=False))) 278 278 self._genc.preamble_add(mcgen(''' 279 279 #include "qemu/osdep.h" 280 280 #include "%(prefix)sqapi-commands.h"
+1 -2
scripts/qapi/expr.py
··· 35 35 def check_name_str(name, info, source, 36 36 allow_optional=False, enum_member=False, 37 37 permit_upper=False): 38 - global valid_name 39 38 membername = name 40 39 41 40 if allow_optional and name.startswith('*'): ··· 249 248 def check_alternate(expr, info): 250 249 members = expr['data'] 251 250 252 - if len(members) == 0: 251 + if not members: 253 252 raise QAPISemError(info, "'data' must not be empty") 254 253 for (key, value) in members.items(): 255 254 source = "'data' member '%s'" % key
+6 -3
scripts/qapi/gen.py
··· 45 45 46 46 def write(self, output_dir): 47 47 pathname = os.path.join(output_dir, self.fname) 48 - dir = os.path.dirname(pathname) 49 - if dir: 48 + odir = os.path.dirname(pathname) 49 + if odir: 50 50 try: 51 - os.makedirs(dir) 51 + os.makedirs(odir) 52 52 except os.error as e: 53 53 if e.errno != errno.EEXIST: 54 54 raise ··· 260 260 (genc, genh) = self._module[name] 261 261 genc.write(output_dir) 262 262 genh.write(output_dir) 263 + 264 + def _begin_system_module(self, name): 265 + pass 263 266 264 267 def _begin_user_module(self, name): 265 268 pass
-2
scripts/qapi/introspect.py
··· 10 10 See the COPYING file in the top-level directory. 11 11 """ 12 12 13 - import string 14 - 15 13 from qapi.common import * 16 14 from qapi.gen import QAPISchemaMonolithicCVisitor 17 15 from qapi.schema import (QAPISchemaArrayType, QAPISchemaBuiltinType,
+2 -4
scripts/qapi/parser.py
··· 282 282 doc.end_comment() 283 283 self.accept() 284 284 return doc 285 - else: 286 - doc.append(self.val) 285 + doc.append(self.val) 287 286 self.accept(False) 288 287 289 288 raise QAPIParseError(self, "documentation comment must end with '##'") ··· 492 491 raise QAPIParseError(self._parser, 493 492 "'%s' can't follow '%s' section" 494 493 % (name, self.sections[0].name)) 495 - elif self._is_section_tag(name): 494 + if self._is_section_tag(name): 496 495 line = line[len(name)+1:] 497 496 self._start_section(name[:-1]) 498 497 ··· 556 555 raise QAPISemError(feature.info, 557 556 "feature '%s' lacks documentation" 558 557 % feature.name) 559 - self.features[feature.name] = QAPIDoc.ArgSection(feature.name) 560 558 self.features[feature.name].connect(feature) 561 559 562 560 def check_expr(self, expr):
+5 -6
scripts/qapi/schema.py
··· 19 19 from collections import OrderedDict 20 20 21 21 from qapi.common import c_name, pointer_suffix 22 - from qapi.error import QAPIError, QAPIParseError, QAPISemError 22 + from qapi.error import QAPIError, QAPISemError 23 23 from qapi.expr import check_exprs 24 24 from qapi.parser import QAPISchemaParser 25 25 ··· 96 96 def visit_end(self): 97 97 pass 98 98 99 - def visit_module(self, fname): 99 + def visit_module(self, name): 100 100 pass 101 101 102 102 def visit_needed(self, entity): 103 103 # Default to visiting everything 104 104 return True 105 105 106 - def visit_include(self, fname, info): 106 + def visit_include(self, name, info): 107 107 pass 108 108 109 109 def visit_builtin_type(self, name, info, json_type): ··· 576 576 assert self.tag_member.ifcond == [] 577 577 if self._tag_name: # flat union 578 578 # branches that are not explicitly covered get an empty type 579 - cases = set([v.name for v in self.variants]) 579 + cases = {v.name for v in self.variants} 580 580 for m in self.tag_member.type.members: 581 581 if m.name not in cases: 582 582 v = QAPISchemaObjectTypeVariant(m.name, self.info, ··· 848 848 849 849 def _make_module(self, fname): 850 850 name = self._module_name(fname) 851 - if not name in self._module_dict: 851 + if name not in self._module_dict: 852 852 self._module_dict[name] = QAPISchemaModule(name) 853 853 return self._module_dict[name] 854 854 ··· 1097 1097 1098 1098 def visit(self, visitor): 1099 1099 visitor.visit_begin(self) 1100 - module = None 1101 1100 for mod in self._module_dict.values(): 1102 1101 mod.visit(visitor) 1103 1102 visitor.visit_end()