From f71a94a5977de93d84b6f00a92a8be6c72f9a50b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 18 Feb 2020 10:15:44 +0300 Subject: [PATCH] More seealso directive usage --- doc/examples.rst | 8 ++++---- pyderasn.py | 33 ++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/doc/examples.rst b/doc/examples.rst index a0f7ee0..ddc2d0e 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -184,12 +184,12 @@ it's DER encoded representation is already in ``raw`` variable):: serialNumber: CertificateSerialNumber INTEGER 61595; signature: AlgorithmIdentifier SEQUENCE[OBJECT IDENTIFIER 1.2.840.113549.1.1.5... -:ref:`Look here ` for better pretty printing. +.. seealso:: :ref:`Better pretty printing ` As command line utility ----------------------- -:ref:`Look here `. +.. seealso:: :ref:`cmdline` Descriptive errors ------------------ @@ -327,8 +327,8 @@ printer will show:: . . . . . . . 74:73:20:50:74:79:20:4C:74:64 95 [1,1, 24] . . . . . . . DEFINED BY (2.5.4.10): PrintableString PrintableString Internet Widgits Pty Ltd -:ref:`Read more ` about that feature. +.. seealso:: :ref:`definedby` Streaming and dealing with huge structures ------------------------------------------ -:ref:`Look here `. +.. seealso:: :ref:`streaming` diff --git a/pyderasn.py b/pyderasn.py index c9d6a11..62e884b 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -763,6 +763,8 @@ forcefully encoded in DER during CER encoding, by specifying bounds = (1, 32) der_forced = True +.. _agg_octet_string: + agg_octet_string ________________ @@ -1759,13 +1761,13 @@ class Obj(object): @property def tlen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return len(self.tag) @property def tlvlen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.tlen + self.llen + self.vlen @@ -1921,7 +1923,8 @@ class Obj(object): That method is identical to :py:meth:`pyderasn.Obj.decode`, but it returns the generator producing ``(decode_path, obj, tail)`` - values. See :ref:`evgen mode `. + values. + .. seealso:: :ref:`evgen mode `. """ if ctx is None: ctx = {} @@ -2070,25 +2073,25 @@ class Obj(object): @property def expled(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self._expl is not None @property def expl_tag(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self._expl @property def expl_tlen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return len(self._expl) @property def expl_llen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ if self.expl_lenindef: return 1 @@ -2096,31 +2099,31 @@ class Obj(object): @property def expl_offset(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.offset - self.expl_tlen - self.expl_llen @property def expl_vlen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.tlvlen @property def expl_tlvlen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.expl_tlen + self.expl_llen + self.expl_vlen @property def fulloffset(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.expl_offset if self.expled else self.offset @property def fulllen(self): - """See :ref:`decoding` + """.. seealso:: :ref:`decoding` """ return self.expl_tlvlen if self.expled else self.tlvlen @@ -4074,6 +4077,8 @@ def agg_octet_string(evgens, decode_path, raw, writer): :param writer: buffer.write where string is going to be saved :param writer: where string is going to be saved. Must comply with ``io.RawIOBase.write`` behaviour + + .. seealso:: :ref:`agg_octet_string` """ decode_path_len = len(decode_path) for dp, obj, _ in evgens: @@ -4291,7 +4296,9 @@ class ObjectIdentifier(Obj): tuple element is ``{OID: pyderasn.Obj()}`` dictionary, mapping between current OID value and structure applied to defined field. - :ref:`Read about DEFINED BY ` + + .. seealso:: :ref:`definedby` + :param bytes impl: override default tag with ``IMPLICIT`` one :param bytes expl: override default tag with ``EXPLICIT`` one :param default: set default value. Type same as in ``value`` -- 2.44.0