Skip to content

Commit

Permalink
Merge pull request #450 from plotly/remove-keywords
Browse files Browse the repository at this point in the history
Use all python keywords when checking if prop name is valid
  • Loading branch information
rmarren1 authored Nov 6, 2018
2 parents 09f551a + 06f848f commit 1c94fd2
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/requirements/dev-requirements-py37.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dash_core_components>=0.35.1
dash_core_components==0.35.1
dash_html_components==0.12.0rc3
dash-flow-example==0.0.3
dash-dangerously-set-inner-html
Expand Down
2 changes: 1 addition & 1 deletion .circleci/requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dash_core_components>=0.35.1
dash_core_components==0.35.1
dash_html_components>=0.12.0rc3
dash_flow_example==0.0.3
dash-dangerously-set-inner-html
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.28.7 - 2018-11-05
## Fixed
- Component generation now uses the same prop name black list in all supported Python versions. Closes [#361](https://github.com/plotly/dash/issues/361). [#450](https://github.com/plotly/dash/pull/450)

## 0.28.6 - 2018-11-05
## Fixed
- `Dash.registered_paths` changed to a `collections.defaultdict(set)`, was appending the same package paths on every index. [#443](https://github.com/plotly/dash/pull/443)
Expand Down
44 changes: 44 additions & 0 deletions dash/development/_all_keywords.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This is a set of Python keywords that cannot be used as prop names.
# Keywords for a particular version are obtained as follows:
# >>> import keyword
# >>> keyword.kwlist

kwlist = set([
'and',
'elif',
'is',
'global',
'as',
'in',
'if',
'from',
'raise',
'for',
'except',
'nonlocal',
'pass',
'finally',
'print',
'import',
'True',
'None',
'return',
'exec',
'await',
'else',
'break',
'not',
'with',
'class',
'assert',
'False',
'yield',
'try',
'while',
'continue',
'del',
'async',
'or',
'def',
'lambda'
])
4 changes: 2 additions & 2 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import copy
import os
import inspect
import keyword
from ._all_keywords import kwlist


def is_number(s):
Expand Down Expand Up @@ -380,7 +380,7 @@ def __repr__(self):
'{:s}=Component.UNDEFINED'.format(p))
for p in prop_keys
if not p.endswith("-*") and
p not in keyword.kwlist and
p not in kwlist and
p not in ['dashEvents', 'fireEvent', 'setProps']] + ['**kwargs']
)

Expand Down
2 changes: 1 addition & 1 deletion dash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.28.6'
__version__ = '0.28.7'

0 comments on commit 1c94fd2

Please sign in to comment.