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 ()
@@ -282,7 +283,7 @@ def verify_checksum(version: str) -> None:
282283 )
283284
284285
285- def get_soliditylang_checksums (version : str ) -> ( str , str ) :
286+ def get_soliditylang_checksums (version : str ) -> Tuple [ str , str ] :
286287 (_ , list_url ) = get_url (version = version )
287288 # pylint: disable=consider-using-with
288289 list_json = urllib .request .urlopen (list_url ).read ()
@@ -297,7 +298,7 @@ def get_soliditylang_checksums(version: str) -> (str, str):
297298 return matches [0 ]["sha256" ], matches [0 ]["keccak256" ]
298299
299300
300- def get_url (version : str = "" , artifact : str = "" ) -> ( str , str ) :
301+ def get_url (version : str = "" , artifact : str = "" ) -> Tuple [ str , str ] :
301302 if soliditylang_platform () == LINUX_AMD64 :
302303 if version != "" and is_older_linux (version ):
303304 return (
@@ -361,14 +362,14 @@ def valid_install_arg(arg: str) -> str:
361362 return valid_version (arg )
362363
363364
364- def get_installable_versions () -> [str ]:
365+ def get_installable_versions () -> List [str ]:
365366 installable = list (set (get_available_versions ()) - set (installed_versions ()))
366367 installable .sort (key = Version )
367368 return installable
368369
369370
370371# pylint: disable=consider-using-with
371- def get_available_versions () -> [ str ]:
372+ def get_available_versions () -> Dict [ str , str ]:
372373 (_ , list_url ) = get_url ()
373374 list_json = urllib .request .urlopen (list_url ).read ()
374375 available_releases = json .loads (list_json )["releases" ]
0 commit comments