Patch 0001 removes an unused instance variable from GLModule and
GLModuleSystem. I didn't notice these until now, but PyCharm finds no
refrences to them and removing them doesn't break anything. And
$ grep '\.args' pygnulib/*.py
doesn't find any use of them. So I think it is safe to say they are
unused.
Patch 0002 adds a comment about "private" functions and instance
variables to main.py.
Collin
From b3dce6e6d9548c21e0a6f98b2f5342c8b9dd413a Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 18 Apr 2024 10:46:33 -0700
Subject: [PATCH 1/2] gnulib-tool.py: Remove some unused instance variables.
* pygnulib/GLModuleSystem.py (GLModuleSystem.__init__)
(GLModule.__init__): Remove unused 'args' instance variable.
---
ChangeLog | 6 ++++++
pygnulib/GLModuleSystem.py | 2 --
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a92574391..ed733e7e00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-18 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Remove some unused instance variables.
+ * pygnulib/GLModuleSystem.py (GLModuleSystem.__init__)
+ (GLModule.__init__): Remove unused 'args' instance variable.
+
2024-04-18 Bruno Haible <br...@clisp.org>
totalorderl: Simplify on MSVC.
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index 40ac591dc4..efc39ec925 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -63,7 +63,6 @@ def __init__(self, config: GLConfig) -> None:
'''Create new GLModuleSystem instance. Some functions use GLFileSystem class
to look up a file in localpath or gnulib directories, or combine it through
'patch' utility.'''
- self.args = dict()
if type(config) is not GLConfig:
raise TypeError('config must be a GLConfig, not %s'
% type(config).__name__)
@@ -185,7 +184,6 @@ def __init__(self, config: GLConfig, name: str, path: str, patched: bool = False
- name, the name of the module,
- path, the file name of the (possibly patched) module description,
- patched, indicating whether that module description was created by applying a patch.'''
- self.args = dict()
self.cache = dict()
self.content = ''
if type(config) is not GLConfig:
--
2.44.0
From d59a765e2e4a37c22b5224f8e0b3308c2644b280 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 18 Apr 2024 11:03:00 -0700
Subject: [PATCH 2/2] gnulib-tool.py: Add a comment about coding style.
* pygnulib/main.py: Add a note about the common convention of using an
underscore prefix to mark a function/variable as private.
---
ChangeLog | 6 ++++++
pygnulib/main.py | 3 +++
2 files changed, 9 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index ed733e7e00..602eaada43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-18 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Add a comment about coding style.
+ * pygnulib/main.py: Add a note about the common convention of using an
+ underscore prefix to mark a function/variable as private.
+
2024-04-18 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Remove some unused instance variables.
diff --git a/pygnulib/main.py b/pygnulib/main.py
index fd39cf07a6..8316c0abf2 100644
--- a/pygnulib/main.py
+++ b/pygnulib/main.py
@@ -54,6 +54,9 @@
# Cf. <https://peps.python.org/pep-0585/>.
# - Never use the {} literal, because it denotes a dictionary,
# as opposed to {x}, {x,y}, etc., which denote sets.
+# - Use a leading underscore to indicate that functions and instance variables
+# should be considered private. This is a widely accepted convention from
+# PEP 8 <https://peps.python.org/pep-0008/#method-names-and-instance-variables>.
# You can use this command to check the style:
# $ pycodestyle *.py
--
2.44.0