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

Method is_matchable

src/licensedcode/query.py:798–818  ·  view source on GitHub ↗

Return True if this query run has some matchable high token positions. Optinally if `include_low`m include low tokens. If a list of `qspans` is provided, their positions are also subtracted.

(self, include_low=False, qspans=None)

Source from the content-addressed store, hash-verified

796 return intbitset(self.tokens).issubset(self.digit_only_tids)
797
798 def is_matchable(self, include_low=False, qspans=None):
799 """
800 Return True if this query run has some matchable high token positions.
801 Optinally if `include_low`m include low tokens.
802 If a list of `qspans` is provided, their positions are also subtracted.
803 """
804 if include_low:
805 matchables = self.matchables
806 else:
807 matchables = self.high_matchables
808
809 if self.is_digits_only():
810 return False
811
812 if not qspans:
813 return matchables
814
815 matched = intbitset.union(*[q._set for q in qspans])
816 matchables = intbitset(matchables)
817 matchables.difference_update(matched)
818 return matchables
819
820 @property
821 def matchables(self):

Callers 5

get_fragments_matchesMethod · 0.80
match_queryMethod · 0.80
match_sequenceFunction · 0.80

Calls 2

is_digits_onlyMethod · 0.95
unionMethod · 0.80

Tested by 1