fixes in order to support NetworkManager#204
fixes in order to support NetworkManager#204j-baker wants to merge 1 commit intopygobject:masterfrom
Conversation
I wanted to generate stubs using this tool for NetworkManager (NM). What I found was failures for two reasons: 1. Cannot generate due to invalid identifiers (80211Flags). 1. Some enums with no entries. I fixed this by: 1. Quoting those identifiers. My belief is that this will keep mypy working but fixing the python level issues. 1. Printing `pass` after each enum with empty entries.
|
Hi, thanks for trying to fix this. Can you add the stubs that you now can generate with the script as a second commit to this PR, so i can see how that change looks if its needed. |
|
There are several constants/flags beginning with digits, e.g.
Since Python classes cannot begin with digits, this is a problem. The flags mentioned above are described in https://lazka.github.io/pgi-docs/#NM-1.0/classes/AccessPoint.html#properties but are not linked there (probably due to the same circumstances as here). An eample from Vala docs offers more insights: https://valadoc.org/libnm/NM.@80211ApSecurityFlags.html So I think instead of quoting these, the generator should skip them but issue a warning. And in the stubs, they should rather be manual overrides named something like |
|
@j-baker Added the proposed changes (by @cal0pteryx) and the generated stubs in j-baker#1 |
|
I pushed a better solution. Enums/Flags which have a invalid name are returned as "int", this allows the developer to pass the correct type. Of course he has to lookup in the docs what ints are valid, but i dont see a better solution. So i close this, please generate with these fixes the stubs and create a PR. Thanks |
I wanted to generate stubs using this tool for NetworkManager (NM).
What I found was failures for two reasons:
I fixed this by:
passafter each enum with empty entries.