Skip to content

Commit fdebea0

Browse files
authored
Remove literal type alias to help sphinx render (#1129)
This type alias is used in 3 locations (two of which are internal), but sphinx autodoc does not render it as desired or expected. It seems that there's something more complex going wrong with the docstring for this class, but it may also be related to some outstanding sphinx bugs related to type aliases and literals, specifically. For now, switch off of the alias and use the literal verbatim in `TransferData.__init__` to get a rendering which is much closer to being correct.
1 parent f434f8e commit fdebea0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/globus_sdk/services/transfer/data/transfer_data.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
import globus_sdk
1212

1313
log = logging.getLogger(__name__)
14-
_StrSyncLevel = t.Literal["exists", "size", "mtime", "checksum"]
15-
_sync_level_dict: dict[_StrSyncLevel, int] = {
14+
_sync_level_dict: dict[t.Literal["exists", "size", "mtime", "checksum"], int] = {
1615
"exists": 0,
1716
"size": 1,
1817
"mtime": 2,
1918
"checksum": 3,
2019
}
2120

2221

23-
def _parse_sync_level(sync_level: _StrSyncLevel | int) -> int:
22+
def _parse_sync_level(
23+
sync_level: t.Literal["exists", "size", "mtime", "checksum"] | int
24+
) -> int:
2425
"""
2526
Map sync_level strings to known int values
2627
@@ -168,7 +169,9 @@ def __init__(
168169
*,
169170
label: str | None = None,
170171
submission_id: UUIDLike | None = None,
171-
sync_level: _StrSyncLevel | int | None = None,
172+
sync_level: (
173+
int | None | t.Literal["exists", "size", "mtime", "checksum"]
174+
) = None,
172175
verify_checksum: bool = False,
173176
preserve_timestamp: bool = False,
174177
encrypt_data: bool = False,

0 commit comments

Comments
 (0)