On Thu, 28 Sept 2023, 18:54 Tom Tromey via Libstdc++, <libstd...@gcc.gnu.org>
wrote:

> 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.
>

OK, thanks.



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

Reply via email to