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

HTML Renderer show-all #280

Closed
emil-peters opened this issue Nov 21, 2023 · 2 comments
Closed

HTML Renderer show-all #280

emil-peters opened this issue Nov 21, 2023 · 2 comments

Comments

@emil-peters
Copy link
Contributor

Currently it is not possible to apply the show_all to the HTML output when trying to save HTML output inline using the following:

    f = open("speed.html", "w")
    print(p.output_html(timeline=False), file=f)
    f.close()

This doesn't make sense as the HTMLRenderer extends FrameRenderer and initializes it which does support show_all.

By changing output_html to accept **kwargs, it allows for more freedom in rendering HTML and rendering with the show_all:

    def output_html(self, timeline: bool = False, **kwargs) -> str:
        """
        Return the profile output as HTML, as rendered by :class:`HTMLRenderer`
        """
        return self.output(renderer=renderers.HTMLRenderer(timeline=timeline, **kwargs))

Turning the original code in:

    f = open("speed_all.html", "w")
    print(p.output_html(timeline=False, show_all=True), file=f)
    f.close()
@joerick
Copy link
Owner

joerick commented Nov 21, 2023

Yes, happy to take a PR for that. The only downside of **kwargs is that it doesn't show the option in the documentation, so minor preference to listing it out fully.

@emil-peters
Copy link
Contributor Author

Closed with #281

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

No branches or pull requests

2 participants