From 04fc187bc44c39fcd5d8c29ce7f27f91667065ce Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci Date: Thu, 12 Dec 2024 09:27:19 +0100 Subject: [PATCH] chore: remove deprecation warnings related to `store_full_path` (#8626) * remove deprecation warnings related to store_full_path * unused imports --- haystack/components/converters/azure.py | 7 ------- haystack/components/converters/csv.py | 8 -------- haystack/components/converters/docx.py | 8 -------- haystack/components/converters/html.py | 7 ------- haystack/components/converters/json.py | 7 ------- haystack/components/converters/markdown.py | 8 -------- haystack/components/converters/pdfminer.py | 7 ------- haystack/components/converters/pptx.py | 7 ------- haystack/components/converters/pypdf.py | 8 +------- haystack/components/converters/tika.py | 7 ------- haystack/components/converters/txt.py | 7 ------- 11 files changed, 1 insertion(+), 80 deletions(-) diff --git a/haystack/components/converters/azure.py b/haystack/components/converters/azure.py index 0c1172e6dc..d55a6b8ac8 100644 --- a/haystack/components/converters/azure.py +++ b/haystack/components/converters/azure.py @@ -5,7 +5,6 @@ import copy import hashlib import os -import warnings from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Union @@ -143,12 +142,6 @@ def run(self, sources: List[Union[str, Path, ByteStream]], meta: Optional[List[D azure_output.append(result.to_dict()) merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) diff --git a/haystack/components/converters/csv.py b/haystack/components/converters/csv.py index 1a007dc2ea..248ce69620 100644 --- a/haystack/components/converters/csv.py +++ b/haystack/components/converters/csv.py @@ -4,7 +4,6 @@ import io import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -94,13 +93,6 @@ def run( merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) - if not self.store_full_path and "file_path" in bytestream.meta: file_path = bytestream.meta.get("file_path") if file_path: # Ensure the value is not None for pylint diff --git a/haystack/components/converters/docx.py b/haystack/components/converters/docx.py index fcd7cbf33f..b9d59bd564 100644 --- a/haystack/components/converters/docx.py +++ b/haystack/components/converters/docx.py @@ -5,7 +5,6 @@ import csv import io import os -import warnings from dataclasses import dataclass from enum import Enum from io import StringIO @@ -189,13 +188,6 @@ def run( ) continue - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) - docx_metadata = self._get_docx_metadata(document=docx_document) merged_metadata = {**bytestream.meta, **metadata, "docx": docx_metadata} diff --git a/haystack/components/converters/html.py b/haystack/components/converters/html.py index 79baecac4f..10509e1fab 100644 --- a/haystack/components/converters/html.py +++ b/haystack/components/converters/html.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -123,12 +122,6 @@ def run( merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and "file_path" in bytestream.meta: file_path = bytestream.meta.get("file_path") if file_path: # Ensure the value is not None for pylint diff --git a/haystack/components/converters/json.py b/haystack/components/converters/json.py index 8a39237035..3a8c6f52f0 100644 --- a/haystack/components/converters/json.py +++ b/haystack/components/converters/json.py @@ -4,7 +4,6 @@ import json import os -import warnings from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union @@ -280,12 +279,6 @@ def run( data = self._get_content_and_meta(bytestream) - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) for text, extra_meta in data: merged_metadata = {**bytestream.meta, **metadata, **extra_meta} diff --git a/haystack/components/converters/markdown.py b/haystack/components/converters/markdown.py index cf57af557c..2ffbe4b745 100644 --- a/haystack/components/converters/markdown.py +++ b/haystack/components/converters/markdown.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -112,13 +111,6 @@ def run( merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) - if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) diff --git a/haystack/components/converters/pdfminer.py b/haystack/components/converters/pdfminer.py index fe9a28cad7..8642447816 100644 --- a/haystack/components/converters/pdfminer.py +++ b/haystack/components/converters/pdfminer.py @@ -4,7 +4,6 @@ import io import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -172,12 +171,6 @@ def run( ) merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) diff --git a/haystack/components/converters/pptx.py b/haystack/components/converters/pptx.py index 468d843bd3..7282cc5ddb 100644 --- a/haystack/components/converters/pptx.py +++ b/haystack/components/converters/pptx.py @@ -4,7 +4,6 @@ import io import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -104,12 +103,6 @@ def run( continue merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) diff --git a/haystack/components/converters/pypdf.py b/haystack/components/converters/pypdf.py index df8be1ad79..19a4e2e453 100644 --- a/haystack/components/converters/pypdf.py +++ b/haystack/components/converters/pypdf.py @@ -4,7 +4,6 @@ import io import os -import warnings from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -220,12 +219,7 @@ def run( ) merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) + if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) document.meta = merged_metadata diff --git a/haystack/components/converters/tika.py b/haystack/components/converters/tika.py index a6a27f584d..980fb00911 100644 --- a/haystack/components/converters/tika.py +++ b/haystack/components/converters/tika.py @@ -4,7 +4,6 @@ import io import os -import warnings from html.parser import HTMLParser from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -139,12 +138,6 @@ def run( continue merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path) diff --git a/haystack/components/converters/txt.py b/haystack/components/converters/txt.py index ea29e3f078..0ebbda8dfc 100644 --- a/haystack/components/converters/txt.py +++ b/haystack/components/converters/txt.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 import os -import warnings from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -93,12 +92,6 @@ def run( continue merged_metadata = {**bytestream.meta, **metadata} - warnings.warn( - "The `store_full_path` parameter defaults to True, storing full file paths in metadata. " - "In the 2.9.0 release, the default value for `store_full_path` will change to False, " - "storing only file names to improve privacy.", - DeprecationWarning, - ) if not self.store_full_path and (file_path := bytestream.meta.get("file_path")): merged_metadata["file_path"] = os.path.basename(file_path)