1010import sys
1111import urllib .request
1212from pathlib import Path
13+ from typing import Dict , List , Tuple
1314from zipfile import ZipFile
1415
1516from Crypto .Hash import keccak
@@ -61,7 +62,7 @@ def check_emulation_available() -> bool:
6162 return False
6263
6364
64- def get_emulation_prefix () -> list :
65+ def get_emulation_prefix () -> List [ str ] :
6566 """Get the command prefix for emulation if needed."""
6667 if get_arch () != "arm64" :
6768 return []
@@ -159,7 +160,7 @@ def upgrade_architecture() -> None:
159160 raise argparse .ArgumentTypeError ("Run `solc-select install --help` for more information" )
160161
161162
162- def current_version () -> ( str , str ) :
163+ def current_version () -> Tuple [ str , str ] :
163164 source = "SOLC_VERSION"
164165 version = os .environ .get (source )
165166 if not version :
@@ -182,7 +183,7 @@ def current_version() -> (str, str):
182183 return version , source
183184
184185
185- def installed_versions () -> [str ]:
186+ def installed_versions () -> List [str ]:
186187 return [
187188 f .replace ("solc-" , "" ) for f in sorted (os .listdir (ARTIFACTS_DIR )) if f .startswith ("solc-" )
188189 ]
@@ -192,7 +193,7 @@ def artifact_path(version: str) -> Path:
192193 return ARTIFACTS_DIR .joinpath (f"solc-{ version } " , f"solc-{ version } " )
193194
194195
195- def install_artifacts (versions : [str ], silent : bool = False ) -> bool :
196+ def install_artifacts (versions : List [str ], silent : bool = False ) -> bool :
196197 # Warn ARM64 users about compatibility on first install
197198 if get_arch () == "arm64" and not silent :
198199 warn_about_arm64 ()
@@ -274,7 +275,7 @@ def verify_checksum(version: str) -> None:
274275 )
275276
276277
277- def get_soliditylang_checksums (version : str ) -> ( str , str ) :
278+ def get_soliditylang_checksums (version : str ) -> Tuple [ str , str ] :
278279 (_ , list_url ) = get_url (version = version )
279280 # pylint: disable=consider-using-with
280281 list_json = urllib .request .urlopen (list_url ).read ()
@@ -289,7 +290,7 @@ def get_soliditylang_checksums(version: str) -> (str, str):
289290 return matches [0 ]["sha256" ], matches [0 ]["keccak256" ]
290291
291292
292- def get_url (version : str = "" , artifact : str = "" ) -> ( str , str ) :
293+ def get_url (version : str = "" , artifact : str = "" ) -> Tuple [ str , str ] :
293294 if soliditylang_platform () == LINUX_AMD64 :
294295 if version != "" and is_older_linux (version ):
295296 return (
@@ -353,14 +354,14 @@ def valid_install_arg(arg: str) -> str:
353354 return valid_version (arg )
354355
355356
356- def get_installable_versions () -> [str ]:
357+ def get_installable_versions () -> List [str ]:
357358 installable = list (set (get_available_versions ()) - set (installed_versions ()))
358359 installable .sort (key = Version )
359360 return installable
360361
361362
362363# pylint: disable=consider-using-with
363- def get_available_versions () -> [ str ]:
364+ def get_available_versions () -> Dict [ str , str ]:
364365 (_ , list_url ) = get_url ()
365366 list_json = urllib .request .urlopen (list_url ).read ()
366367 available_releases = json .loads (list_json )["releases" ]
0 commit comments