|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | from collections.abc import Sequence |
4 | | -from typing import TYPE_CHECKING, Final |
| 4 | +from typing import Final |
5 | 5 |
|
6 | 6 | from mypy_extensions import u8 |
7 | | - |
8 | | -try: |
9 | | - from native_internal import ( |
10 | | - Buffer as Buffer, |
11 | | - read_bool as read_bool, |
12 | | - read_float as read_float, |
13 | | - read_int as read_int, |
14 | | - read_str as read_str, |
15 | | - read_tag as read_tag, |
16 | | - write_bool as write_bool, |
17 | | - write_float as write_float, |
18 | | - write_int as write_int, |
19 | | - write_str as write_str, |
20 | | - write_tag as write_tag, |
21 | | - ) |
22 | | -except ImportError: |
23 | | - # TODO: temporary, remove this after we publish mypy-native on PyPI. |
24 | | - if not TYPE_CHECKING: |
25 | | - |
26 | | - class Buffer: |
27 | | - def __init__(self, source: bytes = b"") -> None: |
28 | | - raise NotImplementedError |
29 | | - |
30 | | - def getvalue(self) -> bytes: |
31 | | - raise NotImplementedError |
32 | | - |
33 | | - def read_int(data: Buffer) -> int: |
34 | | - raise NotImplementedError |
35 | | - |
36 | | - def write_int(data: Buffer, value: int) -> None: |
37 | | - raise NotImplementedError |
38 | | - |
39 | | - def read_tag(data: Buffer) -> u8: |
40 | | - raise NotImplementedError |
41 | | - |
42 | | - def write_tag(data: Buffer, value: u8) -> None: |
43 | | - raise NotImplementedError |
44 | | - |
45 | | - def read_str(data: Buffer) -> str: |
46 | | - raise NotImplementedError |
47 | | - |
48 | | - def write_str(data: Buffer, value: str) -> None: |
49 | | - raise NotImplementedError |
50 | | - |
51 | | - def read_bool(data: Buffer) -> bool: |
52 | | - raise NotImplementedError |
53 | | - |
54 | | - def write_bool(data: Buffer, value: bool) -> None: |
55 | | - raise NotImplementedError |
56 | | - |
57 | | - def read_float(data: Buffer) -> float: |
58 | | - raise NotImplementedError |
59 | | - |
60 | | - def write_float(data: Buffer, value: float) -> None: |
61 | | - raise NotImplementedError |
62 | | - |
| 7 | +from native_internal import ( |
| 8 | + Buffer as Buffer, |
| 9 | + read_bool as read_bool, |
| 10 | + read_float as read_float, |
| 11 | + read_int as read_int, |
| 12 | + read_str as read_str, |
| 13 | + read_tag as read_tag, |
| 14 | + write_bool as write_bool, |
| 15 | + write_float as write_float, |
| 16 | + write_int as write_int, |
| 17 | + write_str as write_str, |
| 18 | + write_tag as write_tag, |
| 19 | +) |
63 | 20 |
|
64 | 21 | # Always use this type alias to refer to type tags. |
65 | 22 | Tag = u8 |
|
0 commit comments