Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codecolor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codecolor

Inspect python object code with colorful syntax highlighting

  • 0.0.2
  • PyPI
  • Socket score

Maintainers
1

========= codecolor

.. image:: https://raw.githubusercontent.com/zkneupper/codecolor/master/docs/_static/code_color_logo.png

.. image:: https://img.shields.io/pypi/v/codecolor.svg :target: https://pypi.python.org/pypi/codecolor

.. image:: https://img.shields.io/travis/zkneupper/codecolor.svg :target: https://travis-ci.com/zkneupper/codecolor

.. image:: https://readthedocs.org/projects/codecolor/badge/?version=latest :target: https://codecolor.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

Inspect python object code with colorful syntax highlighting!

Codecolor adds color when inspecting source code of python objects. It applies syntax highlighting to object source code.

The primary function of the codecolor module is the printsource function. The printsource(obj, style="default") function prints the syntax-highlighted source code for the python object obj.

Codecolor combines the code inspection functionality of inspect.getsource() and syntax highlighting functionality of the pygments package.

Example

How does the pytorch relu function work under the hood? You can easily inspect the source code of the pytorch relu function by using codecolor.printsource(relu) to to print the source code of the relu function with syntax highlighting.

.. code-block:: python

from codecolor import printsource

from torch.nn.functional import relu

printsource(relu)
# prints the source code of the relu function with syntax highlighting

.. image:: https://raw.githubusercontent.com/zkneupper/codecolor/master/docs/_static/codecolor-demo.gif

Functions:

  • printsource(obj, style="default")
  • getsource(obj, style="default")
  • highlight_code(code, style="default")
  • get_all_styles()

To-Do

  • Add pytest unit tests

  • Flesh out readme

      * Example usage
      * Motivation
      * Installation
      * Center logo image
    
  • Deploy to pypi

Credits

This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _audreyr/cookiecutter-pypackage: https://github.com/audreyr/cookiecutter-pypackage

======= History

0.0.1 (2020-09-19)

  • First release on PyPI.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc