Add some typing

This commit is contained in:
Ayaz Salikhov
2021-05-03 00:54:52 +03:00
parent 7d7bbba09f
commit 2172a9ab16
7 changed files with 40 additions and 30 deletions

View File

@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__)
class DockerRunner:
def __init__(self, image_name, docker_client=docker.from_env(), command="sleep infinity"):
def __init__(self, image_name: str, docker_client=docker.from_env(), command: str = "sleep infinity"):
self.container = None
self.image_name = image_name
self.command = command
@@ -29,7 +29,7 @@ class DockerRunner:
logger.info(f"Container {self.container.name} removed")
@staticmethod
def run_simple_command(container, cmd, print_result=True):
def run_simple_command(container, cmd: str, print_result: bool = True):
logger.info(f"Running cmd: '{cmd}' on container: {container}")
out = container.exec_run(cmd)
assert out.exit_code == 0, f"Command: {cmd} failed"