import os import sys class TooManyArguments(Exception): pass def pwd(args: list, stdin=sys.stdin, stdout=sys.stdout): if not len(args) == 0: raise TooManyArguments() print(os.getcwd(), file=stdout) def chdir(args: list, stdin=sys.stdin, stdout=sys.stdout): if len(args) == 0: os.chdir(os.getenv("HOME")) elif len(args) == 1: os.chdir(next(iter(args))) else: raise TooManyArguments() def export(args: list, stdin=sys.stdin, stdout=sys.stdout): if len(args) == 0: for key, value in sorted(os.environ.items()): print(f"{key}={value}", file=stdout) else: raise NotImplementedError()