cognee/cognee/shared/CodeGraphEntities.py
Boris 711ae8e675
feat: codegraph improvements and new CODE search [COG-1351] (#581)
<!-- .github/pull_request_template.md -->

## Description
<!-- Provide a clear description of the changes in this PR -->

## DCO Affirmation
I affirm that all code in every commit of this pull request conforms to
the terms of the Topoteretes Developer Certificate of Origin


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced an automated deployment workflow to build and push
container images.
	- Updated dependency management to include additional database support.
- **Refactor**
- Enhanced asynchronous operations and logging in the server for
improved performance.
	- Optimized extraction and retrieval processes for code-related data.
- **Chores**
- Streamlined build configurations and startup scripts for greater
reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: hajdul88 <52442977+hajdul88@users.noreply.github.com>
Co-authored-by: Igor Ilic <igorilic03@gmail.com>
2025-02-26 20:15:02 +01:00

61 lines
1.5 KiB
Python

from typing import List, Optional
from cognee.low_level import DataPoint
class Repository(DataPoint):
path: str
class ImportStatement(DataPoint):
name: str
module: str
start_point: tuple
end_point: tuple
source_code: str
file_path: Optional[str] = None
class FunctionDefinition(DataPoint):
name: str
start_point: tuple
end_point: tuple
source_code: str
file_path: Optional[str] = None
metadata: dict = {"index_fields": ["source_code"]}
class ClassDefinition(DataPoint):
name: str
start_point: tuple
end_point: tuple
source_code: str
file_path: Optional[str] = None
metadata: dict = {"index_fields": ["source_code"]}
class CodeFile(DataPoint):
name: str
file_path: str
source_code: Optional[str] = None
part_of: Optional[Repository] = None
depends_on: Optional[List["ImportStatement"]] = []
provides_function_definition: Optional[List["FunctionDefinition"]] = []
provides_class_definition: Optional[List["ClassDefinition"]] = []
metadata: dict = {"index_fields": ["name"]}
class CodePart(DataPoint):
file_path: str
source_code: Optional[str] = None
metadata: dict = {"index_fields": []}
class SourceCodeChunk(DataPoint):
code_chunk_of: Optional[CodePart] = None
source_code: Optional[str] = None
previous_chunk: Optional["SourceCodeChunk"] = None
metadata: dict = {"index_fields": ["source_code"]}
CodeFile.model_rebuild()
SourceCodeChunk.model_rebuild()