From 924f0c734a7accb87e2ac911cee6e24dd463f237 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 9 May 2023 15:10:25 +0200 Subject: add type annotations to most of the code --- readyaml.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'readyaml.py') diff --git a/readyaml.py b/readyaml.py index b88d1e0..7008263 100755 --- a/readyaml.py +++ b/readyaml.py @@ -5,11 +5,13 @@ updates the database with the contents.""" import argparse import sqlite3 import sys +import typing from debian.debian_support import version_compare import yaml -def readyaml(db, stream): + +def readyaml(db: sqlite3.Connection, stream: typing.TextIO) -> None: cur = db.cursor() cur.execute("PRAGMA foreign_keys = ON;") gen = yaml.load_all(stream, yaml.CSafeLoader) @@ -53,7 +55,8 @@ def readyaml(db, stream): for func, hexhash in entry["hashes"].items())) raise ValueError("missing commit block") -def main(): + +def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("-d", "--database", action="store", default="test.sqlite3", -- cgit v1.2.3