Skip to content

Commit

Permalink
Fix some typing hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Aug 22, 2023
1 parent 4278dc4 commit 935da0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clean_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Docker Registry cleaner
"""

import argparse
import logging
import os
import re
import shlex
import sys
import subprocess

from argparse import ArgumentParser
from shutil import rmtree


Expand Down Expand Up @@ -48,7 +48,7 @@ def check_name(image: str) -> bool:
return bool(len(image) < 256 and tag_valid and repo_valid)


def run_command(command: list) -> int:
def run_command(command: list[str]) -> int:
'''Run command'''
logging.info("Running %s", shlex.join(command))
try:
Expand Down Expand Up @@ -122,15 +122,15 @@ def clean_repo(basedir: str, image: str, dry_run: bool = False) -> None:
clean_tag(basedir, repo, tag, dry_run)


def get_os_release():
def get_os_release() -> dict[str, str]:
'''Get OS release'''
with open("/etc/os-release", encoding="utf-8") as file:
return {k: v.strip('"') for k, v in [line.split('=') for line in file.read().splitlines()]}


def parse_args(): # pragma: no cover
def parse_args() -> argparse.Namespace:
"""Parse args"""
parser = ArgumentParser()
parser = argparse.ArgumentParser()
parser.add_argument(
'--dry-run', action='store_true',
help="Don't remove anything")
Expand Down

0 comments on commit 935da0d

Please sign in to comment.