def to_special_value(self, value): """Checks if value is a special SPDX value such as NONE, NOASSERTION or UNKNOWN if so returns proper model. else returns value""" if value == self.spdx_namespace.none: return utils.SPDXNone() elif value == self.spdx_namespace.noassertion: return utils.NoAssert() elif value == self.spdx_namespace.unknown: return utils.UnKnown() else: return value
def p_pkg_suppl(self, p_term, predicate): for _s, _p, o in self.graph.triples((p_term, predicate, None)): try: if o == "NOASSERTION": self.builder.set_pkg_supplier(self.doc, utils.NoAssert()) else: ent = self.builder.create_entity(self.doc, six.text_type(o)) self.builder.set_pkg_supplier(self.doc, ent) except CardinalityError: self.more_than_one_error('Package supplier') break except SPDXValueError: self.value_error('PKG_SUPPL_VALUE', o)
def p_pkg_originator(self, p_term, predicate): for _s, _p, o in self.graph.triples((p_term, predicate, None)): try: if o == "NOASSERTION": self.builder.set_pkg_originator(self.doc, utils.NoAssert()) else: ent = self.builder.create_entity(self.doc, unicode(o)) self.builder.set_pkg_originator(self.doc, ent) except CardinalityError: self.more_than_one_error('Package originator') break except SPDXValueError: self.value_error('PKG_ORIGINATOR_VALUE', o)
def test_validate_file_cpyright_does_not_crash_on_NoAssert_or_SPDXNone( self): validations.validate_file_cpyright(utils.NoAssert()) validations.validate_file_cpyright(utils.SPDXNone())
def test_validate_pkg_cr_text_does_not_crash_on_NoAssert_or_SPDXNone(self): validations.validate_pkg_cr_text(utils.NoAssert()) validations.validate_pkg_cr_text(utils.SPDXNone())
def p_pkg_supplier_values_1(self, p): """pkg_supplier_values : NO_ASSERT""" p[0] = utils.NoAssert()
def p_pkg_down_value_3(self, p): """pkg_down_value : NO_ASSERT""" p[0] = utils.NoAssert()
def p_pkg_lic_ff_value_2(self, p): """pkg_lic_ff_value : NO_ASSERT""" p[0] = utils.NoAssert()
def p_pkg_cr_text_value_3(self, p): """pkg_cr_text_value : NO_ASSERT""" p[0] = utils.NoAssert()
def p_conc_license_1(self, p): """conc_license : NO_ASSERT""" p[0] = utils.NoAssert()
def p_file_lic_info_value_2(self, p): """file_lic_info_value : NO_ASSERT""" p[0] = utils.NoAssert()
def p_file_cr_value_3(self, p): """file_cr_value : NO_ASSERT""" p[0] = utils.NoAssert()
def p_extr_lic_name_value_2(self, p): """extr_lic_name_value : NO_ASSERT""" p[0] = utils.NoAssert()