From patchwork Thu Sep 28 17:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 146242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3493259vqu; Thu, 28 Sep 2023 10:53:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrrlicunPaq5FDTOCmr+KOs4m3836g1EZsTszKAc9+iVPVBBVnF69F+huCRfzqSd6V2HfT X-Received: by 2002:a19:7110:0:b0:500:b7ed:105a with SMTP id m16-20020a197110000000b00500b7ed105amr1593620lfc.29.1695923635607; Thu, 28 Sep 2023 10:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695923635; cv=none; d=google.com; s=arc-20160816; b=XUp9UJwm4ka0ZZQIDXvdFnnS/7KVbPoR3QOr55XhbDD1UIcpHwDwKKxS3zzeq6rI9a qTOEv7uiIj12M1lJySyvklfcNfxbpAYUxn+taC1qn/rWsTrsQpd4enBhI3iq7Ujs7zzp nY7ePxDsIkuLyMAiCDOwwKgEfGo0kTPSlBk0EqMgISNIaUWH+cksJCwe4VaSGXDTRaXh WQ862dbhdjl5Nzct56G4XRddOKqPFOHywwSsn7q47+WY63F1rZ/VvLO4Zn5jrBAafZjz cVpRcy67dkdPX+k/lh2G3J54k63CZ93WhxLHRDQjdwA1xlolUeJ0BRqnqYJpDQRCcBX9 yhgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=nzCDTUskecfdSBaQy086LaR/2B/dhPGAP8Vlr2wmgn4=; fh=Ogh3zaPUNpdNYHofIVNHsbX+D3lwaT1T8Jhe/MolwAA=; b=Q3l+qMo055T3Kh4EypmFa44QuJsU3FP9zS5Mjzucf5Q0hcorSrUaTA+gl6PteI/LYw NkJhTIowDmJjyzMclwEg6p13LrjDsALj7FHZoybdUJN+MCFnmkp+VKwzK6NpfdPvWOWX KVaxGJnELwJCV/CNOwJG2umWFV178QizoHrWKPdrJs1H8vyQtl7aynj8qvIw0b7eo4uy BqlUiOoQer4ViWEdMBuslqCVFf6q1EW96817U0ZFqQyVY3ECMOokp9HQnFaQe+GbWnfT Run4s4pMCn/0VZhBjSr2Vih4pP8zdZWPcx4f6RK2qtivwgk9jvpyLnGehEQJxyCNsRZT vfSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=UhiNLQo4; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l14-20020aa7d94e000000b005333a11ab8dsi12562359eds.378.2023.09.28.10.53.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 10:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=UhiNLQo4; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 393AB394D8FF for ; Thu, 28 Sep 2023 17:48:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 880C43870C0A for ; Thu, 28 Sep 2023 17:46:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 880C43870C0A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-76c64da0e46so471031139f.0 for ; Thu, 28 Sep 2023 10:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1695923206; x=1696528006; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nzCDTUskecfdSBaQy086LaR/2B/dhPGAP8Vlr2wmgn4=; b=UhiNLQo4u7rfN2gkIZV6t0cAhImmLWLxYMRlZUsHSKpR5X+nqn3J/cxPIFSk+1Tbci HQjkegFfCq5ryUktxkwnjiPmpEq/ITIns7C7PffjAW+uePDat6IVDw0WX7975anhTkQB XueuPKfySJM7QsFQ9+hrMMxyNy3CHwk7czYqCVv9eNyDWww1OJ8CXNbil0BtXrHb6gNN +01yLpNTeWWtI758nIIkOF6j0RaHHWU3qAI7c/aQQx5t9+OfTm2Q8g5Hx9pPxWrh5Wxx pecnHdn6CtMw9k96gsXCA0eEYQMzqOqfiqNSbIzKVgU8sRNXmiwf6ih4olr1rsxIMuUT CVwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695923206; x=1696528006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nzCDTUskecfdSBaQy086LaR/2B/dhPGAP8Vlr2wmgn4=; b=oRJVF/xIUGawb3wg+qHhtr21E6jJSN+iSdOpZyeJg8g7F3zuEZ9RKootb/+RuviwWx Rq9da/9zkCQDQyCOb6dqG4+fg6xjra1+CW8MTxAwJziUS9ADXgN/8kIFcJfS2zdFX8Ww 03JbgtWWrDyjeaIkEfilWKVCOUKzqvIOsuunddl0Z+UoSe66h2nfxZeMuPufPYFdbikh vgtN5gGCWcOlJGo+8aRxKkxQXrC7GQqP5WoNgFpMCQYJAPSL1lqRdC0dVPzuG2b8+yMb wcYIGYX6Hyz8FNagtCLm7D18vsmzgInEqwDfmTB4Fq+xSEMyrh6eP9LeBeFkfNbPLGMy 7zEQ== X-Gm-Message-State: AOJu0YwZe2ggysO1s6boJ7vg69i45NBlpjcr/ZQ5MONwBk/+ijkTM8X9 VYuZlOzdYctGstgaKjRnvxwuiuek9BaYMdHSqy4LUw== X-Received: by 2002:a05:6e02:1787:b0:349:3503:253b with SMTP id y7-20020a056e02178700b003493503253bmr2313015ilu.17.1695923205804; Thu, 28 Sep 2023 10:46:45 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id p6-20020a92d486000000b0034fc8c1c24fsm3450963ilg.54.2023.09.28.10.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 10:46:45 -0700 (PDT) From: Tom Tromey To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Tom Tromey Subject: [PATCH 7/7] libstdc++: Use Python "not in" operator Date: Thu, 28 Sep 2023 11:46:30 -0600 Message-Id: <20230928174630.4004388-8-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928174630.4004388-1-tromey@adacore.com> References: <20230928174630.4004388-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778304822017242026 X-GMAIL-MSGID: 1778304822017242026 flake8 warns about code like not something in "whatever" Ordinarily in Python this should be written as: something not in "whatever" This patch makes this change. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (Printer.add_version) (add_one_template_type_printer) (FilteringTypePrinter.add_one_type_printer): Use Python "not in" operator. --- libstdc++-v3/python/libstdcxx/v6/printers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index d125236b777..380426cd41e 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -2321,7 +2321,7 @@ class Printer(object): # Add a name using _GLIBCXX_BEGIN_NAMESPACE_VERSION. def add_version(self, base, name, function): self.add(base + name, function) - if _versioned_namespace and not '__cxx11' in base: + if _versioned_namespace and '__cxx11' not in base: vbase = re.sub('^(std|__gnu_cxx)::', r'\g<0>%s' % _versioned_namespace, base) self.add(vbase + name, function) @@ -2494,7 +2494,7 @@ def add_one_template_type_printer(obj, name, defargs): printer = TemplateTypePrinter('std::__debug::'+name, defargs) gdb.types.register_type_printer(obj, printer) - if _versioned_namespace and not '__cxx11' in name: + if _versioned_namespace and '__cxx11' not in name: # Add second type printer for same type in versioned namespace: ns = 'std::' + _versioned_namespace # PR 86112 Cannot use dict comprehension here: @@ -2589,7 +2589,7 @@ class FilteringTypePrinter(object): def add_one_type_printer(obj, template, name, targ1=None): printer = FilteringTypePrinter('std::' + template, 'std::' + name, targ1) gdb.types.register_type_printer(obj, printer) - if _versioned_namespace and not '__cxx11' in template: + if _versioned_namespace and '__cxx11' not in template: ns = 'std::' + _versioned_namespace printer = FilteringTypePrinter(ns + template, ns + name, targ1) gdb.types.register_type_printer(obj, printer)