Coverage for sphinx_reports/DataModel/Dependency.py: 71%

34 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-09 22:12 +0000

1# ==================================================================================================================== # 

2# _ _ _ # 

3# ___ _ __ | |__ (_)_ __ __ __ _ __ ___ _ __ ___ _ __| |_ ___ # 

4# / __| '_ \| '_ \| | '_ \\ \/ /____| '__/ _ \ '_ \ / _ \| '__| __/ __| # 

5# \__ \ |_) | | | | | | | |> <_____| | | __/ |_) | (_) | | | |_\__ \ # 

6# |___/ .__/|_| |_|_|_| |_/_/\_\ |_| \___| .__/ \___/|_| \__|___/ # 

7# |_| |_| # 

8# ==================================================================================================================== # 

9# Authors: # 

10# Patrick Lehmann # 

11# # 

12# License: # 

13# ==================================================================================================================== # 

14# Copyright 2023-2025 Patrick Lehmann - Bötzingen, Germany # 

15# # 

16# Licensed under the Apache License, Version 2.0 (the "License"); # 

17# you may not use this file except in compliance with the License. # 

18# You may obtain a copy of the License at # 

19# # 

20# http://www.apache.org/licenses/LICENSE-2.0 # 

21# # 

22# Unless required by applicable law or agreed to in writing, software # 

23# distributed under the License is distributed on an "AS IS" BASIS, # 

24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

25# See the License for the specific language governing permissions and # 

26# limitations under the License. # 

27# # 

28# SPDX-License-Identifier: Apache-2.0 # 

29# ==================================================================================================================== # 

30# 

31"""""" 

32from typing import List, Iterable 

33 

34from pyTooling.Decorators import export, readonly 

35 

36 

37@export 

38class VersionSpecifier: 

39 _spec: str 

40 

41 def __init__(self, spec: str): 

42 self._spec = spec 

43 

44 

45@export 

46class License: 

47 _name: str 

48 

49 def __init__(self, name: str): 

50 self._name = name 

51 

52 

53@export 

54class Distribution: 

55 _name: str 

56 _packages: List[str] 

57 _version: VersionSpecifier 

58 _licenses: List[License] 

59 _dependencies: List["Distribution"] 

60 

61 def __init__(self, name: str): 

62 self._name = name 

63 

64 self._packages = [] 

65 self._version = None 

66 self._licenses = [] 

67 self._dependencies = [] 

68 

69 @readonly 

70 def Name(self) -> str: 

71 return self._name 

72 

73 @readonly 

74 def Version(self) -> VersionSpecifier: 

75 return self._version 

76 

77 @readonly 

78 def Licenses(self) -> Iterable[License]: 

79 return self._licenses