1 """Something just to look at via pydoc.""" 2 3 import types 4 5 class A_classic: 6 "A classic class." 7 def A_method(self): 8 "Method defined in A." 9 def AB_method(self): 10 "Method defined in A and B." 11 def AC_method(self): 12 "Method defined in A and C." 13 def AD_method(self): 14 "Method defined in A and D." 15 def ABC_method(self): 16 "Method defined in A, B and C." 17 def ABD_method(self): 18 "Method defined in A, B and D." 19 def ACD_method(self): 20 "Method defined in A, C and D." 21 def ABCD_method(self): 22 "Method defined in A, B, C and D." 23 24 25 class B_classic(A_classic): 26 "A classic class, derived from A_classic." 27 def AB_method(self): 28 "Method defined in A and B." 29 def ABC_method(self): 30 "Method defined in A, B and C." 31 def ABD_method(self): 32 "Method defined in A, B and D." 33 def ABCD_method(self): 34 "Method defined in A, B, C and D." 35 def B_method(self): 36 "Method defined in B." 37 def BC_method(self): 38 "Method defined in B and C." 39 def BD_method(self): 40 "Method defined in B and D." 41 def BCD_method(self): 42 "Method defined in B, C and D." 43 44 class C_classic(A_classic): 45 "A classic class, derived from A_classic." 46 def AC_method(self): 47 "Method defined in A and C." 48 def ABC_method(self): 49 "Method defined in A, B and C." 50 def ACD_method(self): 51 "Method defined in A, C and D." 52 def ABCD_method(self): 53 "Method defined in A, B, C and D." 54 def BC_method(self): 55 "Method defined in B and C." 56 def BCD_method(self): 57 "Method defined in B, C and D." 58 def C_method(self): 59 "Method defined in C." 60 def CD_method(self): 61 "Method defined in C and D." 62 63 class D_classic(B_classic, C_classic): 64 "A classic class, derived from B_classic and C_classic." 65 def AD_method(self): 66 "Method defined in A and D." 67 def ABD_method(self): 68 "Method defined in A, B and D." 69 def ACD_method(self): 70 "Method defined in A, C and D." 71 def ABCD_method(self): 72 "Method defined in A, B, C and D." 73 def BD_method(self): 74 "Method defined in B and D." 75 def BCD_method(self): 76 "Method defined in B, C and D." 77 def CD_method(self): 78 "Method defined in C and D." 79 def D_method(self): 80 "Method defined in D." 81 82 83 class A_new(object): 84 "A new-style class." 85 86 def A_method(self): 87 "Method defined in A." 88 def AB_method(self): 89 "Method defined in A and B." 90 def AC_method(self): 91 "Method defined in A and C." 92 def AD_method(self): 93 "Method defined in A and D." 94 def ABC_method(self): 95 "Method defined in A, B and C." 96 def ABD_method(self): 97 "Method defined in A, B and D." 98 def ACD_method(self): 99 "Method defined in A, C and D." 100 def ABCD_method(self): 101 "Method defined in A, B, C and D." 102 103 def A_classmethod(cls, x): 104 "A class method defined in A." 105 A_classmethod = classmethod(A_classmethod) 106 107 def A_staticmethod(): 108 "A static method defined in A." 109 A_staticmethod = staticmethod(A_staticmethod) 110 111 def _getx(self): 112 "A property getter function." 113 def _setx(self, value): 114 "A property setter function." 115 def _delx(self): 116 "A property deleter function." 117 A_property = property(fdel=_delx, fget=_getx, fset=_setx, 118 doc="A sample property defined in A.") 119 120 A_int_alias = int 121 122 class B_new(A_new): 123 "A new-style class, derived from A_new." 124 125 def AB_method(self): 126 "Method defined in A and B." 127 def ABC_method(self): 128 "Method defined in A, B and C." 129 def ABD_method(self): 130 "Method defined in A, B and D." 131 def ABCD_method(self): 132 "Method defined in A, B, C and D." 133 def B_method(self): 134 "Method defined in B." 135 def BC_method(self): 136 "Method defined in B and C." 137 def BD_method(self): 138 "Method defined in B and D." 139 def BCD_method(self): 140 "Method defined in B, C and D." 141 142 class C_new(A_new): 143 "A new-style class, derived from A_new." 144 145 def AC_method(self): 146 "Method defined in A and C." 147 def ABC_method(self): 148 "Method defined in A, B and C." 149 def ACD_method(self): 150 "Method defined in A, C and D." 151 def ABCD_method(self): 152 "Method defined in A, B, C and D." 153 def BC_method(self): 154 "Method defined in B and C." 155 def BCD_method(self): 156 "Method defined in B, C and D." 157 def C_method(self): 158 "Method defined in C." 159 def CD_method(self): 160 "Method defined in C and D." 161 162 class D_new(B_new, C_new): 163 """A new-style class, derived from B_new and C_new. 164 """ 165 166 def AD_method(self): 167 "Method defined in A and D." 168 def ABD_method(self): 169 "Method defined in A, B and D." 170 def ACD_method(self): 171 "Method defined in A, C and D." 172 def ABCD_method(self): 173 "Method defined in A, B, C and D." 174 def BD_method(self): 175 "Method defined in B and D." 176 def BCD_method(self): 177 "Method defined in B, C and D." 178 def CD_method(self): 179 "Method defined in C and D." 180 def D_method(self): 181 "Method defined in D." 182 183 class FunkyProperties(object): 184 """From SF bug 472347, by Roeland Rengelink. 185 186 Property getters etc may not be vanilla functions or methods, 187 and this used to make GUI pydoc blow up. 188 """ 189 190 def __init__(self): 191 self.desc = {'x':0} 192 193 class get_desc: 194 def __init__(self, attr): 195 self.attr = attr 196 def __call__(self, inst): 197 print 'Get called', self, inst 198 return inst.desc[self.attr] 199 class set_desc: 200 def __init__(self, attr): 201 self.attr = attr 202 def __call__(self, inst, val): 203 print 'Set called', self, inst, val 204 inst.desc[self.attr] = val 205 class del_desc: 206 def __init__(self, attr): 207 self.attr = attr 208 def __call__(self, inst): 209 print 'Del called', self, inst 210 del inst.desc[self.attr] 211 212 x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x') 213 214 215 submodule = types.ModuleType(__name__ + '.submodule', 216 """A submodule, which should appear in its parent's summary""") 217