]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Include code in docs, more docs
authorHenryk Plötz <henryk@ploetzli.ch>
Fri, 10 Aug 2018 22:44:21 +0000 (00:44 +0200)
committerRaphael Michel <mail@raphaelmichel.de>
Mon, 3 Dec 2018 18:34:17 +0000 (19:34 +0100)
docs/conf.py
docs/developer.rst

index 316782fd6636a7ccf65bcbbe2233d7bada185552..d3afa1467fdcba60ce6f554a8a29efc6a0b6e64e 100644 (file)
@@ -39,6 +39,7 @@ extensions = [
     'sphinx.ext.intersphinx',
     'sphinx.ext.todo',
     'sphinx.ext.doctest',
+    'sphinx.ext.viewcode',
 ]
 
 # Add any paths that contain templates here, relative to this directory.
index e49346c63a6eccb2377a8d4f671046f87466fb1c..a7ccf643af61542b15f0bf0c4a3e7e8c48bc0012 100644 (file)
@@ -116,7 +116,19 @@ The only exception is: Every field can be set to ``None`` in order to clear the
     >>> s
     fints.segments.HNHBS1(header=fints.formals.SegmentHeader(None, None, None), message_number=None)
 
-Some segment fields have a variable number of values. These are always treated as a list (convenience exception: setting a non-iterable value operates on the first value of the list), and minimum/maximum list length is obeyed. Setting a value beyond the end of the list results in an exception. Empty values are added to maintain the correct minimum number of values.
+When calling the constructor with non-keyword arguments, fields are assigned in order, with the exception of ``header`` in :class:`~fints.segments.FinTS3Segment` subclasses, which can only be given as a keyword argument. When no ``header`` argument is present, a :class:`~fints.formals.SegmentHeader` is automatically constructed with default values (and no ``number``). It's generally not required to construct the ``header`` parameter manually.
+
+**FIXME** The ``number`` should in the future be generated automatically within in sequence (at least before serializing).
+
+.. code-block:: python
+
+    >>> HNHBS1(42)
+    fints.segments.HNHBS1(header=fints.formals.SegmentHeader('HNHBS', None, 1), message_number=42)
+    >>> HNHBS1(42, header=SegmentHeader('FOO'))
+    fints.segments.HNHBS1(header=fints.formals.SegmentHeader('FOO', None, None), message_number=42)
+
+
+Some segment fields have a variable number of values. These are always treated as a list, and minimum/maximum list length is obeyed. Setting a value beyond the end of the list results in an exception. Empty values are added to maintain the correct minimum number of values.
 
 .. code-block:: python
 
@@ -142,6 +154,17 @@ Some segment fields have a variable number of values. These are always treated a
                     ),
             ],
     )
+    >>> HIRMG2(response=[fints.formals.Response('2342')]).print_nested()
+    fints.segments.HIRMG2(
+        header = fints.formals.SegmentHeader('HIRMG', None, 2),
+        response = [
+                    fints.formals.Response(
+                        response_code = '2342',
+                        reference_element = None,
+                        response_text = None,
+                    ),
+            ],
+    )
 
 
 All Segments