Skip to content

Docstring default values + minor corrections #782

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

Merged
merged 22 commits into from
Jun 22, 2019

Conversation

shammamah-zz
Copy link
Contributor

@shammamah-zz shammamah-zz commented Jun 19, 2019

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • Add default values to generated docstrings, if they are defined
    • Ensure that component names that start with a vowel are preceded by "An" and not "A"
    • Remove duplicate periods in top-level component descriptions, and add periods if they are missing
    • Change pluralization for "list of" prop when it's a list of dict (as opposed to an "s" being appended after all of the keys are defined for a dict)
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follow
    • this github #PR number updates the dash docs
    • here is the show and tell thread in plotly dash community

@shammamah-zz shammamah-zz force-pushed the docstring-default-values branch from 3b6b683 to 584341c Compare June 20, 2019 20:02
Remove string comparison to number.
@shammamah-zz shammamah-zz force-pushed the docstring-default-values branch from 584341c to 6ae9004 Compare June 20, 2019 20:09
Shammamah Hossain added 2 commits June 20, 2019 17:46
Add 'dict' to all props that are objects in metadata_test.
…fied.

Replace 'optional' with default values for props that have them specified in metadata_test.
@shammamah-zz shammamah-zz force-pushed the docstring-default-values branch from 6783169 to 29266ce Compare June 20, 2019 21:50
@shammamah-zz shammamah-zz force-pushed the docstring-default-values branch from 29266ce to db2230b Compare June 20, 2019 21:54

Keyword arguments:\n{args}"""
).format(
n='n' if component_name[0].lower() in ['a', 'e', 'i', 'o', 'u']
else '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Classy touch 🥂

@@ -249,6 +251,8 @@ def create_docstring(component_name, props, description):
else prop['flowType'],
required=prop['required'],
description=prop['description'],
default=prop['defaultValue']['value']
if 'defaultValue' in prop.keys() else '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

🐄 'defaultValue' in prop is sufficient, .keys() is unneeded

Copy link
Collaborator

Choose a reason for hiding this comment

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

this gets repeated a few times - 🌴 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit conflicted about moving this out into a function or something. It would need to be at the topmost scope, and only gets used three times. Is there another way to do this without repeating myself?

Copy link
Contributor Author

@shammamah-zz shammamah-zz Jun 21, 2019

Choose a reason for hiding this comment

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

(The .keys() have been removed in 9271f5b and f5bbab4 (I found another instance of it being used, so I went ahead and fixed that too).)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried doing this, just for brevity: bbccf47

Copy link
Collaborator

Choose a reason for hiding this comment

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

I probably would have just made a top-level function but that's OK, we can leave it inline. I don't think bbccf47 is an improvement - shorter in one case, longer in the others, and less readable.

Though, the other thing you could do is move this logic into create_prop_docstring - ie pass the whole object in rather than the string value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prop objects wouldn't have been trivial to extract in situations like this:

So I compromised with 20cf393!

Shammamah Hossain added 8 commits June 21, 2019 10:03
@shammamah-zz shammamah-zz force-pushed the docstring-default-values branch from 3189ad8 to 20cf393 Compare June 21, 2019 19:33
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

Nice job! 💃

@shammamah-zz shammamah-zz merged commit ba27feb into master Jun 22, 2019
@shammamah-zz shammamah-zz deleted the docstring-default-values branch June 22, 2019 01:29
@shammamah-zz shammamah-zz mentioned this pull request Aug 2, 2019
6 tasks
HammadTheOne added a commit to HammadTheOne/dash that referenced this pull request May 28, 2021
* Changed window.location for absolute paths

* Added integration tests

* Flaky test run 3.7
HammadTheOne added a commit that referenced this pull request Jul 23, 2021
* Changed window.location for absolute paths

* Added integration tests

* Flaky test run 3.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants