add type annotation for mypy

mypy comlains:

```
ubuntutools/config.py:53: error: Need type annotation for "config" (hint: "config: dict[<type>, <type>] = ...")  [var-annotated]
ubuntutools/lp/lpapicache.py:1504: error: Need type annotation for "_source_sets" (hint: "_source_sets: dict[<type>, <type>] = ...")  [var-annotated]
```
This commit is contained in:
Benjamin Drung 2025-12-03 14:36:49 +01:00
parent aa439fec02
commit f0326592bd
2 changed files with 4 additions and 3 deletions

View File

@ -50,7 +50,7 @@ class UDTConfig:
"KEYID": None, "KEYID": None,
} }
# Populated from the configuration files: # Populated from the configuration files:
config = {} config: dict[str, str] = {}
def __init__(self, no_conf=False, prefix=None): def __init__(self, no_conf=False, prefix=None):
self.no_conf = no_conf self.no_conf = no_conf
@ -61,7 +61,7 @@ class UDTConfig:
self.config = self.parse_devscripts_config() self.config = self.parse_devscripts_config()
@staticmethod @staticmethod
def parse_devscripts_config(): def parse_devscripts_config() -> dict[str, str]:
"""Read the devscripts configuration files, and return the values as a """Read the devscripts configuration files, and return the values as a
dictionary dictionary
""" """

View File

@ -26,6 +26,7 @@ import logging
import os import os
import re import re
from copy import copy from copy import copy
from typing import Any
from urllib.error import URLError from urllib.error import URLError
from urllib.parse import urlparse from urllib.parse import urlparse
@ -1501,7 +1502,7 @@ class Packageset(BaseWrapper): # pylint: disable=too-few-public-methods
resource_type = "packageset" resource_type = "packageset"
_lp_packagesets = None _lp_packagesets = None
_source_sets = {} _source_sets: dict[tuple[str, str | None, bool], Any] = {}
@classmethod @classmethod
def setsIncludingSource(cls, sourcepackagename, distroseries=None, direct_inclusion=False): def setsIncludingSource(cls, sourcepackagename, distroseries=None, direct_inclusion=False):