8000 Merge pull request #80 from IBM/main · codellm-devkit/python-sdk@f839d5e · GitHub
[go: up one dir, main page]

Skip to content

Commit f839d5e

Browse files
authored
Merge pull request #80 from IBM/main
Downstream changes from main to c-cpp branch
2 parents 7d70520 + 8d118d9 commit f839d5e

File tree

5 files changed

+517
-22
lines changed

5 files changed

+517
-22
lines changed

cldk/analysis/python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
Python package
1919
"""
2020

21-
from .python import PythonAnalysis
21+
from .python_analysis import PythonAnalysis
2222

2323
__all__ = ["PythonAnalysis"]

cldk/analysis/python/python.py renamed to cldk/analysis/python/python_analysis.py

Lines changed: 21 additions & 21 deletions
5F1D
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
Python module
1919
"""
2020

21-
from abc import ABC
2221
from pathlib import Path
23-
from typing import Dict, List
24-
from pandas import DataFrame
22+
from typing import List
2523

2624
from cldk.analysis import SymbolTable
2725
from cldk.analysis.python.treesitter import PythonSitter
2826
from cldk.models.python.models import PyMethod, PyImport, PyModule, PyClass
2927

3028

3129
class PythonAnalysis(SymbolTable):
30+
"""Python Analysis Class"""
31+
3232
def __init__(
3333
self,
3434
analysis_backend: str,
@@ -48,13 +48,13 @@ def __init__(
4848

4949
# Initialize the analysis analysis_backend
5050
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.")
5252
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.")
5454
elif analysis_backend.lower() == "treesitter":
5555
self.analysis_backend: PythonSitter = PythonSitter()
5656
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.")
5858

5959
def get_methods(self) -> List[PyMethod]:
6060
"""
@@ -89,14 +89,14 @@ def get_method_details(self, method_signature: str) -> PyMethod:
8989

9090
def is_parsable(self, source_code: str) -> bool:
9191
"""
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
9595
96-
Returns:
97-
True if the code is parsable, False otherwise
96+
Returns:
97+
True if the code is parsable, False otherwise
9898
"""
99-
return PythonSitter.is_parsable(self, source_code)
99+
return PythonSitter().is_parsable(source_code)
100100

101101
def get_raw_ast(self, source_code: str) -> str:
102102
"""
@@ -107,9 +107,9 @@ def get_raw_ast(self, source_code: str) -> str:
107107
Returns:
108108
Tree: the raw AST
109109
"""
110-
return PythonSitter.get_raw_ast(self, source_code)
110+
return PythonSitter().get_raw_ast(source_code)
111111

112-
def get_imports(self) -> List[PyImport]:
112+
def get_imports(self) -> List[PyImport]:
113113
"""
114114
Given an application or a source code, get all the imports
115115
"""
@@ -119,7 +119,7 @@ def get_variables(self, **kwargs):
119119
"""
120120
Given an application or a source code, get all the variables
121121
"""
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.")
123123

124124
def get_classes(self) -> List[PyClass]:
125125
"""
@@ -131,34 +131,34 @@ def get_classes_by_criteria(self, **kwargs):
131131
"""
132132
Given an application or a source code, get all the classes given the inclusion and exclution criteria
133133
"""
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.")
135135

136136
def get_sub_classes(self, **kwargs):
137137
"""
138138
Given an application or a source code, get all the sub-classes
139139
"""
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.")
141141

142142
def get_nested_classes(self, **kwargs):
143143
"""
144144
Given an application or a source code, get all the nested classes
145145
"""
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.")
147147

148148
def get_constructors(self, **kwargs):
149149
"""
150150
Given an application or a source code, get all the constructors
151151
"""
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.")
153153

154154
def get_methods_in_class(self, **kwargs):
155155
"""
156156
Given an application or a source code, get all the methods within the given class
157157
"""
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.")
159159

160160
def get_fields(self, **kwargs):
161161
"""
162162
Given an application or a source code, get all the fields
163163
"""
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.")

tests/analysis/python/test_python.py

Whitespace-only changes.

0 commit comments

Comments
 (0)
0