Skip to content

Commit 7576b0e

Browse files
committed
fix(sentinel-graph): preserve narrowed token type for mypy 1.14
Return the locally-bound token (typed 'str') instead of cfg._token (typed 'Optional[str]'). Functionally equivalent — token is assigned to cfg._token on the previous line — but mypy 1.14 (the pinned mypy on the Python 3.8 lockfile) does not narrow the field-access form and flagged: 'Incompatible return value type (got str | None, expected str)'. mypy 1.20+ (3.10+ lockfiles) accepted the original code, which is why the failure was 3.8-specific. Verified clean with both mypy 1.14 and 1.20.2; sentinel-graph tests still pass.
1 parent dadb444 commit 7576b0e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

graphistry/plugins/sentinel_graph.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,12 @@ def _get_auth_token(self) -> str:
378378

379379
# Get token
380380
token_obj = credential.get_token(cfg.auth_scope)
381-
cfg._token = token_obj.token
381+
token = token_obj.token
382+
cfg._token = token
382383
cfg._token_expiry = token_obj.expires_on
383384

384385
logger.info("Successfully obtained authentication token")
385-
return cfg._token
386+
return token
386387

387388
except Exception:
388389
# Security: Don't expose credential details or exception messages

0 commit comments

Comments
 (0)