Skip to content

Add python-gnupg stubs - #13465

Closed
lovetox wants to merge 2 commits into
python:mainfrom
lovetox:gnupg
Closed

lovetox wants to merge 2 commits into
python:mainfrom
lovetox:gnupg

Conversation

@lovetox

@lovetox lovetox commented Feb 5, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, notes below. Also:

  • Please add a comment for each Any explaining the valid types.
  • Instance variables initialized in __init__ should be added to all classes.
  • Default values should be the actual default values, not ... (unless they are complex).

Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
__author__: str = ...
__date__: str = ...

from typing import Protocol

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be combined with the imports above.

Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
logger: logging.Logger = ...
fsencoding: str = ...

UNSAFE: re.Pattern[Any] = ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this is only defined on some platforms, I would just add gnupg.UNSAFE to @tests/stubtest_allowlist.txt.

Comment on lines +84 to +85
UID_INDEX: int = ...
FIELDS: list[str] = ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

FIELDS: list[str] = ...
def __init__(self, gpg: GPG) -> None: ...
def key(self, args: Any) -> None: ...
sec: Any = ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sec: Any = ...
pub = key
sec = key

Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
Comment thread stubs/python-gnupg/gnupg/__init__.pyi Resolved
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@@ -0,0 +1,257 @@
import logging
import re
from typing import Any

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from typing import Any
from typing import Any, Final

@brianschubert

Copy link
Copy Markdown
Collaborator

Marking this as a draft for now since CI isn't passing and the review above needs to be addressed

@brianschubert
brianschubert marked this pull request as draft March 14, 2026 19:56
@lovetox

lovetox commented Mar 14, 2026

Copy link
Copy Markdown
Contributor Author

I dont want to follow up on this, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants