Skip to content

Commit

Permalink
fixed typing for conditional expression
Browse files Browse the repository at this point in the history
  • Loading branch information
cloutierMat committed Oct 15, 2024
1 parent 7f14f9b commit cb47a38
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion moto/ec2/models/iam_instance_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def associate_iam_instance_profile(
iam_instance_profile_association = IamInstanceProfileAssociation(
self,
iam_association_id,
self.get_instance(instance_id) if instance_id else None, # type: ignore[attr-defined]
self.get_instance(instance_id) if instance_id else None, # type: ignore[attr-defined, arg-type]
instance_profile,
)
# Regarding to AWS there can be only one association with ec2.
Expand Down
5 changes: 4 additions & 1 deletion moto/ec2/responses/vpcs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import List

from moto.core.utils import camelcase_to_underscores
from moto.ec2.utils import add_tag_specification

from ..models.managed_prefixes import ManagedPrefixList
from ._base_response import EC2BaseResponse


Expand Down Expand Up @@ -294,7 +297,7 @@ def get_managed_prefix_list_entries(self) -> str:
managed_prefix_list = self.ec2_backend.get_managed_prefix_list_entries(
prefix_list_id=prefix_list_id
)
entries = []
entries: List[ManagedPrefixList] = []
if managed_prefix_list:
entries = (
list(managed_prefix_list.entries.values())[-1]
Expand Down
6 changes: 3 additions & 3 deletions moto/packages/boto/ec2/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Represents an EC2 Instance
"""

from typing import Any
from typing import Any, Optional

from moto.packages.boto.ec2.ec2object import EC2Object, TaggedEC2Object
from moto.packages.boto.ec2.image import ProductCodes
Expand Down Expand Up @@ -159,8 +159,8 @@ def __init__(self, connection: Any = None):
self.platform = None
self.interfaces: Any = []
self.hypervisor = None
self.virtualization_type = None
self.architecture = None
self.virtualization_type: Optional[str] = None
self.architecture: Optional[str] = None
self.instance_profile = None
self._previous_state = None
self._placement = InstancePlacement()
Expand Down
3 changes: 3 additions & 0 deletions moto/s3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ def get_canned_acl(acl: str) -> FakeAcl:


class LifecycleFilter(BaseModel):
tag_key: Optional[str]
tag_value: Optional[str]

def __init__(
self,
prefix: Optional[str] = None,
Expand Down

0 comments on commit cb47a38

Please sign in to comment.