Skip to content

Conversation

@gnarf
Copy link
Contributor

@gnarf gnarf commented Jul 5, 2017

This uses the output from a npm run build from https://github.com/probcomp/iventure-jsviz/pull/5 which creates a dist/iventure-jsviz.js

@gnarf gnarf requested a review from fsaad July 5, 2017 17:34
return Javascript(script.format(host=host, port=port))


def whenReady(script):
Copy link
Collaborator

Choose a reason for hiding this comment

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

No camelcase for function names in python, when_ready.



def whenReady(script):
"""execute your JS script when iventure-jsviz is ready"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Docsting should be punctuated as full sentence, and avoid vague references .e.g "your" (whose?)
"""Execute JS script when iventure-jsviz is ready."""

return whenReady(
'interactive_bar(cell, %s)' % (
df.to_json(orient='split')
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For string formatting with a % sign and a single parameter, force the argument into a tuple using a trailing-comma (this behavior is needed mostly to handle python quirks):

return when_ready('interactive_bar(cell, %s)' % (df.to_json(orient='split'),))

@riastradh-probcomp
Copy link
Contributor

@gnarf: Can you write a README for how to use this?

@gnarf
Copy link
Contributor Author

gnarf commented Jul 6, 2017 via email

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.

3 participants