Skip to content

Commit 240326e

Browse files
committed
style(sdk/python): apply ruff formatting
1 parent 148d9c0 commit 240326e

3 files changed

Lines changed: 8 additions & 27 deletions

File tree

sdk/python/src/dstack_sdk/dstack_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,7 @@ async def _ensure_algorithm_supported(self, algorithm: str) -> None:
401401
"OS version too old (Version RPC unavailable)"
402402
)
403403

404-
async def _ensure_tls_key_options_supported(
405-
self, feature_names: List[str]
406-
) -> None:
404+
async def _ensure_tls_key_options_supported(self, feature_names: List[str]) -> None:
407405
"""Check OS version when 0.5.7+ TLS key options are requested."""
408406
try:
409407
await self.version()

sdk/python/src/dstack_sdk/verify_env_encrypt_public_key.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def verify_env_encrypt_public_key(
7979
return None
8080

8181
timestamp_bytes = timestamp.to_bytes(8, "big")
82-
message = (
83-
_PREFIX + _SEPARATOR + app_id_bytes + timestamp_bytes + public_key
84-
)
82+
message = _PREFIX + _SEPARATOR + app_id_bytes + timestamp_bytes + public_key
8583
return _recover_signer(keccak(message), signature)
8684

8785

sdk/python/tests/test_verify_env_encrypt_public_key.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ def test_v1_recovers_signer_for_round_trip_signature():
108108
timestamp = int(time.time())
109109
signature = _sign_v1(signer, public_key, app_id, timestamp)
110110

111-
recovered = verify_env_encrypt_public_key(
112-
public_key, signature, app_id, timestamp
113-
)
111+
recovered = verify_env_encrypt_public_key(public_key, signature, app_id, timestamp)
114112
assert recovered == "0x" + signer.public_key.to_compressed_bytes().hex()
115113

116114

@@ -122,10 +120,7 @@ def test_v1_rejects_expired_timestamp():
122120
signature = _sign_v1(signer, public_key, app_id, timestamp)
123121

124122
assert (
125-
verify_env_encrypt_public_key(
126-
public_key, signature, app_id, timestamp
127-
)
128-
is None
123+
verify_env_encrypt_public_key(public_key, signature, app_id, timestamp) is None
129124
)
130125

131126

@@ -137,10 +132,7 @@ def test_v1_rejects_future_timestamp_beyond_skew():
137132
signature = _sign_v1(signer, public_key, app_id, timestamp)
138133

139134
assert (
140-
verify_env_encrypt_public_key(
141-
public_key, signature, app_id, timestamp
142-
)
143-
is None
135+
verify_env_encrypt_public_key(public_key, signature, app_id, timestamp) is None
144136
)
145137

146138

@@ -151,9 +143,7 @@ def test_v1_accepts_small_future_skew():
151143
timestamp = int(time.time()) + 30 # within the 60s tolerance
152144
signature = _sign_v1(signer, public_key, app_id, timestamp)
153145

154-
recovered = verify_env_encrypt_public_key(
155-
public_key, signature, app_id, timestamp
156-
)
146+
recovered = verify_env_encrypt_public_key(public_key, signature, app_id, timestamp)
157147
assert recovered == "0x" + signer.public_key.to_compressed_bytes().hex()
158148

159149

@@ -165,10 +155,7 @@ def test_v1_respects_custom_max_age():
165155
signature = _sign_v1(signer, public_key, app_id, timestamp)
166156

167157
assert (
168-
verify_env_encrypt_public_key(
169-
public_key, signature, app_id, timestamp
170-
)
171-
is None
158+
verify_env_encrypt_public_key(public_key, signature, app_id, timestamp) is None
172159
)
173160
recovered = verify_env_encrypt_public_key(
174161
public_key, signature, app_id, timestamp, max_age_seconds=1000
@@ -193,9 +180,7 @@ def test_v1_rejects_malformed_app_id():
193180
# Sign with the well-formed app_id but verify with a malformed one.
194181
signature = _sign_v1(signer, public_key, "ab" * 20, timestamp)
195182
assert (
196-
verify_env_encrypt_public_key(
197-
public_key, signature, "not-hex", timestamp
198-
)
183+
verify_env_encrypt_public_key(public_key, signature, "not-hex", timestamp)
199184
is None
200185
)
201186

0 commit comments

Comments
 (0)