Skip to content
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

[docs] initial docstring for makedataset #2879

Merged
merged 5 commits into from
Nov 6, 2020

Conversation

bjuncek
Copy link
Contributor

@bjuncek bjuncek commented Oct 23, 2020

per issue
#2841

@vfdev-5 can you please check out that the wording is ok?

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bjuncek ! I left few comments but it's a nitpicking.

is_valid_file should not be passed. Defaults to None.

Raises:
ValueError: In case ``extensions`` and ``is_valid_file`` is None.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is raised if both_none or both_something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in a following commit

torchvision/datasets/folder.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bjuncek thanks for the PR! YOu have included a lot of unrelated formatting changes. Could you revert them?

@bjuncek bjuncek requested a review from vfdev-5 October 29, 2020 17:46
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjuncek thanks for the update. I have a small comment about how you write arg type (as typing annotation). I'm not sure about its rendering in the docs. Could you please check that ?

Args:
directory (str): root dataset directory
class_to_idx (Dict[str, int]): dictionary mapping class name to class index
extensions (Optional[Tuple[str, ...]], optional): A list of allowed extensions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional is repeated twice now (here and below). I'm not sure if we started to add arg type as typing annotations... @pmeier what do you think ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should stick to one form. Either

extensions (optional): A list of allowed extensions.

or

extensions (Optional[Tuple[str, ...]]): Allowed extensions.

I prefer the second version especially because the type hints can be auto generated from the annotations. That being said we need a sphinx extension for that and thus we should stick to the first version for now.


I've just realized that the type annotation and the docstring contradict each other. Should this be a list or a tuple?

Copy link
Contributor Author

@bjuncek bjuncek Nov 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

the latter type was auto-generated, sorry about that. Pushed the changes that hopefully resolve this :)
Please let me know if this is OK to merge :)

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fmassa fmassa merged commit 3852b41 into pytorch:master Nov 6, 2020
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
* initial docstring

* Revert "initial docstring"

This reverts commit 2bf68ca.

* revert the formatting changes

* clear up per Victor's comment

* Addressing PR comments

Co-authored-by: Bruno Korbar <korbar@vggdev9.vggdev.cluster>
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
* initial docstring

* Revert "initial docstring"

This reverts commit 2bf68ca.

* revert the formatting changes

* clear up per Victor's comment

* Addressing PR comments

Co-authored-by: Bruno Korbar <korbar@vggdev9.vggdev.cluster>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants