docs.py
Go to the documentation of this file.
1 import xml.etree.ElementTree as ET
2 
3 
4 class Doc():
5  def __init__(self, tree):
6  self.tree = tree
7 
8  def get_tree(self):
9  """Get this Doc's tree.
10 
11  Returns:
12  The xml.etree.ElementTree object of the documentation.
13  """
14  return self.tree
15 
16  def __eq__(self, other):
17  if other is None or other.get_tree() is None:
18  return None
19 
20  return ET.tostring(self.tree.getroot()) == \
21  ET.tostring(other.get_tree().getroot())
22 
23 
24 class ClassDoc(Doc):
25  pass
26 
27 
28 class FreeDoc(Doc):
29  pass
30 
31 
32 class Docs():
33  def __init__(self, class_docs, free_docs):
34  # These are dicts that map file_path -> Doc
35  self.class_docs = class_docs
36  self.free_docs = free_docs
37 
38  def get_class_docs(self, class_name):
39  '''Get the documentation for the class.
40 
41  Arguments:
42  class_name -- the name of the class
43 
44  Returns:
45  The ClassDoc with the class's documentation. None if the class does not
46  exist.
47  '''
48  return self.class_docs.get(class_name)
49 
50  def get_free_docs(self, free_func_name):
51  '''Get the documentation for a free function.
52 
53  Arguments:
54  free_func_name -- the name of the free function
55 
56  Returns:
57  The FreeDoc with the free function's documentation. None if the class
58  does not exist.
59  '''
60  return self.free_docs.get(free_func_name)
61 
63  return list(self.class_docs)
64 
66  return list(self.free_docs)
67 
69  return list(self.class_docs.values())
70 
72  return list(self.free_docs.values())
def get_class_docs_keys_list(self)
Definition: docs.py:62
def get_class_docs(self, class_name)
Definition: docs.py:38
def get_tree(self)
Definition: docs.py:8
def get_free_docs(self, free_func_name)
Definition: docs.py:50
tree
Definition: docs.py:6
def get_free_docs_values_list(self)
Definition: docs.py:71
free_docs
Definition: docs.py:36
class_docs
Definition: docs.py:35
Definition: docs.py:4
Definition: pytypes.h:1301
def __init__(self, tree)
Definition: docs.py:5
def __init__(self, class_docs, free_docs)
Definition: docs.py:33
def get_free_docs_keys_list(self)
Definition: docs.py:65
def get_class_docs_values_list(self)
Definition: docs.py:68
def __eq__(self, other)
Definition: docs.py:16


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:59