[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib-tool.py: Remove a redundant function.
From: |
Collin Funk |
Subject: |
Re: gnulib-tool.py: Remove a redundant function. |
Date: |
Sun, 14 Apr 2024 19:20:21 -0700 |
User-agent: |
Mozilla Thunderbird |
On 4/14/24 6:23 PM, Collin Funk wrote:
> Also, I noticed we have:
>
> for src in old_files:
> dest = self.rewrite_files([src])[-1]
> old_table.append(tuple([dest, src]))
>
> This is looping over a list, creating a new list with one item,
> calling GLImport.rewrite_files(), which then calls sorted(set(...))
> twice, and then appending the result to a list.
>
> We should be able to create a new list from that function and zip()
> the two together. I'll submit another patch for that since it requires
> some sorting changes.
Patch 0002 does this. GLTestDir also has this rewrite_files() function
so I did the same there. Maybe it is worth making that a helper
function or using a base class in the future.
Also, the set() and list() calls around zip(...) are important since
zip() returns an iterator [1]. I've used whichever was most similar to
the previous code.
Patch 0003 removes a directories list that was unused. These are
created in the loop below it as files are written.
[1] https://docs.python.org/3/library/functions.html#zip
Collin
0002-gnulib-tool.py-Refactor-file-name-transformations.patch
Description: Text Data
0003-gnulib-tool.py-Remove-an-unused-variable.patch
Description: Text Data
- gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/14
- Re: gnulib-tool.py: Remove a redundant function.,
Collin Funk <=
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/16
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/16
- Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/16
- Re: Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/17
Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15