File: sample_module.py

package info (click to toggle)
python-autodoc-traits 1.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212 kB
  • sloc: python: 408; makefile: 3
file content (148 lines) | stat: -rw-r--r-- 3,449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
"""
sample_module docstring

This module provides a module and classes with and without traits to test
autodoc_traits against. It does not contain tests.
"""

from traitlets import Bool, Dict, Instance, Integer, Unicode, Union
from traitlets.config.configurable import Configurable


class SampleConfigurable(Configurable):
    """SampleConfigurable docstring"""

    non_trait = False

    @property
    def non_trait_property(self):
        """non_trait_property docstring"""

    trait = Bool(
        help="""trait help text""",
        config=True,
    )
    trait_nohelp = Bool(
        config=True,
    )
    trait_noconfig = Bool(
        help="""trait_noconfig help text""",
    )

    def method(self):
        """method docstring"""


class SampleConfigurableSubclass(SampleConfigurable):
    """SampleConfigurableSubclass docstring"""

    subclass_non_trait = False

    @property
    def subclass_non_trait_property(self):
        """subclass_non_trait_property docstring"""

    subclass_trait = Bool(
        config=True,
        help="""subclass_trait help text""",
    )
    subclass_trait_nohelp = Bool(
        config=True,
    )
    subclass_trait_noconfig = Bool(
        help="""subclass_trait_noconfig help text""",
    )

    def subclass_method(self):
        """subclass_method docstring"""


class SampleNonConfigurable:
    """SampleNonConfigurable docstring"""

    non_trait = False

    @property
    def non_trait_property(self):
        """non_trait_property docstring"""

    def method(self):
        """method docstring"""


class SampleNonConfigurableSubclass(SampleNonConfigurable):
    """SampleNonConfigurableSubclass docstring"""

    non_trait = False

    @property
    def subclass_non_trait_property(self):
        """subclass_non_trait_property docstring"""

    def subclass_method(self):
        """subclass_method docstring"""


class TraitTypesSampleConfigurable(Configurable):
    """TraitTypesSampleConfigurable docstring"""

    trait_integer = Integer(
        help="""trait_integer help text""",
        config=True,
    )
    trait_integer_nohelp = Integer(
        config=True,
    )
    trait_integer_noconfig = Integer(
        help="""trait_integer_noconfig help text""",
    )

    trait_unicode = Unicode(
        help="""trait_unicode help text""",
        config=True,
    )
    trait_unicode_nohelp = Unicode(
        config=True,
    )
    trait_unicode_noconfig = Unicode(
        help="""trait_unicode_noconfig help text""",
    )

    trait_dict = Dict(
        help="""trait_dict help text""",
        config=True,
    )
    trait_dict_nohelp = Dict(
        config=True,
    )
    trait_dict_noconfig = Dict(
        help="""trait_dict_noconfig help text""",
    )

    trait_instance = Instance(
        klass=SampleConfigurable,
        help="""trait_instance help text""",
        config=True,
    )
    trait_instance_nohelp = Instance(
        klass=SampleConfigurable,
        config=True,
    )
    trait_instance_noconfig = Instance(
        klass=SampleConfigurable,
        help="""trait_instance_noconfig help text""",
    )

    trait_union = Union(
        [Integer(), Unicode()],
        help="""trait_union help text""",
        config=True,
    )
    trait_union_nohelp = Union(
        [Integer(), Unicode()],
        config=True,
    )
    trait_union_noconfig = Union(
        [Integer(), Unicode()],
        help="""trait_union_noconfig help text""",
    )