diff --git a/src/maps b/src/maps index b03430c..22ebcb5 100755 --- a/src/maps +++ b/src/maps @@ -133,8 +133,9 @@ def addCLI(): return parser, parser_runtime, parser_remote, parser_pack -def sanity_checks(parsers): - """Some simple sanity checks, before the program proceeds""" +def sanity_checks(parsers: tuple[argparse.ArgumentParser, argparse.ArgumentParser, + argparse.ArgumentParser, argparse.ArgumentParser]): + """Some simply sanity checks, before the program proceeds""" if len(sys.argv) == 1: parsers[0].print_help() sys.exit(1) @@ -185,7 +186,7 @@ def create_config_file(config_path): return config -def program_init(repopath): +def program_init(repopath: str): """Init function verifies requirements, sets up the repo. Returns the OSTree Repo.""" opt1 = "-q" opt2 = "1>/dev/null" @@ -326,7 +327,7 @@ def program_init(repopath): return repo -def make_remote_ref_list(repo, remote): +def make_remote_ref_list(repo: OSTree.Repo, remote: str): """Given a repo and a remote, return a list of refs in the remote of that repo""" if remote is None: return [] @@ -347,7 +348,7 @@ def make_remote_ref_list(repo, remote): return remote_refs -def mode_list(repo): +def mode_list(repo: OSTree.Repo): """Prints a list of available refs""" print("Available runtimes are :") refs = list(repo.list_refs()[1].keys()) @@ -372,7 +373,7 @@ def list_remotes(repo): return retval -def mode_remotes(repo, args): +def mode_remotes(repo: OSTree.Repo, args): # todo: type for args? """Administrative mode for remotes of the repo""" if args.LIST is not False: remotes = list_remotes(repo) @@ -581,7 +582,7 @@ def make_bwrap_command(location, command, nogui, gui): return bwrapstring, senv -def mode_run(repo, args): +def mode_run(repo, args): # TODO """Function to execute a deployed environment""" remote, runtime = disambiguate_runtime(repo, args.RUN, installed=True) @@ -661,7 +662,7 @@ def download(repo, repopath, remote, target): # Uninstall -def uninstall_runtime(repo, args): +def uninstall_runtime(repo: OSTree.repo, args): # todo: type for args? """Function to remove a runtime from both the local disk checkout, and the local repo""" # Check if runtime is checked out FLAG_DIREXISTS = False @@ -723,7 +724,7 @@ def validate_runtime_name(runtime_id: str): # Update -def mode_update(repo, repopath, args, remote=""): +def mode_update(repo, repopath, args, remote=""): # TODO """Function to update a runtime identifier to its recent version (if any)""" if not args.UPDATE: args.UPDATE = args.DEPLOY @@ -808,7 +809,7 @@ def checkout(repo, remote, runtime): # Deploy Mode -def mode_deploy(repo, repopath, args): +def mode_deploy(repo: OSTree.Repo, repopath: str, args): # todo: type for args? """Function to deploy from repo to local disk""" remote, runtime = disambiguate_runtime(repo, args.DEPLOY, installed=False) @@ -872,7 +873,7 @@ def blank_options(): # Package Mode -def mode_package(repo, repopath, args): +def mode_package(repo, repopath, args): #TODO """Function for package mode. Not intended to be used by "end users" """ if args.DIR is not None: refhash = '' @@ -936,7 +937,7 @@ def mode_package(repo, repopath, args): upload(repo, args.UPLOAD) -def commit(zarglist): +def commit(zarglist: list): """ Function commits a tree to a repo in branch asynchronously, so spinner can be animated in the main thread to show activity. @@ -965,7 +966,7 @@ def commit(zarglist): repo.commit_transaction(None) -def reset(repo, runtime): +def reset(repo, runtime): #TODO """ Function resets a runtime, simply by deleting the contents of the "rwfs" dir. """ @@ -1090,7 +1091,7 @@ def mode_url(repo, repopath, args): # runtime mode: the default path for execution -def mode_runtime(repo, repopath, args): +def mode_runtime(repo: OSTree.Repo, repopath: str, args): """ Runtime mode, the default path for execution, and the "end user" mode. """