Back to index

python3.2  3.2.2
pydocfodder.py
Go to the documentation of this file.
00001 """Something just to look at via pydoc."""
00002 
00003 import types
00004 
00005 class A_classic:
00006     "A classic class."
00007     def A_method(self):
00008         "Method defined in A."
00009     def AB_method(self):
00010         "Method defined in A and B."
00011     def AC_method(self):
00012         "Method defined in A and C."
00013     def AD_method(self):
00014         "Method defined in A and D."
00015     def ABC_method(self):
00016         "Method defined in A, B and C."
00017     def ABD_method(self):
00018         "Method defined in A, B and D."
00019     def ACD_method(self):
00020         "Method defined in A, C and D."
00021     def ABCD_method(self):
00022         "Method defined in A, B, C and D."
00023 
00024 
00025 class B_classic(A_classic):
00026     "A classic class, derived from A_classic."
00027     def AB_method(self):
00028         "Method defined in A and B."
00029     def ABC_method(self):
00030         "Method defined in A, B and C."
00031     def ABD_method(self):
00032         "Method defined in A, B and D."
00033     def ABCD_method(self):
00034         "Method defined in A, B, C and D."
00035     def B_method(self):
00036         "Method defined in B."
00037     def BC_method(self):
00038         "Method defined in B and C."
00039     def BD_method(self):
00040         "Method defined in B and D."
00041     def BCD_method(self):
00042         "Method defined in B, C and D."
00043 
00044 class C_classic(A_classic):
00045     "A classic class, derived from A_classic."
00046     def AC_method(self):
00047         "Method defined in A and C."
00048     def ABC_method(self):
00049         "Method defined in A, B and C."
00050     def ACD_method(self):
00051         "Method defined in A, C and D."
00052     def ABCD_method(self):
00053         "Method defined in A, B, C and D."
00054     def BC_method(self):
00055         "Method defined in B and C."
00056     def BCD_method(self):
00057         "Method defined in B, C and D."
00058     def C_method(self):
00059         "Method defined in C."
00060     def CD_method(self):
00061         "Method defined in C and D."
00062 
00063 class D_classic(B_classic, C_classic):
00064     "A classic class, derived from B_classic and C_classic."
00065     def AD_method(self):
00066         "Method defined in A and D."
00067     def ABD_method(self):
00068         "Method defined in A, B and D."
00069     def ACD_method(self):
00070         "Method defined in A, C and D."
00071     def ABCD_method(self):
00072         "Method defined in A, B, C and D."
00073     def BD_method(self):
00074         "Method defined in B and D."
00075     def BCD_method(self):
00076         "Method defined in B, C and D."
00077     def CD_method(self):
00078         "Method defined in C and D."
00079     def D_method(self):
00080         "Method defined in D."
00081 
00082 
00083 class A_new(object):
00084     "A new-style class."
00085 
00086     def A_method(self):
00087         "Method defined in A."
00088     def AB_method(self):
00089         "Method defined in A and B."
00090     def AC_method(self):
00091         "Method defined in A and C."
00092     def AD_method(self):
00093         "Method defined in A and D."
00094     def ABC_method(self):
00095         "Method defined in A, B and C."
00096     def ABD_method(self):
00097         "Method defined in A, B and D."
00098     def ACD_method(self):
00099         "Method defined in A, C and D."
00100     def ABCD_method(self):
00101         "Method defined in A, B, C and D."
00102 
00103     def A_classmethod(cls, x):
00104         "A class method defined in A."
00105     A_classmethod = classmethod(A_classmethod)
00106 
00107     def A_staticmethod():
00108         "A static method defined in A."
00109     A_staticmethod = staticmethod(A_staticmethod)
00110 
00111     def _getx(self):
00112         "A property getter function."
00113     def _setx(self, value):
00114         "A property setter function."
00115     def _delx(self):
00116         "A property deleter function."
00117     A_property = property(fdel=_delx, fget=_getx, fset=_setx,
00118                           doc="A sample property defined in A.")
00119 
00120     A_int_alias = int
00121 
00122 class B_new(A_new):
00123     "A new-style class, derived from A_new."
00124 
00125     def AB_method(self):
00126         "Method defined in A and B."
00127     def ABC_method(self):
00128         "Method defined in A, B and C."
00129     def ABD_method(self):
00130         "Method defined in A, B and D."
00131     def ABCD_method(self):
00132         "Method defined in A, B, C and D."
00133     def B_method(self):
00134         "Method defined in B."
00135     def BC_method(self):
00136         "Method defined in B and C."
00137     def BD_method(self):
00138         "Method defined in B and D."
00139     def BCD_method(self):
00140         "Method defined in B, C and D."
00141 
00142 class C_new(A_new):
00143     "A new-style class, derived from A_new."
00144 
00145     def AC_method(self):
00146         "Method defined in A and C."
00147     def ABC_method(self):
00148         "Method defined in A, B and C."
00149     def ACD_method(self):
00150         "Method defined in A, C and D."
00151     def ABCD_method(self):
00152         "Method defined in A, B, C and D."
00153     def BC_method(self):
00154         "Method defined in B and C."
00155     def BCD_method(self):
00156         "Method defined in B, C and D."
00157     def C_method(self):
00158         "Method defined in C."
00159     def CD_method(self):
00160         "Method defined in C and D."
00161 
00162 class D_new(B_new, C_new):
00163     """A new-style class, derived from B_new and C_new.
00164     """
00165 
00166     def AD_method(self):
00167         "Method defined in A and D."
00168     def ABD_method(self):
00169         "Method defined in A, B and D."
00170     def ACD_method(self):
00171         "Method defined in A, C and D."
00172     def ABCD_method(self):
00173         "Method defined in A, B, C and D."
00174     def BD_method(self):
00175         "Method defined in B and D."
00176     def BCD_method(self):
00177         "Method defined in B, C and D."
00178     def CD_method(self):
00179         "Method defined in C and D."
00180     def D_method(self):
00181         "Method defined in D."
00182 
00183 class FunkyProperties(object):
00184     """From SF bug 472347, by Roeland Rengelink.
00185 
00186     Property getters etc may not be vanilla functions or methods,
00187     and this used to make GUI pydoc blow up.
00188     """
00189 
00190     def __init__(self):
00191         self.desc = {'x':0}
00192 
00193     class get_desc:
00194         def __init__(self, attr):
00195             self.attr = attr
00196         def __call__(self, inst):
00197             print('Get called', self, inst)
00198             return inst.desc[self.attr]
00199     class set_desc:
00200         def __init__(self, attr):
00201             self.attr = attr
00202         def __call__(self, inst, val):
00203             print('Set called', self, inst, val)
00204             inst.desc[self.attr] = val
00205     class del_desc:
00206         def __init__(self, attr):
00207             self.attr = attr
00208         def __call__(self, inst):
00209             print('Del called', self, inst)
00210             del inst.desc[self.attr]
00211 
00212     x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x')
00213 
00214 
00215 submodule = types.ModuleType(__name__ + '.submodule',
00216     """A submodule, which should appear in its parent's summary""")