bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-tool.py: Omit some unnecessary list() calls around sorted().


From: Collin Funk
Subject: Re: gnulib-tool.py: Omit some unnecessary list() calls around sorted().
Date: Sun, 7 Apr 2024 22:57:26 -0700
User-agent: Mozilla Thunderbird

Hi Bruno,

I was having a look at GLModuleSystem.py and noticed some duplicate
checks that an key is valid. Patch 0003 addresses that.

Patch 0004 adds a missing None return type hint to
GLModuleTable.getCondition(). This is used to indicate that the module
is not a conditional dependency. I missed this in the type hint patch.

This was also one of the functions you mentioned here:

     https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00360.html

> * In GLModuleSystem.py lines 784, 821:
>   A condition can be a string or True. But
>      str | bool
>    makes it look like False was also a valid value. Is possible to
>    write
>      str | True
>    in some way?

The correct way to do this is Literal[True] after the import:

    from typing import Literal

but I wasn't sure if it was compatible with Python 3.7. I ended up
trying it and it is compatible with Python 3.7. The documentation says
Python 3.8 which I've confirmed with my installation [1].

Here is the thread we chose Python 3.7:

    https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00004.html

It appears it is EOL but I'm not sure how RHEL / CentOS versions and
packages work [2]. Does the next version default to 3.7? It looks like
they ship a few and allow you to use 'alternatives --set', but I am
unsure which is default.

[1] https://docs.python.org/3/library/typing.html#typing.Literal
[2] https://devguide.python.org/versions

Collin

Attachment: 0003-gnulib-tool.py-Remove-unnecessary-conditional.patch
Description: Text Data

Attachment: 0004-gnulib-tool.py-Fix-incomplete-type-hint.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]