Esempio n. 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 ()
Esempio n. 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
     ]
Esempio n. 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
     ]
Esempio n. 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 ()
Esempio n. 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 ()
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