12
12
import string
13
13
from typing import Dict , List , MutableMapping , MutableSequence , Optional , Union , cast
14
14
15
- from .builder import Builder , HasReqsHints
15
+ from typing_extensions import TYPE_CHECKING
16
+
17
+ if TYPE_CHECKING :
18
+ from .builder import Builder , HasReqsHints
16
19
17
20
try :
18
21
from galaxy .tool_util .deps .requirements import ToolRequirement , ToolRequirements
34
37
35
38
36
39
class DependenciesConfiguration (object ):
37
- def __init__ (self , args ):
38
- # type: (argparse.Namespace) -> None
40
+ def __init__ (self , args : argparse .Namespace ) -> None :
39
41
"""Initialize."""
40
42
conf_file = getattr (args , "beta_dependency_resolvers_configuration" , None )
41
43
tool_dependency_dir = getattr (args , "beta_dependencies_directory" , None )
@@ -55,8 +57,7 @@ def __init__(self, args):
55
57
else :
56
58
self .use_tool_dependencies = False
57
59
58
- def build_job_script (self , builder , command ):
59
- # type: (Builder, List[str]) -> str
60
+ def build_job_script (self , builder : "Builder" , command : List [str ]) -> str :
60
61
ensure_galaxy_lib_available ()
61
62
resolution_config_dict = {
62
63
"use" : self .use_tool_dependencies ,
@@ -87,7 +88,7 @@ def build_job_script(self, builder, command):
87
88
return job_script
88
89
89
90
90
- def get_dependencies (builder : HasReqsHints ) -> ToolRequirements :
91
+ def get_dependencies (builder : " HasReqsHints" ) -> ToolRequirements :
91
92
(software_requirement , _ ) = builder .get_requirement ("SoftwareRequirement" )
92
93
dependencies = [] # type: List[ToolRequirement]
93
94
if software_requirement and software_requirement .get ("packages" ):
@@ -117,8 +118,9 @@ def get_dependencies(builder: HasReqsHints) -> ToolRequirements:
117
118
return ToolRequirements .from_list (dependencies )
118
119
119
120
120
- def get_container_from_software_requirements (use_biocontainers , builder ):
121
- # type: (bool, HasReqsHints) -> Optional[str]
121
+ def get_container_from_software_requirements (
122
+ use_biocontainers : bool , builder : "HasReqsHints"
123
+ ) -> Optional [str ]:
122
124
if use_biocontainers :
123
125
ensure_galaxy_lib_available ()
124
126
from galaxy .tool_util .deps .dependencies import AppInfo , ToolInfo
@@ -144,8 +146,7 @@ def get_container_from_software_requirements(use_biocontainers, builder):
144
146
return None
145
147
146
148
147
- def ensure_galaxy_lib_available ():
148
- # type: () -> None
149
+ def ensure_galaxy_lib_available () -> None :
149
150
if not SOFTWARE_REQUIREMENTS_ENABLED :
150
151
raise Exception (
151
152
"Optional Python library galaxy-lib not available, it is required for this configuration."
0 commit comments