MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / setup

Method setup

src/licensedcode/models.py:1834–1859  ·  view source on GitHub ↗

Setup a few basic computed attributes after instance creation.

(self)

Source from the content-addressed store, hash-verified

1832 self.setup()
1833
1834 def setup(self):
1835 """
1836 Setup a few basic computed attributes after instance creation.
1837 """
1838 self.relevance = as_int(float(self.relevance))
1839 self.minimum_coverage = as_int(float(self.minimum_coverage or 0))
1840
1841 if self.license_expression:
1842 try:
1843 expression = self.licensing.parse(self.license_expression)
1844 except Exception as e:
1845 exp = self.license_expression
1846 trace = traceback.format_exc()
1847 raise InvalidRule(
1848 f'Unable to parse Rule license expression: {exp!r} '
1849 f'for: file://{self.identifier}\n{trace}'
1850 ) from e
1851
1852 if expression is None:
1853 raise InvalidRule(
1854 f'Invalid rule License expression parsed to empty: '
1855 f'{self.license_expression!r} for: file://{self.identifier}'
1856 )
1857
1858 self.license_expression = expression.render()
1859 self.license_expression_object = expression
1860
1861 @property
1862 def has_unknown(self):

Callers 9

__attrs_post_init__Method · 0.95
setup.pyFile · 0.45
build_rule_from_licenseFunction · 0.45
__attrs_post_init__Method · 0.45
loadMethod · 0.45
__attrs_post_init__Method · 0.45
__attrs_post_init__Method · 0.45
run_scanFunction · 0.45

Calls 4

as_intFunction · 0.85
InvalidRuleClass · 0.85
parseMethod · 0.45
renderMethod · 0.45

Tested by 1