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

Function remove_from_tallies

src/summarycode/summarizer.py:139–156  ·  view source on GitHub ↗

Return an list containing the elements of `tallies`, without `entry`

(entry, tallies)

Source from the content-addressed store, hash-verified

137
138
139def remove_from_tallies(entry, tallies):
140 """
141 Return an list containing the elements of `tallies`, without `entry`
142 """
143 pruned_tallies = []
144 for t in tallies:
145 if (
146 isinstance(entry, dict)
147 and t == entry
148 or isinstance(entry, (list, tuple))
149 and t in entry
150 or isinstance(entry, (list, tuple))
151 and t.get('value') in entry
152 or t.get('value') == entry
153 ):
154 continue
155 pruned_tallies.append(t)
156 return pruned_tallies
157
158
159def get_declared_holders(codebase, holders_tallies):

Callers 2

process_codebaseMethod · 0.85

Calls 2

getMethod · 0.65
appendMethod · 0.45

Tested by 1