From 7e8b88cececfa05a0661fc77166252431813a2af Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Thu, 21 Dec 2023 22:07:49 +0530 Subject: [PATCH 1/6] Default encoding for I/O operations should be UTF-8 Signed-off-by: aadityasinha-dotcom --- src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index 785a7228..e40e4dcb 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -406,7 +406,7 @@ def get_job_output_as_files(self, status, output_dir): _output_file = os.path.join(output_dir, _job_name, _job_id, 'jcl.txt') _data_spool_file = self.get_jcl_text(_job_correlator) _dataset_content = _data_spool_file['response'] - _out_file = open(_output_file, 'w') + _out_file = open(_output_file, 'w', encoding="utf-8") _out_file.write(_dataset_content) _out_file.close() @@ -421,7 +421,7 @@ def get_job_output_as_files(self, status, output_dir): _output_file = os.path.join(output_dir, _job_name, _job_id, _stepname, _ddname) _data_spool_file = self.get_spool_file_contents(_job_correlator, _spoolfile_id) _dataset_content = _data_spool_file['response'] - _out_file = open(_output_file, 'w') + _out_file = open(_output_file, 'w', encoding="utf-8") _out_file.write(_dataset_content) _out_file.close() From 310e948e2b3d2bb41db8cf2e683370769ab6ec0d Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Fri, 5 Jan 2024 22:24:42 +0530 Subject: [PATCH 2/6] few changes as per the reviews Signed-off-by: aadityasinha-dotcom --- CHANGELOG.md | 1 + src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 4 ++-- src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 168c5874..521b632a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,4 +4,5 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil ## Recent Changes +- Bug: Default encoding for I/O operations should be UTF-8 - Feature: Added method to load profile properties from environment variables \ No newline at end of file diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index 4ca01ebe..bd529f69 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -510,7 +510,7 @@ def write_to_dsn(self, dataset_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODING def download_dsn(self, dataset_name, output_file): """Retrieve the contents of a dataset and saves it to a given file.""" raw_response = self.get_dsn_content_streamed(dataset_name) - with open(output_file, 'w') as f: + with open(output_file, 'w', encoding="utf-8") as f: shutil.copyfileobj(raw_response, f) def download_binary_dsn(self, dataset_name, output_file, with_prefixes=False): @@ -559,7 +559,7 @@ def write_to_uss(self, filepath_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODIN def upload_file_to_uss(self, input_file, filepath_name, encoding=_ZOWE_FILES_DEFAULT_ENCODING): """Upload contents of a given file and uploads it to UNIX file""" if os.path.isfile(input_file): - in_file = open(input_file, 'r') + in_file = open(input_file, 'r', encoding="utf-8") file_contents = in_file.read() response_json = self.write_to_uss(filepath_name, file_contents) else: diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index e40e4dcb..a94c5344 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -274,7 +274,7 @@ def submit_from_local_file(self, jcl_path): A JSON containing the result of the request execution """ if os.path.isfile(jcl_path): - jcl_file = open(jcl_path, "r") + jcl_file = open(jcl_path, "r", encoding="utf-8") file_content = jcl_file.read() jcl_file.close() return self.submit_plaintext(file_content) From 6768c2a175ee44c7540eb039f0ebcdb1ba3c4810 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Fri, 5 Jan 2024 22:30:43 +0530 Subject: [PATCH 3/6] few fixes Signed-off-by: aadityasinha-dotcom --- src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index ab33a5e4..374e98a5 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -517,11 +517,7 @@ def write_to_dsn(self, dataset_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODING def download_dsn(self, dataset_name, output_file): """Retrieve the contents of a dataset and saves it to a given file.""" raw_response = self.get_dsn_content_streamed(dataset_name) -<<<<<<< HEAD with open(output_file, 'w', encoding="utf-8") as f: -======= - with open(output_file, "w") as f: ->>>>>>> 80c6a66785746ec730684d04aa70064b2da6e397 shutil.copyfileobj(raw_response, f) def download_binary_dsn(self, dataset_name, output_file, with_prefixes=False): @@ -568,11 +564,7 @@ def write_to_uss(self, filepath_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODIN def upload_file_to_uss(self, input_file, filepath_name, encoding=_ZOWE_FILES_DEFAULT_ENCODING): """Upload contents of a given file and uploads it to UNIX file""" if os.path.isfile(input_file): -<<<<<<< HEAD in_file = open(input_file, 'r', encoding="utf-8") -======= - in_file = open(input_file, "r") ->>>>>>> 80c6a66785746ec730684d04aa70064b2da6e397 file_contents = in_file.read() response_json = self.write_to_uss(filepath_name, file_contents) else: From 47aabdc0cda9295a6616052e6ad38773e8227e88 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 9 Jan 2024 22:30:06 +0530 Subject: [PATCH 4/6] resolve merge conflicts Signed-off-by: aadityasinha-dotcom --- CHANGELOG.md | 31 ------------------- .../zowe/zos_files_for_zowe_sdk/files.py | 4 +-- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 810ef783..c6ca66ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,36 +4,5 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil ## Recent Changes -<<<<<<< HEAD - Bug: Default encoding for I/O operations should be UTF-8 - Feature: Added method to load profile properties from environment variables -======= -### Bug Fixes - -- Fixed 'create_data_set' to accept "FBA", "FBM", "VBA", "VBM" as valid recfm [#240](https://github.com/zowe/zowe-client-python-sdk/issues/240) -- Return response instead of raw from streamed requests - -## `1.0.0-dev12` - -### Bug Fixes - -- Fixed Secrets SDK requiring LD_LIBRARY_PATH to be defined when installed from wheel on Linux [#229](https://github.com/zowe/zowe-client-python-sdk/issues/229) -- Fixed 'issue_command' Console API function to provide custom console name [#231](https://github.com/zowe/zowe-client-python-sdk/issues/231) - -## `1.0.0-dev11` - -### Enhancements - -- Added method to save secure profile properties to vault [#72](https://github.com/zowe/zowe-client-python-sdk/issues/72) -- Added method to save profile properties to zowe.config.json file [#73](https://github.com/zowe/zowe-client-python-sdk/issues/73) -- Added CredentialManager class to securely retrieve values from credentials and manage multiple credential entries on Windows [#134](https://github.com/zowe/zowe-client-python-sdk/issues/134) -- Added method to load profile properties from environment variables [#136](https://github.com/zowe/zowe-client-python-sdk/issues/136) -- Added validation of zowe.config.json file matching the schema [#192](https://github.com/zowe/zowe-client-python-sdk/issues/192) -- Added Secrets SDK for storing client secrets in OS keyring [#208](https://github.com/zowe/zowe-client-python-sdk/issues/208) - -### Bug Fixes - -- Fixed profile merge order to match Node.js SDK [#190](https://github.com/zowe/zowe-client-python-sdk/issues/190) -- Fixed issue for datasets and jobs with special characters in URL [#211](https://github.com/zowe/zowe-client-python-sdk/issues/211) -- Fixed exception handling in session.py [#213](https://github.com/zowe/zowe-client-python-sdk/issues/213) ->>>>>>> 80c6a66785746ec730684d04aa70064b2da6e397 diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index 374e98a5..26f49370 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -517,7 +517,7 @@ def write_to_dsn(self, dataset_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODING def download_dsn(self, dataset_name, output_file): """Retrieve the contents of a dataset and saves it to a given file.""" raw_response = self.get_dsn_content_streamed(dataset_name) - with open(output_file, 'w', encoding="utf-8") as f: + with open(output_file, "w", encoding="utf-8") as f: shutil.copyfileobj(raw_response, f) def download_binary_dsn(self, dataset_name, output_file, with_prefixes=False): @@ -564,7 +564,7 @@ def write_to_uss(self, filepath_name, data, encoding=_ZOWE_FILES_DEFAULT_ENCODIN def upload_file_to_uss(self, input_file, filepath_name, encoding=_ZOWE_FILES_DEFAULT_ENCODING): """Upload contents of a given file and uploads it to UNIX file""" if os.path.isfile(input_file): - in_file = open(input_file, 'r', encoding="utf-8") + in_file = open(input_file, "r", encoding="utf-8") file_contents = in_file.read() response_json = self.write_to_uss(filepath_name, file_contents) else: From d1ca06652a0e793dcaa7e44da7498ccf94c71b6a Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 9 Jan 2024 22:32:21 +0530 Subject: [PATCH 5/6] merge conflicts Signed-off-by: aadityasinha-dotcom --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ca66ba..91eb63e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,5 +4,33 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil ## Recent Changes +### Bug Fixes + +- Fixed 'create_data_set' to accept "FBA", "FBM", "VBA", "VBM" as valid recfm [#240](https://github.com/zowe/zowe-client-python-sdk/issues/240) +- Return response instead of raw from streamed requests + +## `1.0.0-dev12` + +### Bug Fixes + +- Fixed Secrets SDK requiring LD_LIBRARY_PATH to be defined when installed from wheel on Linux [#229](https://github.com/zowe/zowe-client-python-sdk/issues/229) +- Fixed 'issue_command' Console API function to provide custom console name [#231](https://github.com/zowe/zowe-client-python-sdk/issues/231) + +## `1.0.0-dev11` + +### Enhancements + +- Added method to save secure profile properties to vault [#72](https://github.com/zowe/zowe-client-python-sdk/issues/72) +- Added method to save profile properties to zowe.config.json file [#73](https://github.com/zowe/zowe-client-python-sdk/issues/73) +- Added CredentialManager class to securely retrieve values from credentials and manage multiple credential entries on Windows [#134](https://github.com/zowe/zowe-client-python-sdk/issues/134) +- Added method to load profile properties from environment variables [#136](https://github.com/zowe/zowe-client-python-sdk/issues/136) +- Added validation of zowe.config.json file matching the schema [#192](https://github.com/zowe/zowe-client-python-sdk/issues/192) +- Added Secrets SDK for storing client secrets in OS keyring [#208](https://github.com/zowe/zowe-client-python-sdk/issues/208) + +### Bug Fixes + +- Fixed profile merge order to match Node.js SDK [#190](https://github.com/zowe/zowe-client-python-sdk/issues/190) +- Fixed issue for datasets and jobs with special characters in URL [#211](https://github.com/zowe/zowe-client-python-sdk/issues/211) +- Fixed exception handling in session.py [#213](https://github.com/zowe/zowe-client-python-sdk/issues/213) - Bug: Default encoding for I/O operations should be UTF-8 - Feature: Added method to load profile properties from environment variables From c43d6b22814512490814c7b5aa3374ed51f0c917 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 9 Jan 2024 13:43:50 -0500 Subject: [PATCH 6/6] Update CHANGELOG.md Signed-off-by: Timothy Johnson --- CHANGELOG.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daa782cf..97de4d09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,13 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil ### Bug Fixes -- Fixed `create_data_set` to accept "FBA", "FBM", "VBA", "VBM" as valid recfm [#240](https://github.com/zowe/zowe-client-python-sdk/issues/240) -- Fixed an issue with `list_jobs` user correlator parameter [#242](https://github.com/zowe/zowe-client-python-sdk/issues/242) -- Return response instead of raw from streamed requests [#245](https://github.com/zowe/zowe-client-python-sdk/pull/245) +- Fixed `Files.create_data_set` to accept "FBA", "FBM", "VBA", "VBM" as valid recfm [#240](https://github.com/zowe/zowe-client-python-sdk/issues/240) +- Fixed an issue with `Jobs.list_jobs` user correlator parameter [#242](https://github.com/zowe/zowe-client-python-sdk/issues/242) +- Fixed default encoding for I/O operations to be UTF-8 on Windows [#243](https://github.com/zowe/zowe-client-python-sdk/issues/243) + +### Enhancements + +- Next Breaking: Updated core SDK method `RequestHandler.perform_streamed_request` to return response object instead of raw buffer. [#245](https://github.com/zowe/zowe-client-python-sdk/pull/245) ## `1.0.0-dev12` @@ -33,5 +37,3 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil - Fixed profile merge order to match Node.js SDK [#190](https://github.com/zowe/zowe-client-python-sdk/issues/190) - Fixed issue for datasets and jobs with special characters in URL [#211](https://github.com/zowe/zowe-client-python-sdk/issues/211) - Fixed exception handling in session.py [#213](https://github.com/zowe/zowe-client-python-sdk/issues/213) -- Bug: Default encoding for I/O operations should be UTF-8 -- Feature: Added method to load profile properties from environment variables