Skip to content

Commit

Permalink
fix(python): default_bytes_stream_chunk_size is respected even if req…
Browse files Browse the repository at this point in the history
…uest options is not passed in (#4972)
  • Loading branch information
armandobelardo authored Oct 21, 2024
1 parent d7b7c8f commit d260cd5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions generators/python/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# For unreleased changes, use unreleased.yml
- version: 4.3.2
irVersion: 53
changelogEntry:
- type: fix
summary: |
The generator will now correctly default to the configured global `default_bytes_stream_chunk_size` when the `request_options` parameter is not provided.
- version: 4.3.1
irVersion: 53
changelogEntry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ def _handle_success_text(

def _handle_success_file_download(self, *, writer: AST.NodeWriter) -> None:
maybe_chunk_size_default = self._context.custom_config.default_bytes_stream_chunk_size
defaulted_chunk_size_default = maybe_chunk_size_default if maybe_chunk_size_default is not None else "None"
chunk_size_variable = "_chunk_size"
writer.write_line(
f'{chunk_size_variable} = request_options.get("chunk_size", {maybe_chunk_size_default if maybe_chunk_size_default is not None else "None"}) if request_options is not None else None'
f'{chunk_size_variable} = request_options.get("chunk_size", {defaulted_chunk_size_default}) if request_options is not None else {defaulted_chunk_size_default}'
)
if self._is_async:
writer.write("async ")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d260cd5

Please sign in to comment.