chore: add type annotation to cloudinit.config.cc_growpart - #7063
chore: add type annotation to cloudinit.config.cc_growpart#7063JaneSoo wants to merge 2 commits into
Conversation
| diskdev: Optional[str], | ||
| partnum: Optional[str], | ||
| partdev: str, | ||
| fs: Optional[str], | ||
| ) -> Tuple[Optional[int], Optional[int]]: | ||
| assert diskdev is not None | ||
| assert partnum is not None |
There was a problem hiding this comment.
This defeats the purpose of type annotations. You label it as Optional, but then throw an exception on the first line - this means that a caller that passes a NoneType will not by warned by type checking that this will crash the program.
There was a problem hiding this comment.
thanks for reviewing, I've removed the assert part and make them required str.
b455f8c to
65aaa9a
Compare
holmanb
left a comment
There was a problem hiding this comment.
Without dropping the module from the mypy overrides, this doesn't enable type checking on the module.
| if disk is not None and ptnum is None: | ||
| if disk and ptnum: |
There was a problem hiding this comment.
This inverts the existing check.
b78477e to
79f6e51
Compare
@holmanb I think the module was dropped in this commit 3082dcb#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L39 |
ref: #5445 (comment)
chore: add type annotation to cloudinit.config.cc_growpart