From f0326592bd183fed9499cb15ec1720bcede9a02d Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 3 Dec 2025 14:36:49 +0100 Subject: [PATCH] add type annotation for mypy mypy comlains: ``` ubuntutools/config.py:53: error: Need type annotation for "config" (hint: "config: dict[, ] = ...") [var-annotated] ubuntutools/lp/lpapicache.py:1504: error: Need type annotation for "_source_sets" (hint: "_source_sets: dict[, ] = ...") [var-annotated] ``` --- ubuntutools/config.py | 4 ++-- ubuntutools/lp/lpapicache.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ubuntutools/config.py b/ubuntutools/config.py index b15f0f5..41d1c66 100644 --- a/ubuntutools/config.py +++ b/ubuntutools/config.py @@ -50,7 +50,7 @@ class UDTConfig: "KEYID": None, } # Populated from the configuration files: - config = {} + config: dict[str, str] = {} def __init__(self, no_conf=False, prefix=None): self.no_conf = no_conf @@ -61,7 +61,7 @@ class UDTConfig: self.config = self.parse_devscripts_config() @staticmethod - def parse_devscripts_config(): + def parse_devscripts_config() -> dict[str, str]: """Read the devscripts configuration files, and return the values as a dictionary """ diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index d026215..67a15e9 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -26,6 +26,7 @@ import logging import os import re from copy import copy +from typing import Any from urllib.error import URLError from urllib.parse import urlparse @@ -1501,7 +1502,7 @@ class Packageset(BaseWrapper): # pylint: disable=too-few-public-methods resource_type = "packageset" _lp_packagesets = None - _source_sets = {} + _source_sets: dict[tuple[str, str | None, bool], Any] = {} @classmethod def setsIncludingSource(cls, sourcepackagename, distroseries=None, direct_inclusion=False):