4141import re
4242import time
4343from collections import namedtuple
44+ from collections .abc import Iterable
4445from concurrent .futures import (
4546 thread ,
4647 ThreadPoolExecutor ,
4748)
48- from typing import (
49- Iterable ,
50- List ,
51- Optional ,
52- )
49+ from typing import Optional
5350
5451import requests
5552import yaml
@@ -106,21 +103,21 @@ class InstallRepoDict(TypedDict):
106103 tool_panel_section_id : NotRequired [Optional [str ]]
107104 tool_panel_section_label : NotRequired [Optional [str ]]
108105 tool_shed_url : NotRequired [str ]
109- revisions : NotRequired [List [str ]]
106+ revisions : NotRequired [list [str ]]
110107 install_repository_dependencies : NotRequired [bool ]
111108 install_resolver_dependencies : NotRequired [bool ]
112109 install_tool_dependencies : NotRequired [bool ]
113110
114111
115112class FilterResults (NamedTuple ):
116- already_installed_repos : List [InstallRepoDict ]
117- not_installed_repos : List [InstallRepoDict ]
113+ already_installed_repos : list [InstallRepoDict ]
114+ not_installed_repos : list [InstallRepoDict ]
118115
119116
120117class InstallResults (NamedTuple ):
121- installed_repositories : List [InstallRepoDict ]
122- skipped_repositories : List [InstallRepoDict ]
123- errored_repositories : List [InstallRepoDict ]
118+ installed_repositories : list [InstallRepoDict ]
119+ skipped_repositories : list [InstallRepoDict ]
120+ errored_repositories : list [InstallRepoDict ]
124121
125122
126123class InstallRepositoryManager :
@@ -131,7 +128,7 @@ def __init__(self, galaxy_instance):
131128 self .gi = galaxy_instance
132129 self .tool_shed_client = ToolShedClient (self .gi )
133130
134- def installed_repositories (self ) -> List [InstallRepoDict ]:
131+ def installed_repositories (self ) -> list [InstallRepoDict ]:
135132 """Get currently installed tools"""
136133 return GiToToolYaml (
137134 gi = self .gi ,
@@ -142,8 +139,8 @@ def installed_repositories(self) -> List[InstallRepoDict]:
142139
143140 def filter_installed_repos (self , repos : Iterable [InstallRepoDict ], check_revision : bool = True ) -> FilterResults :
144141 """This filters a list of repositories"""
145- not_installed_repos : List [InstallRepoDict ] = []
146- already_installed_repos : List [InstallRepoDict ] = []
142+ not_installed_repos : list [InstallRepoDict ] = []
143+ already_installed_repos : list [InstallRepoDict ] = []
147144 if check_revision :
148145 # If we want to check if revisions are equal, flatten the list,
149146 # so each repository - revision combination has its own entry
@@ -167,7 +164,7 @@ def filter_installed_repos(self, repos: Iterable[InstallRepoDict], check_revisio
167164
168165 def install_repositories (
169166 self ,
170- repositories : List [InstallRepoDict ],
167+ repositories : list [InstallRepoDict ],
171168 log = log ,
172169 force_latest_revision : bool = False ,
173170 default_toolshed : str = "https://toolshed.g2.bx.psu.edu/" ,
@@ -177,9 +174,9 @@ def install_repositories(
177174 ):
178175 """Install a list of tools on the current galaxy"""
179176 installation_start = dt .datetime .now ()
180- installed_repositories : List [InstallRepoDict ] = []
181- skipped_repositories : List [InstallRepoDict ] = []
182- errored_repositories : List [InstallRepoDict ] = []
177+ installed_repositories : list [InstallRepoDict ] = []
178+ skipped_repositories : list [InstallRepoDict ] = []
179+ errored_repositories : list [InstallRepoDict ] = []
183180 counter = 0
184181
185182 # Check repos for invalid keys
@@ -194,7 +191,7 @@ def install_repositories(
194191 total_num_repositories = len (flattened_repos )
195192
196193 # Complete the repo information, and make sure each repository has a revision
197- repository_list : List [InstallRepoDict ] = []
194+ repository_list : list [InstallRepoDict ] = []
198195 for repository in flattened_repos :
199196 start = dt .datetime .now ()
200197 try :
@@ -651,7 +648,7 @@ def log_repository_install_start(
651648 )
652649
653650
654- def args_to_repos (args ) -> List [InstallRepoDict ]:
651+ def args_to_repos (args ) -> list [InstallRepoDict ]:
655652 if args .tool_list_file :
656653 tool_list = load_yaml_file (args .tool_list_file )
657654 repos = tool_list ["tools" ]
0 commit comments