public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, Tom Tromey <tromey@adacore.com>
Subject: [PATCH 7/7] libstdc++: Use Python "not in" operator
Date: Thu, 28 Sep 2023 11:46:30 -0600	[thread overview]
Message-ID: <20230928174630.4004388-8-tromey@adacore.com> (raw)
In-Reply-To: <20230928174630.4004388-1-tromey@adacore.com>

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)
-- 
2.40.1


  parent reply	other threads:[~2023-09-28 17:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 17:46 [PATCH 0/7] libstdc++: Use gdb.ValuePrinter in pretty-printers Tom Tromey
2023-09-28 17:46 ` [PATCH 1/7] libstdc++: Show full Python stack on error Tom Tromey
2023-09-28 18:49   ` Jonathan Wakely
2023-09-28 17:46 ` [PATCH 2/7] libstdc++: Use gdb.ValuePrinter base class Tom Tromey
2023-09-28 20:26   ` Jonathan Wakely
2023-09-28 20:38     ` Tom Tromey
2023-09-28 20:49       ` Jonathan Wakely
2023-09-28 17:46 ` [PATCH 3/7] libstdc++: Remove unused Python imports Tom Tromey
2023-09-28 18:53   ` Jonathan Wakely
2023-09-28 17:46 ` [PATCH 4/7] libstdc++: Remove unused locals from printers.py Tom Tromey
2023-09-28 18:53   ` Jonathan Wakely
2023-09-28 17:46 ` [PATCH 5/7] libstdc++: Remove std_ratio_t_tuple Tom Tromey
2023-09-28 19:01   ` Jonathan Wakely
2023-09-28 17:46 ` [PATCH 6/7] libstdc++: Fix regex escapes in pretty-printers Tom Tromey
2023-09-28 18:51   ` Jonathan Wakely
2023-09-28 19:11     ` Tom Tromey
2023-09-28 17:46 ` Tom Tromey [this message]
2023-09-28 18:52   ` [PATCH 7/7] libstdc++: Use Python "not in" operator Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230928174630.4004388-8-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).