here.platform.model.version_dependency
Source code for here.platform.model.version_dependency
Copyright (C) 2020-2022 HERE Global B.V. and its affiliate(s).
All rights reserved.
This software and other materials contain proprietary information
controlled by HERE and are protected by applicable copyright legislation.
Any use and utilization of this software and other materials and
disclosure to any third parties is conditional upon having a separate
agreement with HERE for the access, use, utilization or disclosure of this
software. In the absence of such agreement, the use of the software is not
allowed.
"""
This module defines the model and functions of a version dependency.
"""
from here.platform.utils import JsonDictDocument
[docs]
class VersionDependency(JsonDictDocument):
"""
Represent how a catalog version is related to a version of another catalog.
"""
def init(self, hrn: str, version: int, direct: bool = True):
"""
Create a new dependency.
:param hrn: the HRN of the catalog depending upon
:param version: the version of the catalog depending upon
:param direct: if the dependent catalog is a direct dependency,
or if the dependency relation is only via a 3rd catalog (indirect)
"""
json_dict = {"hrn": hrn, "version": version, "direct": direct}
super().init(json_dict)
@property
def hrn(self) -> str:
"""The HRN of the catalog depending upon"""
return str(self.json["hrn"])
@property
def version(self) -> int:
"""The version of the catalog depending upon"""
return int(self.json["version"])
@property
def direct(self) -> bool:
"""If the dependent catalog is a direct dependency,
or if the dependency relation is only via a 3rd catalog (indirect)""" # noqa
return bool(self.json["direct"])