18
18
Python module
19
19
"""
20
20
21
- from abc import ABC
22
21
from pathlib import Path
23
- from typing import Dict , List
24
- from pandas import DataFrame
22
+ from typing import List
25
23
26
24
from cldk .analysis import SymbolTable
27
25
from cldk .analysis .python .treesitter import PythonSitter
28
26
from cldk .models .python .models import PyMethod , PyImport , PyModule , PyClass
29
27
30
28
31
29
class PythonAnalysis (SymbolTable ):
30
+ """Python Analysis Class"""
31
+
32
32
def __init__ (
33
33
self ,
34
34
analysis_backend : str ,
@@ -48,13 +48,13 @@ def __init__(
48
48
49
49
# Initialize the analysis analysis_backend
50
50
if analysis_backend .lower () == "codeql" :
51
- raise NotImplementedError (f "Support for { analysis_backend } has not been implemented yet." )
51
+ raise NotImplementedError ("Support for {analysis_backend} has not been implemented yet." )
52
52
elif analysis_backend .lower () == "codeanalyzer" :
53
- raise NotImplementedError (f "Support for { analysis_backend } has not been implemented yet." )
53
+ raise NotImplementedError ("Support for {analysis_backend} has not been implemented yet." )
54
54
elif analysis_backend .lower () == "treesitter" :
55
55
self .analysis_backend : PythonSitter = PythonSitter ()
56
56
else :
57
- raise NotImplementedError (f "Support for { analysis_backend } has not been implemented yet." )
57
+ raise NotImplementedError ("Support for {analysis_backend} has not been implemented yet." )
58
58
59
59
def get_methods (self ) -> List [PyMethod ]:
60
60
"""
@@ -89,14 +89,14 @@ def get_method_details(self, method_signature: str) -> PyMethod:
89
89
90
90
def is_parsable (self , source_code : str ) -> bool :
91
91
"""
92
- Check if the code is parsable
93
- Args:
94
- source_code: source code
92
+ Check if the code is parsable
93
+ Args:
94
+ source_code: source code
95
95
96
- Returns:
97
- True if the code is parsable, False otherwise
96
+ Returns:
97
+ True if the code is parsable, False otherwise
98
98
"""
99
- return PythonSitter .is_parsable (self , source_code )
99
+ return PythonSitter () .is_parsable (source_code )
100
100
101
101
def get_raw_ast (self , source_code : str ) -> str :
102
102
"""
@@ -107,9 +107,9 @@ def get_raw_ast(self, source_code: str) -> str:
107
107
Returns:
108
108
Tree: the raw AST
109
109
"""
110
- return PythonSitter .get_raw_ast (self , source_code )
110
+ return PythonSitter () .get_raw_ast (source_code )
111
111
112
- def get_imports (self ) -> List [PyImport ]:
112
+ def get_imports (self ) -> List [PyImport ]:
113
113
"""
114
114
Given an application or a source code, get all the imports
115
115
"""
@@ -119,7 +119,7 @@ def get_variables(self, **kwargs):
119
119
"""
120
120
Given an application or a source code, get all the variables
121
121
"""
122
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
122
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
123
123
124
124
def get_classes (self ) -> List [PyClass ]:
125
125
"""
@@ -131,34 +131,34 @@ def get_classes_by_criteria(self, **kwargs):
131
131
"""
132
132
Given an application or a source code, get all the classes given the inclusion and exclution criteria
133
133
"""
134
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
134
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
135
135
136
136
def get_sub_classes (self , ** kwargs ):
137
137
"""
138
138
Given an application or a source code, get all the sub-classes
139
139
"""
140
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
140
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
141
141
142
142
def get_nested_classes (self , ** kwargs ):
143
143
"""
144
144
Given an application or a source code, get all the nested classes
145
145
"""
146
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
146
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
147
147
148
148
def get_constructors (self , ** kwargs ):
149
149
"""
150
150
Given an application or a source code, get all the constructors
151
151
"""
152
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
152
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
153
153
154
154
def get_methods_in_class (self , ** kwargs ):
155
155
"""
156
156
Given an application or a source code, get all the methods within the given class
157
157
"""
158
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
158
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
159
159
160
160
def get_fields (self , ** kwargs ):
5F1D
161
161
"""
162
162
Given an application or a source code, get all the fields
163
163
"""
164
- raise NotImplementedError (f "Support for this functionality has not been implemented yet." )
164
+ raise NotImplementedError ("Support for this functionality has not been implemented yet." )
0 commit comments