[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-util] 05/07: add vertical space to example blocks
From: |
gnunet |
Subject: |
[taler-taler-util] 05/07: add vertical space to example blocks |
Date: |
Fri, 11 Feb 2022 01:45:27 +0100 |
This is an automated email from the git hooks/post-receive script.
ttn pushed a commit to branch master
in repository taler-util.
commit 2c0b6e7c77db084faa981d11defb9f737b7f21c0
Author: Thien-Thi Nguyen <ttn@gnuvola.org>
AuthorDate: Thu Feb 10 18:53:18 2022 -0500
add vertical space to example blocks
---
doc/doc.org | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
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=
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-util] branch master updated (35bc3d7 -> 262b998), gnunet, 2022/02/10
- [taler-taler-util] 02/07: change markup for Amount ctor args, properties from / to =, gnunet, 2022/02/10
- [taler-taler-util] 04/07: include "+ fraction" in subheading, gnunet, 2022/02/10
- [taler-taler-util] 03/07: touch up ‘GnunetLogger’ section, gnunet, 2022/02/10
- [taler-taler-util] 01/07: touch up ‘Amount’, ‘SignedAmount’ section, gnunet, 2022/02/10
- [taler-taler-util] 05/07: add vertical space to example blocks,
gnunet <=
- [taler-taler-util] 06/07: add documentation for payto.py, gnunet, 2022/02/10
- [taler-taler-util] 07/07: regenerate doc.{html,txt}, gnunet, 2022/02/10