Skip to content

Commit 3cea407

Browse files
jacalataclaude
andcommitted
Deduplicate DOWNLOAD_CHUNK_SIZE_MB default
jarhun88 pointed out the default value 1 was hardcoded in two places: once as the string fallback for os.getenv, and again in the ValueError except branch. Pull it into a single class attribute so there's one source of truth. Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent 08d456c commit 3cea407

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎tableauserverclient/config.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ def CHUNK_SIZE_MB(self):
3636
# Bounds: values <= 0 or non-numeric input are treated as invalid and fall
3737
# back to the 1 MB default; 0 or a negative chunk size would silently
3838
# corrupt the output because iter_content interprets it as "read all".
39+
_DOWNLOAD_CHUNK_SIZE_MB_DEFAULT = 1
40+
3941
@property
4042
def DOWNLOAD_CHUNK_SIZE_MB(self) -> int:
41-
raw = os.getenv("TSC_DOWNLOAD_CHUNK_SIZE_MB", "1")
43+
raw = os.getenv("TSC_DOWNLOAD_CHUNK_SIZE_MB", str(self._DOWNLOAD_CHUNK_SIZE_MB_DEFAULT))
4244
try:
4345
value = int(raw)
4446
except ValueError:
4547
# invalid env value; fall back to default
46-
value = 1
48+
value = self._DOWNLOAD_CHUNK_SIZE_MB_DEFAULT
4749
return max(1, value)
4850

4951
# Default page size

0 commit comments

Comments
 (0)