File tree Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
3
+ from collections import defaultdict
3
4
import itertools
4
5
import os .path
6
+ import stringcase
5
7
import sys
6
8
import textwrap
7
- from collections import defaultdict
8
9
from typing import Dict , List , Optional , Type
10
+ from betterproto .casing import safe_snake_case
9
11
10
12
try :
13
+ # betterproto[compiler] specific dependencies
11
14
import black
12
- except ImportError :
15
+ from google .protobuf .compiler import plugin_pb2 as plugin
16
+ from google .protobuf .descriptor_pb2 import (
17
+ DescriptorProto ,
18
+ EnumDescriptorProto ,
19
+ FieldDescriptorProto ,
20
+ )
21
+ import google .protobuf .wrappers_pb2 as google_wrappers
22
+ import jinja2
23
+ except ImportError as err :
24
+ missing_import = err .args [0 ][17 :- 1 ]
13
25
print (
14
- "Unable to import `black` formatter. Did you install the compiler feature with `pip install betterproto[compiler]`?"
26
+ "\033 [31m"
27
+ f"Unable to import `{ missing_import } ` from betterproto plugin! "
28
+ "Please ensure that you've installed betterproto as "
29
+ '`pip install "betterproto[compiler]"` so that compiler dependencies '
30
+ "are included."
31
+ "\033 [0m"
15
32
)
16
33
raise SystemExit (1 )
17
34
18
- import jinja2
19
- import stringcase
20
-
21
- from google .protobuf .compiler import plugin_pb2 as plugin
22
- from google .protobuf .descriptor_pb2 import (
23
- DescriptorProto ,
24
- EnumDescriptorProto ,
25
- FieldDescriptorProto ,
26
- )
27
-
28
- from betterproto .casing import safe_snake_case
29
-
30
- import google .protobuf .wrappers_pb2 as google_wrappers
31
35
32
36
WRAPPER_TYPES : Dict [str , Optional [Type ]] = defaultdict (
33
37
lambda : None ,
Original file line number Diff line number Diff line change 11
11
"googletypes_service_returns_empty" , # 9
12
12
"casing_message_field_uppercase" , # 11
13
13
"namespace_keywords" , # 70
14
- "namespace_builtin_types" # 53
14
+ "namespace_builtin_types" , # 53
15
15
}
16
16
17
17
services = {
You can’t perform that action at this time.
0 commit comments