Skip to content

Commit e79a240

Browse files
Small cleaning (#175)
1 parent 94a7adf commit e79a240

3 files changed

Lines changed: 3 additions & 37 deletions

File tree

betterproto2/src/betterproto2/__init__.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,24 +1301,6 @@ def _validate_field_groups(cls, values):
13011301
Message.__annotations__ = {} # HACK to avoid typing.get_type_hints breaking :)
13021302

13031303

1304-
# The Rust codec is not available for now
1305-
# try:
1306-
# import betterproto2_rust_codec # pyright: ignore[reportMissingImports]
1307-
# except ModuleNotFoundError:
1308-
# pass
1309-
# else:
1310-
1311-
# def parse_patched(self, data: bytes) -> Message:
1312-
# betterproto2_rust_codec.deserialize(self, data)
1313-
# return self
1314-
1315-
# def bytes_patched(self) -> bytes:
1316-
# return betterproto2_rust_codec.serialize(self)
1317-
1318-
# Message.parse = parse_patched
1319-
# Message.__bytes__ = bytes_patched
1320-
1321-
13221304
def which_one_of(message: Message, group_name: str) -> tuple[str, Any | None]:
13231305
"""
13241306
Return the name and value of a message's one-of field group.

betterproto2_compiler/src/betterproto2_compiler/plugin/compiler.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,10 @@
33
import sys
44
from importlib import metadata
55

6-
from .module_validation import ModuleValidator
7-
8-
try:
9-
# betterproto[compiler] specific dependencies
10-
import jinja2
11-
except ImportError as err:
12-
print(
13-
"\033[31m"
14-
f"Unable to import `{err.name}` from betterproto plugin! "
15-
"Please ensure that you've installed betterproto as "
16-
'`pip install "betterproto[compiler]"` so that compiler dependencies '
17-
"are included."
18-
"\033[0m",
19-
)
20-
raise SystemExit(1)
6+
import jinja2
217

228
from .models import OutputTemplate
9+
from .module_validation import ModuleValidator
2310

2411

2512
def outputfile_compiler(output_file: OutputTemplate) -> str:

betterproto2_compiler/src/betterproto2_compiler/plugin/models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
import builtins
2828
import inspect
2929
from collections.abc import Iterator
30-
from dataclasses import (
31-
dataclass,
32-
field,
33-
)
30+
from dataclasses import dataclass, field
3431

3532
from betterproto2 import unwrap
3633

0 commit comments

Comments
 (0)