Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion execjs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def runtimes():

def available_runtimes():
"""return a dictionary of all supported JavaScript runtimes which is usable"""
return dict((name, runtime) for name, runtime in _runtimes.items() if runtime.is_available())
return {
name: runtime
for name, runtime in _runtimes.items()
if runtime.is_available()
}
Comment on lines -93 to +97
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function available_runtimes refactored with the following changes:



def _auto_detect():
Expand Down
7 changes: 2 additions & 5 deletions execjs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ def main():

context = runtime.compile("\n".join(codes))
if opts.expr:
if isinstance(opts.expr, bytes):
expr = opts.expr.decode()
else:
expr = opts.expr
expr = opts.expr.decode() if isinstance(opts.expr, bytes) else opts.expr
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

sys.stdout.write(repr(context.eval(expr)) + "\n")
else:
ret = context.eval(sys.stdin.read())
sys.stdout.write(repr(ret) + "\n")

if "__main__" == __name__:
if __name__ == "__main__":
Comment on lines -56 to +53
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 56-56 refactored with the following changes:

main()