-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
IDE support #276
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
IDE support #276
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a27a5b7
generate_class_string and generate_class_file functions with tests.
rmarren1 e79214a
Add generate_classes function.
rmarren1 3812d8d
generate_classes tests.
rmarren1 03288a1
update generate_classes and tests to automatically look in lib/
rmarren1 f761537
Small change to generate_classes docstring.
rmarren1 4cc4ad1
Added 'AUTO GENERATED FILE - DO NOT EDIT' comment.
rmarren1 0fb3ed9
Small fix to correctly set class _namespace attribute.
rmarren1 c058909
Generate an _imports_.py file so py classes import normally.
rmarren1 84c5214
Fix order of arguments in test case for generate_classes
rmarren1 a3a6a46
Real arguments instead of **kwargs
rmarren1 9140f27
In Python 3, spoof the __init__ function signature.
rmarren1 3c6e4cf
More semantic default arugments objects
rmarren1 ac52a59
Update changelog and version.
rmarren1 6cb29c4
Merge branch 'master' into ide
rmarren1 5858699
Remove extra line in version.py
rmarren1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.21.1' | ||
__version__ = '0.22.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# AUTO GENERATED FILE - DO NOT EDIT | ||
|
||
from dash.development.base_component import Component, _explicitize_args | ||
|
||
|
||
class Table(Component): | ||
"""A Table component. | ||
This is a description of the component. | ||
It's multiple lines long. | ||
|
||
Keyword arguments: | ||
- children (a list of or a singular dash component, string or number; optional) | ||
- optionalArray (list; optional): Description of optionalArray | ||
- optionalBool (boolean; optional) | ||
- optionalNumber (number; optional) | ||
- optionalObject (dict; optional) | ||
- optionalString (string; optional) | ||
- optionalNode (a list of or a singular dash component, string or number; optional) | ||
- optionalElement (dash component; optional) | ||
- optionalEnum (a value equal to: 'News', 'Photos'; optional) | ||
- optionalUnion (string | number; optional) | ||
- optionalArrayOf (list; optional) | ||
- optionalObjectOf (dict with strings as keys and values of type number; optional) | ||
- optionalObjectWithShapeAndNestedDescription (optional): . optionalObjectWithShapeAndNestedDescription has the following type: dict containing keys 'color', 'fontSize', 'figure'. | ||
Those keys have the following types: | ||
- color (string; optional) | ||
- fontSize (number; optional) | ||
- figure (optional): Figure is a plotly graph object. figure has the following type: dict containing keys 'data', 'layout'. | ||
Those keys have the following types: | ||
- data (list; optional): data is a collection of traces | ||
- layout (dict; optional): layout describes the rest of the figure | ||
- optionalAny (boolean | number | string | dict | list; optional) | ||
- customProp (optional) | ||
- customArrayProp (list; optional) | ||
- data-* (string; optional) | ||
- aria-* (string; optional) | ||
- id (string; optional) | ||
|
||
Available events: 'restyle', 'relayout', 'click'""" | ||
@_explicitize_args | ||
def __init__(self, children=None, optionalArray=Component.UNDEFINED, optionalBool=Component.UNDEFINED, optionalFunc=Component.UNDEFINED, optionalNumber=Component.UNDEFINED, optionalObject=Component.UNDEFINED, optionalString=Component.UNDEFINED, optionalSymbol=Component.UNDEFINED, optionalNode=Component.UNDEFINED, optionalElement=Component.UNDEFINED, optionalMessage=Component.UNDEFINED, optionalEnum=Component.UNDEFINED, optionalUnion=Component.UNDEFINED, optionalArrayOf=Component.UNDEFINED, optionalObjectOf=Component.UNDEFINED, optionalObjectWithShapeAndNestedDescription=Component.UNDEFINED, optionalAny=Component.UNDEFINED, customProp=Component.UNDEFINED, customArrayProp=Component.UNDEFINED, id=Component.UNDEFINED, **kwargs): | ||
self._prop_names = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'id'] | ||
self._type = 'Table' | ||
self._namespace = 'TableComponents' | ||
self._valid_wildcard_attributes = ['data-', 'aria-'] | ||
self.available_events = ['restyle', 'relayout', 'click'] | ||
self.available_properties = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'id'] | ||
self.available_wildcard_properties = ['data-', 'aria-'] | ||
|
||
_explicit_args = kwargs.pop('_explicit_args') | ||
_locals = locals() | ||
_locals.update(kwargs) # For wildcard attrs | ||
args = {k: _locals[k] for k in _explicit_args if k != 'children'} | ||
|
||
for k in []: | ||
if k not in args: | ||
raise TypeError( | ||
'Required argument `' + k + '` was not specified.') | ||
super(Table, self).__init__(children=children, **args) | ||
|
||
def __repr__(self): | ||
if(any(getattr(self, c, None) is not None | ||
for c in self._prop_names | ||
if c is not self._prop_names[0]) | ||
or any(getattr(self, c, None) is not None | ||
for c in self.__dict__.keys() | ||
if any(c.startswith(wc_attr) | ||
for wc_attr in self._valid_wildcard_attributes))): | ||
props_string = ', '.join([c+'='+repr(getattr(self, c, None)) | ||
for c in self._prop_names | ||
if getattr(self, c, None) is not None]) | ||
wilds_string = ', '.join([c+'='+repr(getattr(self, c, None)) | ||
for c in self.__dict__.keys() | ||
if any([c.startswith(wc_attr) | ||
for wc_attr in | ||
self._valid_wildcard_attributes])]) | ||
return ('Table(' + props_string + | ||
(', ' + wilds_string if wilds_string != '' else '') + ')') | ||
else: | ||
return ( | ||
'Table(' + | ||
repr(getattr(self, self._prop_names[0], None)) + ')') | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you see room for improvement in making these classes even more minimal? I don't think we have to do it in this PR, but in the future it might be nice if these classes were able to inherit more of this logic, mainly because it looks pretty gnarly 😉
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 think a lot of it could be moved into the base component (pretty much everything that is not an attribute assignment, and even some of those appear to be the same). I'll make a new issue for this