Skip to content

Commit ffd1b83

Browse files
committed
Add optional typecheck for nullable parameters
1 parent 0e3769e commit ffd1b83

13 files changed

+91
-91
lines changed

src/sagemaker/workflow/automl_step.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def __init__(
3434
self,
3535
name: str,
3636
step_args: _JobStepArguments,
37-
display_name: str = None,
38-
description: str = None,
39-
cache_config: CacheConfig = None,
37+
display_name: Optional[str] = None,
38+
description: Optional[str] = None,
39+
cache_config: Optional[CacheConfig] = None,
4040
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
41-
retry_policies: List[RetryPolicy] = None,
41+
retry_policies: Optional[List[RetryPolicy]] = None,
4242
):
4343
"""Construct a `AutoMLStep`, given a `AutoML` instance.
4444

src/sagemaker/workflow/callback_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def __init__(
8484
sqs_queue_url: str,
8585
inputs: dict,
8686
outputs: List[CallbackOutput],
87-
display_name: str = None,
88-
description: str = None,
89-
cache_config: CacheConfig = None,
87+
display_name: Optional[str] = None,
88+
description: Optional[str] = None,
89+
cache_config: Optional[CacheConfig] = None,
9090
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
9191
):
9292
"""Constructs a CallbackStep.

src/sagemaker/workflow/clarify_check_step.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ def __init__(
159159
skip_check: Union[bool, PipelineVariable] = False,
160160
fail_on_violation: Union[bool, PipelineVariable] = True,
161161
register_new_baseline: Union[bool, PipelineVariable] = False,
162-
model_package_group_name: Union[str, PipelineVariable] = None,
163-
supplied_baseline_constraints: Union[str, PipelineVariable] = None,
164-
display_name: str = None,
165-
description: str = None,
166-
cache_config: CacheConfig = None,
162+
model_package_group_name: Optional[Union[str, PipelineVariable]] = None,
163+
supplied_baseline_constraints: Optional[Union[str, PipelineVariable]] = None,
164+
display_name: Optional[str] = None,
165+
description: Optional[str] = None,
166+
cache_config: Optional[CacheConfig] = None,
167167
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
168168
):
169169
"""Constructs a ClarifyCheckStep.

src/sagemaker/workflow/condition_step.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def __init__(
4141
self,
4242
name: str,
4343
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
44-
display_name: str = None,
45-
description: str = None,
46-
conditions: List[Condition] = None,
47-
if_steps: List[Union[Step, StepCollection, StepOutput]] = None,
48-
else_steps: List[Union[Step, StepCollection, StepOutput]] = None,
44+
display_name: Optional[str] = None,
45+
description: Optional[str] = None,
46+
conditions: Optional[List[Condition]] = None,
47+
if_steps: Optional[List[Union[Step, StepCollection]]] = None,
48+
else_steps: Optional[List[Union[Step, StepCollection]]] = None,
4949
):
5050
"""Construct a ConditionStep for pipelines to support conditional branching.
5151

src/sagemaker/workflow/emr_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ def __init__(
161161
cluster_id: str,
162162
step_config: EMRStepConfig,
163163
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
164-
cache_config: CacheConfig = None,
165-
cluster_config: Dict[str, Any] = None,
166-
execution_role_arn: str = None,
164+
cache_config: Optional[CacheConfig] = None,
165+
cluster_config: Optional[Dict[str, Any]] = None,
166+
execution_role_arn: Optional[str] = None,
167167
):
168168
"""Constructs an `EMRStep`.
169169

src/sagemaker/workflow/fail_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class FailStep(Step):
2929
def __init__(
3030
self,
3131
name: str,
32-
error_message: Union[str, PipelineVariable] = None,
33-
display_name: str = None,
34-
description: str = None,
32+
error_message: Optional[Union[str, PipelineVariable]] = None,
33+
display_name: Optional[str] = None,
34+
description: Optional[str] = None,
3535
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
3636
):
3737
"""Constructs a `FailStep`.

