Skip to content

Commit

Permalink
Admin: Fix remaining ruff and pylint error (#7512)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsugumi-sys authored Mar 23, 2024
1 parent e3555bb commit ee4c5ed
Show file tree
Hide file tree
Showing 52 changed files with 314 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
run: |
pip install -r requirements-dev.txt
- name: Lint
run:
run: |
mkdir .mypy_cache
make lint
Expand Down
6 changes: 3 additions & 3 deletions moto/acmpca/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def set_revocation_configuration(
"S3ObjectAcl", None
)
if acl is None:
self.revocation_configuration["CrlConfiguration"][
"S3ObjectAcl"
] = "PUBLIC_READ"
self.revocation_configuration["CrlConfiguration"]["S3ObjectAcl"] = (
"PUBLIC_READ"
)
else:
if acl not in ["PUBLIC_READ", "BUCKET_OWNER_FULL_CONTROL"]:
raise InvalidS3ObjectAclInCrlConfiguration(acl)
Expand Down
116 changes: 58 additions & 58 deletions moto/apigateway/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def __validate_api_key_source(self, api_key_source: str) -> TYPE_RESPONSE: # ty
).format(api_key_source=api_key_source),
)

def __validate_endpoint_configuration(
def __validate_endpoint_configuration( # type: ignore[return]
self, endpoint_configuration: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
if endpoint_configuration and "types" in endpoint_configuration:
invalid_types = list(
set(endpoint_configuration["types"]) - set(ENDPOINT_CONFIGURATION_TYPES)
Expand All @@ -57,9 +57,9 @@ def __validate_endpoint_configuration(
).format(endpoint_type=invalid_types[0]),
)

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

if self.method == "GET":
Expand Down Expand Up @@ -105,9 +105,9 @@ def restapis(

return 200, {}, json.dumps(rest_api.to_dict())

def __validte_rest_patch_operations(
def __validte_rest_patch_operations( # type: ignore[return]
self, patch_operations: List[Dict[str, str]]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
for op in patch_operations:
path = op["path"]
if "apiKeySource" in path:
Expand Down Expand Up @@ -142,9 +142,9 @@ def restapis_individual(

return 200, {}, json.dumps(rest_api.to_dict())

def resources(
def resources( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
function_id = self.path.replace("/restapis/", "", 1).split("/")[0]

Expand All @@ -156,9 +156,9 @@ def resources(
json.dumps({"item": [resource.to_dict() for resource in resources]}),
)

def gateway_response(
def gateway_response( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
if request.method == "PUT":
return self.put_gateway_response()
Expand All @@ -167,16 +167,16 @@ def gateway_response(
elif request.method == "DELETE":
return self.delete_gateway_response()

def gateway_responses(
def gateway_responses( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
if request.method == "GET":
return self.get_gateway_responses()

def resource_individual(
def resource_individual( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
function_id = self.path.replace("/restapis/", "", 1).split("/")[0]
resource_id = self.path.split("/")[-1]
Expand Down Expand Up @@ -268,9 +268,9 @@ def resource_method_responses(
return 204, {}, json.dumps(method_response.to_json()) # type: ignore[union-attr]
raise Exception(f'Unexpected HTTP method "{self.method}"')

def restapis_authorizers(
def restapis_authorizers( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
restapi_id = url_path_parts[2]
Expand Down Expand Up @@ -320,9 +320,9 @@ def restapis_authorizers(
authorizers = self.backend.get_authorizers(restapi_id)
return 200, {}, json.dumps({"item": [a.to_json() for a in authorizers]})

def request_validators(
def request_validators( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
restapi_id = url_path_parts[2]
Expand All @@ -342,9 +342,9 @@ def request_validators(
)
return 201, {}, json.dumps(validator.to_dict())

def request_validator_individual(
def request_validator_individual( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
restapi_id = url_path_parts[2]
Expand All @@ -363,9 +363,9 @@ def request_validator_individual(
)
return 200, {}, json.dumps(validator.to_dict())

def authorizers(
def authorizers( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
restapi_id = url_path_parts[2]
Expand All @@ -384,9 +384,9 @@ def authorizers(
self.backend.delete_authorizer(restapi_id, authorizer_id)
return 202, {}, "{}"

def restapis_stages(
def restapis_stages( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[2]
Expand Down Expand Up @@ -417,9 +417,9 @@ def restapis_stages(
stages = self.backend.get_stages(function_id)
return 200, {}, json.dumps({"item": [s.to_json() for s in stages]})

def restapis_stages_tags(
def restapis_stages_tags( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[4]
Expand All @@ -437,9 +437,9 @@ def restapis_stages_tags(
stage.tags.pop(tag, None) # type: ignore[union-attr]
return 200, {}, json.dumps({"item": ""})

def stages(
def stages( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[2]
Expand Down Expand Up @@ -476,9 +476,9 @@ def export(
}
return 200, headers, json.dumps(body).encode("utf-8")

def integrations(
def integrations( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[2]
Expand Down Expand Up @@ -534,9 +534,9 @@ def integrations(
)
return 204, {}, json.dumps(integration_response.to_json())

def integration_responses(
def integration_responses( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[2]
Expand Down Expand Up @@ -574,9 +574,9 @@ def integration_responses(
)
return 204, {}, json.dumps(integration_response.to_json())

def deployments(
def deployments( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
function_id = self.path.replace("/restapis/", "", 1).split("/")[0]

Expand All @@ -592,9 +592,9 @@ def deployments(
)
return 201, {}, json.dumps(deployment.to_json())

def individual_deployment(
def individual_deployment( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
function_id = url_path_parts[2]
Expand All @@ -607,9 +607,9 @@ def individual_deployment(
deployment = self.backend.delete_deployment(function_id, deployment_id)
return 202, {}, json.dumps(deployment.to_json())

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

if self.method == "POST":
Expand Down Expand Up @@ -649,9 +649,9 @@ def apikey_individual(

return 200, {}, json.dumps(apikey_resp)

def usage_plans(
def usage_plans( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
if self.method == "POST":
usage_plan_response = self.backend.create_usage_plan(json.loads(self.body))
Expand All @@ -665,9 +665,9 @@ def usage_plans(
json.dumps({"item": [u.to_json() for u in usage_plans_response]}),
)

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

url_path_parts = self.path.split("/")
Expand All @@ -686,9 +686,9 @@ def usage_plan_individual(
)
return 200, {}, json.dumps(usage_plan_response.to_json())

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

url_path_parts = self.path.split("/")
Expand All @@ -707,9 +707,9 @@ def usage_plan_keys(
json.dumps({"item": [u.to_json() for u in usage_plans_response]}),
)

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

url_path_parts = self.path.split("/")
Expand All @@ -723,9 +723,9 @@ def usage_plan_key_individual(
self.backend.delete_usage_plan_key(usage_plan_id, key_id)
return 202, {}, "{}"

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

if self.method == "GET":
Expand Down Expand Up @@ -780,9 +780,9 @@ def domain_name_induvidual(
msg = f'Method "{self.method}" for API GW domain names not implemented'
return 404, {}, json.dumps({"error": msg})

def models(
def models( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
rest_api_id = self.path.replace("/restapis/", "", 1).split("/")[0]

Expand Down Expand Up @@ -817,9 +817,9 @@ def model_induvidual(
return 200, {}, json.dumps(model_info.to_json())
return 200, {}, "{}"

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

url_path_parts = self.path.split("/")
Expand All @@ -842,9 +842,9 @@ def base_path_mappings(
)
return 201, {}, json.dumps(base_path_mapping_resp.to_json())

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

url_path_parts = self.path.split("/")
Expand All @@ -866,9 +866,9 @@ def base_path_mapping_individual(
)
return 200, {}, json.dumps(base_path_mapping.to_json())

def vpc_link(
def vpc_link( # type: ignore[return]
self, request: Any, full_url: str, headers: Dict[str, str]
) -> TYPE_RESPONSE: # type: ignore[return]
) -> TYPE_RESPONSE:
self.setup_class(request, full_url, headers)
url_path_parts = self.path.split("/")
vpc_link_id = url_path_parts[-1]
Expand All @@ -880,9 +880,9 @@ def vpc_link(
vpc_link = self.backend.get_vpc_link(vpc_link_id=vpc_link_id)
return 200, {}, json.dumps(vpc_link.to_json())

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

if self.method == "GET":
Expand Down
Loading

0 comments on commit ee4c5ed

Please sign in to comment.