-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
210 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,56 @@ | ||
from .group import Group | ||
|
||
class License(object): | ||
"""docstring for License""" | ||
""" | ||
This class is responsible for managing all attributes of lincese class, | ||
like it self ecosystemDataManager, version and index | ||
""" | ||
def __init__(self, ecosystemDataManager, version, index): | ||
super(License, self).__init__() | ||
self.ecosystemDataManager = ecosystemDataManager | ||
self.version = version | ||
self.index = index | ||
""" | ||
This function is internally called for initialization of the class and set all attributes | ||
""" | ||
|
||
def getName(self): | ||
versionsHasLicenses = self.ecosystemDataManager.get("VersionsHasLicenses") | ||
return versionsHasLicenses[self.version.getIndex()][self.index] | ||
""" | ||
This function is internally called to return the license name itself | ||
""" | ||
|
||
def getGroup(self): | ||
licensesHasGroup = self.ecosystemDataManager.get("LicensesHasGroup") | ||
return Group(licensesHasGroup[self.version.getIndex()][self.index]) | ||
""" | ||
This function is internally called to return the license group itself | ||
""" | ||
|
||
def setGroup(self, group): | ||
licensesHasGroup = self.ecosystemDataManager.get("LicensesHasGroup") | ||
licensesHasGroup[self.version.getIndex()][self.index] = group.value | ||
return self | ||
|
||
""" | ||
This function is internally called to set the new group | ||
""" | ||
def __hash__(self): | ||
return self.index | ||
|
||
""" | ||
This overwritten function is internally called to return the self index for hash | ||
""" | ||
def __eq__(self, other): | ||
if type(other) == str: | ||
return self.getName() == other | ||
elif type(other) != type(self): | ||
return False | ||
return self.getName() == other.getName() | ||
|
||
""" | ||
This overwritten function is internally called to compare this license with other license by license Name | ||
""" | ||
def __str__(self): | ||
return self.getName() | ||
return self.getName() | ||
""" | ||
This overwritten function is internally called to return license Name | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.