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
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A module that shows every type of documentable class / method / function.
Attributes:
ATTRIBUTE_VALUE (float):
Some number.
"""
ATTRIBUTE_VALUE = 14.3
class MyKlass(object):
"""A class that does something.
Multi-line information here.
Attributes:
attribute_value (str):
Some string.
"""
attribute_value = "asdfasdf"
def __init__(self, value):
"""Create this instance."""
# A comment that should show up in the unittest's results
super(MyKlass, self).__init__()
@staticmethod
def get_staticmethod():
"""int: Get some value."""
return 8
@classmethod
def get_classmethod(cls):
"""int: Get some value."""
return 8
def get_method(self):
"""int: Get some value."""
return 8
class ParentClass(object):
"""The outter class.
Attributes:
attribute_value (str):
Some string.
"""
attribute_value = "tttt"
class NestedClass(object):
"""A class within a class.
Attributes:
attribute_value (str):
Some string.
"""
attribute_value = "zzzzzzzzzzzzz"
@staticmethod
def get_staticmethod():
"""int: Get some value."""
return 5
@classmethod
def get_classmethod(cls):
"""int: Get some value."""
return 5
def get_method(self):
"""int: Get some value."""
return 5
@staticmethod
def get_staticmethod():
"""int: Get some value."""
return 6
@classmethod
def get_classmethod(cls):
"""int: Get some value."""
return 6
def get_method(self):
"""int: Get some value."""
return 6
def _set_private_function_thing(value, another):
"""Do something here."""
# Do something with these values
# and more comment text, here.
#
if value:
return 2
# Another comment
return 1
def set_function_thing(value, another):
if value:
return 2
return 1
|