summaryrefslogtreecommitdiff
path: root/doc/doc.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/doc.txt')
-rw-r--r--doc/doc.txt94
1 files changed, 28 insertions, 66 deletions
diff --git a/doc/doc.txt b/doc/doc.txt
index 82c32a3..9248a83 100644
--- a/doc/doc.txt
+++ b/doc/doc.txt
@@ -29,7 +29,6 @@ Table of Contents
.. 3. retrieving values
..... 1. specific values
..... 2. entire set
-.. 4. usage as a program
The Taler-Util library provides several classes that deal with various
@@ -113,10 +112,10 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> from taler.util.amount import Amount, SignedAmount
- │
+ │
│ # KUDOS 10.50
│ >>> amt = Amount ("KUDOS", 10, 50000000)
- │
+ │
│ >>> amt
│ Amount(currency='KUDOS', value=10, fraction=50000000)
└────
@@ -148,9 +147,9 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> amt + amt
│ Amount(currency='KUDOS', value=21, fraction=0)
- │
+ │
│ >>> another = Amount ("KUDOS", 5, 42)
- │
+ │
│ >>> amt - another
│ Amount(currency='KUDOS', value=5, fraction=49999958)
└────
@@ -177,13 +176,13 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> str (amt)
│ 'KUDOS:10.5'
- │
+ │
│ >>> amt.stringify()
│ 'KUDOS:10.5'
- │
+ │
│ >>> amt.stringify(pretty=True)
│ '10.5 KUDOS'
- │
+ │
│ >>> (amt + amt).stringify(pretty=True)
│ '21 KUDOS'
└────
@@ -205,7 +204,7 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> amt > another
│ True
- │
+ │
│ >>> amt == another
│ False
└────
@@ -220,10 +219,10 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> p = amt.as_signed ()
- │
+ │
│ >>> p.is_positive
│ True
- │
+ │
│ >>> p.amount
│ Amount(currency='KUDOS', value=10, fraction=50000000)
└────
@@ -234,10 +233,10 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> q = another.as_signed ()
- │
+ │
│ >>> (p - q).is_positive
│ True
- │
+ │
│ >>> (q - p).is_positive
│ False
└────
@@ -249,7 +248,7 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> (p - q).stringify (pretty=False)
│ '+KUDOS:5.49999958'
- │
+ │
│ >>> (q - p).stringify (pretty=True)
│ '-5.49999958 KUDOS'
└────
@@ -269,10 +268,10 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> n = q - p
- │
+ │
│ >>> n.is_positive
│ False
- │
+ │
│ >>> (- n).is_positive
│ True
└────
@@ -378,7 +377,7 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> from taler.util.gnunet_log import GnunetLogger
- │
+ │
│ >>> l = GnunetLogger ("ui")
└────
@@ -422,10 +421,10 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> from taler.util.payto import PaytoParse
- │
+ │
│ # from RFC 8905
│ >>> uri = "payto://iban/DE75512108001245126199?amount=EUR:200.0&message=hello"
- │
+ │
│ >>> p = PaytoParse (uri)
│ Traceback (most recent call last):
│ File "<stdin>", line 1, in <module>
@@ -441,21 +440,21 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ >>> uri = "payto://iban/SOGEDEFFXXX/DE75512108001245126199?amount=EUR:200.0&message=hello"
- │
+ │
│ >>> p = PaytoParse (uri)
- │
+ │
│ >>> p.target
│ 'DE75512108001245126199'
- │
+ │
│ >>> p.bank
│ 'SOGEDEFFXXX'
- │
+ │
│ >>> p.authority
│ 'iban'
- │
+ │
│ >>> p.message
│ 'hello'
- │
+ │
│ >>> p.amount
│ Amount(currency='EUR', value=200, fraction=0)
└────
@@ -510,12 +509,6 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
The same would result if ‘TALER_PREFIX’ were ‘/usr/local’ (the
suffixing is unconditional).
- • if module ‘talerpaths’ exists and exports ‘TALER_DATADIR’, then the
- directory named by suffixing its value with ‘share/taler/config.d’
-
- FIXME: Comment in code: "not clear if this is a good idea" – Maybe
- we should remove this functionality or leave it undocumented?
-
If ‘load_defaults’ cannot find something to load it logs a warning "no
base directory found".
@@ -541,9 +534,9 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
These mimic shell-style variable expansion. In all these constructs,
the value of ‘X’ replaces the construct. In the second one only, if
- the value of ‘X’ is empty, use the value of ‘Y’ instead.
-
- FIXME: Can the second type be nested (i.e., ‘${X:-${Y:-Z}}’)?
+ the value of ‘X’ is empty, use the value of ‘Y’ instead. Also, the
+ second type can be nested, i.e., ‘${X:-${Y:-Z}}’. That is, if ‘X’ is
+ empty, try ‘Y’, and if ‘Y’ is empty, try ‘Z’.
For example, ‘${TMPDIR:-/tmp}/taler-test’ expands to
‘/var/tmp/taler-test’ if environment variable ‘TMPDIR’ has value
@@ -591,36 +584,5 @@ Ongoing discussion: <https://bugs.gnunet.org/view.php?id=6649>
┌────
│ [section]
- │ option = value # FIXME (what is location?)
+ │ option = value # filename & line number pair
└────
-
-
-6.4 usage as a program
-──────────────────────
-
- FIXME: Is this supposed to be documented? Seems out of place in a
- library. Maybe it's there only for testing purposes? Another idea is
- to move it to its own utility program.
-
- If ‘talerconfig.py’ is invoked from the command-line, it functions as
- a program that displays either a specific value or dumps the entire
- set, depending on the command-line args given.
-
- Options are:
-
- ‘-c, --config FILE’
- Read Taler configuration from ‘FILE’. See ‘from_file’ (above)
- for behavior if unspecified.
-
- ‘-s, --section SECTION’
- Look for option in section ‘SECTION’.
-
- ‘-o, --option OPTION’
- Display value associated with option ‘OPTION’.
-
- ‘-f, --filename’
- If the value is a string, do shell-style variable expansion (see
- above) on it.
-
- If both ‘SECTION’ and ‘OPTION’ are omitted, display the entire set of
- values using the ‘dump’ method (see above).