def __init__(self, graph_store, synonyms_store): """Initialize the analyzer and read known synonyms.""" # load graph from given data store self.g = DirectedGraph.read_from_json(graph_store) self.known_licenses = [ 'public domain', 'mit', 'bsd-new', 'bsd-simplified', 'apache 2.0', 'lgplv2.1', 'lgplv2.1+', 'lgplv3+', 'mpl 1.1', 'gplv2', 'gplv2+', 'gplv3+', 'affero gplv3', 'epl 1.0', 'epl 2.0', 'cddlv1.1+', 'mpl 2.0', 'w3c', 'bouncycastle', 'cc0v1.0', 'cc-by-3.0', 'edl', 'json', 'postgresql', 'apache 1.1', 'cpl 1.0', 'cpal 1.0', 'ISC', 'gwt', 'psfl' ] # IMPORTANT: Order matters in the following tuple self.license_type_tuple = ('P', 'WP', 'SP', 'NP') # read the json that contains known synonyms list_synonym_jsons = synonyms_store.list_files() for synonym_json in list_synonym_jsons: self.syn = synonyms_store.read_json_file(synonym_json) break # currently only one synonym json is supported # identify compatibility classes among the licenses in graph self.dict_compatibility_classes = {} self.dict_type_compatibility_classes = {} self._find_compatibility_classes() self._find_type_compatibility_classes()
def __init__(self, graph_store, synonyms_store): # load graph from given data store self.g = DirectedGraph.read_from_json(graph_store) self.known_licenses = [ 'public domain', 'mit', 'bsd-new', 'apache 2.0', 'lgplv2.1', 'lgplv2.1+', 'lgplv3+', 'mpl 1.1', 'gplv2', 'gplv2+', 'gplv3+', 'affero gplv3' ] # IMPORTANT: Order matters in the following tuple self.license_type_tuple = ('P', 'WP', 'SP', 'NP') # read the json that contains known synonyms list_synonym_jsons = synonyms_store.list_files() for synonym_json in list_synonym_jsons: self.syn = synonyms_store.read_json_file(synonym_json) break # currently only one synonym json is supported # identify compatibility classes among the licenses in graph self.dict_compatibility_classes = {} self.dict_type_compatibility_classes = {} self._find_compatibility_classes() self._find_type_compatibility_classes()