Skip to content
Closed
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
11 changes: 3 additions & 8 deletions moto/apigateway/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,6 @@ def to_json(self) -> Dict[str, Any]:


class RestAPI(CloudFormationModel):

PROP_ID = "id"
PROP_NAME = "name"
PROP_DESCRIPTION = "description"
Expand Down Expand Up @@ -1462,7 +1461,6 @@ def to_json(self) -> Dict[str, Any]:


class BasePathMapping(BaseModel):

# operations
OPERATION_REPLACE = "replace"
OPERATION_PATH = "path"
Expand Down Expand Up @@ -1681,9 +1679,7 @@ def put_rest_api(
api.resources = {}
api.default = api.add_child("/") # Add default child

for (path, resource_doc) in sorted(
api_doc["paths"].items(), key=lambda x: x[0]
):
for path, resource_doc in sorted(api_doc["paths"].items(), key=lambda x: x[0]):
# We may want to create a path like /store/inventory
# Ensure that /store exists first, so we can use it as a parent
ancestors = path.split("/")[
Expand Down Expand Up @@ -1715,12 +1711,12 @@ def put_rest_api(
path_part=path[path.rfind("/") + 1 :],
)

for (method_type, method_doc) in resource_doc.items():
for method_type, method_doc in resource_doc.items():
method_type = method_type.upper()
if method_doc.get("x-amazon-apigateway-integration") is None:
self.put_method(function_id, resource.id, method_type, None)
method_responses = method_doc.get("responses", {}).items()
for (response_code, _) in method_responses:
for response_code, _ in method_responses:
self.put_method_response(
function_id,
resource.id,
Expand Down Expand Up @@ -2375,7 +2371,6 @@ def delete_base_path_mapping(self, domain_name: str, base_path: str) -> None:
def update_base_path_mapping(
self, domain_name: str, base_path: str, patch_operations: Any
) -> BasePathMapping:

if domain_name not in self.domain_names:
raise DomainNameNotFound()

Expand Down
1 change: 0 additions & 1 deletion moto/apigateway/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ def base_path_mappings(self, request: Any, full_url: str, headers: Dict[str, str
return 201, {}, json.dumps(base_path_mapping_resp.to_json())

def base_path_mapping_individual(self, request: Any, full_url: str, headers: Dict[str, str]) -> TYPE_RESPONSE: # type: ignore[return]

self.setup_class(request, full_url, headers)

url_path_parts = self.path.split("/")
Expand Down
1 change: 0 additions & 1 deletion moto/athena/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def delete_tags(self, tag_keys: List[str]) -> List[Dict[str, str]]:


class WorkGroup(TaggableResourceMixin, BaseModel):

resource_type = "workgroup"
state = "ENABLED"

Expand Down
1 change: 0 additions & 1 deletion moto/autoscaling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ def update_auto_scaling_group(
def describe_auto_scaling_groups(
self, names: List[str], filters: Optional[List[Dict[str, str]]] = None
) -> List[FakeAutoScalingGroup]:

groups = list(self.autoscaling_groups.values())

if filters:
Expand Down
1 change: 0 additions & 1 deletion moto/awslambda/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,6 @@ def _get_service_source_from_arn(self, event_source_arn: str) -> str:
return event_source_arn.split(":")[2].lower()

def _validate_event_source(self, event_source_arn: str) -> bool:

valid_services = ("dynamodb", "kinesis", "sqs")
service = self._get_service_source_from_arn(event_source_arn)
return service in valid_services
Expand Down
1 change: 0 additions & 1 deletion moto/awslambda_simple/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def invoke(
headers: Any,
response_headers: Any,
) -> Optional[Union[str, bytes]]:

if body:
return str.encode(body)
return b"Simple Lambda happy path OK"
Expand Down
3 changes: 0 additions & 3 deletions moto/backup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def __init__(
creator_request_id: str,
backend: "BackupBackend",
):

self.backup_plan_id = str(mock_random.uuid4())
self.backup_plan_arn = f"arn:aws:backup:{backend.region_name}:{backend.account_id}:backup-plan:{self.backup_plan_id}"
self.creation_date = unix_time()
Expand Down Expand Up @@ -137,7 +136,6 @@ def create_backup_plan(
backup_plan_tags: Dict[str, str],
creator_request_id: str,
) -> Plan:

if backup_plan["BackupPlanName"] in list(
p.backup_plan["BackupPlanName"] for p in list(self.plans.values())
):
Expand Down Expand Up @@ -197,7 +195,6 @@ def create_backup_vault(
encryption_key_arn: str,
creator_request_id: str,
) -> Vault:

if backup_vault_name in self.vaults:
raise AlreadyExistsException(
msg="Backup vault with the same name already exists"
Expand Down
2 changes: 0 additions & 2 deletions moto/cloudformation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def update(
regions: List[str],
operation_id: str,
) -> Dict[str, Any]:

self.template = template or self.template
self.description = description if description is not None else self.description
self.parameters = parameters or self.parameters
Expand Down Expand Up @@ -447,7 +446,6 @@ def _add_stack_event(
resource_status_reason: Optional[str] = None,
resource_properties: Optional[str] = None,
) -> None:

event = FakeEvent(
stack_id=self.stack_id,
stack_name=self.name,
Expand Down
5 changes: 0 additions & 5 deletions moto/cloudformation/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@ def creation_complete(self) -> bool:
return all_resources_ready

def build_resource_diff(self, other_template: Dict[str, Any]) -> Dict[str, Any]:

old = self._resource_json_map
new = other_template["Resources"]

Expand All @@ -750,7 +749,6 @@ def build_resource_diff(self, other_template: Dict[str, Any]) -> Dict[str, Any]:
def build_change_set_actions(
self, template: Dict[str, Any]
) -> Dict[str, Dict[str, Dict[str, str]]]:

resource_names_by_action = self.build_resource_diff(template)

resources_by_action: Dict[str, Dict[str, Dict[str, str]]] = {
Expand Down Expand Up @@ -782,7 +780,6 @@ def build_change_set_actions(
def update(
self, template: Dict[str, Any], parameters: Optional[Dict[str, Any]] = None
) -> None:

resource_names_by_action = self.build_resource_diff(template)

for logical_name in resource_names_by_action["Remove"]:
Expand All @@ -800,7 +797,6 @@ def update(
self._resource_json_map = template["Resources"]

for logical_name in resource_names_by_action["Add"]:

# call __getitem__ to initialize the resource
# TODO: usage of indexer to initalize the resource is questionable
_ = self[logical_name]
Expand Down Expand Up @@ -851,7 +847,6 @@ def delete(self) -> None:
not isinstance(parsed_resource, str)
and parsed_resource is not None
):

resource_json = self._resource_json_map[
parsed_resource.logical_resource_id
]
Expand Down
3 changes: 0 additions & 3 deletions moto/codebuild/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def create_project(
return self.codebuild_projects[project_name].project_metadata

def list_projects(self) -> List[str]:

projects = []

for project in self.codebuild_projects.keys():
Expand All @@ -180,7 +179,6 @@ def start_build(
source_version: Optional[str] = None,
artifact_override: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:

build_id = f"{project_name}:{mock_random.uuid4()}"

# construct a new build
Expand Down Expand Up @@ -269,7 +267,6 @@ def delete_project(self, project_name: str) -> None:
self.codebuild_projects.pop(project_name, None)

def stop_build(self, build_id: str) -> Optional[Dict[str, Any]]: # type: ignore[return]

for metadata in self.build_metadata_history.values():
for build in metadata:
if build["id"] == build_id:
Expand Down
1 change: 0 additions & 1 deletion moto/cognitoidentity/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def __init__(self, message: str):


class InvalidNameException(JsonRESTError):

message = "1 validation error detected: Value '{}' at 'identityPoolName' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\w\\s+=,.@-]+"

def __init__(self, name: str):
Expand Down
2 changes: 0 additions & 2 deletions moto/cognitoidp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def list(cls) -> List[str]:


class CognitoIdpUserPoolAttribute(BaseModel):

STANDARD_SCHEMA = {
"sub": {
"AttributeDataType": "String",
Expand Down Expand Up @@ -385,7 +384,6 @@ def to_json(self) -> Dict[str, Any]:


class CognitoIdpUserPool(BaseModel):

MAX_ID_LENGTH = 55

def __init__(
Expand Down
1 change: 0 additions & 1 deletion moto/core/botocore_stubber.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def process_request(self, request: Any) -> Optional[TYPE_RESPONSE]:

for service, pattern in backend_index.backend_url_patterns:
if pattern.match(clean_url):

if passthrough_service(service):
return None

Expand Down
1 change: 0 additions & 1 deletion moto/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ def _disable_patching(self, remove_data: bool) -> None:


class ProxyModeMockAWS(MockAWS):

_RESET_IN_PROGRESS = False

def __init__(self, *args: Any, **kwargs: Any):
Expand Down
2 changes: 0 additions & 2 deletions moto/databrew/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def update_dataset(
dataset_path_options: Dict[str, Any],
tags: Dict[str, str],
) -> "FakeDataset":

if dataset_name not in self.datasets:
raise ResourceNotFoundException("One or more resources can't be found.")

Expand Down Expand Up @@ -621,7 +620,6 @@ class BaseModelABCMeta(ABCMeta, type(BaseModel)): # type: ignore[misc]


class FakeJob(BaseModel, metaclass=BaseModelABCMeta): # type: ignore[misc]

ENCRYPTION_MODES = ("SSE-S3", "SSE-KMS")
LOG_SUBSCRIPTION_VALUES = ("ENABLE", "DISABLE")

Expand Down
1 change: 0 additions & 1 deletion moto/datasync/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def __init__(


class TaskExecution(BaseModel):

# For simplicity, task_execution can never fail
# Some documentation refers to this list:
# 'Status': 'QUEUED'|'LAUNCHING'|'PREPARING'|'TRANSFERRING'|'VERIFYING'|'SUCCESS'|'ERROR'
Expand Down
2 changes: 1 addition & 1 deletion moto/ds/validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def validate_args(validators: Any) -> None:
err_msgs = []
# This eventually could be a switch (python 3.10), elminating the need
# for the above map and individual functions.
for (fieldname, value) in validators:
for fieldname, value in validators:
msg = validation_map[fieldname](value)
if msg:
err_msgs.append((fieldname, value, msg))
Expand Down
1 change: 0 additions & 1 deletion moto/dynamodb/models/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ def query(
filter_expression: Any = None,
**filter_kwargs: Any,
) -> Tuple[List[Item], int, Optional[Dict[str, Any]]]:

# FIND POSSIBLE RESULTS
if index_name:
all_indexes = self.all_indexes()
Expand Down
1 change: 0 additions & 1 deletion moto/ec2/models/dhcp_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def create_dhcp_options(
netbios_name_servers: Optional[List[str]] = None,
netbios_node_type: Optional[str] = None,
) -> DHCPOptionsSet:

NETBIOS_NODE_TYPES = [1, 2, 4, 8]

for field_value in domain_name_servers, ntp_servers, netbios_name_servers:
Expand Down
2 changes: 1 addition & 1 deletion moto/ec2/models/elastic_network_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def describe_network_interfaces(
enis = list(self.enis.values())

if filters:
for (_filter, _filter_value) in filters.items():
for _filter, _filter_value in filters.items():
if _filter == "network-interface-id":
_filter = "id"
enis = [
Expand Down
3 changes: 0 additions & 3 deletions moto/ec2/models/fleets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(
valid_until: str,
tag_specifications: List[Dict[str, Any]],
):

self.ec2_backend = ec2_backend
self.id = fleet_id
self.spot_options = spot_options
Expand Down Expand Up @@ -269,7 +268,6 @@ def create_fleet(
valid_until: str,
tag_specifications: List[Dict[str, Any]],
) -> Fleet:

fleet_id = random_fleet_id()
fleet = Fleet(
self,
Expand Down Expand Up @@ -309,7 +307,6 @@ def describe_fleets(self, fleet_ids: Optional[List[str]]) -> List[Fleet]:
def delete_fleets(
self, fleet_ids: List[str], terminate_instances: bool
) -> List[Fleet]:

fleets = []
for fleet_id in fleet_ids:
fleet = self.fleets[fleet_id]
Expand Down
3 changes: 0 additions & 3 deletions moto/ec2/models/launch_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def create_from_cloudformation_json( # type: ignore[misc]
region_name: str,
**kwargs: Any
) -> "LaunchTemplate":

from ..models import ec2_backends

backend = ec2_backends[account_id][region_name]
Expand Down Expand Up @@ -160,7 +159,6 @@ def update_from_cloudformation_json( # type: ignore[misc]
account_id: str,
region_name: str,
) -> "LaunchTemplate":

from ..models import ec2_backends

backend = ec2_backends[account_id][region_name]
Expand All @@ -184,7 +182,6 @@ def delete_from_cloudformation_json( # type: ignore[misc]
account_id: str,
region_name: str,
) -> None:

from ..models import ec2_backends

backend = ec2_backends[account_id][region_name]
Expand Down
3 changes: 0 additions & 3 deletions moto/ec2/models/network_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def create_network_acl_entry(
port_range_from: Optional[int],
port_range_to: Optional[int],
) -> "NetworkAclEntry":

network_acl = self.get_network_acl(network_acl_id)
if any(
entry.egress == egress and entry.rule_number == rule_number
Expand Down Expand Up @@ -129,7 +128,6 @@ def replace_network_acl_entry(
port_range_from: int,
port_range_to: int,
) -> "NetworkAclEntry":

self.delete_network_acl_entry(network_acl_id, rule_number, egress)
network_acl_entry = self.create_network_acl_entry(
network_acl_id,
Expand All @@ -148,7 +146,6 @@ def replace_network_acl_entry(
def replace_network_acl_association(
self, association_id: str, network_acl_id: str
) -> "NetworkAclAssociation":

# lookup existing association for subnet and delete it
default_acl = next(
value
Expand Down
2 changes: 0 additions & 2 deletions moto/ec2/models/spot_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def __init__(
instance_interruption_behaviour: Optional[str],
tag_specifications: Optional[List[Dict[str, Any]]],
):

self.ec2_backend = ec2_backend
self.spot_backend = spot_backend
self.id = spot_fleet_request_id
Expand Down Expand Up @@ -468,7 +467,6 @@ def request_spot_fleet(
instance_interruption_behaviour: Optional[str] = None,
tag_specifications: Optional[List[Dict[str, Any]]] = None,
) -> SpotFleetRequest:

spot_fleet_request_id = random_spot_fleet_request_id()
request = SpotFleetRequest(
ec2_backend=self,
Expand Down
1 change: 0 additions & 1 deletion moto/ec2/models/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ def create_subnet(
availability_zone_id: Optional[str] = None,
tags: Optional[Dict[str, Dict[str, str]]] = None,
) -> Subnet:

subnet_id = random_subnet_id()
# Validate VPC exists and the supplied CIDR block is a subnet of the VPC's
vpc = self.get_vpc(vpc_id) # type: ignore[attr-defined]
Expand Down
1 change: 0 additions & 1 deletion moto/ec2/models/transit_gateway_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def modify_transit_gateway_vpc_attachment(
options: Optional[Dict[str, str]] = None,
remove_subnet_ids: Optional[List[str]] = None,
) -> TransitGatewayAttachment:

tgw_attachment = self.transit_gateway_attachments[transit_gateway_attachment_id]
if remove_subnet_ids:
tgw_attachment.subnet_ids = [ # type: ignore[attr-defined]
Expand Down
Loading