Ejemplo n.º 1
0
 def print_raw(self, events: RegistryType) -> None:
     """Print out the fully-qualified named for each mapped function."""
     raw = {
         label: [fname(f) for f in funcs]
         for label, funcs in events.items()
     }
     self.stdout.write(json.dumps(raw, indent=4))
Ejemplo n.º 2
0
 def print_default(self, events: RegistryType) -> None:
     """Print the first line of the docstring for each mapped function."""
     for label, funcs in events.items():
         self.stdout.write("")
         self.stdout.write(label)
         for func in funcs:
             docs = docstring(func)
             if docs is None:
                 self.missing_docstrings.append(fname(func))
                 self.stderr.write(f"  x {fname(func)} (no docstring)")
             else:
                 self.stdout.write(f"  - {docs[0]}")
Ejemplo n.º 3
0
 def print_verbose(self, events: RegistryType) -> None:
     """Print the entire docstring for each mapped function."""
     for label, funcs in events.items():
         self.stdout.write("")
         self.stdout.write(label)
         self.stdout.write("")
         for func in funcs:
             docs = docstring(func)
             if docs is None:
                 self.missing_docstrings.append(fname(func))
                 self.stderr.write(f"  x {fname(func)} (no docstring)")
                 self.stdout.write("")
             else:
                 self.stdout.write(f"  - {fname(func)}:")
                 self.stdout.write(f"    {docs[0]}")
                 for line in docs[1:]:
                     self.stdout.write(f"    {line}")
                 self.stdout.write("")
Ejemplo n.º 4
0
 def test_fname(self):
     self.assertEqual(
         # wait, what?
         registry.fname(registry.fname),
         "side_effects.registry.fname",
     )