#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024-2025 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. import re def pyprint(obj, indent=0, sort=None, lmin=9, lmax=16): if isinstance(obj, str): if obj.startswith("lit:"): return f'''{obj[4:]}''' if "\\" in obj or obj.startswith("re:"): prefix = "r" else: prefix = "" if "\n" in obj: quote = '"""' elif '"' in obj: obj = re.sub(r'(?