Beispiel #1
0
 def mainTable(self):
     children = self.children()
     if children:
         return ChildTable(self.docgetter, self.ob, children,
                           ChildTable.lookup_loader(self.template_lookup))
     else:
         return ()
Beispiel #2
0
 def baseTables(self, request: object, item: Tag) -> "Flattenable":
     baselists = self.baselists[:]
     if not baselists:
         return []
     if baselists[0][0][0] == self.ob:
         del baselists[0]
     loader = ChildTable.lookup_loader(self.template_lookup)
     return [
         item.clone().fillSlots(baseName=self.baseName(b),
                                baseTable=ChildTable(
                                    self.docgetter, self.ob,
                                    sorted(attrs, key=objects_order),
                                    loader)) for b, attrs in baselists
     ]
Beispiel #3
0
 def baseTables(self, request, item):
     baselists = self.baselists[:]
     if not baselists:
         return []
     if baselists[0][0][0] == self.ob:
         del baselists[0]
     loader = ChildTable.lookup_loader(self.template_lookup)
     return [
         item.clone().fillSlots(
             baseName=self.baseName(b),
             baseTable=ChildTable(
                 self.docgetter, self.ob,
                 sorted(attrs, key=lambda o: -o.privacyClass.value),
                 loader)) for b, attrs in baselists
     ]
Beispiel #4
0
 def packageInitTable(self) -> "Flattenable":
     children = sorted((o for o in self.ob.contents.values()
                        if not isinstance(o, model.Module) and o.isVisible),
                       key=objects_order)
     if children:
         loader = ChildTable.lookup_loader(self.template_lookup)
         return [
             tags.p("From ",
                    tags.code("__init__.py"),
                    ":",
                    class_="fromInitPy"),
             ChildTable(self.docgetter, self.ob, children, loader)
         ]
     else:
         return ()
Beispiel #5
0
 def packageInitTable(self):
     init = self.ob.contents['__init__']
     children = sorted([o for o in init.contents.values() if o.isVisible],
                       key=lambda o2:
                       (-o2.privacyClass.value, o2.fullName()))
     if children:
         loader = ChildTable.lookup_loader(self.template_lookup)
         return [
             tags.p("From the ",
                    tags.code("__init__.py"),
                    " module:",
                    class_="fromInitPy"),
             ChildTable(self.docgetter, init, children, loader)
         ]
     else:
         return ()
Beispiel #6
0
 def mainTable(self):
     children = self.children()
     if children:
         return ChildTable(self.docgetter, self.ob, self.has_lineno_col(),
                           children)
     else:
         return ()
Beispiel #7
0
 def bigTable(self, request, tag):
     if not self.usesplitlinks or len(self.baselists) == 1:
         return ()
     all_attrs = []
     for b, attrs in self.baselists:
         all_attrs.extend(attrs)
     all_attrs.sort(key=lambda o: (-o.privacyClass, o.name.lower()))
     return tag(
         ChildTable(self.docgetter, self.ob, self.has_lineno_col(),
                    all_attrs))
Beispiel #8
0
 def packageInitTable(self):
     init = self.ob.contents['__init__']
     children = sorted([o for o in init.orderedcontents if o.isVisible],
                       key=lambda o2: (-o2.privacyClass, o2.fullName()))
     if children:
         return [
             tags.p("From the __init__.py module:"),
             ChildTable(self.docgetter, init, self.usesorttable, children)
         ]
     else:
         return ()
Beispiel #9
0
 def baseTables(self, request, item):
     baselists = self.baselists[:]
     if not baselists:
         return []
     if baselists[0][0][0] == self.ob:
         del baselists[0]
     return [
         item.fillSlots(baseName=self.baseName(b),
                        baseTable=ChildTable(
                            self.docgetter, self.ob,
                            sorted(attrs, key=lambda o: -o.privacyClass)))
         for b, attrs in baselists
     ]
Beispiel #10
0
 def mainTable(self):
     children = self.children()
     if children:
         return ChildTable(self.docgetter, self.ob, children)
     else:
         return ()
def test_nonempty_table() -> None:
    mod = fromText('def f(): pass')
    t = ChildTable(pages.DocGetter(), mod, mod.contents.values(),
                   ChildTable.lookup_loader(TemplateLookup()))
    flattened = flatten(t)
    assert 'The renderer named' not in flattened
def test_empty_table() -> None:
    mod = fromText('')
    t = ChildTable(pages.DocGetter(), mod, [],
                   ChildTable.lookup_loader(TemplateLookup()))
    flattened = flatten(t)
    assert 'The renderer named' not in flattened