mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
coverage: keep the body scan linear and build the zero counter with dict.fromkeys (SonarCloud S8786/S7519) (#2713)
- ORF_DECODED's Camedia branch drops the redundant \\S+ before .*; with two anchored greedies the scanner can no longer retry the same substring count-for-count at lower and lower split points (same match set, verified on 14 body strings).
- {c: 0 for c in classes} is now dict.fromkeys(classes, 0), which the rule wants and which stones the per-class counters.
This commit is contained in:
@@ -29,7 +29,7 @@ HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# Olympus ORF bodies that write uncompressed / packed data (crates/raw/src/vendor/orf.rs). Everything else
|
||||
# writes compressed ORF, which is preview-only (the E-M5 II / PEN-F high-res mode alone is decoded).
|
||||
ORF_DECODED = re.compile(r"^(E-1|E-10|E-20|EVOLT E-300|EVOLT E-330|EVOLT E-400|EVOLT E-500|E-300|E-330|E-500|Camedia C-\S+.*|Stylus XZ-2 iHS)$")
|
||||
ORF_DECODED = re.compile(r"^(E-1|E-10|E-20|EVOLT E-300|EVOLT E-330|EVOLT E-400|EVOLT E-500|E-300|E-330|E-500|Camedia C-\S.*|Stylus XZ-2 iHS)$")
|
||||
# Samsung SRW bodies with compressed raw data (crates/raw/src/vendor/srw.rs refuses 32770 / 32772 / 32773).
|
||||
SRW_COMPRESSED = re.compile(r"(^|\W)(NX1|NX30|NX300|NX300M|NX500|NX2000|NX3000|NX3300|NX mini|EK-GN\d+|EK-KN\d+)(\W|$)")
|
||||
# Fujifilm bodies before the X series whose RAF has no raw IFD (crates/raw/src/vendor/raf.rs).
|
||||
@@ -123,7 +123,7 @@ def main():
|
||||
classes = ["verified", "unverified", "preview", "unsupported"]
|
||||
by_maker = {}
|
||||
for r in rows:
|
||||
by_maker.setdefault(r["maker"], {c: 0 for c in classes})[r["class"]] += 1
|
||||
by_maker.setdefault(r["maker"], dict.fromkeys(classes, 0))[r["class"]] += 1
|
||||
print("| Maker | Adobe models | verified | unverified | preview | unsupported |")
|
||||
print("|---|---:|---:|---:|---:|---:|")
|
||||
for m, c in sorted(by_maker.items(), key=lambda kv: -sum(kv[1].values())):
|
||||
|
||||
Reference in New Issue
Block a user