A specialized rule object that is used for the special case of unknown license detection. Since we may have an infinite number of possible unknown licenses and these are not backed by a traditional rule text file, we use this class to handle the specifics of these how such rule
| 2776 | |
| 2777 | @attr.s(slots=True, repr=False) |
| 2778 | class UnknownRule(SynthethicRule): |
| 2779 | """ |
| 2780 | A specialized rule object that is used for the special case of unknown |
| 2781 | license detection. |
| 2782 | |
| 2783 | Since we may have an infinite number of possible unknown licenses and these |
| 2784 | are not backed by a traditional rule text file, we use this class to handle |
| 2785 | the specifics of these how such rules are built at matching time: one new |
| 2786 | synthetic rule is created for each detected unknown license match. |
| 2787 | """ |
| 2788 | |
| 2789 | def __attrs_post_init__(self, *args, **kwargs): |
| 2790 | # We craft a UNIQUE identifier for the matched content |
| 2791 | self.identifier = f'license-detection-unknown-{self._unique_id}' |
| 2792 | |
| 2793 | self.license_expression = UNKNOWN_LICENSE_KEY |
| 2794 | # TODO: that this could be shared across rules as an optimization |
| 2795 | self.license_expression_object = self.licensing.parse(UNKNOWN_LICENSE_KEY) |
| 2796 | self.is_license_notice = True |
| 2797 | self.notes = 'Unknown license based on a composite of license words.' |
| 2798 | self.is_synthetic = True |
| 2799 | self.setup() |
| 2800 | |
| 2801 | |
| 2802 | @attr.s(slots=True, repr=False) |