From 2acd6772c4c19cf55120387dfb5036987a17050d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Koutensk=C3=BD?= Date: Sun, 18 Feb 2018 20:08:43 +0100 Subject: [PATCH] Add a new NullPaddedInt type --- beets/dbcore/types.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/beets/dbcore/types.py b/beets/dbcore/types.py index b909904bd..935d03870 100644 --- a/beets/dbcore/types.py +++ b/beets/dbcore/types.py @@ -143,6 +143,12 @@ class PaddedInt(Integer): return u'{0:0{1}d}'.format(value or 0, self.digits) +class NullPaddedInt(PaddedInt): + """Same as `PaddedInt`, but does not normalize `None` to `0.0`. + """ + null = None + + class ScaledInt(Integer): """An integer whose formatting operation scales the number by a constant and adds a suffix. Good for units with large magnitudes.