Fix type annotation of `type_to_object_store_class` function

This commit is contained in:
Nicola Soranzo
2022-10-05 17:26:53 +01:00
parent 8018c3ee75
commit dc5ef79232
6 changed files with 15 additions and 10 deletions
+1
View File
@@ -216,6 +216,7 @@ class MinimalGalaxyApplication(BasicSharedApp, HaltableContainer, SentryClientMi
toolbox_search: ToolBoxSearch
container_finder: containers.ContainerFinder
install_model: ModelMapping
object_store: BaseObjectStore
def __init__(self, fsmon=False, **kwargs) -> None:
super().__init__()
+3 -2
View File
@@ -16,6 +16,7 @@ from typing import (
Any,
Dict,
List,
Tuple,
Type,
)
@@ -1089,8 +1090,8 @@ class HierarchicalObjectStore(NestedObjectStore):
self.backends[0].create(obj, **kwargs)
def type_to_object_store_class(store, fsmon=False):
objectstore_class: Type[ObjectStore]
def type_to_object_store_class(store: str, fsmon: bool = False) -> Tuple[Type[BaseObjectStore], Dict[str, Any]]:
objectstore_class: Type[BaseObjectStore]
objectstore_constructor_kwds = {}
if store == "disk":
objectstore_class = DiskObjectStore
+5 -2
View File
@@ -23,7 +23,10 @@ from galaxy.model.security import (
HostAgent,
)
from galaxy.model.tags import GalaxyTagHandler
from galaxy.objectstore import ObjectStore
from galaxy.objectstore import (
BaseObjectStore,
ObjectStore,
)
from galaxy.quota import QuotaAgent
from galaxy.security.idencoding import IdEncodingHelper
from galaxy.security.vault import Vault
@@ -85,7 +88,6 @@ class MinimalApp(BasicSharedApp):
install_model: ModelMapping
security_agent: GalaxyRBACAgent
host_security_agent: HostAgent
object_store: ObjectStore
class MinimalManagerApp(MinimalApp):
@@ -108,6 +110,7 @@ class MinimalManagerApp(MinimalApp):
dynamic_tool_manager: Any # 'galaxy.managers.tools.DynamicToolManager'
genomes: "Genomes"
error_reports: "ErrorReports"
object_store: BaseObjectStore
@property
def is_job_handler(self) -> bool:
+2 -2
View File
@@ -18,7 +18,7 @@ from galaxy.model import (
Task,
User,
)
from galaxy.objectstore import ObjectStore
from galaxy.objectstore import BaseObjectStore
from galaxy.tools import ToolBox
from galaxy.util.bunch import Bunch
from galaxy.util.unittest import TestCase
@@ -52,7 +52,7 @@ class AbstractTestCases:
self.app.toolbox = cast(ToolBox, MockToolbox(MockTool(self)))
self.working_directory = os.path.join(self.test_directory, "working")
self.app.object_store = cast(ObjectStore, MockObjectStore(self.working_directory))
self.app.object_store = cast(BaseObjectStore, MockObjectStore(self.working_directory))
self.queue = MockJobQueue(self.app)
self.job = job
+2 -2
View File
@@ -4,7 +4,7 @@ from typing import cast
from galaxy import model
from galaxy.app_unittest_utils import tools_support
from galaxy.exceptions import UserActivationRequiredException
from galaxy.objectstore import ObjectStore
from galaxy.objectstore import BaseObjectStore
from galaxy.tool_util.parser.output_objects import ToolOutput
from galaxy.tools.actions import (
DefaultToolAction,
@@ -68,7 +68,7 @@ class TestDefaultToolAction(TestCase, tools_support.UsesTools):
self.app.model.context.flush()
self.action = DefaultToolAction()
self.app.config.len_file_path = "moocow"
self.app.object_store = cast(ObjectStore, MockObjectStore())
self.app.object_store = cast(BaseObjectStore, MockObjectStore())
def test_output_created(self):
_, output = self._simple_execute()
@@ -7,7 +7,7 @@ from galaxy import (
util,
)
from galaxy.app_unittest_utils import tools_support
from galaxy.objectstore import ObjectStore
from galaxy.objectstore import BaseObjectStore
from galaxy.tool_util.parser import output_collection_def
from galaxy.tool_util.provided_metadata import (
BaseToolProvidedMetadata,
@@ -23,7 +23,7 @@ DEFAULT_EXTRA_NAME = "test1"
class TestCollectPrimaryDatasets(TestCase, tools_support.UsesTools):
def setUp(self):
self.setup_app()
object_store = cast(ObjectStore, MockObjectStore())
object_store = cast(BaseObjectStore, MockObjectStore())
self.app.object_store = object_store
self._init_tool(tools_support.SIMPLE_TOOL_CONTENTS)
self._setup_test_output()