コード例 #1
0
ファイル: ClassDocumenter.py プロジェクト: Alwnikrotikz/abjad
    def __init__(self, obj, prefix="abjad.tools."):
        assert isinstance(obj, type)
        Documenter.__init__(self, obj, prefix)

        class_methods = []
        data = []
        inherited_attributes = []
        methods = []
        readonly_properties = []
        readwrite_properties = []
        special_methods = []
        static_methods = []

        attrs = inspect.classify_class_attrs(self._object)
        for attr in attrs:
            if attr.defining_class is object:
                continue
            if self._attribute_is_inherited(attr):
                inherited_attributes.append(attr)
            if attr.kind == "method":
                if attr.name not in self._ignored_special_methods:
                    if attr.name.startswith("__"):
                        special_methods.append(attr)
                    elif not attr.name.startswith("_"):
                        methods.append(attr)
            elif attr.kind == "class method":
                if attr.name not in self._ignored_special_methods:
                    if attr.name.startswith("__"):
                        special_methods.append(attr)
                    elif not attr.name.startswith("_"):
                        class_methods.append(attr)
            elif attr.kind == "static method":
                if attr.name not in self._ignored_special_methods:
                    if attr.name.startswith("__"):
                        special_methods.append(attr)
                    elif not attr.name.startswith("_"):
                        static_methods.append(attr)
            elif attr.kind == "property" and not attr.name.startswith("_"):
                if attr.object.fset is None:
                    readonly_properties.append(attr)
                else:
                    readwrite_properties.append(attr)
            elif (
                attr.kind == "data"
                and not attr.name.startswith("_")
                and attr.name not in getattr(self.object, "__slots__", ())
            ):
                data.append(attr)

        self._class_methods = tuple(sorted(class_methods))
        self._data = tuple(sorted(data))
        self._inherited_attributes = tuple(sorted(inherited_attributes))
        self._methods = tuple(sorted(methods))
        self._readonly_properties = tuple(sorted(readonly_properties))
        self._readwrite_properties = tuple(sorted(readwrite_properties))
        self._special_methods = tuple(sorted(special_methods))
        self._static_methods = tuple(sorted(static_methods))
コード例 #2
0
 def __init__(self,
     obj,
     ignored_directory_names=(),
     prefix='abjad.tools.',
     ):
     assert isinstance(obj, types.ModuleType)
     Documenter.__init__(self, obj, prefix=prefix)
     self._ignored_directory_names = ignored_directory_names
     self._examine_tools_package()
コード例 #3
0
 def __init__(
     self,
     subject=None,
     ignored_directory_names=(),
     prefix='abjad.tools.',
     ):
     assert isinstance(subject, (types.ModuleType, type(None)))
     Documenter.__init__(self, subject, prefix=prefix)
     self._ignored_directory_names = ignored_directory_names
     self._examine_tools_package()
コード例 #4
0
 def __init__(
         self,
         subject=None,
         ignored_directory_names=(),
         prefix='abjad.tools.',
 ):
     assert isinstance(subject, (types.ModuleType, type(None)))
     Documenter.__init__(self, subject, prefix=prefix)
     self._ignored_directory_names = ignored_directory_names
     self._examine_tools_package()
コード例 #5
0
 def __init__(self, subject=None, prefix='abjad.tools.'):
     if subject is None:
         subject = type(None)
     assert isinstance(subject, type)
     Documenter.__init__(self, subject, prefix)
     class_methods = []
     data = []
     inherited_attributes = []
     methods = []
     readonly_properties = []
     readwrite_properties = []
     special_methods = []
     static_methods = []
     attrs = inspect.classify_class_attrs(self.subject)
     for attr in attrs:
         if attr.defining_class is object:
             continue
         if self._attribute_is_inherited(attr):
             inherited_attributes.append(attr)
         if attr.kind == 'method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     methods.append(attr)
         elif attr.kind == 'class method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     class_methods.append(attr)
         elif attr.kind == 'static method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     static_methods.append(attr)
         elif attr.kind == 'property' and not attr.name.startswith('_'):
             if attr.object.fset is None:
                 readonly_properties.append(attr)
             else:
                 readwrite_properties.append(attr)
         elif attr.kind == 'data' and not attr.name.startswith('_') \
             and attr.name not in getattr(self.subject, '__slots__', ()):
             data.append(attr)
     self._class_methods = tuple(sorted(class_methods))
     self._data = tuple(sorted(data))
     self._inherited_attributes = tuple(sorted(inherited_attributes))
     self._methods = tuple(sorted(methods))
     self._readonly_properties = tuple(sorted(readonly_properties))
     self._readwrite_properties = tuple(sorted(readwrite_properties))
     self._special_methods = tuple(sorted(special_methods))
     self._static_methods = tuple(sorted(static_methods))
コード例 #6
0
ファイル: ClassDocumenter.py プロジェクト: willingc/abjad
 def __init__(self, subject=None, prefix='abjad.tools.'):
     if subject is None:
         subject = type(None)
     assert isinstance(subject, type)
     Documenter.__init__(self, subject, prefix)
     class_methods = []
     data = []
     inherited_attributes = []
     methods = []
     readonly_properties = []
     readwrite_properties = []
     special_methods = []
     static_methods = []
     attrs = inspect.classify_class_attrs(self.subject)
     for attr in attrs:
         if attr.defining_class is object:
             continue
         if self._attribute_is_inherited(attr):
             inherited_attributes.append(attr)
         if attr.kind == 'method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     methods.append(attr)
         elif attr.kind == 'class method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     class_methods.append(attr)
         elif attr.kind == 'static method':
             if attr.name not in self._ignored_special_methods:
                 if attr.name.startswith('__'):
                     special_methods.append(attr)
                 elif not attr.name.startswith('_'):
                     static_methods.append(attr)
         elif attr.kind == 'property' and not attr.name.startswith('_'):
             if attr.object.fset is None:
                 readonly_properties.append(attr)
             else:
                 readwrite_properties.append(attr)
         elif attr.kind == 'data' and not attr.name.startswith('_') \
             and attr.name not in getattr(self.subject, '__slots__', ()):
             data.append(attr)
     self._class_methods = tuple(sorted(class_methods))
     self._data = tuple(sorted(data))
     self._inherited_attributes = tuple(sorted(inherited_attributes))
     self._methods = tuple(sorted(methods))
     self._readonly_properties = tuple(sorted(readonly_properties))
     self._readwrite_properties = tuple(sorted(readwrite_properties))
     self._special_methods = tuple(sorted(special_methods))
     self._static_methods = tuple(sorted(static_methods))
コード例 #7
0
 def __init__(self, obj, prefix='abjad.tools.'):
     assert isinstance(obj, types.FunctionType)
     if obj.__name__ == 'wrapper':
         obj = obj.func_closure[1].cell_contents
     Documenter.__init__(self, obj, prefix)
コード例 #8
0
 def __init__(self, subject=None, prefix='abjad.tools.'):
     if isinstance(subject, types.FunctionType):
         if subject.__name__ == 'wrapper':
             subject = subject.func_closure[1].cell_contents
     Documenter.__init__(self, subject, prefix)
コード例 #9
0
 def __init__(self, subject=None, prefix='abjad.tools.'):
     if isinstance(subject, types.FunctionType):
         if subject.__name__ == 'wrapper':
             subject = subject.func_closure[1].cell_contents
     Documenter.__init__(self, subject, prefix)