facebook / pyre-check

Performant type-checking for python.
https://pyre-check.org/
MIT License
6.79k stars 432 forks source link

added show to registry #890

Closed esohel30 closed 1 month ago

esohel30 commented 2 months ago

869

This pull request adds pp and show functions to the Registry module to enable pretty-printing of the map contents for easier debugging and logging.

Changes:

Added pp Function:

The pp function formats the map's key-value pairs for pretty-printing. Utilizes Format.fprintf for formatting and printing the map contents in a readable format.

Added show Function:

The show function converts the map to a string representation using the pp function.

Uses Format.asprintf to generate the string representation of the map.

esohel30 commented 2 months ago

Hey maxime I am kind of confused about pretty-printing a registry. How do I go about doing it within a test. I understand that I don't have to make it a test and that I just need to demonstrate that it works by showing some logs/stderr output but I am still confused on how to go about doing that.

arthaud commented 1 month ago

Done in https://github.com/facebook/pyre-check/pull/877