Skip to content

Commit

Permalink
Repair mypy
Browse files Browse the repository at this point in the history
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
  • Loading branch information
carmenbianca committed Apr 27, 2024
1 parent ae7ccaf commit a746e74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/reuse/convert_dep5.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
from argparse import ArgumentParser, Namespace
from gettext import gettext as _
from typing import IO, cast
from typing import IO, Any, List, Union, cast

import tomlkit
from debian.copyright import Copyright
Expand All @@ -21,18 +21,22 @@ def toml_from_dep5(dep5: Copyright) -> str:
annotations = []
for paragraph in dep5.all_files_paragraphs():
# Convert some lists to single-item elements as necessary.
copyrights = [line.strip() for line in paragraph.copyright.splitlines()]
copyrights: Union[str, List[str]] = [
line.strip() for line in cast(str, paragraph.copyright).splitlines()
]
if len(copyrights) == 1:
copyrights = copyrights[0]
paths = list(paragraph.files)
paths: Union[str, List[str]] = list(paragraph.files)
if len(paths) == 1:
paths = paths[0]
annotations.append(
{
"path": paths,
"precedence": "aggregate",
"SPDX-FileCopyrightText": copyrights,
"SPDX-License-Identifier": paragraph.license.synopsis,
"SPDX-License-Identifier": cast(
Any, paragraph.license
).synopsis,
}
)
# TODO: magic version number
Expand Down

0 comments on commit a746e74

Please sign in to comment.