Skip to content

Commit

Permalink
chores: types: use Python 3.8 compatible types
Browse files Browse the repository at this point in the history
  • Loading branch information
tngraf committed Dec 24, 2023
1 parent 43cee3d commit 90d0260
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
14 changes: 7 additions & 7 deletions cli_support/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import sys
import xml.etree.ElementTree as ET
from typing import Any, Optional
from typing import Any, List, Optional

from .cli_assessment_summary import CliAssessmentSummary
from .cli_copyright import CliCopyright
Expand Down Expand Up @@ -65,12 +65,12 @@ def __init__(self) -> None:
self.general_information = CliGeneralInformation()
self.assessment_summary = CliAssessmentSummary()

self.licenses: list[CliLicense] = []
self.copyrights: list[CliCopyright] = []
self.obligations: list[CliObligation] = []
self.tags: list[str] = []
self.export_restrictions: list[CliExportRestriction] = []
self.external_ids: list[CliExternalId] = []
self.licenses: List[CliLicense] = []
self.copyrights: List[CliCopyright] = []
self.obligations: List[CliObligation] = []
self.tags: List[str] = []
self.export_restrictions: List[CliExportRestriction] = []
self.external_ids: List[CliExternalId] = []
self.irrelevant_files = CliIrrelevantFiles()
self.comment: str = ""

Expand Down
5 changes: 3 additions & 2 deletions cli_support/cli_copyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# -------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
from typing import List

from .cli_file_item_base import CliFileItemBase

Expand All @@ -20,8 +21,8 @@ class CliCopyright(CliFileItemBase):
def __init__(self) -> None:
CliFileItemBase.__init__(self)
self.text: str = ""
self.files: list[str] = []
self.hashes: list[str] = []
self.files: List[str] = []
self.hashes: List[str] = []

def _read_from_element(self, element: ET.Element) -> None:
"""Read copyright from XML element."""
Expand Down
5 changes: 3 additions & 2 deletions cli_support/cli_file_item_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# -------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
from typing import List

from .xml_base import XmlBase

Expand All @@ -19,8 +20,8 @@ class CliFileItemBase(XmlBase):
FILEHASH_TAG = "FileHash"

def __init__(self) -> None:
self.files: list[str] = []
self.hashes: list[str] = []
self.files: List[str] = []
self.hashes: List[str] = []

def _read_files_from_element(self, element: ET.Element) -> None:
"""Read files and hashes from XML element."""
Expand Down
5 changes: 3 additions & 2 deletions cli_support/cli_irrelevant_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# -------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
from typing import List

from .cli_file_item_base import CliFileItemBase

Expand All @@ -19,8 +20,8 @@ class CliIrrelevantFiles(CliFileItemBase):

def __init__(self) -> None:
CliFileItemBase.__init__(self)
self.files: list[str] = []
self.hashes: list[str] = []
self.files: List[str] = []
self.hashes: List[str] = []

def _read_from_element(self, element: ET.Element) -> None:
"""Read irrelevant files from XML element."""
Expand Down
9 changes: 5 additions & 4 deletions cli_support/cli_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# -------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
from typing import List

from .cli_file_item_base import CliFileItemBase

Expand All @@ -25,10 +26,10 @@ def __init__(self) -> None:
self.type: str = ""
self.name: str = ""
self.spdx_identifier: str = ""
self.acknowledgements: list[str] = []
self.tags: list[str] = []
self.files: list[str] = []
self.hashes: list[str] = []
self.acknowledgements: List[str] = []
self.tags: List[str] = []
self.files: List[str] = []
self.hashes: List[str] = []

def _read_from_element(self, element: ET.Element) -> None:
"""Read license from XML element."""
Expand Down
3 changes: 2 additions & 1 deletion cli_support/cli_obligation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# -------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
from typing import List

from .xml_base import XmlBase

Expand All @@ -23,7 +24,7 @@ class CliObligation(XmlBase):
def __init__(self) -> None:
self.text: str = ""
self.topic: str = ""
self.licenses: list[str] = []
self.licenses: List[str] = []

def _read_from_element(self, element: ET.Element) -> None:
"""Read license from XML element."""
Expand Down
2 changes: 1 addition & 1 deletion cli_support/license_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_global_license(clifile: CliFile) -> Optional[CliLicense]:
@staticmethod
def get_non_global_licenses(clifile: CliFile) -> List[CliLicense]:
"""Gets the non global licenses."""
result: list[CliLicense] = []
result: List[CliLicense] = []
for lic in clifile.licenses:
if lic.type.upper() != "GLOBAL":
result.append(lic)
Expand Down

0 comments on commit 90d0260

Please sign in to comment.