Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from theturboturnip/main
Browse files Browse the repository at this point in the history
Corrected kwargs to use two stars
  • Loading branch information
mysticfall authored Apr 11, 2022
2 parents d3cc665 + 934a8fb commit 7fc1627
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bpystubgen/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def parse_args(self, func: FunctionDef, fields: Mapping[str, str]) -> (OrderedDi
elems["*args"] = Argument(name="*args")

if func.args.kwarg:
elems["**kwargs"] = Argument(name="*kwargs")
elems["**kwargs"] = Argument(name="**kwargs")

return elems, messages

Expand Down
2 changes: 1 addition & 1 deletion bpystubgen/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def generate(self, dest_dir: Path, writer: Writer) -> Optional[Path]:
with open(marker, "w"):
pass

fout = FileOutput(destination_path=str(target))
fout = FileOutput(destination_path=str(target), encoding="utf-8")

try:
writer.write(self.doctree, fout)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ def test_parse_varargs_with_kwargs(parser: Parser, document: document):
assert args[3].name == "frames"
assert args[3].type == "typing.Iterable[int]"

assert args[4].name == "*kwargs"
assert args[4].name == "**kwargs"
assert not args[4].type

assert func.signature == "def bake_action(obj: bpy.types.Object, *args, action: bpy.types.Action, " \
"frames: typing.Iterable[int], *kwargs) -> None:"
"frames: typing.Iterable[int], **kwargs) -> None:"


def test_signature():
Expand Down

0 comments on commit 7fc1627

Please sign in to comment.