From 3bb736052517267c9afcd1a0fd8e2391ab3b4c4e Mon Sep 17 00:00:00 2001 From: Chris Steege Date: Tue, 20 Jun 2023 16:35:16 -0500 Subject: [PATCH 1/2] Patch broken release --- mindflow/__init__.py | 2 +- mindflow/core/__init__.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 mindflow/core/__init__.py diff --git a/mindflow/__init__.py b/mindflow/__init__.py index 3d18726..dd9b22c 100644 --- a/mindflow/__init__.py +++ b/mindflow/__init__.py @@ -1 +1 @@ -__version__ = "0.5.0" +__version__ = "0.5.1" diff --git a/mindflow/core/__init__.py b/mindflow/core/__init__.py new file mode 100644 index 0000000..e69de29 From fad88e87b269afb59bb297a36d73538e1600042c Mon Sep 17 00:00:00 2001 From: Chris Steege Date: Tue, 20 Jun 2023 16:37:03 -0500 Subject: [PATCH 2/2] Fix linting --- mindflow/core/commands/delete.py | 17 +++++++++++++---- mindflow/core/commands/index.py | 2 +- mindflow/core/commands/query.py | 4 +++- mindflow/core/file_processing/git.py | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/mindflow/core/commands/delete.py b/mindflow/core/commands/delete.py index 4228309..1dd48f1 100644 --- a/mindflow/core/commands/delete.py +++ b/mindflow/core/commands/delete.py @@ -12,9 +12,18 @@ def run_delete(document_paths: List[str]) -> str: """Delete documents from MindFlow index.""" - document_references: List[DocumentReference] = resolve_paths_to_document_references(document_paths) - - document_ids = [document_id for document_id in [get_document_id(document_reference.path, document_reference.document_type) for document_reference in document_references] if document_id is not None] + document_references: List[DocumentReference] = resolve_paths_to_document_references( + document_paths + ) + + document_ids = [ + document_id + for document_id in [ + get_document_id(document_reference.path, document_reference.document_type) + for document_reference in document_references + ] + if document_id is not None + ] if not document_ids: return "No document IDs resolved. Nothing to delete." @@ -30,4 +39,4 @@ def run_delete(document_paths: List[str]) -> str: Document.delete_bulk(document_ids) DocumentChunk.delete_bulk(document_chunk_ids) - return True, "Documents and associated chunks deleted successfully." + return "Documents and associated chunks deleted successfully." diff --git a/mindflow/core/commands/index.py b/mindflow/core/commands/index.py index 7372d4d..7ffe063 100644 --- a/mindflow/core/commands/index.py +++ b/mindflow/core/commands/index.py @@ -39,7 +39,7 @@ def run_index(document_paths: List[str]) -> str: indexable_documents := get_indexable_documents( document_references, completion_model ) - ): + ): return "No documents to index" print_total_size_of_documents(indexable_documents) diff --git a/mindflow/core/commands/query.py b/mindflow/core/commands/query.py index 63b38da..37624c3 100644 --- a/mindflow/core/commands/query.py +++ b/mindflow/core/commands/query.py @@ -52,7 +52,9 @@ def run_query(document_paths: List[str], query: str) -> str: top_k=100, ) ): - return "No index for requested hashes. Please generate index for passed content." + return ( + "No index for requested hashes. Please generate index for passed content." + ) document_selection_batch: List[Tuple[str, DocumentChunk]] = [ (document_hash_to_path[document_chunk.id.split("_")[0]], document_chunk) diff --git a/mindflow/core/file_processing/git.py b/mindflow/core/file_processing/git.py index 8f28496..198341e 100644 --- a/mindflow/core/file_processing/git.py +++ b/mindflow/core/file_processing/git.py @@ -29,6 +29,6 @@ def get_all_unignored_git_files_from_path(path: Union[str, os.PathLike]) -> List ) git_files = output.stdout.decode().strip().split("\n") return [os.path.abspath(os.path.join(os.fspath(path), f)) for f in git_files] - except GitError as error: + except subprocess.CalledProcessError as error: logging.debug("Failed extract git files with 'git ls-files': %s", error) return []