From nobody Sat Jul 5 16:20:14 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 1521528612906457.1775285322698; Mon, 19 Mar 2018 23:50:12 -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 94E25356E6; Tue, 20 Mar 2018 06:50:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E8075FCA2; Tue, 20 Mar 2018 06:50:11 +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 210C64CAB4; Tue, 20 Mar 2018 06:50:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2K6nsvF019550 for ; Tue, 20 Mar 2018 02:49:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 263EA5DA62; Tue, 20 Mar 2018 06:49:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1FCD95D962 for ; Tue, 20 Mar 2018 06:49:51 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) (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 182A3C057FA2 for ; Tue, 20 Mar 2018 06:49:49 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id d10so467786wrf.3 for ; Mon, 19 Mar 2018 23:49:49 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id g38sm1923269wra.77.2018.03.19.23.49.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Mar 2018 23:49:46 -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=GFAbTMkdOEeiovcpP3u+THvSjHqi2xZo5Brw9oHcOPo=; b=V+KLlq05bZVwHy6tLXoWNGmEaSEHb+Z8FQ1j4PU7FG9V5JBb8Dxa74eKmxzVUt9swx O8qCOJWGBlhRNie2lJPWih09WPFe1r9A9LQTHqnhrFM9sZ+CrXJ962Yxzw22rYD56vQI 8rHr73PPTxKe/uKnTnqpOP0IlfEBSNe3R+ZVIn9SCaWVsRriGA7KYzQ3Dj97yQmduFNX rGdJKjOB1jyJh31mnEu3vPY+6VdTow6V+lrQbIDnbEuEcl6SmXEL73xBOZ+iW62dEv06 sb4v5CFM37BYBDMHrjsXCQFkwC9AcSDY3Dq0y3yalqaTC1wykrCIVF2b+rmv1r4+Q+u5 aTGA== 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=GFAbTMkdOEeiovcpP3u+THvSjHqi2xZo5Brw9oHcOPo=; b=HZ1vIsuenif2QOZLk1DiTRzz+ip1wLwmtDJjk7p7Y0HpWtCWn2PCJcgpAtgeIwCUZF wZ2Rztvlr0sgZfP9SecE9ARO5sJ3x7jUpmlBBbO/7ePeLpPu9TAuV80X/bfL8T5B4nzQ Az2SJ1OByHlLMNA9xYFlXzk1lkF2sxbSe3JwULA4oYoBBe3muyegdFiJE3bdc4fzM95w 1qiiXBj6SdIK95KnVftUg+U3PehJGIT9HK6hKyXtKCYmdDJyIlj+YV0gL9hLRkwEasdd DzIhPVCmAwsvKNP22fqLjSebbFSUUnj25Z5tVB2mOQu/lShhDq6K+1e5lv5a5J3ygr/F DIqA== X-Gm-Message-State: AElRT7GQ0gSSV4oxBfgN/1QwbEA8pMwDQB93HynBufvwPz+6V4GHTKPG 7bZGp5sDzbmB9TcDUIQViEOP8qGt X-Google-Smtp-Source: AG47ELuu7b7NyAbLSe8weZ3shjS3gtMhUmOTxY8NDhnN1d8DNoECjkmatyiZNW2qB+FgYoXf8HGA+g== X-Received: by 10.223.188.1 with SMTP id s1mr12329151wrg.243.1521528587173; Mon, 19 Mar 2018 23:49:47 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Tue, 20 Mar 2018 06:49:00 +0000 Message-Id: <20180320064908.17723-18-rstoyanov1@gmail.com> In-Reply-To: <20180320064908.17723-1-rstoyanov1@gmail.com> References: <20180320064908.17723-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 20 Mar 2018 06:49:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 20 Mar 2018 06:49:49 +0000 (UTC) for IP:'209.85.128.193' DOMAIN:'mail-wr0-f193.google.com' HELO:'mail-wr0-f193.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.149 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_FILL_THIS_FORM_SHORT) 209.85.128.193 mail-wr0-f193.google.com 209.85.128.193 mail-wr0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCHv2 17/25] 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.30]); Tue, 20 Mar 2018 06:50:12 +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 --- docs/apibuild.py | 296 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 150 insertions(+), 146 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index acfbcafb2..90d944ccf 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,92 +311,93 @@ 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: - up =3D idx.functions[id] - # check that function condition agrees with header - if up.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" % up.conditionals) - 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: + up =3D idx.functions[id] + # check that function condition agrees with header + if up.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" % up.conditionals) + 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 @@ -725,7 +729,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): @@ -876,11 +880,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 @@ -988,9 +992,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: @@ -1022,7 +1026,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() @@ -1107,11 +1111,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 @@ -1148,9 +1152,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 @@ -1160,7 +1164,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] @@ -1185,7 +1189,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() @@ -1203,10 +1207,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 "{": @@ -1242,27 +1246,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() @@ -1293,13 +1297,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) @@ -1347,9 +1351,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 @@ -1512,10 +1516,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 "{": @@ -1528,11 +1532,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 [] @@ -1710,9 +1714,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() @@ -1743,9 +1747,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() @@ -1765,7 +1769,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) @@ -1773,9 +1777,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= ')': @@ -1791,7 +1795,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: @@ -1885,10 +1889,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': @@ -1945,9 +1949,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