tracking-claim-audit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tracking_claim_audit-0.1.0/LICENSE +21 -0
- tracking_claim_audit-0.1.0/MANIFEST.in +2 -0
- tracking_claim_audit-0.1.0/PKG-INFO +70 -0
- tracking_claim_audit-0.1.0/README.md +60 -0
- tracking_claim_audit-0.1.0/pyproject.toml +17 -0
- tracking_claim_audit-0.1.0/setup.cfg +4 -0
- tracking_claim_audit-0.1.0/tests/__init__.py +0 -0
- tracking_claim_audit-0.1.0/tests/fixtures/bad/README.md +1 -0
- tracking_claim_audit-0.1.0/tests/fixtures/bad/app.py +2 -0
- tracking_claim_audit-0.1.0/tests/fixtures/good/README.md +1 -0
- tracking_claim_audit-0.1.0/tests/fixtures/good/app.py +2 -0
- tracking_claim_audit-0.1.0/tests/fixtures/no_claim/README.md +1 -0
- tracking_claim_audit-0.1.0/tests/fixtures/no_claim/app.py +2 -0
- tracking_claim_audit-0.1.0/tests/fixtures/no_tracking/README.md +1 -0
- tracking_claim_audit-0.1.0/tests/fixtures/no_tracking/app.py +2 -0
- tracking_claim_audit-0.1.0/tests/fixtures/testonly/README.md +1 -0
- tracking_claim_audit-0.1.0/tests/fixtures/testonly/app.py +0 -0
- tracking_claim_audit-0.1.0/tests/fixtures/testonly/test_provider.py +2 -0
- tracking_claim_audit-0.1.0/tests/test_audit.py +219 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit/__init__.py +1 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit/__main__.py +41 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit/audit.py +166 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit/phrases.py +105 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit.egg-info/PKG-INFO +70 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit.egg-info/SOURCES.txt +26 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit.egg-info/dependency_links.txt +1 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit.egg-info/entry_points.txt +2 -0
- tracking_claim_audit-0.1.0/tracking_claim_audit.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tracking-claim-audit contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tracking-claim-audit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Offline audit of documented cross-frame following capabilities
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# Cross-frame following claim audit
|
|
12
|
+
|
|
13
|
+
An offline, dependency-free Python 3.9+ checker comparing documentation promises
|
|
14
|
+
about following objects across video frames with Python provider fingerprints.
|
|
15
|
+
Source files are parsed with AST and never executed.
|
|
16
|
+
|
|
17
|
+
Install and run:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install tracking-claim-audit
|
|
21
|
+
tracking-claim-audit ./project --json
|
|
22
|
+
python3 -m tracking_claim_audit ./project --verbose
|
|
23
|
+
tracking-claim-audit ./project --ignore 'vendor/*' --fail-on MEDIUM
|
|
24
|
+
tracking-claim-audit --version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The root README.md and Markdown files beneath any docs path component supply
|
|
28
|
+
claims. Fenced blocks using backticks or tildes are omitted; inline code counts.
|
|
29
|
+
Blank lines delimit paragraphs; wrapped lines join. Case, contractions, hyphens,
|
|
30
|
+
and whitespace are normalized. Exact word-boundary templates are matched longest
|
|
31
|
+
first, with denial spans removed before positive matching.
|
|
32
|
+
|
|
33
|
+
Python evidence comes from OpenCV constructor calls (including legacy providers),
|
|
34
|
+
ultralytics YOLO instances with a track method call, norfair Tracker, supervision
|
|
35
|
+
ByteTrack, DeepSort/DeepSORT from deep_sort or deep_sort_realtime, Sort from sort,
|
|
36
|
+
and dlib correlation_tracker. Import aliases resolve within a module; local
|
|
37
|
+
bindings shadow imported names. Construction suffices except for YOLO, which
|
|
38
|
+
also needs the method invocation. No vision dependencies are installed.
|
|
39
|
+
|
|
40
|
+
The two rules are:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
documented-tracking-claim-false: HIGH without production evidence; MEDIUM with only test evidence
|
|
44
|
+
documented-no-tracking-claim-false: HIGH when denial conflicts with production evidence
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
At most one finding is emitted per rule. With no claim, the result is PASS.
|
|
48
|
+
Tests are separated from production by a tests component or test_*.py / *_test.py
|
|
49
|
+
filename. Files beneath fixtures, docs, and examples supply no source evidence.
|
|
50
|
+
Symbolic links are excluded. Invalid Python supplies no evidence. Repeatable
|
|
51
|
+
--ignore patterns use fnmatch against relative POSIX file paths.
|
|
52
|
+
|
|
53
|
+
Exit 0 means PASS at the chosen threshold; 2 means FAIL; 1 means invalid input,
|
|
54
|
+
unreadable input, or command usage error. The default threshold is HIGH, so a
|
|
55
|
+
MEDIUM finding still yields PASS unless --fail-on MEDIUM is selected. JSON has
|
|
56
|
+
verdict, findings (rule, severity, message), and files_scanned fields. Human
|
|
57
|
+
output prints the verdict and findings; --verbose adds the scanned file count.
|
|
58
|
+
|
|
59
|
+
This is static evidence, not a runtime correctness guarantee. Imports alone,
|
|
60
|
+
image loading, frame capture, box drawing, per-frame detection, segmentation,
|
|
61
|
+
classification, face/hand/pose detectors, OCR, barcode decoding, flow estimation,
|
|
62
|
+
and standalone Kalman filters do not qualify. Hand-written IoU box association
|
|
63
|
+
has no supported provider fingerprint. Strings, shell commands, subprocesses,
|
|
64
|
+
unbound method calls, and locally defined lookalikes do not qualify. Dynamic
|
|
65
|
+
imports, cross-module model provenance, and arbitrary alias propagation are
|
|
66
|
+
unsupported. Binding analysis is conservative across each module, so rebinding
|
|
67
|
+
a provider or model can suppress evidence even before the rebinding statement.
|
|
68
|
+
|
|
69
|
+
Build and test with python3 -m build and python3 -m unittest discover. The source
|
|
70
|
+
archive includes the unittest suite and its fixtures. This project uses MIT terms.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Cross-frame following claim audit
|
|
2
|
+
|
|
3
|
+
An offline, dependency-free Python 3.9+ checker comparing documentation promises
|
|
4
|
+
about following objects across video frames with Python provider fingerprints.
|
|
5
|
+
Source files are parsed with AST and never executed.
|
|
6
|
+
|
|
7
|
+
Install and run:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install tracking-claim-audit
|
|
11
|
+
tracking-claim-audit ./project --json
|
|
12
|
+
python3 -m tracking_claim_audit ./project --verbose
|
|
13
|
+
tracking-claim-audit ./project --ignore 'vendor/*' --fail-on MEDIUM
|
|
14
|
+
tracking-claim-audit --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The root README.md and Markdown files beneath any docs path component supply
|
|
18
|
+
claims. Fenced blocks using backticks or tildes are omitted; inline code counts.
|
|
19
|
+
Blank lines delimit paragraphs; wrapped lines join. Case, contractions, hyphens,
|
|
20
|
+
and whitespace are normalized. Exact word-boundary templates are matched longest
|
|
21
|
+
first, with denial spans removed before positive matching.
|
|
22
|
+
|
|
23
|
+
Python evidence comes from OpenCV constructor calls (including legacy providers),
|
|
24
|
+
ultralytics YOLO instances with a track method call, norfair Tracker, supervision
|
|
25
|
+
ByteTrack, DeepSort/DeepSORT from deep_sort or deep_sort_realtime, Sort from sort,
|
|
26
|
+
and dlib correlation_tracker. Import aliases resolve within a module; local
|
|
27
|
+
bindings shadow imported names. Construction suffices except for YOLO, which
|
|
28
|
+
also needs the method invocation. No vision dependencies are installed.
|
|
29
|
+
|
|
30
|
+
The two rules are:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
documented-tracking-claim-false: HIGH without production evidence; MEDIUM with only test evidence
|
|
34
|
+
documented-no-tracking-claim-false: HIGH when denial conflicts with production evidence
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
At most one finding is emitted per rule. With no claim, the result is PASS.
|
|
38
|
+
Tests are separated from production by a tests component or test_*.py / *_test.py
|
|
39
|
+
filename. Files beneath fixtures, docs, and examples supply no source evidence.
|
|
40
|
+
Symbolic links are excluded. Invalid Python supplies no evidence. Repeatable
|
|
41
|
+
--ignore patterns use fnmatch against relative POSIX file paths.
|
|
42
|
+
|
|
43
|
+
Exit 0 means PASS at the chosen threshold; 2 means FAIL; 1 means invalid input,
|
|
44
|
+
unreadable input, or command usage error. The default threshold is HIGH, so a
|
|
45
|
+
MEDIUM finding still yields PASS unless --fail-on MEDIUM is selected. JSON has
|
|
46
|
+
verdict, findings (rule, severity, message), and files_scanned fields. Human
|
|
47
|
+
output prints the verdict and findings; --verbose adds the scanned file count.
|
|
48
|
+
|
|
49
|
+
This is static evidence, not a runtime correctness guarantee. Imports alone,
|
|
50
|
+
image loading, frame capture, box drawing, per-frame detection, segmentation,
|
|
51
|
+
classification, face/hand/pose detectors, OCR, barcode decoding, flow estimation,
|
|
52
|
+
and standalone Kalman filters do not qualify. Hand-written IoU box association
|
|
53
|
+
has no supported provider fingerprint. Strings, shell commands, subprocesses,
|
|
54
|
+
unbound method calls, and locally defined lookalikes do not qualify. Dynamic
|
|
55
|
+
imports, cross-module model provenance, and arbitrary alias propagation are
|
|
56
|
+
unsupported. Binding analysis is conservative across each module, so rebinding
|
|
57
|
+
a provider or model can suppress evidence even before the rebinding statement.
|
|
58
|
+
|
|
59
|
+
Build and test with python3 -m build and python3 -m unittest discover. The source
|
|
60
|
+
archive includes the unittest suite and its fixtures. This project uses MIT terms.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tracking-claim-audit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Offline audit of documented cross-frame following capabilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
|
|
13
|
+
[project.scripts]
|
|
14
|
+
tracking-claim-audit = "tracking_claim_audit.__main__:main"
|
|
15
|
+
|
|
16
|
+
[tool.setuptools.packages.find]
|
|
17
|
+
include = ["tracking_claim_audit*"]
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Tracks objects.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Supports object tracking.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
A utility.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Does not track objects.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Tracks objects.
|
|
File without changes
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
import unittest
|
|
7
|
+
|
|
8
|
+
from tracking_claim_audit.audit import audit, claims, evidence
|
|
9
|
+
from tracking_claim_audit.phrases import TRACKING, NOTRACKING
|
|
10
|
+
|
|
11
|
+
FIXTURES = Path(__file__).parent / 'fixtures'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ClaimsTests(unittest.TestCase):
|
|
15
|
+
def test_fences(self):
|
|
16
|
+
for marker in ('```', '~~~', ' ````'):
|
|
17
|
+
self.assertEqual(claims(marker + '\ntracks objects\n' + marker), (False, False))
|
|
18
|
+
|
|
19
|
+
def test_inline(self):
|
|
20
|
+
self.assertEqual(claims('`tracks objects`'), (True, False))
|
|
21
|
+
|
|
22
|
+
def test_negative_removal(self):
|
|
23
|
+
for phrase in NOTRACKING:
|
|
24
|
+
with self.subTest(phrase=phrase):
|
|
25
|
+
self.assertEqual(claims(phrase), (False, True))
|
|
26
|
+
|
|
27
|
+
def test_all_positive_templates(self):
|
|
28
|
+
for phrase in TRACKING:
|
|
29
|
+
self.assertEqual(claims(phrase), (True, False))
|
|
30
|
+
|
|
31
|
+
def test_hyphens(self):
|
|
32
|
+
self.assertEqual(claims('multi-object tracking'), (True, False))
|
|
33
|
+
|
|
34
|
+
def test_contraction(self):
|
|
35
|
+
self.assertEqual(claims("doesn't track objects"), (False, True))
|
|
36
|
+
|
|
37
|
+
def test_paragraphs(self):
|
|
38
|
+
self.assertEqual(claims('tracks\nobjects'), (True, False))
|
|
39
|
+
self.assertEqual(claims('tracks\n\nobjects'), (False, False))
|
|
40
|
+
|
|
41
|
+
def test_boundaries(self):
|
|
42
|
+
self.assertEqual(claims('distracks objectsx'), (False, False))
|
|
43
|
+
|
|
44
|
+
def test_longest(self):
|
|
45
|
+
self.assertEqual(claims('does not track objects across frames; tracks people'), (True, True))
|
|
46
|
+
for phrases in (TRACKING, NOTRACKING):
|
|
47
|
+
self.assertEqual(list(phrases), sorted(phrases, key=len, reverse=True))
|
|
48
|
+
self.assertEqual(len(phrases), len(set(phrases)))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class EvidenceTests(unittest.TestCase):
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
POSITIVE = {
|
|
56
|
+
'cv_direct': 'import cv2\ncv2.TrackerCSRT_create()',
|
|
57
|
+
'cv_alias': 'import cv2 as c\nc.TrackerKCF_create()',
|
|
58
|
+
'cv_from': 'from cv2 import TrackerMIL_create as T\nT()',
|
|
59
|
+
'cv_legacy': 'import cv2\ncv2.legacy.TrackerMOSSE_create()',
|
|
60
|
+
'cv_legacy_from': 'from cv2.legacy import MultiTracker_create\nMultiTracker_create()',
|
|
61
|
+
'yolo_bound': 'from ultralytics import YOLO\nm = YOLO("x")\nm.track()',
|
|
62
|
+
'yolo_chain': 'import ultralytics as u\nu.YOLO("x").track()',
|
|
63
|
+
'norfair': 'import norfair\nnorfair.Tracker()',
|
|
64
|
+
'norfair_from': 'from norfair import Tracker as T\nT()',
|
|
65
|
+
'supervision': 'import supervision\nsupervision.ByteTrack()',
|
|
66
|
+
'sv': 'import supervision as sv\nsv.ByteTrack()',
|
|
67
|
+
'supervision_from': 'from supervision import ByteTrack\nByteTrack()',
|
|
68
|
+
'deep': 'import deep_sort_realtime\ndeep_sort_realtime.DeepSort()',
|
|
69
|
+
'deep_from': 'from deep_sort_realtime.deepsort_tracker import DeepSort as D\nD()',
|
|
70
|
+
'deep_upper': 'from deep_sort import DeepSORT\nDeepSORT()',
|
|
71
|
+
'sort': 'import sort\nsort.Sort()',
|
|
72
|
+
'sort_from': 'from sort import Sort as S\nS()',
|
|
73
|
+
'dlib': 'import dlib\ndlib.correlation_tracker()',
|
|
74
|
+
'dlib_from': 'from dlib import correlation_tracker as C\nC()',
|
|
75
|
+
}
|
|
76
|
+
NEGATIVE = {
|
|
77
|
+
'import': 'import cv2',
|
|
78
|
+
'image': 'import cv2\ncv2.imread("x")',
|
|
79
|
+
'pil': 'from PIL import Image\nImage.open("x")',
|
|
80
|
+
'camera': 'import cv2\ncv2.VideoCapture(0)',
|
|
81
|
+
'drawing': 'import cv2\ncv2.rectangle(image, box)',
|
|
82
|
+
'detection': 'from torchvision.models.detection import fasterrcnn_resnet50_fpn\nfasterrcnn_resnet50_fpn()',
|
|
83
|
+
'yolo_alone': 'from ultralytics import YOLO\nm=YOLO("x")',
|
|
84
|
+
'yolo_predict': 'from ultralytics import YOLO\nm=YOLO("x")\nm.predict()',
|
|
85
|
+
'yolo_call': 'from ultralytics import YOLO\nm=YOLO("x")\nm()',
|
|
86
|
+
'segmentation': 'import mediapipe as mp\nmp.solutions.selfie_segmentation.SelfieSegmentation()',
|
|
87
|
+
'classification': 'import timm\ntimm.create_model("x")',
|
|
88
|
+
'face': 'import cv2\ncv2.CascadeClassifier("x").detectMultiScale(img)',
|
|
89
|
+
'hand': 'import mediapipe as mp\nmp.solutions.hands.Hands()',
|
|
90
|
+
'pose': 'import mediapipe as mp\nmp.solutions.pose.Pose()',
|
|
91
|
+
'ocr': 'import easyocr\neasyocr.Reader(["en"])',
|
|
92
|
+
'barcode': 'from pyzbar.pyzbar import decode\ndecode(img)',
|
|
93
|
+
'flow': 'import cv2\ncv2.calcOpticalFlowFarneback(a,b)',
|
|
94
|
+
'kalman': 'import cv2\ncv2.KalmanFilter()\nfrom filterpy.kalman import KalmanFilter\nKalmanFilter()',
|
|
95
|
+
'shadow': 'from norfair import Tracker\nclass Tracker: pass\nTracker()',
|
|
96
|
+
'shadow_cv': 'import cv2\ncv2 = custom\ncv2.TrackerCSRT_create()',
|
|
97
|
+
'shadow_yolo': 'from ultralytics import YOLO\ndef YOLO(): pass\nYOLO().track()',
|
|
98
|
+
'shadow_deep': 'from deep_sort import DeepSort\ndef DeepSort(): pass\nDeepSort()',
|
|
99
|
+
'shadow_byte': 'from supervision import ByteTrack\nclass ByteTrack: pass\nByteTrack()',
|
|
100
|
+
'shadow_sort': 'from sort import Sort\nclass Sort: pass\nSort()',
|
|
101
|
+
'unbound': 'whatever.track()',
|
|
102
|
+
'string': 's = "cv2.TrackerCSRT_create() tracking"',
|
|
103
|
+
'subprocess': 'import subprocess\nsubprocess.run(["tracker"])',
|
|
104
|
+
'invalid': 'import cv2\ncv2.TrackerCSRT_create((',
|
|
105
|
+
'other_sort': 'from something import Sort\nSort()',
|
|
106
|
+
'other_provider': 'from something import TrackerCSRT_create, YOLO, correlation_tracker\nTrackerCSRT_create()\nYOLO().track()\ncorrelation_tracker()',
|
|
107
|
+
'rebound_model': 'from ultralytics import YOLO\nm=YOLO()\nm=other\nm.track()',
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def evidence_test(source, expected):
|
|
112
|
+
def test(self):
|
|
113
|
+
self.assertEqual(evidence(source), expected)
|
|
114
|
+
return test
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
for name, source in POSITIVE.items():
|
|
118
|
+
setattr(EvidenceTests, 'test_positive_' + name, evidence_test(source, True))
|
|
119
|
+
for name, source in NEGATIVE.items():
|
|
120
|
+
setattr(EvidenceTests, 'test_negative_' + name, evidence_test(source, False))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class IntegrationTests(unittest.TestCase):
|
|
124
|
+
def run_cli(self, *args):
|
|
125
|
+
return subprocess.run([sys.executable, '-m', 'tracking_claim_audit', *map(str, args)], capture_output=True, text=True)
|
|
126
|
+
|
|
127
|
+
def test_good(self):
|
|
128
|
+
self.assertEqual(audit(FIXTURES / 'good')['findings'], [])
|
|
129
|
+
|
|
130
|
+
def test_bad(self):
|
|
131
|
+
result = self.run_cli(FIXTURES / 'bad', '--json')
|
|
132
|
+
self.assertEqual(result.returncode, 2)
|
|
133
|
+
self.assert_finding(json.loads(result.stdout), 'HIGH', 'documented-tracking-claim-false')
|
|
134
|
+
|
|
135
|
+
def assert_finding(self, result, severity, rule):
|
|
136
|
+
self.assertEqual(len(result['findings']), 1)
|
|
137
|
+
self.assertEqual(result['findings'][0]['severity'], severity)
|
|
138
|
+
self.assertEqual(result['findings'][0]['rule'], rule)
|
|
139
|
+
|
|
140
|
+
def test_testonly(self):
|
|
141
|
+
for extra, code in [([], 0), (['--fail-on', 'MEDIUM'], 2)]:
|
|
142
|
+
result = self.run_cli(FIXTURES / 'testonly', '--json', *extra)
|
|
143
|
+
self.assertEqual(result.returncode, code)
|
|
144
|
+
self.assert_finding(json.loads(result.stdout), 'MEDIUM', 'documented-tracking-claim-false')
|
|
145
|
+
|
|
146
|
+
def test_denial(self):
|
|
147
|
+
result = self.run_cli(FIXTURES / 'no_tracking', '--json')
|
|
148
|
+
self.assertEqual(result.returncode, 2)
|
|
149
|
+
self.assert_finding(json.loads(result.stdout), 'HIGH', 'documented-no-tracking-claim-false')
|
|
150
|
+
|
|
151
|
+
def test_no_claim(self):
|
|
152
|
+
self.assertEqual(audit(FIXTURES / 'no_claim')['verdict'], 'PASS')
|
|
153
|
+
|
|
154
|
+
def test_ignore(self):
|
|
155
|
+
self.assertEqual(audit(FIXTURES / 'bad', ['README.*'])['verdict'], 'PASS')
|
|
156
|
+
|
|
157
|
+
def test_json(self):
|
|
158
|
+
result = json.loads(self.run_cli(FIXTURES / 'good', '--json').stdout)
|
|
159
|
+
self.assertEqual(set(result), {'verdict', 'findings', 'files_scanned'})
|
|
160
|
+
self.assertEqual(result['files_scanned'], 2)
|
|
161
|
+
|
|
162
|
+
def test_verbose(self):
|
|
163
|
+
self.assertIn('Files scanned: 2', self.run_cli(FIXTURES / 'good', '--verbose').stdout)
|
|
164
|
+
|
|
165
|
+
def test_version(self):
|
|
166
|
+
result = self.run_cli('--version')
|
|
167
|
+
self.assertEqual((result.returncode, result.stdout.strip()), (0, '0.1.0'))
|
|
168
|
+
|
|
169
|
+
def test_invalid_root(self):
|
|
170
|
+
self.assertEqual(self.run_cli(FIXTURES / 'absent').returncode, 1)
|
|
171
|
+
|
|
172
|
+
def test_usage(self):
|
|
173
|
+
for args in ([], ['--unknown'], [str(FIXTURES), '--fail-on', 'LOW']):
|
|
174
|
+
self.assertEqual(self.run_cli(*args).returncode, 1)
|
|
175
|
+
|
|
176
|
+
def test_excluded_source(self):
|
|
177
|
+
for relative in ('fixtures/x.py', 'docs/x.py', 'examples/x.py'):
|
|
178
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
179
|
+
root = Path(temp)
|
|
180
|
+
(root / 'README.md').write_text('tracks objects')
|
|
181
|
+
target = root / relative
|
|
182
|
+
target.parent.mkdir()
|
|
183
|
+
target.write_text(POSITIVE['cv_direct'])
|
|
184
|
+
self.assert_finding(audit(root), 'HIGH', 'documented-tracking-claim-false')
|
|
185
|
+
|
|
186
|
+
def test_test_names(self):
|
|
187
|
+
for relative in ('test_x.py', 'x_test.py', 'tests/x.py'):
|
|
188
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
189
|
+
root = Path(temp)
|
|
190
|
+
(root / 'README.md').write_text('tracks objects')
|
|
191
|
+
target = root / relative
|
|
192
|
+
target.parent.mkdir(exist_ok=True)
|
|
193
|
+
target.write_text(POSITIVE['cv_direct'])
|
|
194
|
+
self.assert_finding(audit(root), 'MEDIUM', 'documented-tracking-claim-false')
|
|
195
|
+
|
|
196
|
+
def test_docs_scope_and_symlinks(self):
|
|
197
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
198
|
+
root = Path(temp)
|
|
199
|
+
(root / 'other.md').write_text('tracks objects')
|
|
200
|
+
self.assertEqual(audit(root)['files_scanned'], 0)
|
|
201
|
+
(root / 'nested/docs').mkdir(parents=True)
|
|
202
|
+
(root / 'nested/docs/claim.md').write_text('tracks objects')
|
|
203
|
+
(root / 'source.txt').write_text(POSITIVE['cv_direct'])
|
|
204
|
+
(root / 'linked.py').symlink_to(root / 'source.txt')
|
|
205
|
+
(root / 'loop').symlink_to(root, target_is_directory=True)
|
|
206
|
+
self.assert_finding(audit(root), 'HIGH', 'documented-tracking-claim-false')
|
|
207
|
+
self.assertEqual(audit(root)['files_scanned'], 1)
|
|
208
|
+
|
|
209
|
+
def test_both_families(self):
|
|
210
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
211
|
+
root = Path(temp)
|
|
212
|
+
(root / 'README.md').write_text('tracks objects\n\ndoes not track objects')
|
|
213
|
+
self.assertEqual(len(audit(root)['findings']), 1)
|
|
214
|
+
(root / 'app.py').write_text(POSITIVE['cv_direct'])
|
|
215
|
+
self.assert_finding(audit(root), 'HIGH', 'documented-no-tracking-claim-false')
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
if __name__ == '__main__':
|
|
219
|
+
unittest.main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Command line entry point."""
|
|
2
|
+
import argparse
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
from . import __version__
|
|
6
|
+
from .audit import audit
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Parser(argparse.ArgumentParser):
|
|
10
|
+
def error(self, message):
|
|
11
|
+
self.print_usage(sys.stderr)
|
|
12
|
+
self.exit(1, self.prog + ': error: ' + message + '\n')
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main(argv=None):
|
|
16
|
+
parser = Parser(description='Audit documented cross-frame following capabilities.')
|
|
17
|
+
parser.add_argument('root')
|
|
18
|
+
parser.add_argument('--json', action='store_true')
|
|
19
|
+
parser.add_argument('--verbose', action='store_true')
|
|
20
|
+
parser.add_argument('--ignore', action='append', default=[])
|
|
21
|
+
parser.add_argument('--fail-on', choices=['HIGH', 'MEDIUM'], default='HIGH')
|
|
22
|
+
parser.add_argument('--version', action='version', version=__version__)
|
|
23
|
+
args = parser.parse_args(argv)
|
|
24
|
+
try:
|
|
25
|
+
result = audit(args.root, args.ignore, args.fail_on)
|
|
26
|
+
except (OSError, UnicodeError, ValueError) as error:
|
|
27
|
+
print('error: ' + str(error), file=sys.stderr)
|
|
28
|
+
return 1
|
|
29
|
+
if args.json:
|
|
30
|
+
print(json.dumps(result))
|
|
31
|
+
else:
|
|
32
|
+
print(result['verdict'])
|
|
33
|
+
for finding in result['findings']:
|
|
34
|
+
print('{severity} {rule}: {message}'.format(**finding))
|
|
35
|
+
if args.verbose:
|
|
36
|
+
print('Files scanned: ' + str(result['files_scanned']))
|
|
37
|
+
return 2 if result['verdict'] == 'FAIL' else 0
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
sys.exit(main())
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""Offline documentation and Python AST inspection; source is never executed."""
|
|
2
|
+
import ast
|
|
3
|
+
import fnmatch
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from .phrases import TRACKING, NOTRACKING
|
|
9
|
+
|
|
10
|
+
CV = {
|
|
11
|
+
'TrackerCSRT_create', 'TrackerKCF_create', 'TrackerMOSSE_create',
|
|
12
|
+
'TrackerMIL_create', 'TrackerMedianFlow_create', 'TrackerTLD_create',
|
|
13
|
+
'TrackerGOTURN_create', 'TrackerDaSiamRPN_create', 'TrackerNano_create',
|
|
14
|
+
'TrackerVit_create', 'MultiTracker_create',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def prose(text):
|
|
19
|
+
"""Remove Markdown fenced blocks, preserving paragraph boundaries."""
|
|
20
|
+
lines = []
|
|
21
|
+
fence = None
|
|
22
|
+
for line in text.splitlines():
|
|
23
|
+
if fence:
|
|
24
|
+
if re.match(r'^ {0,3}' + re.escape(fence[0]) + '{' + str(fence[1]) + r',}\s*$', line):
|
|
25
|
+
fence = None
|
|
26
|
+
lines.append('')
|
|
27
|
+
continue
|
|
28
|
+
match = re.match(r'^ {0,3}(`{3,}|~{3,})(.*)$', line)
|
|
29
|
+
if match and not (match[1][0] == '`' and '`' in match[2]):
|
|
30
|
+
fence = (match[1][0], len(match[1]))
|
|
31
|
+
lines.append('')
|
|
32
|
+
else:
|
|
33
|
+
lines.append(line)
|
|
34
|
+
return '\n'.join(lines)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def claims(text):
|
|
38
|
+
positive = negative = False
|
|
39
|
+
for paragraph in re.split(r'\n\s*\n', prose(text)):
|
|
40
|
+
paragraph = paragraph.lower().replace('’', "'").replace("n't", ' not').replace('-', ' ')
|
|
41
|
+
paragraph = re.sub(r'\s+', ' ', paragraph)
|
|
42
|
+
for phrase in sorted(NOTRACKING, key=len, reverse=True):
|
|
43
|
+
pattern = r'\b' + re.escape(phrase) + r'\b'
|
|
44
|
+
if re.search(pattern, paragraph):
|
|
45
|
+
negative = True
|
|
46
|
+
paragraph = re.sub(pattern, ' ', paragraph)
|
|
47
|
+
for phrase in sorted(TRACKING, key=len, reverse=True):
|
|
48
|
+
if re.search(r'\b' + re.escape(phrase) + r'\b', paragraph):
|
|
49
|
+
positive = True
|
|
50
|
+
break
|
|
51
|
+
return positive, negative
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def evidence(source):
|
|
55
|
+
try:
|
|
56
|
+
tree = ast.parse(source)
|
|
57
|
+
except (SyntaxError, ValueError):
|
|
58
|
+
return False
|
|
59
|
+
imports = {}
|
|
60
|
+
shadowed = set()
|
|
61
|
+
assignments = []
|
|
62
|
+
for node in ast.walk(tree):
|
|
63
|
+
if isinstance(node, ast.Import):
|
|
64
|
+
for alias in node.names:
|
|
65
|
+
imports[alias.asname or alias.name.split('.')[0]] = alias.name if alias.asname else alias.name.split('.')[0]
|
|
66
|
+
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
|
|
67
|
+
for alias in node.names:
|
|
68
|
+
imports[alias.asname or alias.name] = node.module + '.' + alias.name
|
|
69
|
+
elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
|
|
70
|
+
shadowed.add(node.name)
|
|
71
|
+
elif isinstance(node, ast.arg):
|
|
72
|
+
shadowed.add(node.arg)
|
|
73
|
+
elif isinstance(node, (ast.Assign, ast.AnnAssign, ast.NamedExpr)):
|
|
74
|
+
assignments.append(node)
|
|
75
|
+
elif isinstance(node, ast.Name) and isinstance(node.ctx, (ast.Store, ast.Del)):
|
|
76
|
+
shadowed.add(node.id)
|
|
77
|
+
# Assignments invalidate imported providers, even if textually later.
|
|
78
|
+
for name in shadowed:
|
|
79
|
+
imports.pop(name, None)
|
|
80
|
+
|
|
81
|
+
def resolve(node):
|
|
82
|
+
if isinstance(node, ast.Name):
|
|
83
|
+
return imports.get(node.id, '')
|
|
84
|
+
if isinstance(node, ast.Attribute):
|
|
85
|
+
parent = resolve(node.value)
|
|
86
|
+
return parent + '.' + node.attr if parent else ''
|
|
87
|
+
return ''
|
|
88
|
+
|
|
89
|
+
def yolo(node):
|
|
90
|
+
if not isinstance(node, ast.Call):
|
|
91
|
+
return False
|
|
92
|
+
path = resolve(node.func).split('.')
|
|
93
|
+
return path[0] == 'ultralytics' and path[-1] == 'YOLO'
|
|
94
|
+
|
|
95
|
+
models = set()
|
|
96
|
+
writes = {}
|
|
97
|
+
for node in ast.walk(tree):
|
|
98
|
+
if isinstance(node, ast.Name) and isinstance(node.ctx, ast.Store):
|
|
99
|
+
writes[node.id] = writes.get(node.id, 0) + 1
|
|
100
|
+
for node in assignments:
|
|
101
|
+
targets = node.targets if isinstance(node, ast.Assign) else [node.target]
|
|
102
|
+
for target in targets:
|
|
103
|
+
if isinstance(target, ast.Name) and yolo(node.value) and writes.get(target.id) == 1:
|
|
104
|
+
models.add(target.id)
|
|
105
|
+
models -= {n.name for n in ast.walk(tree) if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))}
|
|
106
|
+
for node in ast.walk(tree):
|
|
107
|
+
if not isinstance(node, ast.Call):
|
|
108
|
+
continue
|
|
109
|
+
path = resolve(node.func).split('.')
|
|
110
|
+
provider, name = path[0], path[-1]
|
|
111
|
+
if ((provider == 'cv2' and name in CV)
|
|
112
|
+
or (provider == 'norfair' and name == 'Tracker')
|
|
113
|
+
or (provider == 'supervision' and name == 'ByteTrack')
|
|
114
|
+
or (provider in ('deep_sort', 'deep_sort_realtime') and name in ('DeepSort', 'DeepSORT'))
|
|
115
|
+
or (provider == 'sort' and name == 'Sort')
|
|
116
|
+
or (provider == 'dlib' and name == 'correlation_tracker')):
|
|
117
|
+
return True
|
|
118
|
+
if isinstance(node.func, ast.Attribute) and node.func.attr == 'track':
|
|
119
|
+
receiver = node.func.value
|
|
120
|
+
if yolo(receiver) or (isinstance(receiver, ast.Name) and receiver.id in models):
|
|
121
|
+
return True
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def audit(root, ignore=(), fail_on='HIGH'):
|
|
126
|
+
root = Path(root)
|
|
127
|
+
if not root.is_dir() or root.is_symlink():
|
|
128
|
+
raise ValueError('root must be a readable directory')
|
|
129
|
+
positive = negative = production = test = False
|
|
130
|
+
count = 0
|
|
131
|
+
|
|
132
|
+
def walk_error(error):
|
|
133
|
+
raise error
|
|
134
|
+
|
|
135
|
+
for directory, dirs, files in os.walk(str(root), followlinks=False, onerror=walk_error):
|
|
136
|
+
dirs[:] = sorted(d for d in dirs if not (Path(directory) / d).is_symlink())
|
|
137
|
+
for filename in sorted(files):
|
|
138
|
+
file = Path(directory) / filename
|
|
139
|
+
relative = file.relative_to(root)
|
|
140
|
+
path = relative.as_posix()
|
|
141
|
+
if file.is_symlink() or any(fnmatch.fnmatchcase(path, pattern) for pattern in ignore):
|
|
142
|
+
continue
|
|
143
|
+
doc = path == 'README.md' or (file.suffix == '.md' and 'docs' in relative.parts[:-1])
|
|
144
|
+
source = file.suffix == '.py'
|
|
145
|
+
if not (doc or source):
|
|
146
|
+
continue
|
|
147
|
+
text = file.read_text(encoding='utf-8')
|
|
148
|
+
count += 1
|
|
149
|
+
if doc:
|
|
150
|
+
yes, no = claims(text)
|
|
151
|
+
positive |= yes
|
|
152
|
+
negative |= no
|
|
153
|
+
if source and not {'fixtures', 'docs', 'examples'}.intersection(relative.parts[:-1]):
|
|
154
|
+
found = evidence(text)
|
|
155
|
+
is_test = 'tests' in relative.parts[:-1] or filename.startswith('test_') or filename.endswith('_test.py')
|
|
156
|
+
if is_test:
|
|
157
|
+
test |= found
|
|
158
|
+
else:
|
|
159
|
+
production |= found
|
|
160
|
+
findings = []
|
|
161
|
+
if positive and not production:
|
|
162
|
+
findings.append(dict(rule='documented-tracking-claim-false', severity='MEDIUM' if test else 'HIGH', message='Documentation promises cross-frame following without production provider evidence.'))
|
|
163
|
+
if negative and production:
|
|
164
|
+
findings.append(dict(rule='documented-no-tracking-claim-false', severity='HIGH', message='Documentation denies cross-frame following but production provider evidence exists.'))
|
|
165
|
+
failed = any(f['severity'] == 'HIGH' or fail_on == 'MEDIUM' for f in findings)
|
|
166
|
+
return dict(verdict='FAIL' if failed else 'PASS', findings=findings, files_scanned=count)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Exact documentation templates, longest first."""
|
|
2
|
+
|
|
3
|
+
TRACKING = (
|
|
4
|
+
'follows multiple objects across frames',
|
|
5
|
+
'tracks multiple objects across frames',
|
|
6
|
+
'keeps track of objects across frames',
|
|
7
|
+
'tracks moving objects across frames',
|
|
8
|
+
'supports real time object tracking',
|
|
9
|
+
'tracks objects in real time video',
|
|
10
|
+
'multiple object tracking support',
|
|
11
|
+
'follows objects across frames',
|
|
12
|
+
'multi object tracking support',
|
|
13
|
+
'tracks objects across frames',
|
|
14
|
+
'follows objects in real time',
|
|
15
|
+
'tracks objects in real time',
|
|
16
|
+
'follows faces across frames',
|
|
17
|
+
'tracks faces across frames',
|
|
18
|
+
'real time object tracking',
|
|
19
|
+
'automatic object tracking',
|
|
20
|
+
'follows objects in video',
|
|
21
|
+
'performs object tracking',
|
|
22
|
+
'supports object tracking',
|
|
23
|
+
'follows multiple objects',
|
|
24
|
+
'multiple object tracking',
|
|
25
|
+
'keeps track of an object',
|
|
26
|
+
'tracks objects in video',
|
|
27
|
+
'object tracking support',
|
|
28
|
+
'tracks multiple objects',
|
|
29
|
+
'follows moving objects',
|
|
30
|
+
'keeps track of objects',
|
|
31
|
+
'tracks moving objects',
|
|
32
|
+
'multi object tracking',
|
|
33
|
+
'video object tracking',
|
|
34
|
+
'follows across frames',
|
|
35
|
+
'tracks across frames',
|
|
36
|
+
'tracks in real time',
|
|
37
|
+
'tracks pedestrians',
|
|
38
|
+
'track in real time',
|
|
39
|
+
'follows an object',
|
|
40
|
+
'tracks an object',
|
|
41
|
+
'follow an object',
|
|
42
|
+
'tracks a vehicle',
|
|
43
|
+
'object following',
|
|
44
|
+
'follows objects',
|
|
45
|
+
'tracks vehicles',
|
|
46
|
+
'object tracking',
|
|
47
|
+
'object trackers',
|
|
48
|
+
'track an object',
|
|
49
|
+
'tracks a person',
|
|
50
|
+
'tracks movement',
|
|
51
|
+
'tracks a target',
|
|
52
|
+
'tracks objects',
|
|
53
|
+
'follow objects',
|
|
54
|
+
'follows object',
|
|
55
|
+
'tracks targets',
|
|
56
|
+
'object tracker',
|
|
57
|
+
'track a target',
|
|
58
|
+
'track objects',
|
|
59
|
+
'tracks object',
|
|
60
|
+
'follow object',
|
|
61
|
+
'track targets',
|
|
62
|
+
'tracks people',
|
|
63
|
+
'track object',
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
NOTRACKING = (
|
|
67
|
+
'does not support real time object tracking',
|
|
68
|
+
'does not follow objects across frames',
|
|
69
|
+
'does not track objects across frames',
|
|
70
|
+
'does not follow objects in real time',
|
|
71
|
+
'does not track objects in real time',
|
|
72
|
+
'does not perform object tracking',
|
|
73
|
+
'does not support object tracking',
|
|
74
|
+
'does not follow objects in video',
|
|
75
|
+
'does not follow multiple objects',
|
|
76
|
+
'does not track objects in video',
|
|
77
|
+
'does not track multiple objects',
|
|
78
|
+
'does not follow moving objects',
|
|
79
|
+
'does not keep track of objects',
|
|
80
|
+
'object tracking not available',
|
|
81
|
+
'object tracking not supported',
|
|
82
|
+
'does not track moving objects',
|
|
83
|
+
'does not follow across frames',
|
|
84
|
+
'does not track across frames',
|
|
85
|
+
'does not follow objects',
|
|
86
|
+
'without object tracking',
|
|
87
|
+
'does not track vehicles',
|
|
88
|
+
'does not track objects',
|
|
89
|
+
'does not follow object',
|
|
90
|
+
'tracking not supported',
|
|
91
|
+
'does not track targets',
|
|
92
|
+
'does not track object',
|
|
93
|
+
'does not track people',
|
|
94
|
+
'never follows objects',
|
|
95
|
+
'never tracks objects',
|
|
96
|
+
'no object tracking',
|
|
97
|
+
'no object tracker',
|
|
98
|
+
'without tracking',
|
|
99
|
+
'does not follow',
|
|
100
|
+
'does not track',
|
|
101
|
+
'never follows',
|
|
102
|
+
'never tracks',
|
|
103
|
+
'no tracking',
|
|
104
|
+
)
|
|
105
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tracking-claim-audit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Offline audit of documented cross-frame following capabilities
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# Cross-frame following claim audit
|
|
12
|
+
|
|
13
|
+
An offline, dependency-free Python 3.9+ checker comparing documentation promises
|
|
14
|
+
about following objects across video frames with Python provider fingerprints.
|
|
15
|
+
Source files are parsed with AST and never executed.
|
|
16
|
+
|
|
17
|
+
Install and run:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install tracking-claim-audit
|
|
21
|
+
tracking-claim-audit ./project --json
|
|
22
|
+
python3 -m tracking_claim_audit ./project --verbose
|
|
23
|
+
tracking-claim-audit ./project --ignore 'vendor/*' --fail-on MEDIUM
|
|
24
|
+
tracking-claim-audit --version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The root README.md and Markdown files beneath any docs path component supply
|
|
28
|
+
claims. Fenced blocks using backticks or tildes are omitted; inline code counts.
|
|
29
|
+
Blank lines delimit paragraphs; wrapped lines join. Case, contractions, hyphens,
|
|
30
|
+
and whitespace are normalized. Exact word-boundary templates are matched longest
|
|
31
|
+
first, with denial spans removed before positive matching.
|
|
32
|
+
|
|
33
|
+
Python evidence comes from OpenCV constructor calls (including legacy providers),
|
|
34
|
+
ultralytics YOLO instances with a track method call, norfair Tracker, supervision
|
|
35
|
+
ByteTrack, DeepSort/DeepSORT from deep_sort or deep_sort_realtime, Sort from sort,
|
|
36
|
+
and dlib correlation_tracker. Import aliases resolve within a module; local
|
|
37
|
+
bindings shadow imported names. Construction suffices except for YOLO, which
|
|
38
|
+
also needs the method invocation. No vision dependencies are installed.
|
|
39
|
+
|
|
40
|
+
The two rules are:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
documented-tracking-claim-false: HIGH without production evidence; MEDIUM with only test evidence
|
|
44
|
+
documented-no-tracking-claim-false: HIGH when denial conflicts with production evidence
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
At most one finding is emitted per rule. With no claim, the result is PASS.
|
|
48
|
+
Tests are separated from production by a tests component or test_*.py / *_test.py
|
|
49
|
+
filename. Files beneath fixtures, docs, and examples supply no source evidence.
|
|
50
|
+
Symbolic links are excluded. Invalid Python supplies no evidence. Repeatable
|
|
51
|
+
--ignore patterns use fnmatch against relative POSIX file paths.
|
|
52
|
+
|
|
53
|
+
Exit 0 means PASS at the chosen threshold; 2 means FAIL; 1 means invalid input,
|
|
54
|
+
unreadable input, or command usage error. The default threshold is HIGH, so a
|
|
55
|
+
MEDIUM finding still yields PASS unless --fail-on MEDIUM is selected. JSON has
|
|
56
|
+
verdict, findings (rule, severity, message), and files_scanned fields. Human
|
|
57
|
+
output prints the verdict and findings; --verbose adds the scanned file count.
|
|
58
|
+
|
|
59
|
+
This is static evidence, not a runtime correctness guarantee. Imports alone,
|
|
60
|
+
image loading, frame capture, box drawing, per-frame detection, segmentation,
|
|
61
|
+
classification, face/hand/pose detectors, OCR, barcode decoding, flow estimation,
|
|
62
|
+
and standalone Kalman filters do not qualify. Hand-written IoU box association
|
|
63
|
+
has no supported provider fingerprint. Strings, shell commands, subprocesses,
|
|
64
|
+
unbound method calls, and locally defined lookalikes do not qualify. Dynamic
|
|
65
|
+
imports, cross-module model provenance, and arbitrary alias propagation are
|
|
66
|
+
unsupported. Binding analysis is conservative across each module, so rebinding
|
|
67
|
+
a provider or model can suppress evidence even before the rebinding statement.
|
|
68
|
+
|
|
69
|
+
Build and test with python3 -m build and python3 -m unittest discover. The source
|
|
70
|
+
archive includes the unittest suite and its fixtures. This project uses MIT terms.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
tests/__init__.py
|
|
6
|
+
tests/test_audit.py
|
|
7
|
+
tests/fixtures/bad/README.md
|
|
8
|
+
tests/fixtures/bad/app.py
|
|
9
|
+
tests/fixtures/good/README.md
|
|
10
|
+
tests/fixtures/good/app.py
|
|
11
|
+
tests/fixtures/no_claim/README.md
|
|
12
|
+
tests/fixtures/no_claim/app.py
|
|
13
|
+
tests/fixtures/no_tracking/README.md
|
|
14
|
+
tests/fixtures/no_tracking/app.py
|
|
15
|
+
tests/fixtures/testonly/README.md
|
|
16
|
+
tests/fixtures/testonly/app.py
|
|
17
|
+
tests/fixtures/testonly/test_provider.py
|
|
18
|
+
tracking_claim_audit/__init__.py
|
|
19
|
+
tracking_claim_audit/__main__.py
|
|
20
|
+
tracking_claim_audit/audit.py
|
|
21
|
+
tracking_claim_audit/phrases.py
|
|
22
|
+
tracking_claim_audit.egg-info/PKG-INFO
|
|
23
|
+
tracking_claim_audit.egg-info/SOURCES.txt
|
|
24
|
+
tracking_claim_audit.egg-info/dependency_links.txt
|
|
25
|
+
tracking_claim_audit.egg-info/entry_points.txt
|
|
26
|
+
tracking_claim_audit.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tracking_claim_audit
|