From nobody Sat Jul 5 16:17:24 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 1521528621862110.83309606862281; Mon, 19 Mar 2018 23:50:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30D2E7FDC3; Tue, 20 Mar 2018 06:50:20 +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 06D0A620AA; Tue, 20 Mar 2018 06:50:20 +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 B777B4CABB; Tue, 20 Mar 2018 06:50:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2K6nuJf019569 for ; Tue, 20 Mar 2018 02:49:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66EC360BE7; Tue, 20 Mar 2018 06:49:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 607F660BE3 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 2FD78356C2 for ; Tue, 20 Mar 2018 06:49:50 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id s18so458990wrg.9 for ; Mon, 19 Mar 2018 23:49:50 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Mar 2018 23:49:47 -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=vJM2cxpq07QnpNGjrCiu0HGNrxL3pGxKKdJFTKjd6Oc=; b=n2B6M3ZUlFwXk4/srw8bwfXkw9e8Tfcit89vQVx0+jII9pMOYNAvEQY9yo75T+ktxv EQ5yX/sw7O9JwmRx+t0c2U5sh698K+rHPMg849c1nBl+B5HbySW3SKktOwOpra5/oTYR cV+dbdYNTELBmL9s3ljFUtRZfKs0lWJmzZm3g73G5cA8h0HquDTcaT7tNN/rBqFIsbG2 dqBUnX/fwtf/Rry93f7/2XvY0ENE5hLCBpMvhE39yTurPXHJg9BjL0Pl7YxmD5TgVuZH dVJYTwNM+meAycbgoQatIjPuRg8hzhEQW8qEWAdAhMAjgLaffKUe/BShc44qhtB/LNli dmFw== 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=vJM2cxpq07QnpNGjrCiu0HGNrxL3pGxKKdJFTKjd6Oc=; b=DyyAp4yVq7OtUSXBtJndr6GrQdmfQWZTmVZdvXRftthLkJ7Xb4l7Uki5/R8+lAWN+o 4kHBNxHyrfKgIGIPukeDpG791wuVDmOkkD6se26m5bty6j1vqN76G9jo7afjZ+KEXuht skq625EDBJwVJVzstHU+FLRz/W9tneSx1CTCMgnGP29MgP4c47R1LGAhYiUvTFi6PlBb +NYD3Gg6t9U7YyVWgmDBOKC67zAJ7aL1l2GKZIVhi6wyrJ+QdqOOEuVVmqgqWD1YYWxT t9O0dhT0bzZHkMHWu2nU0Sq36iMdbAmdtGfAmWEJnF7olV+0tEGZIP/fcdxoxth0ul2M JHZQ== X-Gm-Message-State: AElRT7GenJMDdyJkJKzGe2GeEUFJxrjmFYewS/q09LanhlrtDYxXZ1Fx LHFW0gvqArSUc7nKq6gwhBym2/0k X-Google-Smtp-Source: AG47ELukcaXiiLVIk9hyGnBCVhQrLcZ9UboQevn71r1zWAnvtsixttTCOPVvjlIAeAgIaPeYcfDsGA== X-Received: by 10.223.185.21 with SMTP id k21mr12249616wrf.116.1521528588623; Mon, 19 Mar 2018 23:49:48 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Tue, 20 Mar 2018 06:49:01 +0000 Message-Id: <20180320064908.17723-19-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.30]); Tue, 20 Mar 2018 06:49:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 20 Mar 2018 06:49:50 +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.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 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.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCHv2 18/25] apibuild: Simplify strip_lead_star() 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 20 Mar 2018 06:50:21 +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" The method strip_lead_star() removes a single leading asterisk character from a string by ignoring leading whitespace, otherwise it returns the original string. This could be achieved with a single if-statement followed by replace. Signed-off-by: Radostin Stoyanov --- docs/apibuild.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 90d944ccf..d5707d5d1 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -721,15 +721,8 @@ class CParser: self.index.info =3D res =20 def strip_lead_star(self, line): - l =3D len(line) - i =3D 0 - while i < l: - if line[i] =3D=3D ' ' or line[i] =3D=3D '\t': - i +=3D 1 - elif line[i] =3D=3D '*': - return line[:i] + line[i + 1:] - else: - return line + if line.lstrip().startswith('*'): + line =3D line.replace('*', '', 1) return line =20 def cleanupComment(self): --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list