File: talon.py

package info (click to toggle)
python-sdjson 0.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: python: 1,566; makefile: 6; sh: 6
file content (11 lines) | stat: -rw-r--r-- 213 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
# stdlib
from fractions import Fraction

# this package
import sdjson


# Create a custom encoder for Fraction that turns it into a string
@sdjson.encoders.register(Fraction)
def encode_str(obj):
	return str(obj)