Skip to content

Commit

Permalink
feat(python): add explicit return type to setters (#1645)
Browse files Browse the repository at this point in the history
Add an explicit `-> None` return annotation to generated property setter
methods. This makes the general style more consistent.
  • Loading branch information
RomainMuller committed May 11, 2020
1 parent b4caff7 commit 0f3c6e2
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 93 deletions.
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ abstract class BaseProperty implements PythonBase {
if (renderAbstract && this.abstract) {
code.line('@abc.abstractmethod');
}
code.openBlock(`def ${this.pythonName}(${this.implicitParameter}, value: ${pythonType})`);
code.openBlock(`def ${this.pythonName}(${this.implicitParameter}, value: ${pythonType}) -> None`);
if ((this.shouldEmitBody || forceEmitBody) && (!renderAbstract || !this.abstract)) {
code.line(`jsii.${this.jsiiSetMethod}(${this.implicitParameter}, "${this.jsName}", value)`);
} else {
Expand Down
Loading

0 comments on commit 0f3c6e2

Please sign in to comment.