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

[WIP] Revised version of R 'transpiler' with support for generator methods #483

Merged
merged 57 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
03b069d
refactored code to work with generator method
Dec 5, 2018
9b10f91
fixed bug in component generation
Dec 5, 2018
c96092e
Merge branch 'master' of github.com:plotly/dash into R2
Dec 5, 2018
670a03f
fixed bug in R help file function descriptions
Dec 6, 2018
27aeea7
edits to resolve pylint and flake8 unhappiness
Dec 8, 2018
3aca86f
flake8 passes locally
Dec 8, 2018
049bc4b
addresses format template issue
Dec 11, 2018
2c3212e
refactored code to avoid direct use of protocols
Dec 11, 2018
6f615c1
removed unnecessary brackets around string in object_type
Dec 11, 2018
bd6bf8d
added --r-prefix argument to cli
Dec 11, 2018
413c3da
moved import importlib to preamble of .py
Dec 11, 2018
a207992
clarified --rlang help for cli
Dec 11, 2018
ec5733a
edited _r_components_generation.py
Dec 11, 2018
ab39376
refactored prefix assignment, added warning msg
Dec 11, 2018
628ec82
refactored prefix assignment, removed :s in templates
Dec 11, 2018
6afe218
updated docstrings
Dec 11, 2018
d321153
rm unnecessary parens
Dec 11, 2018
759941e
eliminate unnecessary rewrites; fix prop_keys assignment
Dec 11, 2018
600ef85
relocated check for R dir to component_generator.py
Dec 11, 2018
d133043
added line to pull in CSS deps to inst/lib
Dec 11, 2018
a3804eb
added check for R dir to component_generator.py
Dec 11, 2018
3f2eb22
renamed/refactored make_package_name_r to snake_case_to_camel_case
Dec 11, 2018
6f954e5
rm more parens, replace apostrophes with dblquotes
Dec 11, 2018
bb352e8
remove spaces
Dec 11, 2018
ffe7f5f
refactor direct access to JSON keys to use .get instead
Dec 11, 2018
3cf3b22
fixed 2 pylint issues
Dec 11, 2018
99ba5c7
fixed import order in _r_components_generation.py
Dec 11, 2018
7614c4d
edits to satisfy pylint
Dec 11, 2018
8a08914
edits to resolve pylint/flake8 complaints
Dec 11, 2018
8d71c0c
added backticks
Dec 11, 2018
75d29b7
fixed code regression caused by modifying key template in default_wil…
Dec 12, 2018
fcbe971
at suggestion of rmarren1, strip _r suffix from proposed methods
Dec 12, 2018
5c95c87
at suggestion of rmarren1, strip _r suffix from proposed methods
Dec 12, 2018
fa8fb38
edits to address pylint issues in _r_components_generation.py
Dec 12, 2018
a6bfc1e
s/props.keys()/prop_keys
Dec 12, 2018
2094f36
address suggestion by rmarren1 to correct formatting of bracket
Dec 12, 2018
05b8a7e
refactored to avoid :camel: in prop_keys filtering
Dec 12, 2018
c80e33e
:paw_prints: migrated long strings to globals for readability
Dec 12, 2018
c150dd2
resolve pylint complaints
Dec 12, 2018
14d23c2
addresses T4rk1n comment about taking `name` attribute
Dec 13, 2018
8332e0c
fixed missing quotation in propNames removed after earlier edits
Dec 14, 2018
47e8516
fixed props, renamed/improved props_to_r method
Dec 17, 2018
dc8b254
removed comment
Dec 17, 2018
059400f
jk, method *now* json_to_r_type >> props_to_r_type
Dec 17, 2018
0fc3d2d
make warning msg for component prefix more explicit
Dec 17, 2018
3176684
edited to remove use of __contains__
Dec 17, 2018
f8041a7
remove unnecessary call to `os.makedirs`
Dec 17, 2018
df97a38
inserted more detailed docstring for help file generator
Dec 17, 2018
adcddac
fix up docstrings for `generate_js_metadata`
Dec 17, 2018
4ca4d58
removed dead function block
Dec 18, 2018
f7d02dc
converted else back to elif
Dec 18, 2018
cdf8f9c
updated `props_to_r_type`
Dec 18, 2018
4a67a6c
building R pkg now requires setting `--r-prefix`
Dec 18, 2018
99b6438
:paw_prints: relocated `importlib` statements
Dec 18, 2018
5923e6b
Merge branch 'master' into R2
rpkyle Dec 18, 2018
28725e6
removed unnecessary importlib import
Dec 18, 2018
a073828
removed trailing whitespace
Dec 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 20 additions & 39 deletions dash/development/_all_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,23 @@
# >>> 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'
])
python_keywords = {
'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'
}

# This is a set of R reserved words that cannot be used as function
# argument names.
#
# Reserved words can be obtained from R's help pages by executing the
# statement below:
# > ?reserved

r_keywords = {
'if', 'else', 'repeat', 'while', 'function', 'for', 'in', 'next', 'break',
'TRUE', 'FALSE', 'NULL', 'Inf', 'NaN', 'NA', 'NA_integer_', 'NA_real_',
'NA_complex_', 'NA_character_', '...'
}
4 changes: 2 additions & 2 deletions dash/development/_py_components_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

from dash.development.base_component import _explicitize_args
from ._all_keywords import kwlist
from ._all_keywords import python_keywords
from .base_component import Component


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

Expand Down
Loading