Coverage for src/pycse/obipython.py: 0.00%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-23 16:23 -0400
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-23 16:23 -0400
1"""Legacy module for ob-ipython and org-mode.
3I should probably remove this when we switch to emacs-jupyter.
4"""
6import IPython
7from tabulate import tabulate
10class OrgFormatter(IPython.core.formatters.BaseFormatter):
11 """A special formatter for Org."""
13 def __call__(self, obj):
14 """Call function for the class."""
15 try:
16 return tabulate(obj, headers="keys", tablefmt="orgtbl", showindex="always")
17 # I am not sure what exceptions get thrown, or why this is here.
18 except: # noqa: E722
19 return None
22try:
23 ip = IPython.get_ipython()
24 ip.display_formatter.formatters["text/org"] = OrgFormatter()
25except AttributeError:
26 pass