-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Simplify and remove javascript from html_annotate templates. #2793
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d332756
Add annotation info to dispatcher object.
stuartarchibald 946dd1d
Simplify and remove javascript from html_annotate templates.
Carreau ff7ddd2
fix display on firefox
Carreau baf28ff
fix ir line
Carreau e5c6a9a
working prototype
Carreau 6ed911d
support multiple signatures
Carreau a81a60b
fix test
Carreau a0fe24c
mor explicit test error
Carreau f8acace
fix test
Carreau 4651b25
Python2 ify
Carreau 1f85b1d
move new file
Carreau 8a8ec98
Access via `pretty=True`
Carreau 401ddfc
escape filenames
Carreau 9fc8880
Fixes to PR.
stuartarchibald b13cd69
Respond on PR review.
stuartarchibald File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
|
@@ -373,15 +373,28 @@ def inspect_asm(self, signature=None): | |
|
||
return dict((sig, self.inspect_asm(sig)) for sig in self.signatures) | ||
|
||
def inspect_types(self, file=None): | ||
if file is None: | ||
file = sys.stdout | ||
def inspect_types(self, file=None, **kwargs): | ||
""" | ||
print or return annotated source with Numba intermediate IR | ||
|
||
Pass `pretty=True` to attempt color highlighting, and HTML rendering in | ||
Jupyter and IPython by returning an Annotate Object. Pygments | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Pygments"? sentence incomplete |
||
""" | ||
pretty = kwargs.get('pretty', False) | ||
style = kwargs.get('style', 'default') | ||
|
||
for ver, res in utils.iteritems(self.overloads): | ||
print("%s %s" % (self.py_func.__name__, ver), file=file) | ||
print('-' * 80, file=file) | ||
print(res.type_annotation, file=file) | ||
print('=' * 80, file=file) | ||
if not pretty: | ||
if file is None: | ||
file = sys.stdout | ||
|
||
for ver, res in utils.iteritems(self.overloads): | ||
print("%s %s" % (self.py_func.__name__, ver), file=file) | ||
print('-' * 80, file=file) | ||
print(res.type_annotation, file=file) | ||
print('=' * 80, file=file) | ||
else: | ||
from .pretty_annotate import Annotate | ||
return Annotate(self, style=style) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add test to exercise this branch |
||
|
||
def inspect_cfg(self, signature=None, show_wrapper=None): | ||
""" | ||
|
@@ -405,6 +418,17 @@ def inspect_cfg(self, signature=None, show_wrapper=None): | |
return dict((sig, self.inspect_cfg(sig, show_wrapper=show_wrapper)) | ||
for sig in self.signatures) | ||
|
||
def get_annotation_info(self, signature=None): | ||
""" | ||
Gets the annotation information for the function specified by | ||
signature. If no signature is supplied a dictionary of signature to | ||
annotation information is returned. | ||
""" | ||
if signature is not None: | ||
cres = self.overloads[signature] | ||
return cres.type_annotation.annotate_raw() | ||
return dict((sig, self.annotate(sig)) for sig in self.signatures) | ||
|
||
def _explain_ambiguous(self, *args, **kws): | ||
""" | ||
Callback for the C _Dispatcher object. | ||
|
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.
remove this line?