-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Add missing None type hint to init functions #6354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
oke-aditya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As such many types are missing 😓 In other files. I just added comment as we can atleast fix up the init in this PR.
Maybe I should get back and try fixing the typing PRs?
cc @datumbox @NicolasHug ?
| """ | ||
|
|
||
| def __init__(self, root, split="train", pass_name="clean", transforms=None): | ||
| def __init__(self, root, split="train", pass_name="clean", transforms=None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well let's type this correctly?
| def __init__(self, root, split="train", pass_name="clean", transforms=None) -> None: | |
| def __init__(self, root: str, split: str = "train", pass_name: str ="clean", transforms: Optional[Callable] = None) -> None: |
| _has_builtin_flow_mask = True | ||
|
|
||
| def __init__(self, root, split="train", transforms=None): | ||
| def __init__(self, root, split="train", transforms=None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same flows for all comments
| def __init__(self, root, split="train", transforms=None) -> None: | |
| def __init__(self, root: str, split: str = "train", transforms: Optional[Callable] = None) -> None: |
| """ | ||
|
|
||
| def __init__(self, root, split="train", transforms=None): | ||
| def __init__(self, root, split="train", transforms=None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def __init__(self, root, split="train", transforms=None) -> None: | |
| def __init__(self, root: str, split: str = "train", transforms: Optional[Callable] = None) -> None: |
| """ | ||
|
|
||
| def __init__(self, root, split="train", pass_name="clean", camera="left", transforms=None): | ||
| def __init__(self, root, split="train", pass_name="clean", camera="left", transforms=None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def __init__(self, root, split="train", pass_name="clean", camera="left", transforms=None) -> None: | |
| def __init__(self, root: str, split: str = "train", pass_name:str = "clean", camera: str = "left", transforms: Optional[Callable] = None) -> None: |
| _has_builtin_flow_mask = True | ||
|
|
||
| def __init__(self, root, split="train", transforms=None): | ||
| def __init__(self, root, split="train", transforms=None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def __init__(self, root, split="train", transforms=None) -> None: | |
| def __init__(self, root: str, split: str = "train", transforms: Optional[Callable] = None) -> None: |
| """ | ||
|
|
||
| def __init__(self, mean, std, inplace=False): | ||
| def __init__(self, mean, std, inplace=False) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyways we plan to remove this file in next version of torchvision.
|
Thanks for the PR @ProGamerGov . I'm not too keen on merging this one, because simply adding
These typing PRs add very little value to the code-base, and even sometimes negative values. Considering how much time consuming it is to write, review, and then maintain them, I'd recommend spending time on more impactful areas. |
|
Yeah I know typing is kind of always a debate. I somehow don't agree to having untyped code as investment in code quality and health is always worth while. |
Fully agreed. Good docs + good tests cover 90% of that already, for half of the effort it takes to work in an annotated and type-checked code-base. |
|
Of course I agree to this.
|
|
I had a look yesterday on the PR to confirm the only changes were the addition of |
All
__init__functions should have the type hint-> Noneaccording to PEP-0484: https://www.python.org/dev/peps/pep-0484/