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

Docstring format conformity, can you use Google's format? #18944

Open
SamuelMarks opened this issue Dec 15, 2023 · 2 comments
Open

Docstring format conformity, can you use Google's format? #18944

SamuelMarks opened this issue Dec 15, 2023 · 2 comments
Assignees
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer type:docs Need to modify the documentation

Comments

@SamuelMarks
Copy link
Contributor

Happy to send the PR(s).

Although there isn't a precise grammar, there is:

Taken from that last link:

        param2 (:obj:`str`, optional): The second parameter. Defaults to None.

Such a PR would involve these kind of patches:

diff --git a/keras/utils/audio_dataset_utils.py b/keras/utils/audio_dataset_utils.py
index a60784380..4c00de4e2 100644
--- a/keras/utils/audio_dataset_utils.py
+++ b/keras/utils/audio_dataset_utils.py
@@ -85,7 +85,7 @@ def audio_dataset_from_directory(
             If set to `False`, sorts the data in alphanumeric order.
             Defaults to `True`.
         seed: Optional random seed for shuffling and transformations.
-        validation_split: Optional float between 0 and 1, fraction of data to
+        validation_split (`float`, optional): Value between 0 and 1, fraction of data to
             reserve for validation.
         subset: Subset of the data to return. One of `"training"`,
             `"validation"` or `"both"`. Only used if `validation_split` is set.

Is this something you would be interested in switching to?

(this would make parsing your codebase unambiguous for both developer and code parsers)

Thanks for your consideration

@hertschuh
Copy link
Contributor

@SamuelMarks

Question: the codebase does not have type annotations, how would you generate such PRs?
The main issue (which is why we haven't added type annotations) is that many parameters are complex unions.

@SamuelMarks
Copy link
Contributor Author

@hertschuh I can automatically apply type annotations throughout the whole codebase using my open-source library.

If you prefer them to be in the docstrings, like we did pre Python 3.6, then my library also supports that syntax (and NumPy, Google, and ReST docstring formats).

Will need some manually massaging beforehand though, as there is textual ambiguity throughout the documentation.

Anyway I can very quickly fix the docstrings if you are open to the PRs. Want a PR for all of keras, per major module, or per file?

(can send them all before christmas 🎄 )

@sachinprasadhs sachinprasadhs removed the keras-team-review-pending Pending review by a Keras team member. label Dec 21, 2023
@SuryanarayanaY SuryanarayanaY added the stat:awaiting keras-eng Awaiting response from Keras engineer label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer type:docs Need to modify the documentation
Projects
None yet
Development

No branches or pull requests

4 participants