From 8ea208f0229aeffba9e6ffc2f501683adc277c81 Mon Sep 17 00:00:00 2001 From: Hugo_Fournier Date: Thu, 10 Apr 2025 12:38:36 +0000 Subject: [PATCH 1/2] v0.1.4 --- pygeodes/geodes.py | 2 +- pygeodes/utils/config.py | 3 +++ pygeodes/utils/consts.py | 3 +-- tests/test_env/pygeodes-config.json | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pygeodes/geodes.py b/pygeodes/geodes.py index 2a8bba7..8e888d3 100644 --- a/pygeodes/geodes.py +++ b/pygeodes/geodes.py @@ -186,7 +186,7 @@ def search_items( if not quiet: print(f"Found {matched} items matching your query") - if matched > MAX_NB_ITEMS: + if matched > self.conf.nb_max_items: raise TooManyResultsException( f"Your query matched with {matched} items, which is too much. Please refine your query to be more precise" ) diff --git a/pygeodes/utils/config.py b/pygeodes/utils/config.py index 452821a..1d3662b 100644 --- a/pygeodes/utils/config.py +++ b/pygeodes/utils/config.py @@ -17,6 +17,7 @@ from pygeodes.utils.consts import ( CONFIG_DEFAULT_FILENAME, + MAX_NB_ITEMS, DEFAULT_LOGGING_LEVEL, DEFAULT_S3_REGION_NAME, ) @@ -50,6 +51,7 @@ class Config: download_dir: str = "." checksum_error: bool = True use_async_requests: bool = True + nb_max_items: int = MAX_NB_ITEMS aws_access_key_id: str = None aws_secret_access_key: str = None aws_session_token: str = None # ajouter profil à la place @@ -169,6 +171,7 @@ def _read_info_from_file(cls, file: str): content = load_json(file) cls._check_config_file(content, file) logger.debug(f"Loaded conf from file {file}") + print(content) return class_from_args(Config, content) @classmethod diff --git a/pygeodes/utils/consts.py b/pygeodes/utils/consts.py index 0e9893a..afdf92b 100644 --- a/pygeodes/utils/consts.py +++ b/pygeodes/utils/consts.py @@ -38,8 +38,7 @@ # SSL_CERT_PATH = "/etc/pki/tls/cert.pem" #CNES certificate SSL_CERT_PATH = "" MAX_PAGE_SIZE = 80 -NB_PAGES_LIMIT = 10000000 -MAX_NB_ITEMS = MAX_PAGE_SIZE * NB_PAGES_LIMIT +MAX_NB_ITEMS = MAX_PAGE_SIZE * 10000000 DOWNLOAD_CHUNK_SIZE = 8192 MAX_NB_RETRIES = 5 TIME_BEFORE_RETRY = 2 diff --git a/tests/test_env/pygeodes-config.json b/tests/test_env/pygeodes-config.json index 92e2b84..16a07d3 100644 --- a/tests/test_env/pygeodes-config.json +++ b/tests/test_env/pygeodes-config.json @@ -3,6 +3,7 @@ "logging_level": "INFO", "download_dir": "./pygeodes/tests/test_env", "checksum_error": true, + "nb_max_items": 2000000, "use_async_requests": true, "aws_access_key_id": null, "aws_secret_access_key": null, From f754bda8613d6eaaa6780f8cb4683c217eff5d2b Mon Sep 17 00:00:00 2001 From: Hugo Fournier <156934049+hfrcnes@users.noreply.github.com> Date: Thu, 10 Apr 2025 15:11:45 +0200 Subject: [PATCH 2/2] Update config.py --- pygeodes/utils/config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygeodes/utils/config.py b/pygeodes/utils/config.py index 1d3662b..8594002 100644 --- a/pygeodes/utils/config.py +++ b/pygeodes/utils/config.py @@ -171,7 +171,6 @@ def _read_info_from_file(cls, file: str): content = load_json(file) cls._check_config_file(content, file) logger.debug(f"Loaded conf from file {file}") - print(content) return class_from_args(Config, content) @classmethod