Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-jpq committed Jul 9, 2023
1 parent c4da68a commit 98a7b5c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
18 changes: 2 additions & 16 deletions pynvim_pp/_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
)
from concurrent.futures import Future, InvalidStateError
from contextlib import asynccontextmanager, suppress
from enum import Enum, unique
from functools import cached_property, wraps
from io import DEFAULT_BUFFER_SIZE
from ipaddress import IPv4Address, IPv6Address
from itertools import count
from pathlib import PurePath
from sys import version_info
Expand All @@ -27,15 +25,13 @@
Callable,
Coroutine,
Iterable,
Literal,
Mapping,
MutableMapping,
NewType,
Optional,
Sequence,
Tuple,
Type,
Union,
)

from msgpack import ExtType, Packer, Unpacker
Expand All @@ -49,24 +45,14 @@
MsgPackExt,
MsgPackTabpage,
MsgPackWindow,
MsgType,
NvimError,
RPCallable,
RPClient,
ServerAddr,
)
from .types import PARENT


@unique
class MsgType(Enum):
req = 0
resp = 1
notif = 2


ServerAddr = Union[
PurePath, Tuple[Union[Literal["localhost"], IPv4Address, IPv6Address], int]
]

RPCdefault = Callable[[MsgType, Method, Sequence[Any]], Coroutine[Any, Any, Any]]
_MSG_ID = NewType("_MSG_ID", int)
_RX_Q = MutableMapping[_MSG_ID, Future]
Expand Down
4 changes: 2 additions & 2 deletions pynvim_pp/nvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
)
from uuid import UUID

from ._rpc import RPCdefault, ServerAddr, client
from ._rpc import RPCdefault, client
from .atomic import Atomic
from .buffer import Buffer
from .handler import GLOBAL_NS, RPC
from .lib import decode, resolve_path
from .rpc_types import Chan, NvimError, RPCallable, RPClient
from .rpc_types import Chan, NvimError, RPCallable, RPClient, ServerAddr
from .tabpage import Tabpage
from .types import (
PARENT,
Expand Down
16 changes: 15 additions & 1 deletion pynvim_pp/rpc_types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import annotations

from abc import abstractmethod
from typing import Any, NewType, Protocol, TypeVar, cast
from enum import Enum, unique
from ipaddress import IPv4Address, IPv6Address
from pathlib import PurePath
from typing import Any, Literal, NewType, Protocol, Tuple, TypeVar, Union, cast
from uuid import UUID

_T_co = TypeVar("_T_co", covariant=True)
Expand All @@ -10,11 +13,22 @@
Chan = NewType("Chan", int)
Method = NewType("Method", str)

ServerAddr = Union[
PurePath, Tuple[Union[Literal["localhost"], IPv4Address, IPv6Address], int]
]


class NvimError(Exception):
...


@unique
class MsgType(Enum):
req = 0
resp = 1
notif = 2


class MsgPackExt:
code = cast(int, None)

Expand Down

0 comments on commit 98a7b5c

Please sign in to comment.