add stubs for py-nanoid (#12074)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Oliver Lambson
2024-05-31 23:02:54 +01:00
committed by GitHub
parent 7e7ffdfd7e
commit 4b6558c12a
7 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
version = "2.0.0"
upstream_repository = "https://github.com/puyuan/py-nanoid"

View File

@@ -0,0 +1,4 @@
from nanoid.generate import generate
from nanoid.non_secure_generate import non_secure_generate
__all__ = ["generate", "non_secure_generate"]

View File

@@ -0,0 +1 @@
def algorithm_generate(random_bytes: int) -> bytearray: ...

View File

@@ -0,0 +1,3 @@
def generate(
alphabet: str = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", size: int = 21 # noqa: Y053
) -> str: ...

View File

@@ -0,0 +1,6 @@
from collections.abc import Callable, Sequence
from typing_extensions import TypeAlias
_Algorithm: TypeAlias = Callable[[int], Sequence[int]]
def method(algorithm: _Algorithm, alphabet: str, size: int) -> str: ...

View File

@@ -0,0 +1,3 @@
def non_secure_generate(
alphabet: str = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", size: int = 21 # noqa: Y053
) -> str: ...

View File

@@ -0,0 +1,2 @@
alphabet: str
size: int