diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index b451cfa83..19f0f1acc 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -8,3 +8,6 @@ e00af2f73cb7d27c3755f18b2161b9acbd8ca8aa # import sorting ca682c8e5647feacb26f8570f77f1bdb6b5d3b9a + +# Ruff formatting +90bdd725552e8cc1466c2b3c1152e0501519a568 diff --git a/moto/resourcegroupstaggingapi/models.py b/moto/resourcegroupstaggingapi/models.py index 0e3495404..b2b2f33cb 100644 --- a/moto/resourcegroupstaggingapi/models.py +++ b/moto/resourcegroupstaggingapi/models.py @@ -536,7 +536,6 @@ class ResourceGroupsTaggingAPIBackend(BaseBackend): "Tags": tags, } - # Workspaces if not resource_type_filters or "workspaces" in resource_type_filters: for ws in self.workspaces_backend.workspaces.values(): diff --git a/moto/workspaces/exceptions.py b/moto/workspaces/exceptions.py index 299b32c46..d58980e2d 100644 --- a/moto/workspaces/exceptions.py +++ b/moto/workspaces/exceptions.py @@ -1,4 +1,5 @@ """Exceptions raised by the workspaces service.""" + from moto.core.exceptions import JsonRESTError diff --git a/moto/workspaces/models.py b/moto/workspaces/models.py index 200b4b237..3b8e70861 100644 --- a/moto/workspaces/models.py +++ b/moto/workspaces/models.py @@ -1,4 +1,5 @@ """WorkSpacesBackend class with methods for supported APIs.""" + import re from collections.abc import Mapping 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]: 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: return d @@ -455,9 +456,9 @@ class WorkSpacesBackend(BaseBackend): tenancy=tenancy, tags=tags, ) - self.workspace_directories[ - workspace_directory.directory_id - ] = workspace_directory + self.workspace_directories[workspace_directory.directory_id] = ( + workspace_directory + ) def describe_workspace_directories( self, directory_ids: Optional[List[str]] = None @@ -479,7 +480,6 @@ class WorkSpacesBackend(BaseBackend): def modify_workspace_creation_properties( self, resource_id: str, workspace_creation_properties: Dict[str, Any] ) -> None: - # Raise Exception if Directory doesnot exist. if resource_id not in self.workspace_directories: raise ValidationException("The request is invalid.") @@ -530,7 +530,6 @@ class WorkSpacesBackend(BaseBackend): def create_workspace_image( self, name: str, description: str, workspace_id: str, tags: List[Dict[str, str]] ) -> Dict[str, Any]: - # Check if workspace exists. if workspace_id not in self.workspaces: raise ResourceNotFoundException( diff --git a/moto/workspaces/responses.py b/moto/workspaces/responses.py index cbf6e5752..55178f0be 100644 --- a/moto/workspaces/responses.py +++ b/moto/workspaces/responses.py @@ -1,4 +1,5 @@ """Handles incoming workspaces requests, invokes methods, returns responses.""" + import json from moto.core.responses import BaseResponse diff --git a/moto/workspaces/urls.py b/moto/workspaces/urls.py index 7bf27b8ac..42ce8b8f5 100644 --- a/moto/workspaces/urls.py +++ b/moto/workspaces/urls.py @@ -1,4 +1,5 @@ """workspaces base URL and path.""" + from .responses import WorkSpacesResponse url_bases = [ diff --git a/tests/test_workspaces/test_workspaces.py b/tests/test_workspaces/test_workspaces.py index 99eff463b..d3b69fa15 100644 --- a/tests/test_workspaces/test_workspaces.py +++ b/tests/test_workspaces/test_workspaces.py @@ -1,4 +1,5 @@ """Unit tests for workspaces-supported APIs.""" + import boto3 import pytest from botocore.exceptions import ClientError