summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2022-02-10 18:53:18 -0500
committerThien-Thi Nguyen <ttn@gnuvola.org>2022-02-10 18:53:18 -0500
commit2c0b6e7c77db084faa981d11defb9f737b7f21c0 (patch)
treedc18a23944908e259c903b4010af20308d6eb852 /doc
parent4d3b4e69afdd473bba12a31cdebad16b6245a6f5 (diff)
downloadtaler-util-2c0b6e7c77db084faa981d11defb9f737b7f21c0.tar.gz
taler-util-2c0b6e7c77db084faa981d11defb9f737b7f21c0.tar.bz2
taler-util-2c0b6e7c77db084faa981d11defb9f737b7f21c0.zip
add vertical space to example blocks
Diffstat (limited to 'doc')
-rw-r--r--doc/doc.org16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/doc.org b/doc/doc.org
index c8f097c..60779b4 100644
--- a/doc/doc.org
+++ b/doc/doc.org
@@ -71,8 +71,10 @@ the constructor throws an =AmountOverflowError= exception.
The constructor takes three args: =currency=, =value=, =fraction=.
: >>> from taler.util.amount import Amount, SignedAmount
+:
: # KUDOS 10.50
: >>> amt = Amount ("KUDOS", 10, 50000000)
+:
: >>> amt
: Amount(currency='KUDOS', value=10, fraction=50000000)
@@ -94,7 +96,9 @@ a =CurrencyMismatchError= exception.
: >>> amt + amt
: Amount(currency='KUDOS', value=21, fraction=0)
+:
: >>> another = Amount ("KUDOS", 5, 42)
+:
: >>> amt - another
: Amount(currency='KUDOS', value=5, fraction=49999958)
@@ -114,10 +118,13 @@ output.
: >>> str (amt)
: 'KUDOS:10.5'
+:
: >>> amt.stringify()
: 'KUDOS:10.5'
+:
: >>> amt.stringify(pretty=True)
: '10.5 KUDOS'
+:
: >>> (amt + amt).stringify(pretty=True)
: '21 KUDOS'
@@ -134,6 +141,7 @@ if both currencies are not the same.
: >>> amt > another
: True
+:
: >>> amt == another
: False
@@ -145,8 +153,10 @@ You can derive a =SignedAmount= from a simple =Amount= with the
=as_signed= method.
: >>> p = amt.as_signed ()
+:
: >>> p.is_positive
: True
+:
: >>> p.amount
: Amount(currency='KUDOS', value=10, fraction=50000000)
@@ -154,8 +164,10 @@ A =SignedAmount= object supports addition, subtraction, and comparison
(equality and inequality) with another =SignedAmount= object.
: >>> q = another.as_signed ()
+:
: >>> (p - q).is_positive
: True
+:
: >>> (q - p).is_positive
: False
@@ -164,6 +176,7 @@ The =stringify= method, like that for =Amount=, takes optional keyword
: >>> (p - q).stringify (pretty=False)
: '+KUDOS:5.49999958'
+:
: >>> (q - p).stringify (pretty=True)
: '-5.49999958 KUDOS'
@@ -177,8 +190,10 @@ positive =SignedAmount=.
Lastly, a =SignedAmount= object can flip its sign using a unary minus.
: >>> n = q - p
+:
: >>> n.is_positive
: False
+:
: >>> (- n).is_positive
: True
@@ -254,6 +269,7 @@ then the expansion might be:
The =GnunetLogger= constructor takes one argument, =component=.
: >>> from taler.util.gnunet_log import GnunetLogger
+:
: >>> l = GnunetLogger ("ui")
*** method =log=