MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / BaseLanguage

Class BaseLanguage

code2flow/model.py:86–144  ·  view source on GitHub ↗

Languages are individual implementations for different dynamic languages. This is the superclass of Python, Javascript, PHP, and Ruby. Every implementation must implement all of these methods. For more detail, see the individual implementations. Note that the 'Tree' type is gene

Source from the content-addressed store, hash-verified

84
85
86class BaseLanguage(abc.ABC):
87 """
88 Languages are individual implementations for different dynamic languages.
89 This is the superclass of Python, Javascript, PHP, and Ruby.
90 Every implementation must implement all of these methods.
91 For more detail, see the individual implementations.
92 Note that the 'Tree' type is generic and will be a different
93 type for different languages. In Python, it is an ast.AST.
94 """
95
96 @staticmethod
97 @abc.abstractmethod
98 def assert_dependencies():
99 """
100 :rtype: None
101 """
102
103 @staticmethod
104 @abc.abstractmethod
105 def get_tree(filename, lang_params):
106 """
107 :param filename str:
108 :rtype: Tree
109 """
110
111 @staticmethod
112 @abc.abstractmethod
113 def separate_namespaces(tree):
114 """
115 :param tree Tree:
116 :rtype: (list[tree], list[tree], list[tree])
117 """
118
119 @staticmethod
120 @abc.abstractmethod
121 def make_nodes(tree, parent):
122 """
123 :param tree Tree:
124 :param parent Group:
125 :rtype: list[Node]
126 """
127
128 @staticmethod
129 @abc.abstractmethod
130 def make_root_node(lines, parent):
131 """
132 :param lines list[Tree]:
133 :param parent Group:
134 :rtype: Node
135 """
136
137 @staticmethod
138 @abc.abstractmethod
139 def make_class_group(tree, parent):
140 """
141 :param tree Tree:
142 :param parent Group:
143 :rtype: Group

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected