Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit d5c1c15

Browse files
committed
Fix trailing commas
1 parent 62be72d commit d5c1c15

File tree

8 files changed

+15
-9
lines changed

8 files changed

+15
-9
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ select = [
5555
"UP",
5656

5757
"I",
58+
59+
"COM812", # Trailing commas
5860
]
5961

6062

src/betterproto2_compiler/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __new__(mcs, name: str, bases: tuple[type, ...], namespace: dict[str, Any])
3737
new_mcs = type(
3838
f"{name}Type",
3939
tuple(
40-
dict.fromkeys([base.__class__ for base in bases if base.__class__ is not type] + [EnumType, type])
40+
dict.fromkeys([base.__class__ for base in bases if base.__class__ is not type] + [EnumType, type]),
4141
), # reorder the bases so EnumType and type are last to avoid conflicts
4242
{"_value_map_": value_map, "_member_map_": member_map},
4343
)

src/betterproto2_compiler/plugin/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"Please ensure that you've installed betterproto as "
1515
'`pip install "betterproto[compiler]"` so that compiler dependencies '
1616
"are included."
17-
"\033[0m"
17+
"\033[0m",
1818
)
1919
raise SystemExit(1)
2020

src/betterproto2_compiler/plugin/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ def field_wraps(self) -> str | None:
420420
@property
421421
def repeated(self) -> bool:
422422
return self.proto_obj.label == FieldDescriptorProtoLabel.LABEL_REPEATED and not is_map(
423-
self.proto_obj, self.parent
423+
self.proto_obj,
424+
self.parent,
424425
)
425426

426427
@property

src/betterproto2_compiler/plugin/parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def generate_code(request: CodeGeneratorRequest) -> CodeGeneratorResponse:
7676
if output_package_name not in request_data.output_packages:
7777
# Create a new output if there is no output for this package
7878
request_data.output_packages[output_package_name] = OutputTemplate(
79-
parent_request=request_data, package_proto_obj=proto_file
79+
parent_request=request_data,
80+
package_proto_obj=proto_file,
8081
)
8182
# Add this input file to the output corresponding to this package
8283
request_data.output_packages[output_package_name].input_files.append(proto_file)
@@ -152,7 +153,7 @@ def generate_code(request: CodeGeneratorRequest) -> CodeGeneratorResponse:
152153
name=str(output_path),
153154
# Render and then format the output file
154155
content=outputfile_compiler(output_file=output_package),
155-
)
156+
),
156157
)
157158

158159
# Make each output directory a package with __init__ file

tests/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async def generate_test_case_output(test_case_input_path: Path, test_case_name:
149149
"",
150150
"NAMES One or more test-case names to generate classes for.",
151151
" python generate.py bool double enums",
152-
)
152+
),
153153
)
154154

155155

tests/test_typing_compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_direct_import_typing_compiler():
3030
"Iterable",
3131
"AsyncIterable",
3232
"AsyncIterator",
33-
}
33+
},
3434
}
3535

3636

tests/util.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async def protoc(
5151
"@echo off",
5252
f"\nchdir {os.getcwd()}",
5353
f"\n{sys.executable} -u {plugin_path.as_posix()}",
54-
]
54+
],
5555
)
5656

5757
tf.flush()
@@ -80,7 +80,9 @@ async def protoc(
8080
*[p.as_posix() for p in path.glob("*.proto")],
8181
]
8282
proc = await asyncio.create_subprocess_exec(
83-
*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
83+
*command,
84+
stdout=asyncio.subprocess.PIPE,
85+
stderr=asyncio.subprocess.PIPE,
8486
)
8587
stdout, stderr = await proc.communicate()
8688
return stdout, stderr, proc.returncode

0 commit comments

Comments
 (0)