From nobody Sat Jul 5 15:59:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296754619469.33919218974995; Sat, 17 Mar 2018 07:25:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68AE5680E2; Sat, 17 Mar 2018 14:25:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C50680E98; Sat, 17 Mar 2018 14:25:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EB5EC180BAE9; Sat, 17 Mar 2018 14:25:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOCES000678 for ; Sat, 17 Mar 2018 10:24:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAEBC6134A; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5D4B600C0 for ; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E9DB19CBC4 for ; Sat, 17 Mar 2018 14:24:08 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id t3so7952314wmc.2 for ; Sat, 17 Mar 2018 07:24:08 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.24.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=efFjLp8RGmTwS56dA8GNf/rwljSHVsfkjRjQPSixny8=; b=S1RW3zXueg8B2zxsrwylNICtxpAjy3vD0IbDo3XTFgAZqmfWKa6dRUcEWlwj9uXY2c v+VI3q0emlr0xFilbi6J/JKA+dpvmGTtQjKs0PqKDiB/puIjs8ND9jRq++YkPYQujG+M NFHHgBgTfUlCiOIHW/9ZOx2rvKFvaVqdJEu+JUyVcGJwTaz6XpMdB3/a08CZCsvndvmM +pqFnxe9x+12UgrdCBb4MMBV4amJI/6ZudIM95TZy2mZJb1NjImDOBqDPqy4yVEO6aS0 mQIYDMdKHITh+sNqDGa5Pg+Uisb9HXyvMcS4VibARyzBLtLNeK2U0io84oLc18BMRgEw smfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=efFjLp8RGmTwS56dA8GNf/rwljSHVsfkjRjQPSixny8=; b=i9Ka7PLbybgttJGXS+MeLMCh7+DFVU0s3oSkXrCPmZMW+WLlC8cuBN9KOT6Q4+Fg2l e2MzNUA9sYMh1n2tpczHHcbE5w6ns5xC8FWE/q1WRhH1kXeu5le9dQbnuKZrezEjIrJ0 gRVa2msAsJ8gXbzW7IEwC4ReN7AGLvvuxRjel5YQvSZZppA5Pfey1+xWMt5eaZaRiPSa eOTq6Trhc4R8yMCNtBKIpR0X9uNPqaeW+OsehYtveZrFiVEZQDyLqHsRjippVTS0XdsD GGhhVN/CtcKr5vDOreTKCkSmV9S7cpBPGrqz7PNu15+H0iblQsz0LQr7v07vWE4+BgGj cf+A== X-Gm-Message-State: AElRT7H/Pq8+BUCG7Qh0MyG/PnQ9R03okvuRk1pfgrRKQvX+Ew2uwwAM HTDIFexDY5OY+YHYx1JmujJ6cJEW X-Google-Smtp-Source: AG47ELtkVKh4vMu5a10+IuBWGjQlAWWhIwn0aa/HA1l8PXaML3CgmFyUF0i8kgt0ogckfOhXCsR7pw== X-Received: by 10.28.50.69 with SMTP id y66mr4644557wmy.133.1521296646470; Sat, 17 Mar 2018 07:24:06 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:34 +0000 Message-Id: <20180317142340.11653-17-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Mar 2018 14:24:08 +0000 (UTC) for IP:'74.125.82.65' DOMAIN:'mail-wm0-f65.google.com' HELO:'mail-wm0-f65.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_FILL_THIS_FORM_SHORT) 74.125.82.65 mail-wm0-f65.google.com 74.125.82.65 mail-wm0-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 16/22] apibuild: Fix indentation not multiple of 4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 14:25:53 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PEP8 recommends that the number of spaces used for indentation of Python code to be a multiple of four [1] [2]. 1: https://lintlyci.github.io/Flake8Rules/rules/E111.html 2: https://lintlyci.github.io/Flake8Rules/rules/E114.html Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 298 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 151 insertions(+), 147 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index bcf7e5c24..9e73b4d27 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -248,11 +248,12 @@ class index: return None d =3D None try: - d =3D self.identifiers[name] - d.update(header, module, type, lineno, info, extra, conditional= s) + d =3D self.identifiers[name] + d.update(header, module, type, lineno, info, extra, conditiona= ls) except: - d =3D identifier(name, header, module, type, lineno, info, extr= a, conditionals) - self.identifiers[name] =3D d + d =3D identifier(name, header, module, type, lineno, info, ext= ra, + conditionals) + self.identifiers[name] =3D d =20 if d is not None and static =3D=3D 1: d.set_static(1) @@ -265,16 +266,18 @@ class index: =20 return d =20 - def add(self, name, header, module, static, type, lineno, info=3DNone,= extra=3DNone, conditionals=3DNone): + def add(self, name, header, module, static, type, lineno, info=3DNone, + extra=3DNone, conditionals=3DNone): if name[0:2] =3D=3D '__': return None d =3D None try: - d =3D self.identifiers[name] - d.update(header, module, type, lineno, info, extra, conditional= s) + d =3D self.identifiers[name] + d.update(header, module, type, lineno, info, extra, conditiona= ls) except: - d =3D identifier(name, header, module, type, lineno, info, extr= a, conditionals) - self.identifiers[name] =3D d + d =3D identifier(name, header, module, type, lineno, info, ext= ra, + conditionals) + self.identifiers[name] =3D d =20 if d is not None and static =3D=3D 1: d.set_static(1) @@ -308,93 +311,94 @@ class index: =20 def merge(self, idx): for id in idx.functions.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.macros: - del self.macros[id] - if id in self.functions: - self.warning("function %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.macros: + del self.macros[id] + if id in self.functions: + self.warning("function %s from %s redeclared in %s" % ( id, self.functions[id].header, idx.functions[id].heade= r)) - else: - self.functions[id] =3D idx.functions[id] - self.identifiers[id] =3D idx.functions[id] + else: + self.functions[id] =3D idx.functions[id] + self.identifiers[id] =3D idx.functions[id] for id in idx.variables.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.macros: - del self.macros[id] - if id in self.variables: - self.warning("variable %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.macros: + del self.macros[id] + if id in self.variables: + self.warning("variable %s from %s redeclared in %s" % ( id, self.variables[id].header, idx.variables[id].heade= r)) - else: - self.variables[id] =3D idx.variables[id] - self.identifiers[id] =3D idx.variables[id] + else: + self.variables[id] =3D idx.variables[id] + self.identifiers[id] =3D idx.variables[id] for id in idx.structs.keys(): - if id in self.structs: - self.warning("struct %s from %s redeclared in %s" % ( + if id in self.structs: + self.warning("struct %s from %s redeclared in %s" % ( id, self.structs[id].header, idx.structs[id].header)) - else: - self.structs[id] =3D idx.structs[id] - self.identifiers[id] =3D idx.structs[id] + else: + self.structs[id] =3D idx.structs[id] + self.identifiers[id] =3D idx.structs[id] for id in idx.unions.keys(): - if id in self.unions: - print("union %s from %s redeclared in %s" % ( + if id in self.unions: + print("union %s from %s redeclared in %s" % ( id, self.unions[id].header, idx.unions[id].header)) - else: - self.unions[id] =3D idx.unions[id] - self.identifiers[id] =3D idx.unions[id] + else: + self.unions[id] =3D idx.unions[id] + self.identifiers[id] =3D idx.unions[id] for id in idx.typedefs.keys(): - if id in self.typedefs: - self.warning("typedef %s from %s redeclared in %s" % ( + if id in self.typedefs: + self.warning("typedef %s from %s redeclared in %s" % ( id, self.typedefs[id].header, idx.typedefs[id].header)) - else: - self.typedefs[id] =3D idx.typedefs[id] - self.identifiers[id] =3D idx.typedefs[id] + else: + self.typedefs[id] =3D idx.typedefs[id] + self.identifiers[id] =3D idx.typedefs[id] for id in idx.macros.keys(): - # - # macro might be used to override functions or variables - # definitions - # - if id in self.variables: - continue - if id in self.functions: - continue - if id in self.enums: - continue - if id in self.macros: - self.warning("macro %s from %s redeclared in %s" % ( + # + # macro might be used to override functions or variables + # definitions + # + if id in self.variables: + continue + if id in self.functions: + continue + if id in self.enums: + continue + if id in self.macros: + self.warning("macro %s from %s redeclared in %s" % ( id, self.macros[id].header, idx.macros[id].header)) - else: - self.macros[id] =3D idx.macros[id] - self.identifiers[id] =3D idx.macros[id] + else: + self.macros[id] =3D idx.macros[id] + self.identifiers[id] =3D idx.macros[id] for id in idx.enums.keys(): - if id in self.enums: - self.warning("enum %s from %s redeclared in %s" % ( + if id in self.enums: + self.warning("enum %s from %s redeclared in %s" % ( id, self.enums[id].header, idx.enums[id].header)) - else: - self.enums[id] =3D idx.enums[id] - self.identifiers[id] =3D idx.enums[id] + else: + self.enums[id] =3D idx.enums[id] + self.identifiers[id] =3D idx.enums[id] =20 def merge_public(self, idx): for id in idx.functions.keys(): - if id in self.functions: - # check that function condition agrees with header - if idx.functions[id].conditionals !=3D \ - self.functions[id].conditionals: - self.warning("Header condition differs from Function" - " for %s:" % id) - self.warning(" H: %s" % self.functions[id].condition= als) - self.warning(" C: %s" % idx.functions[id].conditiona= ls) - up =3D idx.functions[id] - self.functions[id].update(None, up.module, up.type, up.in= fo, up.extra) - # else: - # print("Function %s from %s is not declared in headers" = % ( - # id, idx.functions[id].module)) - # TODO: do the same for variables. + if id in self.functions: + # check that function condition agrees with header + if idx.functions[id].conditionals !=3D \ + self.functions[id].conditionals: + self.warning("Header condition differs from Function" + " for %s:" % id) + self.warning(" H: %s" % self.functions[id].conditiona= ls) + self.warning(" C: %s" % idx.functions[id].conditional= s) + up =3D idx.functions[id] + self.functions[id].update(None, up.module, up.type, up.inf= o, + up.extra) + # else: + # print("Function %s from %s is not declared in headers" %= ( + # id, idx.functions[id].module)) + # TODO: do the same for variables. =20 def analyze_dict(self, type, dict): count =3D 0 @@ -726,7 +730,7 @@ class CParser: elif line[i] =3D=3D '*': return line[:i] + line[i + 1:] else: - return line + return line return line =20 def cleanupComment(self): @@ -877,11 +881,11 @@ class CParser: =20 return((args, desc)) =20 - # - # Parse a comment block and merge the information found in the - # parameters descriptions, finally returns a block as complete - # as possible - # + # + # Parse a comment block and merge the information found in the + # parameters descriptions, finally returns a block as complete + # as possible + # def mergeFunctionComment(self, name, description, quiet=3D0): global ignored_functions =20 @@ -989,9 +993,9 @@ class CParser: desc =3D desc.strip() =20 if quiet =3D=3D 0: - # - # report missing comments - # + # + # report missing comments + # i =3D 0 while i < nbargs: if args[i][2] is None and args[i][0] !=3D "void" and args[= i][1] is not None: @@ -1023,7 +1027,7 @@ class CParser: if token is None: return None if token[0] =3D=3D 'preproc': - # TODO macros with arguments + # TODO macros with arguments name =3D token[1] lst =3D [] token =3D self.lexer.token() @@ -1108,11 +1112,11 @@ class CParser: token =3D self.lexer.token() return token =20 - # - # token acquisition on top of the lexer, it handle internally - # preprocessor and comments since they are logically not part of - # the program structure. - # + # + # token acquisition on top of the lexer, it handle internally + # preprocessor and comments since they are logically not part of + # the program structure. + # def push(self, tok): self.lexer.push(tok) =20 @@ -1149,9 +1153,9 @@ class CParser: return token return None =20 - # - # Parse a typedef, it records the type and its name. - # + # + # Parse a typedef, it records the type and its name. + # def parseTypedef(self, token): if token is None: return None @@ -1161,7 +1165,7 @@ class CParser: return None base_type =3D self.type type =3D base_type - #self.debug("end typedef type", token) + # self.debug("end typedef type", token) while token is not None: if token[0] =3D=3D "name": name =3D token[1] @@ -1186,7 +1190,7 @@ class CParser: else: self.error("parsing typedef: expecting a name") return token - #self.debug("end typedef", token) + # self.debug("end typedef", token) if token is not None and token[0] =3D=3D 'sep' and token[1] = =3D=3D ',': type =3D base_type token =3D self.token() @@ -1204,10 +1208,10 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a C code block, used for functions it parse till - # the balancing } included - # + # + # Parse a C code block, used for functions it parse till + # the balancing } included + # def parseBlock(self, token): while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": @@ -1243,27 +1247,27 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a C struct definition till the balancing } - # + # + # Parse a C struct definition till the balancing } + # def parseStruct(self, token): fields =3D [] - #self.debug("start parseStruct", token) + # self.debug("start parseStruct", token) while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": token =3D self.token() token =3D self.parseTypeBlock(token) elif token[0] =3D=3D "sep" and token[1] =3D=3D "}": self.struct_fields =3D fields - #self.debug("end parseStruct", token) - #print(fields) + # self.debug("end parseStruct", token) + # print(fields) token =3D self.token() return token else: base_type =3D self.type - #self.debug("before parseType", token) + # self.debug("before parseType", token) token =3D self.parseType(token) - #self.debug("after parseType", token) + # self.debug("after parseType", token) if token is not None and token[0] =3D=3D "name": fname =3D token[1] token =3D self.token() @@ -1294,13 +1298,13 @@ class CParser: token =3D self.token() self.type =3D base_type self.struct_fields =3D fields - #self.debug("end parseStruct", token) - #print(fields) + # self.debug("end parseStruct", token) + # print(fields) return token =20 - # - # Parse a C union definition till the balancing } - # + # + # Parse a C union definition till the balancing } + # def parseUnion(self, token): fields =3D [] # self.debug("start parseUnion", token) @@ -1348,9 +1352,9 @@ class CParser: # print(fields) return token =20 - # - # Parse a C enum block, parse till the balancing } - # + # + # Parse a C enum block, parse till the balancing } + # def parseEnumBlock(self, token): self.enums =3D [] name =3D None @@ -1513,10 +1517,10 @@ class CParser: =20 return token =20 - # - # Parse a C definition block, used for structs or unions it parse till - # the balancing } - # + # + # Parse a C definition block, used for structs or unions it parse till + # the balancing } + # def parseTypeBlock(self, token): while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": @@ -1529,11 +1533,11 @@ class CParser: token =3D self.token() return token =20 - # - # Parse a type: the fact that the type name can either occur after - # the definition or within the definition makes it a little harder - # if inside, the name token is pushed back before returning - # + # + # Parse a type: the fact that the type name can either occur after + # the definition or within the definition makes it a little harder + # if inside, the name token is pushed back before returning + # def parseType(self, token): self.type =3D "" self.struct_fields =3D [] @@ -1711,9 +1715,9 @@ class CParser: self.type =3D self.type + " " + token[1] token =3D self.token() =20 - # - # if there is a parenthesis here, this means a function type - # + # + # if there is a parenthesis here, this means a function type + # if token is not None and token[0] =3D=3D "sep" and token[1] =3D=3D= '(': self.type =3D self.type + token[1] token =3D self.token() @@ -1744,9 +1748,9 @@ class CParser: token =3D nametok return token =20 - # - # do some lookahead for arrays - # + # + # do some lookahead for arrays + # if token is not None and token[0] =3D=3D "name": nametok =3D token token =3D self.token() @@ -1766,7 +1770,7 @@ class CParser: self.error("parsing array type, ']' expected", token) return token elif token is not None and token[0] =3D=3D "sep" and token[1] = =3D=3D ':': - # remove :12 in case it's a limited int size + # remove :12 in case it's a limited int size token =3D self.token() token =3D self.token() self.lexer.push(token) @@ -1774,9 +1778,9 @@ class CParser: =20 return token =20 - # - # Parse a signature: '(' has been parsed and we scan the type definit= ion - # up to the ')' included + # + # Parse a signature: '(' has been parsed and we scan the type definiti= on + # up to the ')' included def parseSignature(self, token): signature =3D [] if token is not None and token[0] =3D=3D "sep" and token[1] =3D=3D= ')': @@ -1792,7 +1796,7 @@ class CParser: token =3D self.token() continue elif token is not None and token[0] =3D=3D "sep" and token[1] = =3D=3D ')': - # only the type was provided + # only the type was provided if self.type =3D=3D "...": signature.append((self.type, "...", None)) else: @@ -1886,10 +1890,10 @@ class CParser: "field '%s', use long long instead") % (name, field[1])) =20 - # - # Parse a global definition, be it a type, variable or function - # the extern "C" blocks are a bit nasty and require it to recurse. - # + # + # Parse a global definition, be it a type, variable or function + # the extern "C" blocks are a bit nasty and require it to recurse. + # def parseGlobal(self, token): static =3D 0 if token[1] =3D=3D 'extern': @@ -1946,9 +1950,9 @@ class CParser: token =3D self.token() =20 if token is not None and token[0] =3D=3D "op" and token[1] =3D= =3D "=3D": - # - # Skip the initialization of the variable - # + # + # Skip the initialization of the variable + # token =3D self.token() if token[0] =3D=3D 'sep' and token[1] =3D=3D '{': token =3D self.token() --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list