Use type hint for method declaration#8248
Conversation
|
[note] |
|
|
||
| def _parse_attributes_section(self, section): | ||
| # type: (unicode) -> List[unicode] | ||
| def _parse_attributes_section(self, section: str) -> List[str]: |
There was a problem hiding this comment.
unicode->str
I'm not sure if this is correct...:cry::bow:
There was a problem hiding this comment.
I looks OK (not so sure though).
|
I added type hints for method declarations. |
|
Note that CI jobs for Python2.7 ( |
|
Thank you for the fixes. |
|
Jenkins, test this please |
|
Jenkins CI test (for commit a673492, target branch master) failed with status FAILURE. |
|
Could you check failures? |
|
Sure, I'll check it. |
|
Jenkins, test this please |
|
Jenkins CI test (for commit f79ea01, target branch master) succeeded! |
|
flexCI, test this please |
|
Jenkins CI test (for commit f79ea01, target branch master) succeeded! |
|
I couldn't launch flexCI... |
chainer/link_hook.py
Outdated
| link_hooks[self.name].deleted(None) | ||
| del link_hooks[self.name] | ||
|
|
||
| def added(self, link: tp.Optional['chainer.link.Link']) -> None: |
There was a problem hiding this comment.
Errors occurred a string ('chainer.link.Link') was evaluated as an ordinal class in Python3.5. 🤔
I avoided this error by surrounding a whole annotation with whitespace.
|
flexCI, test this please |
|
Jenkins CI test (for commit f79ea01, target branch master) failed with status FAILURE. |
|
Jenkins, test this please |
|
Jenkins CI test (for commit f79ea01, target branch master) succeeded! |
|
Thank you! |
Close #8240.
[edited: 2019/10/08] I revised module list by running following command.
grep -v "=.\+# type: " **/*.py| grep "# type: "This intended to exclude variable annotations. (#8248 (comment))
grep result
Details
ref. https://www.python.org/dev/peps/pep-0484/