MCPcopy Create free account
hub / github.com/Persper/code-analytics / get_intersected_length

Function get_intersected_length

persper/graphs/detect_change.py:1–17  ·  view source on GitHub ↗

>>> get_intersected_length([1, 9], [2, 8]) 7 >>> get_intersected_length([2, 8], [1, 9]) 7 >>> get_intersected_length([1, 4], [1, 5]) 4 >>> get_intersected_length([2, 10], [4, 11]) 7

(a, b)

Source from the content-addressed store, hash-verified

1def get_intersected_length(a, b):
2 """
3 >>> get_intersected_length([1, 9], [2, 8])
4 7
5 >>> get_intersected_length([2, 8], [1, 9])
6 7
7 >>> get_intersected_length([1, 4], [1, 5])
8 4
9 >>> get_intersected_length([2, 10], [4, 11])
10 7
11 """
12 start = a[0] if a[0] >= b[0] else b[0]
13 end = a[1] if a[1] <= b[1] else b[1]
14 if start > end:
15 return 0
16 else:
17 return end - start + 1
18
19
20def get_changed_functions(func_names, func_ranges, additions, deletions,

Callers 1

get_changed_functionsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected