Ruff formatting (#7508)

This commit is contained in:
Bert Blommers 2024-03-21 20:21:52 -01:00 committed by GitHub
parent 3293b9c666
commit b22683eb98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 12 additions and 7 deletions

View File

@ -8,3 +8,6 @@ e00af2f73cb7d27c3755f18b2161b9acbd8ca8aa
# import sorting # import sorting
ca682c8e5647feacb26f8570f77f1bdb6b5d3b9a ca682c8e5647feacb26f8570f77f1bdb6b5d3b9a
# Ruff formatting
90bdd725552e8cc1466c2b3c1152e0501519a568

View File

@ -536,7 +536,6 @@ class ResourceGroupsTaggingAPIBackend(BaseBackend):
"Tags": tags, "Tags": tags,
} }
# Workspaces # Workspaces
if not resource_type_filters or "workspaces" in resource_type_filters: if not resource_type_filters or "workspaces" in resource_type_filters:
for ws in self.workspaces_backend.workspaces.values(): for ws in self.workspaces_backend.workspaces.values():

View File

@ -1,4 +1,5 @@
"""Exceptions raised by the workspaces service.""" """Exceptions raised by the workspaces service."""
from moto.core.exceptions import JsonRESTError from moto.core.exceptions import JsonRESTError

View File

@ -1,4 +1,5 @@
"""WorkSpacesBackend class with methods for supported APIs.""" """WorkSpacesBackend class with methods for supported APIs."""
import re import re
from collections.abc import Mapping from collections.abc import Mapping
from typing import Any, Dict, List, Optional, Tuple from typing import Any, Dict, List, Optional, Tuple
@ -88,7 +89,7 @@ class Workspace(BaseModel):
def filter_empty_values(self, d: Dict[str, Any]) -> Dict[str, Any]: def filter_empty_values(self, d: Dict[str, Any]) -> Dict[str, Any]:
if isinstance(d, Mapping): if isinstance(d, Mapping):
return dict((k, self.filter_empty_values(v)) for k, v, in d.items() if v) return dict((k, self.filter_empty_values(v)) for k, v in d.items() if v)
else: else:
return d return d
@ -455,9 +456,9 @@ class WorkSpacesBackend(BaseBackend):
tenancy=tenancy, tenancy=tenancy,
tags=tags, tags=tags,
) )
self.workspace_directories[ self.workspace_directories[workspace_directory.directory_id] = (
workspace_directory.directory_id workspace_directory
] = workspace_directory )
def describe_workspace_directories( def describe_workspace_directories(
self, directory_ids: Optional[List[str]] = None self, directory_ids: Optional[List[str]] = None
@ -479,7 +480,6 @@ class WorkSpacesBackend(BaseBackend):
def modify_workspace_creation_properties( def modify_workspace_creation_properties(
self, resource_id: str, workspace_creation_properties: Dict[str, Any] self, resource_id: str, workspace_creation_properties: Dict[str, Any]
) -> None: ) -> None:
# Raise Exception if Directory doesnot exist. # Raise Exception if Directory doesnot exist.
if resource_id not in self.workspace_directories: if resource_id not in self.workspace_directories:
raise ValidationException("The request is invalid.") raise ValidationException("The request is invalid.")
@ -530,7 +530,6 @@ class WorkSpacesBackend(BaseBackend):
def create_workspace_image( def create_workspace_image(
self, name: str, description: str, workspace_id: str, tags: List[Dict[str, str]] self, name: str, description: str, workspace_id: str, tags: List[Dict[str, str]]
) -> Dict[str, Any]: ) -> Dict[str, Any]:
# Check if workspace exists. # Check if workspace exists.
if workspace_id not in self.workspaces: if workspace_id not in self.workspaces:
raise ResourceNotFoundException( raise ResourceNotFoundException(

View File

@ -1,4 +1,5 @@
"""Handles incoming workspaces requests, invokes methods, returns responses.""" """Handles incoming workspaces requests, invokes methods, returns responses."""
import json import json
from moto.core.responses import BaseResponse from moto.core.responses import BaseResponse

View File

@ -1,4 +1,5 @@
"""workspaces base URL and path.""" """workspaces base URL and path."""
from .responses import WorkSpacesResponse from .responses import WorkSpacesResponse
url_bases = [ url_bases = [

View File

@ -1,4 +1,5 @@
"""Unit tests for workspaces-supported APIs.""" """Unit tests for workspaces-supported APIs."""
import boto3 import boto3
import pytest import pytest
from botocore.exceptions import ClientError from botocore.exceptions import ClientError