[RFC,2/2] libstdc++: Add flake8 configuration

Message ID 20231004165832.1750191-3-tromey@adacore.com
State Unresolved
Headers
Series black, isort, and flake8 configuration |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Tom Tromey Oct. 4, 2023, 4:58 p.m. UTC
  flake8 is a Python linter.  This patch adds a .flake8 configuration
file (flake8 does not use pyproject.toml for some reason) and fixes a
few trivial flake8 warnings.

After this patch, the only remaining flake8 warnings are about unused
imports (there are two - but they are not completely trivial to
remove) and the use of bare "except:".

It is possible to change the flake8 configuration to suppress these
warnings, but I haven't done so here.

libstdc++-v3/ChangeLog:

	* python/.flake8: New file.
	* python/libstdcxx/v6/__init__.py: Remove blank line.
	* python/libstdcxx/v6/printers.py: Reformat two comments.
---
 libstdc++-v3/python/.flake8                  | 3 +++
 libstdc++-v3/python/libstdcxx/__init__.py    | 1 -
 libstdc++-v3/python/libstdcxx/v6/printers.py | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
 create mode 100644 libstdc++-v3/python/.flake8
  

Patch

diff --git a/libstdc++-v3/python/.flake8 b/libstdc++-v3/python/.flake8
new file mode 100644
index 00000000000..7ffe4d6e0f7
--- /dev/null
+++ b/libstdc++-v3/python/.flake8
@@ -0,0 +1,3 @@ 
+[flake8]
+max-line-length = 79
+extend-ignore = E203
diff --git a/libstdc++-v3/python/libstdcxx/__init__.py b/libstdc++-v3/python/libstdcxx/__init__.py
index 8b137891791..e69de29bb2d 100644
--- a/libstdc++-v3/python/libstdcxx/__init__.py
+++ b/libstdc++-v3/python/libstdcxx/__init__.py
@@ -1 +0,0 @@ 
-
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index e26b8b36013..202fa450a91 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -2672,8 +2672,8 @@  class FilteringTypePrinter(object):
         name (str): The typedef-name that will be used instead.
         targ1 (str, optional): The first template argument. Defaults to None.
 
-    Checks if a specialization of the class template 'template' is the same type
-    as the typedef 'name', and prints it as 'name' instead.
+    Checks if a specialization of the class template 'template' is the same
+    type as the typedef 'name', and prints it as 'name' instead.
 
     e.g. if an instantiation of std::basic_istream<C, T> is the same type as
     std::istream then print it as std::istream.
@@ -3167,8 +3167,8 @@  def build_libstdcxx_dictionary():
     libstdcxx_printer.add_version(
         'std::chrono::', 'tzdb', StdChronoTzdbPrinter
     )
-    # libstdcxx_printer.add_version('std::chrono::(anonymous namespace)', 'Rule',
-    #                              StdChronoTimeZoneRulePrinter)
+    # libstdcxx_printer.add_version('std::chrono::(anonymous namespace)',
+    #                               'Rule', StdChronoTimeZoneRulePrinter)
 
     # Extensions.
     libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter)