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

Method rule_file

src/licensedcode/models.py:1813–1829  ·  view source on GitHub ↗

Return the path to the rule file for this rule object, given the `rules_data_dir` directory or `licenses_data_dir` if a license rule. Return None if the Rule does not have yet an identifier or is synthetic.

(
        self,
        rules_data_dir=rules_data_dir,
        licenses_data_dir=licenses_data_dir,
    )

Source from the content-addressed store, hash-verified

1811 return SCANCODE_RULE_URL.format(self.identifier)
1812
1813 def rule_file(
1814 self,
1815 rules_data_dir=rules_data_dir,
1816 licenses_data_dir=licenses_data_dir,
1817 ):
1818 """
1819 Return the path to the rule file for this rule object, given the
1820 `rules_data_dir` directory or `licenses_data_dir` if a license rule.
1821 Return None if the Rule does not have yet an identifier or is synthetic.
1822 """
1823 if self.is_synthetic or not self.identifier:
1824 return None
1825
1826 if self.is_from_license:
1827 return join(licenses_data_dir, self.identifier)
1828
1829 return join(rules_data_dir, self.identifier)
1830
1831 def __attrs_post_init__(self, *args, **kwargs):
1832 self.setup()

Calls

no outgoing calls