Skip to content

Conversation

@KUGDev
Copy link
Contributor

@KUGDev KUGDev commented Dec 1, 2025

What It Does

Fixes #375

How to Test

  1. Create a USS file with non-latin symbols
  2. Call uss.get_content("/path/to/file", file_encoding="UTF-8", receive_encoding="UTF-8"), uss.get_content_streamed("/path/to/file", binary=False, file_encoding="UTF-8", receive_encoding="UTF-8"), uss.download("/path/to/file", "/output/path", binary=False, file_encoding="UTF-8", receive_encoding="UTF-8")
  3. Make sure that the content is correct

Review Checklist
I certify that I have:

Additional Comments

@github-project-automation github-project-automation bot moved this to New Issues in Zowe CLI Squad Dec 1, 2025
@zowe-robot zowe-robot moved this from New Issues to Review/QA in Zowe CLI Squad Dec 1, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 82.19178% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.99%. Comparing base (8fe22c2) to head (4289689).

Files with missing lines Patch % Lines
.../zos_files/zowe/zos_files_for_zowe_sdk/datasets.py 53.57% 13 Missing ⚠️
src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py 90.78% 7 Missing ⚠️
..._files/zowe/zos_files_for_zowe_sdk/response/uss.py 82.35% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #380      +/-   ##
==========================================
+ Coverage   81.88%   81.99%   +0.10%     
==========================================
  Files          48       48              
  Lines        2771     2893     +122     
==========================================
+ Hits         2269     2372     +103     
- Misses        502      521      +19     
Flag Coverage Δ
unittests 81.99% <82.19%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delayed review, thanks @KUGDev for your contribution! 😁

Have a few questions related to how receive_encoding works in the download method, otherwise LGTM!

@KUGDev
Copy link
Contributor Author

KUGDev commented Jan 14, 2026

Hi @t1m0thyj.
Thank you for the review.
Please, read my response on the last comment

@t1m0thyj t1m0thyj self-requested a review January 14, 2026 17:08
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
@KUGDev
Copy link
Contributor Author

KUGDev commented Jan 28, 2026

@t1m0thyj I added functionality to upload and write binary USS files 5ff177ee. For some reason GitHub Action for Python 3.12 does not work properly. I don't think it is necessary to create a separate branch for such changes, but let me know if it would be better to do so.

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KUGDev for making updates! Left one more comment.

I think the CI failures were due to a transient Codecov issue, as they passed when re-run.

if not isinstance(response, requests.Response):
raise TypeError(f"Expected requests.Response, got {type(response)}")
with open(output_file, "wb" if binary else "w", encoding="utf-8") as f:
with open(output_file, "wb" if binary else "w", encoding=receive_encoding) as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the open method is invoked with wb mode, it will throw an error if encoding argument is provided.

Suggested change
with open(output_file, "wb" if binary else "w", encoding=receive_encoding) as f:
with open(output_file, "wb" if binary else "w", encoding=None if binary else receive_encoding) as f:

Copy link
Contributor Author

@KUGDev KUGDev Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch @t1m0thyj ! Thank you:)
I also noticed that in the data sets part the same functionality is implemented as download + download_binary. I don't know if it is ok to combine them the same way as in the USS part since some SDK users could already utilize that as it is right now. What do you think?
As a workaround I can propose to mark download_binary as deprecated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also good catch on the inconsistency between USS and Data Set APIs 😋

I think combining the 2 methods for data sets into 1 makes sense, as long as we keep the old method deprecated 👍

Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
@KUGDev KUGDev force-pushed the feature/GH-375 branch 2 times, most recently from b798e87 to b417455 Compare January 28, 2026 20:04
…upload for USSFiles and Datasets classes

Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
@KUGDev
Copy link
Contributor Author

KUGDev commented Jan 28, 2026

@t1m0thyj sorry, got too deep into changes😅
Let me know if it is ok to stay like that, otherwise I will rollback to the previous version

Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
@JTonda JTonda requested a review from t1m0thyj February 2, 2026 16:07
…Response

Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review/QA

Development

Successfully merging this pull request may close these issues.

File encoding issue in USSFiles.download

2 participants