Skip to content

Commit 1260dff

Browse files
committed
add typing and next token
1 parent 4a6b3af commit 1260dff

File tree

2 files changed

+39
-33
lines changed

2 files changed

+39
-33
lines changed

src/sagemaker/session.py

+35-29
Original file line numberDiff line numberDiff line change
@@ -6467,10 +6467,10 @@ def create_hub(
64676467
self,
64686468
hub_name: str,
64696469
hub_description: str,
6470-
hub_display_name=None,
6471-
hub_search_keywords=None,
6472-
s3_storage_config=None,
6473-
tags=None
6470+
hub_display_name: str = None,
6471+
hub_search_keywords: List[str] = None,
6472+
s3_storage_config: Dict[str, Any] = None,
6473+
tags: List[Dict[str, Any]] = None
64746474
) -> Dict[str, str]:
64756475
"""Creates a SageMaker Hub
64766476
@@ -6518,19 +6518,20 @@ def describe_hub(
65186518

65196519
def list_hubs(
65206520
self,
6521-
creation_time_after=None,
6522-
creation_time_before=None,
6523-
max_results=None,
6524-
max_schema_version=None,
6525-
name_contains=None,
6526-
sort_by=None,
6527-
sort_order=None
6521+
creation_time_after: str = None,
6522+
creation_time_before: str = None,
6523+
max_results: int = None,
6524+
max_schema_version: str = None,
6525+
name_contains: str = None,
6526+
next_token: str = None,
6527+
sort_by: str = None,
6528+
sort_order: str = None
65286529
) -> Dict[str, Any]:
65296530
"""Lists all existing SageMaker Hubs
65306531
65316532
Args:
6532-
creation_time_after (int): Only list HubContent that was created after the time specified.
6533-
creation_time_before (int): Only list HubContent that was created before the time specified.
6533+
creation_time_after (str): Only list HubContent that was created after the time specified.
6534+
creation_time_before (str): Only list HubContent that was created before the time specified.
65346535
max_results (int): The maximum amount of HubContent to list.
65356536
max_schema_version (str): The upper bound of the HubContentSchemaVersion.
65366537
name_contains (str): Only list HubContent if the name contains the specified string.
@@ -6552,6 +6553,8 @@ def list_hubs(
65526553
request["MaxSchemaVersion"] = max_schema_version
65536554
if name_contains:
65546555
request["NameContains"] = name_contains
6556+
if next_token:
6557+
request["NextToken"] = next_token
65556558
if sort_by:
65566559
request["SortBy"] = sort_by
65576560
if sort_order:
@@ -6563,21 +6566,22 @@ def list_hub_contents(
65636566
self,
65646567
hub_name: str,
65656568
hub_content_type: str,
6566-
creation_time_after=None,
6567-
creation_time_before=None,
6568-
max_results=None,
6569-
max_schema_version=None,
6570-
name_contains=None,
6571-
sort_by=None,
6572-
sort_order=None
6569+
creation_time_after: str = None,
6570+
creation_time_before: str = None,
6571+
max_results: int = None,
6572+
max_schema_version: str = None,
6573+
name_contains: str = None,
6574+
next_token: str = None,
6575+
sort_by: str = None,
6576+
sort_order: str = None
65736577
) -> Dict[str, Any]:
65746578
"""Lists the HubContents in a SageMaker Hub
65756579
65766580
Args:
65776581
hub_name (str): The name of the Hub to list the contents of.
65786582
hub_content_type (str): The type of the HubContent to list.
6579-
creation_time_after (int): Only list HubContent that was created after the time specified.
6580-
creation_time_before (int): Only list HubContent that was created before the time specified.
6583+
creation_time_after (str): Only list HubContent that was created after the time specified.
6584+
creation_time_before (str): Only list HubContent that was created before the time specified.
65816585
max_results (int): The maximum amount of HubContent to list.
65826586
max_schema_version (str): The upper bound of the HubContentSchemaVersion.
65836587
name_contains (str): Only list HubContent if the name contains the specified string.
@@ -6602,6 +6606,8 @@ def list_hub_contents(
66026606
request["MaxSchemaVersion"] = max_schema_version
66036607
if name_contains:
66046608
request["NameContains"] = name_contains
6609+
if next_token:
6610+
request["NextToken"] = next_token
66056611
if sort_by:
66066612
request["SortBy"] = sort_by
66076613
if sort_order:
@@ -6629,12 +6635,12 @@ def import_hub_content(
66296635
hub_content_type: str,
66306636
hub_name: str,
66316637
hub_content_document: str,
6632-
hub_content_display_name=None,
6633-
hub_content_description=None,
6634-
hub_content_version=None,
6635-
hub_content_markdown=None,
6636-
hub_content_search_keywords=None,
6637-
tags=None
6638+
hub_content_display_name: str = None,
6639+
hub_content_description: str = None,
6640+
hub_content_version: str = None,
6641+
hub_content_markdown: str = None,
6642+
hub_content_search_keywords: List[str] = None,
6643+
tags: List[Dict[str, Any]] =None
66386644
) -> Dict[str, str]:
66396645
"""Imports a new HubContent into a SageMaker Hub
66406646
@@ -6682,7 +6688,7 @@ def describe_hub_content(
66826688
hub_content_name: str,
66836689
hub_content_type: str,
66846690
hub_name: str,
6685-
hub_content_version=None
6691+
hub_content_version: str = None
66866692
) -> Dict[str, Any]:
66876693
"""Describes a HubContent in a SageMaker Hub
66886694

tests/unit/test_session.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6530,7 +6530,7 @@ def test_list_hubs(sagemaker_session):
65306530
sagemaker_session.list_hubs(
65316531
creation_time_after="08-14-1997 12:00:00",
65326532
creation_time_before="01-08-2024 10:25:00",
6533-
max_results="25",
6533+
max_results=25,
65346534
max_schema_version="1.0.5",
65356535
name_contains="mock-hub",
65366536
sort_by="HubName",
@@ -6540,7 +6540,7 @@ def test_list_hubs(sagemaker_session):
65406540
request = {
65416541
"CreationTimeAfter": "08-14-1997 12:00:00",
65426542
"CreationTimeBefore": "01-08-2024 10:25:00",
6543-
"MaxResults": "25",
6543+
"MaxResults": 25,
65446544
"MaxSchemaVersion": "1.0.5",
65456545
"NameContains": "mock-hub",
65466546
"SortBy": "HubName",
@@ -6555,7 +6555,7 @@ def test_list_hub_contents(sagemaker_session):
65556555
hub_content_type="MODEL",
65566556
creation_time_after="08-14-1997 12:00:00",
65576557
creation_time_before="01-08/2024 10:25:00",
6558-
max_results="25",
6558+
max_results=25,
65596559
max_schema_version="1.0.5",
65606560
name_contains="mock-hub",
65616561
sort_by="HubName",
@@ -6567,7 +6567,7 @@ def test_list_hub_contents(sagemaker_session):
65676567
"HubContentType": "MODEL",
65686568
"CreationTimeAfter": "08-14-1997 12:00:00",
65696569
"CreationTimeBefore": "01-08/2024 10:25:00",
6570-
"MaxResults": "25",
6570+
"MaxResults": 25,
65716571
"MaxSchemaVersion": "1.0.5",
65726572
"NameContains": "mock-hub",
65736573
"SortBy": "HubName",

0 commit comments

Comments
 (0)