-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
3b6b683
to
584341c
Compare
Remove string comparison to number.
584341c
to
6ae9004
Compare
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.
6783169
to
29266ce
Compare
…ngs. Fix pylint errors.
29266ce
to
db2230b
Compare
|
||
Keyword arguments:\n{args}""" | ||
).format( | ||
n='n' if component_name[0].lower() in ['a', 'e', 'i', 'o', 'u'] | ||
else '', |
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.
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 '', |
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.
🐄 'defaultValue' in prop
is sufficient, .keys()
is unneeded
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.
this gets repeated a few times - 🌴 ?
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.
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?
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.
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.
I tried doing this, just for brevity: bbccf47
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.
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.
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.
The prop objects wouldn't have been trivial to extract in situations like this:
args='\n'.join( |
So I compromised with 20cf393!
…r they contain them.
Only add 's' to end if referring to a non-dict type; otherwise, change 'dict' to 'dicts' and don't put an 's' on the end. Fix pylint error.
Remove all periods from the end of description, if there are any, and add in another one.
3189ad8
to
20cf393
Compare
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.
Nice job! 💃
* Changed window.location for absolute paths * Added integration tests * Flaky test run 3.7
* Changed window.location for absolute paths * Added integration tests * Flaky test run 3.7
Contributor Checklist
optionals
CHANGELOG.md