Skip to content

Commit 2e9a61f

Browse files
authored
Add lupa stubs (#12650)
1 parent 2ccd254 commit 2e9a61f

File tree

9 files changed

+580
-0
lines changed

9 files changed

+580
-0
lines changed

stubs/lupa/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "2.2.*"
2+
upstream_repository = "https://github.com/scoder/lupa"

stubs/lupa/lupa/__init__.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from .lua54 import *
2+
3+
__all__ = [
4+
# from lua54 (newest lib)
5+
"LUA_VERSION",
6+
"LUA_MAXINTEGER",
7+
"LUA_MININTEGER",
8+
"LuaRuntime",
9+
"LuaError",
10+
"LuaSyntaxError",
11+
"LuaMemoryError",
12+
"as_itemgetter",
13+
"as_attrgetter",
14+
"lua_type",
15+
"unpacks_lua_table",
16+
"unpacks_lua_table_method",
17+
]

stubs/lupa/lupa/lua51.pyi

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from _typeshed import MaybeNone
2+
from collections.abc import Callable, Iterator
3+
from typing import Any, Final, Generic, TypeVar, type_check_only
4+
5+
__all__ = [
6+
"LUA_VERSION",
7+
"LUA_MAXINTEGER",
8+
"LUA_MININTEGER",
9+
"LuaRuntime",
10+
"LuaError",
11+
"LuaSyntaxError",
12+
"LuaMemoryError",
13+
"as_itemgetter",
14+
"as_attrgetter",
15+
"lua_type",
16+
"unpacks_lua_table",
17+
"unpacks_lua_table_method",
18+
]
19+
20+
LUA_MAXINTEGER: Final[int]
21+
LUA_MININTEGER: Final[int]
22+
LUA_VERSION: Final[tuple[int, int]]
23+
24+
# cyfunction object
25+
as_attrgetter: Callable[[object], object]
26+
as_itemgetter: Callable[[object], object]
27+
28+
# cyfunction object
29+
lua_type: Callable[[object], str | MaybeNone]
30+
31+
# cyfunction object as decorator
32+
unpacks_lua_table: Callable[[Callable[..., Any]], Callable[..., Any]]
33+
unpacks_lua_table_method: Callable[[Callable[..., Any]], Callable[..., Any]]
34+
35+
# inner classes
36+
37+
@type_check_only
38+
class _LuaIter:
39+
def __iter__(self) -> Iterator[object]: ...
40+
41+
@type_check_only
42+
class _LuaTable:
43+
def keys(self) -> _LuaIter: ...
44+
def values(self) -> _LuaIter: ...
45+
def items(self) -> _LuaIter: ...
46+
47+
@type_check_only
48+
class _LuaNoGC: ...
49+
50+
@type_check_only
51+
class _LuaObject: ...
52+
53+
# classes
54+
55+
_bint = TypeVar("_bint", bool, int)
56+
57+
class FastRLock(Generic[_bint]):
58+
# @classmethod
59+
# def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ...
60+
def acquire(self, blocking: _bint = True) -> _bint: ...
61+
def release(self) -> None: ...
62+
def __enter__(self) -> _bint: ...
63+
def __exit__(self, t: object, v: object, tb: object) -> None: ...
64+
65+
class LuaError(Exception): ...
66+
class LuaSyntaxError(LuaError): ...
67+
class LuaMemoryError(LuaError, MemoryError): ...
68+
69+
class LuaRuntime:
70+
lua_implementation: Final[str]
71+
lua_version: Final[tuple[int, int]]
72+
73+
# @classmethod
74+
# def __cinit__(cls, unpack_return_tuples: bool) -> None: ...
75+
# def add_pending_unref(self, ref: int) -> None: ...
76+
# def clean_up_pending_unrefs(self) -> int: ...
77+
def get_max_memory(self, total: bool = False) -> int | MaybeNone: ...
78+
def get_memory_used(self, total: bool = False) -> int | MaybeNone: ...
79+
# def reraise_on_exceptions(self) -> int: ...
80+
# def store_raised_exception(self, L: object, lua_error_msg: str) -> None: ... # unannotated
81+
def eval(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
82+
def execute(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
83+
def compile(self, lua_code: str, name: str | None = None, mode: str | None = None) -> Callable[..., object]: ...
84+
def require(self, modulename: str) -> object: ...
85+
def globals(self) -> _LuaTable: ...
86+
def table(self, *items: Any, **kwargs: Any) -> _LuaTable: ...
87+
def table_from(self, *args: Any, recursive: bool = ...) -> _LuaTable: ...
88+
def nogc(self) -> _LuaNoGC: ...
89+
def gccollect(self) -> None: ...
90+
def set_max_memory(self, max_memory: int, total: bool = False) -> None: ...
91+
def set_overflow_handler(self, overflow_handler: Callable[..., None]) -> None: ...
92+
# def register_py_object(self, cname: str, pyname: str, obj: object) -> int: ...
93+
# def init_python_lib(self, register_eval: bool, register_builtins: bool) -> int: ...

stubs/lupa/lupa/lua52.pyi

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from _typeshed import MaybeNone
2+
from collections.abc import Callable, Iterator
3+
from typing import Any, Final, Generic, TypeVar, type_check_only
4+
5+
__all__ = [
6+
"LUA_VERSION",
7+
"LUA_MAXINTEGER",
8+
"LUA_MININTEGER",
9+
"LuaRuntime",
10+
"LuaError",
11+
"LuaSyntaxError",
12+
"LuaMemoryError",
13+
"as_itemgetter",
14+
"as_attrgetter",
15+
"lua_type",
16+
"unpacks_lua_table",
17+
"unpacks_lua_table_method",
18+
]
19+
20+
LUA_MAXINTEGER: Final[int]
21+
LUA_MININTEGER: Final[int]
22+
LUA_VERSION: Final[tuple[int, int]]
23+
24+
# cyfunction object
25+
as_attrgetter: Callable[[object], object]
26+
as_itemgetter: Callable[[object], object]
27+
28+
# cyfunction object
29+
lua_type: Callable[[object], str | MaybeNone]
30+
31+
# cyfunction object as decorator
32+
unpacks_lua_table: Callable[[Callable[..., Any]], Callable[..., Any]]
33+
unpacks_lua_table_method: Callable[[Callable[..., Any]], Callable[..., Any]]
34+
35+
# inner classes
36+
37+
@type_check_only
38+
class _LuaIter:
39+
def __iter__(self) -> Iterator[object]: ...
40+
41+
@type_check_only
42+
class _LuaTable:
43+
def keys(self) -> _LuaIter: ...
44+
def values(self) -> _LuaIter: ...
45+
def items(self) -> _LuaIter: ...
46+
47+
@type_check_only
48+
class _LuaNoGC: ...
49+
50+
@type_check_only
51+
class _LuaObject: ...
52+
53+
# classes
54+
55+
_bint = TypeVar("_bint", bool, int)
56+
57+
class FastRLock(Generic[_bint]):
58+
# @classmethod
59+
# def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ...
60+
def acquire(self, blocking: _bint = True) -> _bint: ...
61+
def release(self) -> None: ...
62+
def __enter__(self) -> _bint: ...
63+
def __exit__(self, t: object, v: object, tb: object) -> None: ...
64+
65+
class LuaError(Exception): ...
66+
class LuaSyntaxError(LuaError): ...
67+
class LuaMemoryError(LuaError, MemoryError): ...
68+
69+
class LuaRuntime:
70+
lua_implementation: Final[str]
71+
lua_version: Final[tuple[int, int]]
72+
73+
# @classmethod
74+
# def __cinit__(cls, unpack_return_tuples: bool) -> None: ...
75+
# def add_pending_unref(self, ref: int) -> None: ...
76+
# def clean_up_pending_unrefs(self) -> int: ...
77+
def get_max_memory(self, total: bool = False) -> int | MaybeNone: ...
78+
def get_memory_used(self, total: bool = False) -> int | MaybeNone: ...
79+
# def reraise_on_exceptions(self) -> int: ...
80+
# def store_raised_exception(self, L: object, lua_error_msg: str) -> None: ... # unannotated
81+
def eval(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
82+
def execute(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
83+
def compile(self, lua_code: str, name: str | None = None, mode: str | None = None) -> Callable[..., object]: ...
84+
def require(self, modulename: str) -> object: ...
85+
def globals(self) -> _LuaTable: ...
86+
def table(self, *items: Any, **kwargs: Any) -> _LuaTable: ...
87+
def table_from(self, *args: Any, recursive: bool = ...) -> _LuaTable: ...
88+
def nogc(self) -> _LuaNoGC: ...
89+
def gccollect(self) -> None: ...
90+
def set_max_memory(self, max_memory: int, total: bool = False) -> None: ...
91+
def set_overflow_handler(self, overflow_handler: Callable[..., None]) -> None: ...
92+
# def register_py_object(self, cname: str, pyname: str, obj: object) -> int: ...
93+
# def init_python_lib(self, register_eval: bool, register_builtins: bool) -> int: ...

stubs/lupa/lupa/lua53.pyi

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from _typeshed import MaybeNone
2+
from collections.abc import Callable, Iterator
3+
from typing import Any, Final, Generic, TypeVar, type_check_only
4+
5+
__all__ = [
6+
"LUA_VERSION",
7+
"LUA_MAXINTEGER",
8+
"LUA_MININTEGER",
9+
"LuaRuntime",
10+
"LuaError",
11+
"LuaSyntaxError",
12+
"LuaMemoryError",
13+
"as_itemgetter",
14+
"as_attrgetter",
15+
"lua_type",
16+
"unpacks_lua_table",
17+
"unpacks_lua_table_method",
18+
]
19+
20+
LUA_MAXINTEGER: Final[int]
21+
LUA_MININTEGER: Final[int]
22+
LUA_VERSION: Final[tuple[int, int]]
23+
24+
# cyfunction object
25+
as_attrgetter: Callable[[object], object]
26+
as_itemgetter: Callable[[object], object]
27+
28+
# cyfunction object
29+
lua_type: Callable[[object], str | MaybeNone]
30+
31+
# cyfunction object as decorator
32+
unpacks_lua_table: Callable[[Callable[..., Any]], Callable[..., Any]]
33+
unpacks_lua_table_method: Callable[[Callable[..., Any]], Callable[..., Any]]
34+
35+
# inner classes
36+
37+
@type_check_only
38+
class _LuaIter:
39+
def __iter__(self) -> Iterator[object]: ...
40+
41+
@type_check_only
42+
class _LuaTable:
43+
def keys(self) -> _LuaIter: ...
44+
def values(self) -> _LuaIter: ...
45+
def items(self) -> _LuaIter: ...
46+
47+
@type_check_only
48+
class _LuaNoGC: ...
49+
50+
@type_check_only
51+
class _LuaObject: ...
52+
53+
# classes
54+
55+
_bint = TypeVar("_bint", bool, int)
56+
57+
class FastRLock(Generic[_bint]):
58+
# @classmethod
59+
# def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ...
60+
def acquire(self, blocking: _bint = True) -> _bint: ...
61+
def release(self) -> None: ...
62+
def __enter__(self) -> _bint: ...
63+
def __exit__(self, t: object, v: object, tb: object) -> None: ...
64+
65+
class LuaError(Exception): ...
66+
class LuaSyntaxError(LuaError): ...
67+
class LuaMemoryError(LuaError, MemoryError): ...
68+
69+
class LuaRuntime:
70+
lua_implementation: Final[str]
71+
lua_version: Final[tuple[int, int]]
72+
73+
# @classmethod
74+
# def __cinit__(cls, unpack_return_tuples: bool) -> None: ...
75+
# def add_pending_unref(self, ref: int) -> None: ...
76+
# def clean_up_pending_unrefs(self) -> int: ...
77+
def get_max_memory(self, total: bool = False) -> int | MaybeNone: ...
78+
def get_memory_used(self, total: bool = False) -> int | MaybeNone: ...
79+
# def reraise_on_exceptions(self) -> int: ...
80+
# def store_raised_exception(self, L: object, lua_error_msg: str) -> None: ... # unannotated
81+
def eval(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
82+
def execute(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
83+
def compile(self, lua_code: str, name: str | None = None, mode: str | None = None) -> Callable[..., object]: ...
84+
def require(self, modulename: str) -> object: ...
85+
def globals(self) -> _LuaTable: ...
86+
def table(self, *items: Any, **kwargs: Any) -> _LuaTable: ...
87+
def table_from(self, *args: Any, recursive: bool = ...) -> _LuaTable: ...
88+
def nogc(self) -> _LuaNoGC: ...
89+
def gccollect(self) -> None: ...
90+
def set_max_memory(self, max_memory: int, total: bool = False) -> None: ...
91+
def set_overflow_handler(self, overflow_handler: Callable[..., None]) -> None: ...
92+
# def register_py_object(self, cname: str, pyname: str, obj: object) -> int: ...
93+
# def init_python_lib(self, register_eval: bool, register_builtins: bool) -> int: ...

stubs/lupa/lupa/lua54.pyi

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from _typeshed import MaybeNone
2+
from collections.abc import Callable, Iterator
3+
from typing import Any, Final, Generic, TypeVar, type_check_only
4+
5+
__all__ = [
6+
"LUA_VERSION",
7+
"LUA_MAXINTEGER",
8+
"LUA_MININTEGER",
9+
"LuaRuntime",
10+
"LuaError",
11+
"LuaSyntaxError",
12+
"LuaMemoryError",
13+
"as_itemgetter",
14+
"as_attrgetter",
15+
"lua_type",
16+
"unpacks_lua_table",
17+
"unpacks_lua_table_method",
18+
]
19+
20+
LUA_MAXINTEGER: Final[int]
21+
LUA_MININTEGER: Final[int]
22+
LUA_VERSION: Final[tuple[int, int]]
23+
24+
# cyfunction object
25+
as_attrgetter: Callable[[object], object]
26+
as_itemgetter: Callable[[object], object]
27+
28+
# cyfunction object
29+
lua_type: Callable[[object], str | MaybeNone]
30+
31+
# cyfunction object as decorator
32+
unpacks_lua_table: Callable[[Callable[..., Any]], Callable[..., Any]]
33+
unpacks_lua_table_method: Callable[[Callable[..., Any]], Callable[..., Any]]
34+
35+
# inner classes
36+
37+
@type_check_only
38+
class _LuaIter:
39+
def __iter__(self) -> Iterator[object]: ...
40+
41+
@type_check_only
42+
class _LuaTable:
43+
def keys(self) -> _LuaIter: ...
44+
def values(self) -> _LuaIter: ...
45+
def items(self) -> _LuaIter: ...
46+
47+
@type_check_only
48+
class _LuaNoGC: ...
49+
50+
@type_check_only
51+
class _LuaObject: ...
52+
53+
# classes
54+
55+
_bint = TypeVar("_bint", bool, int)
56+
57+
class FastRLock(Generic[_bint]):
58+
# @classmethod
59+
# def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ...
60+
def acquire(self, blocking: _bint = True) -> _bint: ...
61+
def release(self) -> None: ...
62+
def __enter__(self) -> _bint: ...
63+
def __exit__(self, t: object, v: object, tb: object) -> None: ...
64+
65+
class LuaError(Exception): ...
66+
class LuaSyntaxError(LuaError): ...
67+
class LuaMemoryError(LuaError, MemoryError): ...
68+
69+
class LuaRuntime:
70+
lua_implementation: Final[str]
71+
lua_version: Final[tuple[int, int]]
72+
73+
# @classmethod
74+
# def __cinit__(cls, unpack_return_tuples: bool) -> None: ...
75+
# def add_pending_unref(self, ref: int) -> None: ...
76+
# def clean_up_pending_unrefs(self) -> int: ...
77+
def get_max_memory(self, total: bool = False) -> int | MaybeNone: ...
78+
def get_memory_used(self, total: bool = False) -> int | MaybeNone: ...
79+
# def reraise_on_exceptions(self) -> int: ...
80+
# def store_raised_exception(self, L: object, lua_error_msg: str) -> None: ... # unannotated
81+
def eval(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
82+
def execute(self, lua_code: str, *args: Any, name: str | None = None, mode: str | None = None) -> object: ...
83+
def compile(self, lua_code: str, name: str | None = None, mode: str | None = None) -> Callable[..., object]: ...
84+
def require(self, modulename: str) -> object: ...
85+
def globals(self) -> _LuaTable: ...
86+
def table(self, *items: Any, **kwargs: Any) -> _LuaTable: ...
87+
def table_from(self, *args: Any, recursive: bool = ...) -> _LuaTable: ...
88+
def nogc(self) -> _LuaNoGC: ...
89+
def gccollect(self) -> None: ...
90+
def set_max_memory(self, max_memory: int, total: bool = False) -> None: ...
91+
def set_overflow_handler(self, overflow_handler: Callable[..., None]) -> None: ...
92+
# def register_py_object(self, cname: str, pyname: str, obj: object) -> int: ...
93+
# def init_python_lib(self, register_eval: bool, register_builtins: bool) -> int: ...

0 commit comments

Comments
 (0)