Skip to content

Commit bbf5e80

Browse files
committed
removed unused functionality
1 parent 922cfea commit bbf5e80

File tree

8 files changed

+2
-933
lines changed

8 files changed

+2
-933
lines changed

code_graph/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from .info import *
22
from .llm import ask
33
from .graph import *
4-
from .project import *
54
from .entities import *
6-
from .git_utils import *
75
from .app import create_app
86
from .code_coverage import *
97
from .analyzers.source_analyzer import *

code_graph/app.py

Lines changed: 0 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -133,144 +133,6 @@ def get_neighbors():
133133

134134
return jsonify(response), 200
135135

136-
137-
@app.route('/process_repo', methods=['POST'])
138-
@token_required # Apply token authentication decorator
139-
def process_repo():
140-
"""
141-
Process a GitHub repository.
142-
143-
Expected JSON payload:
144-
{
145-
"repo_url": "string",
146-
"ignore": ["string"] # optional
147-
}
148-
149-
Returns:
150-
JSON response with processing status
151-
"""
152-
153-
data = request.get_json()
154-
url = data.get('repo_url')
155-
if url is None:
156-
return jsonify({'status': f'Missing mandatory parameter "url"'}), 400
157-
logger.debug(f'Received repo_url: {url}')
158-
159-
ignore = data.get('ignore', [])
160-
161-
proj = Project.from_git_repository(url)
162-
proj.analyze_sources(ignore)
163-
#proj.process_git_history(ignore)
164-
165-
# Create a response
166-
response = {
167-
'status': 'success',
168-
}
169-
170-
return jsonify(response), 200
171-
172-
@app.route('/process_local_repo', methods=['POST'])
173-
@token_required # Apply token authentication decorator
174-
def process_local_repo():
175-
# Get JSON data from the request
176-
data = request.get_json()
177-
178-
# Process the data
179-
repo = data.get('repo')
180-
if repo is None:
181-
return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400
182-
logger.debug(f'Received repo: {repo}')
183-
184-
ignore = data.get('ignore')
185-
if ignore is not None:
186-
logger.debug(f"Ignoring the following paths: {ignore}")
187-
188-
# Create source code analyzer
189-
analyzer = SourceAnalyzer()
190-
191-
try:
192-
analyzer.analyze_local_repository(repo, ignore)
193-
except Exception as e:
194-
logger.error(f'An error occurred: {e}')
195-
return jsonify({'status': f'Failed to process repository: {repo}'}), 400
196-
197-
# Create a response
198-
response = {
199-
'status': 'success',
200-
}
201-
202-
return jsonify(response), 200
203-
204-
@app.route('/process_code_coverage', methods=['POST'])
205-
@token_required # Apply token authentication decorator
206-
def process_code_coverage():
207-
"""
208-
Endpoint to process code coverage data for a given repository.
209-
210-
Returns:
211-
JSON response indicating success or an error message.
212-
"""
213-
214-
# Get JSON data from the request
215-
data = request.get_json()
216-
217-
# Validate that 'repo' is provided
218-
repo = data.get('repo')
219-
if repo is None:
220-
logging.warning("Missing mandatory parameter 'repo'")
221-
return jsonify({'status': 'error', 'message': 'Missing mandatory parameter "repo"'}), 400
222-
223-
# Validate that 'lcov' is provided
224-
lcov = data.get('lcov')
225-
if lcov is None:
226-
logging.warning("Missing mandatory parameter 'lcov'")
227-
return jsonify({'status': f'Missing mandatory parameter "lcov"'}), 400
228-
229-
# Process the lcov data for the repository
230-
process_lcov(repo, lcov)
231-
232-
# Create a success response
233-
response = {
234-
'status': 'success',
235-
}
236-
237-
return jsonify(response), 200
238-
239-
240-
@app.route('/switch_commit', methods=['POST'])
241-
@token_required # Apply token authentication decorator
242-
def switch_commit():
243-
"""
244-
Endpoint to switch a repository to a specific commit.
245-
246-
Returns:
247-
JSON response with the change set or an error message.
248-
"""
249-
250-
# Get JSON data from the request
251-
data = request.get_json()
252-
253-
# Validate that 'repo' is provided
254-
repo = data.get('repo')
255-
if repo is None:
256-
return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400
257-
258-
# Validate that 'commit' is provided
259-
commit = data.get('commit')
260-
if commit is None:
261-
return jsonify({'status': f'Missing mandatory parameter "commit"'}), 400
262-
263-
# Attempt to switch the repository to the specified commit
264-
change_set = switch_commit(repo, commit)
265-
266-
# Create a success response
267-
response = {
268-
'status': 'success',
269-
'change_set': change_set
270-
}
271-
272-
return jsonify(response), 200
273-
274136
@app.route('/auto_complete', methods=['POST'])
275137
@token_required # Apply token authentication decorator
276138
def auto_complete():
@@ -331,45 +193,6 @@ def list_repos():
331193

332194
return jsonify(response), 200
333195

334-
335-
@app.route('/list_commits', methods=['POST'])
336-
@token_required # Apply token authentication decorator
337-
def list_commits():
338-
"""
339-
Endpoint to list all commits of a specified repository.
340-
341-
Request JSON Structure:
342-
{
343-
"repo": "repository_name"
344-
}
345-
346-
Returns:
347-
JSON response with a list of commits or an error message.
348-
"""
349-
350-
# Get JSON data from the request
351-
data = request.get_json()
352-
353-
# Validate the presence of the 'repo' parameter
354-
repo = data.get('repo')
355-
if repo is None:
356-
return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400
357-
358-
# Initialize GitGraph object to interact with the repository
359-
git_graph = GitGraph(GitRepoName(repo))
360-
361-
# Fetch commits from the repository
362-
commits = git_graph.list_commits()
363-
364-
# Return success response with the list of commits
365-
response = {
366-
'status': 'success',
367-
'commits': commits
368-
}
369-
370-
return jsonify(response), 200
371-
372-
373196
@app.route('/repo_info', methods=['POST'])
374197
@token_required # Apply token authentication decorator
375198
def repo_info():
@@ -470,41 +293,6 @@ def find_paths():
470293

471294
return jsonify(response), 200
472295

473-
474-
@app.route('/unreachable', methods=['POST'])
475-
@token_required # Apply token authentication decorator
476-
def unreachable_entities():
477-
"""
478-
Endpoint to retrieve unreachable entities in the graph.
479-
Expects 'repo', optional 'label', and optional 'relation' as parameters in the POST request.
480-
481-
Returns:
482-
JSON response with unreachable entities or error message.
483-
"""
484-
485-
# Get JSON data from the request
486-
data = request.get_json()
487-
488-
# Validate 'repo' parameter
489-
repo = data.get('repo')
490-
if repo is None:
491-
return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400
492-
493-
# Get optional 'label' and 'relation' parameters
494-
lbl = data.get('label', None)
495-
rel = data.get('relation', None)
496-
497-
# Initialize graph with provided repo and credentials
498-
g = Graph(repo)
499-
500-
# Fetch unreachable entities based on optional label and relation
501-
unreachable_entities = g.unreachable_entities(lbl, rel)
502-
503-
# Create and return a successful response
504-
response = { 'status': 'success', 'unreachables ': unreachable_entities }
505-
506-
return jsonify(response), 200
507-
508296
@app.route('/chat', methods=['POST'])
509297
@token_required # Apply token authentication decorator
510298
def chat():

code_graph/git_utils/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)