summaryrefslogtreecommitdiff
path: root/taler
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-01-15 14:09:18 +0100
committerFlorian Dold <florian.dold@gmail.com>2020-01-15 14:09:18 +0100
commita18041565c55644631e6e5f4bcad4b984220c64b (patch)
tree4ff65c017c6cbf2cd624e61f2ed8178459cb0296 /taler
parent53c49f93115cc43342336f5e7a4876e7209bfc7d (diff)
downloadtaler-util-a18041565c55644631e6e5f4bcad4b984220c64b.tar.gz
taler-util-a18041565c55644631e6e5f4bcad4b984220c64b.tar.bz2
taler-util-a18041565c55644631e6e5f4bcad4b984220c64b.zip
spacing
Diffstat (limited to 'taler')
-rw-r--r--taler/util/amount.py43
-rw-r--r--taler/util/gen_errcodes_c.py2
2 files changed, 25 insertions, 20 deletions
diff --git a/taler/util/amount.py b/taler/util/amount.py
index 3c11a43..99986f9 100644
--- a/taler/util/amount.py
+++ b/taler/util/amount.py
@@ -1,25 +1,25 @@
-# This file is part of TALER
-# (C) 2017, 2019 Taler Systems SA
+# This file is part of GNU Taler
+# (C) 2017-2020 Taler Systems SA
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later
-# version.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later
+# version.
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
#
-# @author Marcello Stanisci
-# @version 0.1
-# @repository https://git.taler.net/taler-util.git/
+# @author Marcello Stanisci
+# @version 0.1
+# @repository https://git.taler.net/taler-util.git/
from dataclasses import dataclass
from functools import total_ordering
@@ -163,6 +163,13 @@ class Amount:
def __lt__(self, other):
return self.cmp(other) == -1
+ def as_signed(self):
+ """
+ Return the (positive) SignedAmount corresponding to
+ this amount.
+ """
+ return SignedAmount(True, self)
+
@total_ordering
class SignedAmount:
diff --git a/taler/util/gen_errcodes_c.py b/taler/util/gen_errcodes_c.py
index 51b30cb..400522c 100644
--- a/taler/util/gen_errcodes_c.py
+++ b/taler/util/gen_errcodes_c.py
@@ -61,8 +61,6 @@ enum TALER_ErrorCode
"""
post = """
-
-
};