From nobody Sat Jul 5 16:01: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 1521296751514343.40246091686663; Sat, 17 Mar 2018 07:25:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17E0E356C1; Sat, 17 Mar 2018 14:25:50 +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 E661D7EE23; Sat, 17 Mar 2018 14:25:49 +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 AFAFD180BAD8; Sat, 17 Mar 2018 14:25:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEOCiT000679 for ; Sat, 17 Mar 2018 10:24:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBF4D183C6; Sat, 17 Mar 2018 14:24:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B27F160BE7 for ; Sat, 17 Mar 2018 14:24:10 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (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 5BD1883F45 for ; Sat, 17 Mar 2018 14:24:09 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id w128so8021275wmw.0 for ; Sat, 17 Mar 2018 07:24:09 -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.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:24:06 -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=LJUYctf2rl1Akan+AHZU5s+DCOzqtaR+D1QuVPKc37A=; b=pPWrIyJWomdR9efRaiXK+lWOsuAWCdOO34a3mrfhOjOkuXuLrluXuv/p7dcM7GZMGQ mrr1wq4RpSstewfOhH3Nuqovq302U4qBUGhrERx71soZrsPcbBcp/iAiuj6GM3H+NrgY LPttoRxe6bjx2OkEK/B8rstuRMwKOzZNx0RxEftW0Eh3gZofh2v1gbXDZUwKfzG3mIs5 sj1pPvT/i6O3g0z2dOvOfG/dUq2joXJHO6u9Yo8kLgXBJ14yOXupF9Wv+21hsPxmHTwM avfAuBpr4ZpR0p1413eHRfqlevAWvWEh/xWot59drVFmPw62BjHwWwaMo4A/obx9OGbX rvpw== 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=LJUYctf2rl1Akan+AHZU5s+DCOzqtaR+D1QuVPKc37A=; b=fJNG7sKFHvg4C1EauypAqvp7nAL5TIPB/QR9tBr39f1kiEiTuQVZ/Y35hqGMlAHGeT ts6dT0O+rVOSRPb8em8uwZ6Ay9hp6CfLs9IQDQXdYmFKy1GycPyI6EPy4jgVkPaj8DvZ Zut7lsfGi2a+0kPcAF6ilftar0uTEQ8/p+fwi13nL3QxiNSZr0Oc0VPv2ZJ8rW3cLxOj btvjhKVC3IFB+YEKb8nelvGm3sPqSavMoeTKG8AsDuvBp3sJ1UVuxTmEsjEvnwYnkZU9 gOkUqQtMbl3acFx14u0mwP45eWw/oqre3bDIyu8XU8StqRnd+BZRQrpitZaXyoKHt0lI e0EA== X-Gm-Message-State: AElRT7FOPbKW2RiO6Vc2SrJPQHZPRYZJmJnUANuu5khWRg4K8Hlr/FJh o0uo13HdFATBotFhjV2kY7e4byTM X-Google-Smtp-Source: AG47ELtKH/51rSMV6+/VwKJoVcI7BO20C9sL/o5/+05o6UpiLSL3gFu43r+hD6EbQ55oF+H2MFz6wg== X-Received: by 10.28.43.66 with SMTP id r63mr4725113wmr.93.1521296647791; Sat, 17 Mar 2018 07:24:07 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:35 +0000 Message-Id: <20180317142340.11653-18-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.27]); Sat, 17 Mar 2018 14:24:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 14:24:09 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (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) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 17/22] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Mar 2018 14:25:50 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/apibuild.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 9e73b4d27..b914b1dce 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -722,15 +722,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