src/sagemaker/workflow/lambda_step.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ def __init__(
8484
self,
8585
name: str,
8686
lambda_func: Lambda,
87-
display_name: str = None,
88-
description: str = None,
89-
inputs: dict = None,
90-
outputs: List[LambdaOutput] = None,
91-
cache_config: CacheConfig = None,
87+
display_name: Optional[str] = None,
88+
description: Optional[str] = None,
89+
inputs: Optional[dict] = None,
90+
outputs: Optional[List[LambdaOutput]] = None,
91+
cache_config: Optional[CacheConfig] = None,
9292
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
9393
):
9494
"""Constructs a LambdaStep.

src/sagemaker/workflow/monitor_batch_transform_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def __init__(
4848
check_job_configuration: CheckJobConfig,
4949
monitor_before_transform: bool = False,
5050
fail_on_violation: Union[bool, PipelineVariable] = True,
51-
supplied_baseline_statistics: Union[str, PipelineVariable] = None,
52-
supplied_baseline_constraints: Union[str, PipelineVariable] = None,
51+
supplied_baseline_statistics: Optional[Union[str, PipelineVariable]] = None,
52+
supplied_baseline_constraints: Optional[Union[str, PipelineVariable]] = None,
5353
display_name: Optional[str] = None,
5454
description: Optional[str] = None,
5555
):

src/sagemaker/workflow/quality_check_step.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def __init__(
125125
skip_check: Union[bool, PipelineVariable] = False,
126126
fail_on_violation: Union[bool, PipelineVariable] = True,
127127
register_new_baseline: Union[bool, PipelineVariable] = False,
128-
model_package_group_name: Union[str, PipelineVariable] = None,
129-
supplied_baseline_statistics: Union[str, PipelineVariable] = None,
130-
supplied_baseline_constraints: Union[str, PipelineVariable] = None,
131-
display_name: str = None,
132-
description: str = None,
133-
cache_config: CacheConfig = None,
128+
model_package_group_name: Optional[Union[str, PipelineVariable]] = None,
129+
supplied_baseline_statistics: Optional[Union[str, PipelineVariable]] = None,
130+
supplied_baseline_constraints: Optional[Union[str, PipelineVariable]] = None,
131+
display_name: Optional[str] = None,
132+
description: Optional[str] = None,
133+
cache_config: Optional[CacheConfig] = None,
134134
depends_on: Optional[List[Union[str, Step, StepCollection]]] = None,
135135
):
136136
"""Constructs a QualityCheckStep.

src/sagemaker/workflow/retry.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from __future__ import absolute_import
1515

1616
from enum import Enum
17-
from typing import List
17+
from typing import List, Optional
1818
import attr
1919

2020
from sagemaker.workflow.entities import Entity, DefaultEnumMeta, RequestType
@@ -133,8 +133,8 @@ def __init__(
133133
exception_types: List[StepExceptionTypeEnum],
134134
backoff_rate: float = 2.0,
135135
interval_seconds: int = 1,
136-
max_attempts: int = None,
137-
expire_after_mins: int = None,
136+
max_attempts: Optional[int] = None,
137+
expire_after_mins: Optional[int] = None,
138138
):
139139
super().__init__(backoff_rate, interval_seconds, max_attempts, expire_after_mins)
140140
for exception_type in exception_types:
@@ -177,12 +177,12 @@ class SageMakerJobStepRetryPolicy(RetryPolicy):
177177

178178
def __init__(
179179
self,
180-
exception_types: List[SageMakerJobExceptionTypeEnum] = None,
181-
failure_reason_types: List[SageMakerJobExceptionTypeEnum] = None,
180+
exception_types: Optional[List[SageMakerJobExceptionTypeEnum]] = None,
181+
failure_reason_types: Optional[List[SageMakerJobExceptionTypeEnum]] = None,
182182
backoff_rate: float = 2.0,
183183
interval_seconds: int = 1,
184-
max_attempts: int = None,
185-
expire_after_mins: int = None,
184+
max_attempts: Optional[int] = None,
185+
expire_after_mins: Optional[int] = None,
186186
):
187187
super().__init__(backoff_rate, interval_seconds, max_attempts, expire_after_mins)
188188

0 commit comments

Comments
 (0)