Skip to content

Documentation Utilities

Doc Utilities.

doc_from_type

doc_from_type(type_, title=None, descr=None, comment=None)

Create Doc with defaults from type_.

Parameters:

Name Type Description Default
type_ BaseType

Type to derive from.

required

Other Parameters:

Name Type Description
title str | None

Full Spoken Name.

descr str | None

Documentation Description.

comment str | None

Source Code Comment. Default is 'title'

Dictorary Examples

Basics:

>>> import ucdp as u
>>> class MyType(u.BitType):
...     title:str = "My Bit Title"
...     comment:str = "My Bit Comment"
>>> u.doc_from_type(MyType())
Doc(title='My Bit Title', comment='My Bit Comment')
>>> u.doc_from_type(MyType(), title="My Title")
Doc(title='My Title', comment='My Bit Comment')
>>> u.doc_from_type(MyType(), title="My Title", comment="")
Doc(title='My Title', comment='')
>>> u.doc_from_type(MyType(), comment="My Comment")
Doc(title='My Bit Title', comment='My Comment')