Skip to content

Commit efb4cfb

Browse files
committed
linting
1 parent 843f4b5 commit efb4cfb

5 files changed

Lines changed: 29 additions & 21 deletions

File tree

src/pyssm_client/cli/types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class FileCopyArguments:
167167

168168
# Transfer options
169169
encoding: FileTransferEncoding = FileTransferEncoding.BASE64
170-
chunk_size: int = 32768 # 32KB (safe for base64 encoding + protocol overhead within 64KB frames)
170+
chunk_size: int = (
171+
32768 # 32KB (safe for base64 encoding + protocol overhead within 64KB frames)
172+
)
171173
verify_checksum: bool = True
172174
checksum_type: ChecksumType = ChecksumType.MD5
173175

src/pyssm_client/file_transfer/client.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ async def download_file(
203203

204204
if success and options.verify_checksum and remote_checksum:
205205
# Verify local checksum
206-
local_checksum = FileChecksum.compute(local_file, options.checksum_type)
206+
local_checksum = FileChecksum.compute(
207+
local_file, options.checksum_type
208+
)
207209

208210
if local_checksum.value != remote_checksum:
209211
self.logger.error(
@@ -389,6 +391,7 @@ def handle_closed() -> None:
389391

390392
# Set client info and attach to session
391393
from ..constants import CLIENT_VERSION
394+
392395
try:
393396
data_channel.set_client_info("pyssm-client", CLIENT_VERSION)
394397
except Exception:
@@ -472,7 +475,7 @@ async def _upload_base64(
472475
) -> bool:
473476
"""Upload file using base64 encoding via data channel with verification, move, and chmod."""
474477
temp_remote = f"{remote_path}{options.temp_suffix}"
475-
478+
476479
# Clear any existing temp file
477480
clear_cmd = f"rm -f '{temp_remote}'\n"
478481
await data_channel.send_input_data(clear_cmd.encode())
@@ -482,19 +485,19 @@ async def _upload_base64(
482485
bytes_sent = 0
483486
file_size = local_file.stat().st_size
484487

485-
self.logger.info(
486-
"Starting upload of %s (%s bytes)", local_file, file_size
487-
)
488+
self.logger.info("Starting upload of %s (%s bytes)", local_file, file_size)
488489

489490
with open(local_file, "rb") as f:
490491
while chunk := f.read(options.chunk_size):
491492
# Encode chunk to base64
492-
encoded_chunk = base64.b64encode(chunk).decode('ascii')
493-
493+
encoded_chunk = base64.b64encode(chunk).decode("ascii")
494+
494495
# Send chunk using simple append (no heredoc complexity)
495-
append_cmd = f"echo -n '{encoded_chunk}' | base64 -d >> '{temp_remote}'\n"
496+
append_cmd = (
497+
f"echo -n '{encoded_chunk}' | base64 -d >> '{temp_remote}'\n"
498+
)
496499
await data_channel.send_input_data(append_cmd.encode())
497-
500+
498501
bytes_sent += len(chunk)
499502

500503
# Progress callback
@@ -531,21 +534,22 @@ async def _upload_base64(
531534
file_size,
532535
)
533536

534-
self.logger.debug("Upload completed: %s bytes sent to %s", bytes_sent, temp_remote)
535-
537+
self.logger.debug(
538+
"Upload completed: %s bytes sent to %s", bytes_sent, temp_remote
539+
)
540+
536541
# Move temp file to final location via data channel
537542
move_cmd = f"mv '{temp_remote}' '{remote_path}'\n"
538543
await data_channel.send_input_data(move_cmd.encode())
539544
await asyncio.sleep(0.2)
540-
545+
541546
# Set file permissions to match local file
542547
local_mode = local_file.stat().st_mode & 0o777
543548
chmod_cmd = f"chmod {local_mode:o} '{remote_path}'\n"
544549
await data_channel.send_input_data(chmod_cmd.encode())
545550
await asyncio.sleep(0.1)
546-
547-
return True
548551

552+
return True
549553

550554
async def _upload_raw(
551555
self,
@@ -624,7 +628,10 @@ async def _wait_for_remote_size(
624628
last_size = 0
625629

626630
self.logger.debug(
627-
"Remote file %s currently %s/%s bytes", remote_path, last_size, expected_size
631+
"Remote file %s currently %s/%s bytes",
632+
remote_path,
633+
last_size,
634+
expected_size,
628635
)
629636

630637
if last_size >= expected_size:

src/pyssm_client/file_transfer/types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class FileTransferOptions:
3434
"""Options for file transfer operations."""
3535

3636
# Transfer configuration
37-
chunk_size: int = 32768 # 32KB chunks (safe for base64 encoding + protocol overhead within 64KB frames)
37+
chunk_size: int = (
38+
32768 # 32KB chunks (safe for base64 encoding + protocol overhead within 64KB frames)
39+
)
3840
encoding: FileTransferEncoding = FileTransferEncoding.BASE64
3941
verify_checksum: bool = True
4042
checksum_type: ChecksumType = ChecksumType.MD5

src/pyssm_client/utils/command.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ def handle_closed() -> None:
219219
lines = stdout_text.split("\n")
220220
filtered_lines = [line for line in lines if "__SSM_EXIT__:" not in line]
221221
clean_stdout = "\n".join(filtered_lines)
222-
final_stdout = _filter_shell_output(
223-
clean_stdout.encode("utf-8"), command
224-
)
222+
final_stdout = _filter_shell_output(clean_stdout.encode("utf-8"), command)
225223
else:
226224
final_stdout = _filter_shell_output(bytes(stdout_buf), command)
227225

tests/test_file_transfer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class TestSessionManagerPluginIntegration:
186186
"""Test SessionManagerPlugin file transfer methods."""
187187

188188

189-
190189
class TestProgressReporting:
191190
"""Test progress reporting functionality."""
192191

0 commit comments

Comments
 (0)