diff --git a/jpype/_core.pyi b/jpype/_core.pyi new file mode 100644 index 000000000..f4eb32c79 --- /dev/null +++ b/jpype/_core.pyi @@ -0,0 +1,2 @@ +class _JRuntime: + pass diff --git a/jpype/_jcollection.pyi b/jpype/_jcollection.pyi new file mode 100644 index 000000000..7e811332f --- /dev/null +++ b/jpype/_jcollection.pyi @@ -0,0 +1,93 @@ +from typing import Iterable, Collection, List, Set, Mapping, Tuple, TypeVar, Iterator, Generator, Union, overload + +E = TypeVar('E') +K = TypeVar('K') +V = TypeVar('V') + + +class _JIterable(Iterable[E]): + def __iter__(self) -> Iterator[E]: ... + + +class _JCollection(Collection[E]): + def __len__(self) -> int: ... + + def __delitem__(self, i: E) -> None: ... + + def __contains__(self, i: E) -> bool: ... + + +class _JList(List[E]): + @overload + def __getitem__(self, ndx: int) -> E: ... + + @overload + def __getitem__(self, ndx: slice) -> E: ... + + def __setitem__(self, ndx: int, v: E) -> None: ... + + def __delitem__(self, ndx: int) -> E: ... + + def __reversed__(self) -> Generator[E, None, None]: ... + + def index(self, obj: E) -> int: ... + + def count(self, obj: E) -> int: ... + + def insert(self, idx: int, obj: E) -> '_JList'[E]: ... + + def append(self, obj: E) -> '_JList'[E]: ... + + def reverse(self) -> None: ... + + def extend(self, lst: Iterable[E]) -> None: ... + + def pop(self, idx: int = ...) -> E: ... + + def __iadd__(self, obj: List[E]) -> '_JList'[E]: ... + + def __add__(self, obj: List[E]) -> '_JList'[E]: ... + + def remove(self, obj: E) -> None: ... + + +class _JMap(Mapping[K, V]): + def __len__(self) -> int: ... + + def __iter__(self) -> Iterator[K]: ... + + def __delitem__(self, i: K) -> V: ... + + def __getitem__(self, ndx: K) -> V: ... + + def __setitem__(self, ndx: K, v: V) -> None: ... + + def items(self) -> Set['_JMapEntry'[K, V]]: ... + + def keys(self) -> Set[K]: ... + + def __contains__(self, item: V) -> bool: ... + + +class _JSet(Set[E]): + def __delitem__(self, i: E): ... + + +class _JMapEntry(Tuple[K, V]): + def __len__(self) -> int: ... + + def __getitem__(self, x: int) -> Union[K, V]: ... + + +class _JIterator(Iterator[E]): + def __next__(self) -> E: ... + + def __iter__(self) -> Iterator[E]: ... + + +class _JEnumeration(Iterator[E]): + def __next__(self) -> E: ... + + def __iter__(self) -> Iterator[E]: ... + + def next(self) -> E: ... diff --git a/jpype/_jio.pyi b/jpype/_jio.pyi new file mode 100644 index 000000000..64196de5f --- /dev/null +++ b/jpype/_jio.pyi @@ -0,0 +1,9 @@ +from types import TracebackType +from typing import ContextManager, Optional, Type + + +class _JCloseable(ContextManager['_JCloseable']): + def __enter__(self) -> '_JCloseable': ... + + def __exit__(self, exception_type: Optional[Type[BaseException]], exception_value: Optional[BaseException], + traceback: Optional[TracebackType]) -> bool: ... diff --git a/jpype/_jstring.pyi b/jpype/_jstring.pyi new file mode 100644 index 000000000..bd2d5160a --- /dev/null +++ b/jpype/_jstring.pyi @@ -0,0 +1,13 @@ +from typing import Any, Text + + +class _JStringProto(Text): + def __add__(self, other: Text) -> Text: ... + + def __len__(self) -> int: ... + + def __getitem__(self, i: int) -> Text: ... + + def __contains__(self, other: Text) -> bool: ... + + def __hash__(self) -> Any: ... diff --git a/jpype/_jthread.pyi b/jpype/_jthread.pyi new file mode 100644 index 000000000..fbb828d3f --- /dev/null +++ b/jpype/_jthread.pyi @@ -0,0 +1,12 @@ +class _JThread: + @staticmethod + def isAttached() -> bool: ... + + @staticmethod + def attach() -> None: ... + + @staticmethod + def attachAsDaemon() -> None: ... + + @staticmethod + def detach() -> None: ...