From c7f93426d99f1e766427660812f02eea5ae87105 Mon Sep 17 00:00:00 2001 From: bbean Date: Fri, 9 Aug 2024 20:09:41 -0600 Subject: [PATCH 1/3] remove debug print statements --- opencsp/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/opencsp/__init__.py b/opencsp/__init__.py index 2c8c5ba0a..b77adbc7f 100644 --- a/opencsp/__init__.py +++ b/opencsp/__init__.py @@ -66,8 +66,4 @@ def _opencsp_settings_dirs() -> list[str]: opencsp_settings = configparser.ConfigParser(allow_no_value=True) opencsp_settings.read(_settings_files) -for section in opencsp_settings.sections(): - for key in opencsp_settings[section]: - print(f"opencsp_settings[{section}][{key}]={opencsp_settings[section][key]}") - __all__ = ['opencsp_settings'] From 4a31d7531e946db36a92de6f933cdb394151fc14 Mon Sep 17 00:00:00 2001 From: bbean Date: Fri, 9 Aug 2024 20:10:18 -0600 Subject: [PATCH 2/3] fix sensitive_strings searcher for HDF5 files --- contrib/scripts/sensitive_strings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/scripts/sensitive_strings.py b/contrib/scripts/sensitive_strings.py index 75e25e0b6..cf031df6f 100644 --- a/contrib/scripts/sensitive_strings.py +++ b/contrib/scripts/sensitive_strings.py @@ -109,7 +109,9 @@ def _is_binary_file(self, file_path: str, file_name_ext: str): ext = ext.lower() if ext == ".ipynb": is_binary_file = True - if self._is_img_ext(ext): + elif ext == ".h5": + is_binary_file = True + elif self._is_img_ext(ext): if ext in self._text_file_extensions: is_binary_file = False elif (f"{file_path}/{file_name_ext}" in self._text_file_path_name_exts) or ( From 1e17ec13efc58e035d62b0e4f9d399cf9c15c26d Mon Sep 17 00:00:00 2001 From: bbean Date: Wed, 21 Aug 2024 12:06:45 -0600 Subject: [PATCH 3/3] assume any file >1MB is a binary file --- contrib/scripts/sensitive_strings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/scripts/sensitive_strings.py b/contrib/scripts/sensitive_strings.py index cf031df6f..e28f83631 100644 --- a/contrib/scripts/sensitive_strings.py +++ b/contrib/scripts/sensitive_strings.py @@ -109,8 +109,6 @@ def _is_binary_file(self, file_path: str, file_name_ext: str): ext = ext.lower() if ext == ".ipynb": is_binary_file = True - elif ext == ".h5": - is_binary_file = True elif self._is_img_ext(ext): if ext in self._text_file_extensions: is_binary_file = False @@ -120,6 +118,11 @@ def _is_binary_file(self, file_path: str, file_name_ext: str): is_binary_file = False else: is_binary_file = True + elif ft.file_size(ft.join(file_path, file_name_ext)) > 1e6: + # assume any file > 1MB is a binary file, in order to prevent + # sensitive_strings from taking hours to check these files + # needlessly + is_binary_file = True if not is_binary_file: # attempt to parse the file as a text file try: