[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool.py: Simplify use of GLModuleTable accessors.
From: |
Collin Funk |
Subject: |
gnulib-tool.py: Simplify use of GLModuleTable accessors. |
Date: |
Tue, 9 Apr 2024 00:47:57 -0700 |
User-agent: |
Mozilla Thunderbird |
This patch removes the GLModuleTable.__getitem__ function and changes
the dictionary-like indexing of the GLModuleTable objects to normal
function calls.
I mentioned some of my reasoning here:
https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00113.html
GLConfig has the gnulib-comp.m4 reasoning for using this method [1]. I
don't see a similar reason for doing it in GLModuleTable. Changing
these to normal function calls makes it more clear that a variable is
a GLModuleTable and not a GLConfig or regular dictionary.
I can also see my typos in function names quickly. When I make typos
in keys I have to wait until things break at runtime. :)
Also, now it is easy to see that GLModuleTable.getAvoids() and
GLModuleTable.setAvoids() are not used. I think that it should be fine
to remove them in that case. Then we can make GLModuleTable.avoids a
set since it is only used for membership checks.
$ grep 'getAvoids' pygnulib/*.py
pygnulib/GLConfig.py: def getAvoids(self) -> list[str]:
pygnulib/GLImport.py: avoids = self.config.getAvoids()
pygnulib/GLModuleSystem.py: for avoid in self.config.getAvoids():
pygnulib/GLModuleSystem.py: def getAvoids(self) -> list[GLModule]:
$ grep 'setAvoids' pygnulib/*.py
pygnulib/GLConfig.py: self.resetAvoids()
pygnulib/GLConfig.py: self.setAvoids(avoids)
pygnulib/GLConfig.py: def setAvoids(self, modules: list[str] | tuple[str])
-> None:
pygnulib/GLConfig.py: def resetAvoids(self) -> None:
pygnulib/GLImport.py:
self.cache.setAvoids(cleaner(tempdict['gl_AVOID'].split()))
pygnulib/GLModuleSystem.py: def setAvoids(self, modules: list[GLModule]) ->
None:
[1] https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00364.html
Collin
0001-gnulib-tool.py-Simplify-use-of-GLModuleTable-accesso.patch
Description: Text Data
- gnulib-tool.py: Simplify use of GLModuleTable accessors.,
Collin Funk <=