Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import segregation #209

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/export_data_graph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from neo4j import GraphDatabase
import json

from neo4j import GraphDatabase

# Replace these credentials with your Neo4j database info
uri = "bolt://localhost:7687"
username = "neo4j"
Expand Down
7 changes: 7 additions & 0 deletions unoplat-code-confluence/.isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[settings]
known_third_party = marko,pydantic,ruff,loguru,pygithub,pypdf,pydantic_settings,litellm,pytest,dspy_ai,packaging,progiter,sentence_transformers,einops,rich,neo4j,neomodel,requirements_parser,tomlkit,stdlib_list,pytest_cov,gitpython
import_heading_stdlib = Standard Library
import_heading_thirdparty = Third Party
import_heading_firstparty = First Party
import_heading_localfolder = Local
py_version = 311 # For Python 3.12
43 changes: 29 additions & 14 deletions unoplat-code-confluence/unoplat_code_confluence/__main__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
# Standard Library
import argparse
import asyncio
import os
from loguru import logger
import datetime
from unoplat_code_confluence.codebaseparser.arc_guard_handler import ArchGuardHandler
import os
import re
import warnings

# Third Party
from loguru import logger
from packaging import version

# First Party
from unoplat_code_confluence.codebaseparser.arc_guard_handler import \
ArchGuardHandler
from unoplat_code_confluence.configuration.external_config import AppConfig
from unoplat_code_confluence.data_models.chapi_unoplat_codebase import UnoplatCodebase
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_codebase_summary import DspyUnoplatCodebaseSummary
from unoplat_code_confluence.database.graph.unoplat_graph_processing import UnoplatGraphProcessing
from unoplat_code_confluence.data_models.chapi_unoplat_codebase import \
UnoplatCodebase
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_codebase_summary import \
DspyUnoplatCodebaseSummary
from unoplat_code_confluence.database.graph.unoplat_graph_processing import \
UnoplatGraphProcessing
from unoplat_code_confluence.downloader.downloader import Downloader
from unoplat_code_confluence.dspy_class_summary import CodeConfluenceClassModule
from unoplat_code_confluence.dspy_codebase_summary import CodeConfluenceCodebaseModule
from unoplat_code_confluence.dspy_function_summary import CodeConfluenceFunctionModule
from unoplat_code_confluence.dspy_package_summary import CodeConfluencePackageModule
from unoplat_code_confluence.dspy_class_summary import \
CodeConfluenceClassModule
from unoplat_code_confluence.dspy_codebase_summary import \
CodeConfluenceCodebaseModule
from unoplat_code_confluence.dspy_function_summary import \
CodeConfluenceFunctionModule
from unoplat_code_confluence.dspy_package_summary import \
CodeConfluencePackageModule
from unoplat_code_confluence.loader import iload_json, iparse_json
from unoplat_code_confluence.loader.json_loader import JsonLoader
from unoplat_code_confluence.loader.parse_json import JsonParser
from unoplat_code_confluence.markdownparser.markdownsummariser import MarkdownSummariser
from unoplat_code_confluence.summary_parser.codebase_summary import CodebaseSummaryParser
import warnings
from packaging import version
from unoplat_code_confluence.markdownparser.markdownsummariser import \
MarkdownSummariser
from unoplat_code_confluence.summary_parser.codebase_summary import \
CodebaseSummaryParser


async def start_pipeline():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Standard Library
import os
import subprocess
from unoplat_code_confluence.utility.total_file_count import TotalFileCount

# Third Party
from loguru import logger

# First Party
from unoplat_code_confluence.utility.total_file_count import TotalFileCount


class ArchGuardHandler:
def __init__(self, jar_path, language, codebase_path,codebase_name, output_path,extension:str):
self.jar_path = jar_path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Standard Library
from enum import Enum
from typing import Any, Dict, List
from pydantic import BaseModel, ValidationInfo, field_validator, Field

# Third Party
from pydantic import BaseModel, Field, ValidationInfo, field_validator






class ProgrammingLanguage(Enum):
PYTHON = 'python'
JAVA = 'java'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from unoplat_code_confluence.data_models.chapi_unoplat_annotation_key_val import ChapiUnoplatAnnotationKeyVal
from unoplat_code_confluence.data_models.chapi_unoplat_position import Position
from pydantic import BaseModel, Field
# Standard Library
from typing import Optional

# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_annotation_key_val import \
ChapiUnoplatAnnotationKeyVal
from unoplat_code_confluence.data_models.chapi_unoplat_position import Position


class Annotation(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@



# Standard Library
from typing import Optional

# Third Party
from pydantic import BaseModel, Field


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from pydantic import BaseModel, Field
# Standard Library
from typing import List, Optional

from unoplat_code_confluence.data_models.chapi_unoplat_annotation import Annotation
# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_annotation import \
Annotation


class ClassFieldModel(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Standard Library
from typing import List, Optional

# Third Party
from pydantic import BaseModel, Field

from unoplat_code_confluence.data_models.chapi_unoplat_package import UnoplatPackage
# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_package import \
UnoplatPackage


class UnoplatCodebase(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Standard Library
from typing import List, Optional

# Third Party
from pydantic import BaseModel, Field
from typing import Optional, List

from unoplat_code_confluence.data_models.chapi_unoplat_functioncall import FunctionCall
from unoplat_code_confluence.data_models.unoplat_function_field_model import UnoplatFunctionFieldModel
from unoplat_code_confluence.data_models.chapi_unoplat_annotation import Annotation
# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_annotation import \
Annotation
from unoplat_code_confluence.data_models.chapi_unoplat_functioncall import \
FunctionCall
from unoplat_code_confluence.data_models.chapi_unoplat_position import Position
from unoplat_code_confluence.data_models.unoplat_function_field_model import \
UnoplatFunctionFieldModel


class ChapiUnoplatFunction(BaseModel):
name: Optional[str] = Field(default=None, alias="Name")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@



# Standard Library
from typing import List, Optional

from unoplat_code_confluence.data_models.chapi_unoplat_position import Position
from unoplat_code_confluence.data_models.chapi_unoplat_parameter import Parameter
# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_parameter import \
Parameter
from unoplat_code_confluence.data_models.chapi_unoplat_position import Position


class FunctionCall(BaseModel):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pydantic import BaseModel, Field
from typing import Optional, List
# Standard Library
from typing import List, Optional

# Third Party
from pydantic import BaseModel, Field


class Import(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Standard Library
from typing import List, Optional

# Third Party
from pydantic import BaseModel, Field
from typing import Optional, List
from unoplat_code_confluence.data_models.chapi_unoplat_annotation import Annotation
from unoplat_code_confluence.data_models.chapi_unoplat_class_fieldmodel import ClassFieldModel

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_annotation import \
Annotation
from unoplat_code_confluence.data_models.chapi_unoplat_class_fieldmodel import \
ClassFieldModel
from unoplat_code_confluence.data_models.chapi_unoplat_function import \
ChapiUnoplatFunction
from unoplat_code_confluence.data_models.chapi_unoplat_import import Import
from unoplat_code_confluence.data_models.chapi_unoplat_function import ChapiUnoplatFunction
from unoplat_code_confluence.data_models.chapi_unoplat_position import Position



class ChapiUnoplatNode(BaseModel):
node_name: Optional[str] = Field(default=None, alias="NodeName")
type: Optional[str] = Field(default=None, alias="Type")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Standard Library
from typing import Dict, List, Optional

# Third Party
from pydantic import BaseModel, Field

from unoplat_code_confluence.data_models.chapi_unoplat_node import ChapiUnoplatNode
# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_node import \
ChapiUnoplatNode


class UnoplatPackage(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Standard Library
from typing import Optional

# Third Party
from pydantic import BaseModel, Field


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

# Standard Library
from typing import Optional

# Third Party
from pydantic import BaseModel, Field


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Standard Library
from typing import Dict, Optional
from pydantic import BaseModel,Field

from unoplat_code_confluence.data_models.dspy.dspy_unoplat_package_summary import DspyUnoplatPackageSummary
# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_package_summary import \
DspyUnoplatPackageSummary


class DspyUnoplatCodebaseSummary(BaseModel):
codebase_summary: Optional[str] = Field(default=None, description="A summary of the codebase")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from typing import Optional, List
from pydantic import BaseModel,Field
from unoplat_code_confluence.data_models.chapi_unoplat_function import ChapiUnoplatFunction
# Standard Library
from typing import List, Optional

# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_function import \
ChapiUnoplatFunction


class DspyUnoplatFunctionSummary(ChapiUnoplatFunction):
qualified_name: str = Field(required=True, alias="QualifiedName",description="The qualified name of the function that contains the entire hierarchy of the class")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Standard Library
from typing import Any, Dict, List, Optional
from pydantic import BaseModel,Field

from unoplat_code_confluence.data_models.chapi_unoplat_class_fieldmodel import ClassFieldModel
from unoplat_code_confluence.data_models.chapi_unoplat_node import ChapiUnoplatNode
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_function_summary import DspyUnoplatFunctionSummary
# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.chapi_unoplat_class_fieldmodel import \
ClassFieldModel
from unoplat_code_confluence.data_models.chapi_unoplat_node import \
ChapiUnoplatNode
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_function_summary import \
DspyUnoplatFunctionSummary


class DspyUnoplatNodeSummary(ChapiUnoplatNode):
qualified_name: str = Field(required=True, alias="QualifiedName",description="The qualified name of the class that contains the entire hierarchy of the class")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Standard Library
from typing import Dict, List, Optional
from pydantic import BaseModel,Field

from unoplat_code_confluence.data_models.dspy.dspy_unoplat_node_summary import DspyUnoplatNodeSummary

# Third Party
from pydantic import BaseModel, Field

# First Party
from unoplat_code_confluence.data_models.dspy.dspy_unoplat_node_summary import \
DspyUnoplatNodeSummary


class DspyUnoplatPackageSummary(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Standard Library
from typing import Optional

# Third Party
from pydantic import BaseModel, Field


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Standard Library
from typing import Any, Dict

# Third Party
from neo4j import GraphDatabase
from typing import Dict, Any


class Neo4jConnector:
def __init__(self, uri: str, username: str, password: str):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Standard Library
from typing import Any, Dict

# Third Party
from neo4j import GraphDatabase
from typing import Dict, Any
from neomodel import config, db

# First Party
from unoplat_code_confluence.configuration.external_config import AppConfig
from neomodel import config,db


class UnoplatGraphIngestion:
def __init__(self, app_config: AppConfig):
Expand Down
Loading
Loading