Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add type checking on condition for mypy-boto3 #5570

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions samcli/lib/remote_invoke/lambda_invoke_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
import base64
import json
import logging
import typing
from abc import ABC, abstractmethod
from json import JSONDecodeError
from typing import cast

from botocore.eventstream import EventStream
from botocore.exceptions import ClientError, ParamValidationError
from botocore.response import StreamingBody
from mypy_boto3_lambda.client import LambdaClient

if typing.TYPE_CHECKING: # pragma: no cover
from mypy_boto3_lambda.client import LambdaClient

from samcli.lib.remote_invoke.exceptions import (
ErrorBotoApiCallException,
Expand Down Expand Up @@ -47,11 +50,13 @@ class AbstractLambdaInvokeExecutor(BotoActionExecutor, ABC):
For Payload parameter, if a file location provided, the file handle will be passed as Payload object
"""

_lambda_client: LambdaClient
_lambda_client: "LambdaClient"
_function_name: str
_remote_output_format: RemoteInvokeOutputFormat

def __init__(self, lambda_client: LambdaClient, function_name: str, remote_output_format: RemoteInvokeOutputFormat):
def __init__(
self, lambda_client: "LambdaClient", function_name: str, remote_output_format: RemoteInvokeOutputFormat
):
self._lambda_client = lambda_client
self._function_name = function_name
self._remote_output_format = remote_output_format
Expand Down Expand Up @@ -219,7 +224,7 @@ def map(self, remote_invoke_input: RemoteInvokeResponse) -> RemoteInvokeResponse
return remote_invoke_input


def _is_function_invoke_mode_response_stream(lambda_client: LambdaClient, function_name: str):
def _is_function_invoke_mode_response_stream(lambda_client: "LambdaClient", function_name: str):
"""
Returns True if given function has RESPONSE_STREAM as InvokeMode, False otherwise
"""
Expand Down
9 changes: 6 additions & 3 deletions samcli/lib/remote_invoke/stepfunctions_invoke_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"""
import logging
import time
import typing
from datetime import datetime
from typing import cast

from botocore.exceptions import ClientError, ParamValidationError
from mypy_boto3_stepfunctions import SFNClient

if typing.TYPE_CHECKING: # pragma: no cover
from mypy_boto3_stepfunctions import SFNClient

from samcli.lib.remote_invoke.exceptions import (
ErrorBotoApiCallException,
Expand Down Expand Up @@ -38,13 +41,13 @@ class StepFunctionsStartExecutionExecutor(BotoActionExecutor):
execution details.
"""

_stepfunctions_client: SFNClient
_stepfunctions_client: "SFNClient"
_state_machine_arn: str
_remote_output_format: RemoteInvokeOutputFormat
request_parameters: dict

def __init__(
self, stepfunctions_client: SFNClient, physical_id: str, remote_output_format: RemoteInvokeOutputFormat
self, stepfunctions_client: "SFNClient", physical_id: str, remote_output_format: RemoteInvokeOutputFormat
):
self._stepfunctions_client = stepfunctions_client
self._remote_output_format = remote_output_format
Expand Down
Loading