Dropped csv field prefixes in scripts
The original idea was to allow merging a whole bunch of different csv results into a single lfs.csv file, but this never really happened. It's much easier to operate on smaller context-specific csv files, where the field prefix: - Doesn't really add much information - Requires more typing - Is confusing in how it doesn't match the table field names. We can always use summary.py -fcode_size=size to add prefixes when necessary anyways.
This commit is contained in:
+7
-7
@@ -536,8 +536,8 @@ def main(obj_paths, *,
|
||||
results.append(DataResult(
|
||||
**{k: r[k] for k in DataResult._by
|
||||
if k in r and r[k].strip()},
|
||||
**{k: r['data_'+k] for k in DataResult._fields
|
||||
if 'data_'+k in r and r['data_'+k].strip()}))
|
||||
**{k: r[k] for k in DataResult._fields
|
||||
if k in r and r[k].strip()}))
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
@@ -559,14 +559,14 @@ def main(obj_paths, *,
|
||||
with openio(args['output'], 'w') as f:
|
||||
writer = csv.DictWriter(f,
|
||||
(by if by is not None else DataResult._by)
|
||||
+ ['data_'+k for k in (
|
||||
+ [k for k in (
|
||||
fields if fields is not None else DataResult._fields)])
|
||||
writer.writeheader()
|
||||
for r in results:
|
||||
writer.writerow(
|
||||
{k: getattr(r, k) for k in (
|
||||
by if by is not None else DataResult._by)}
|
||||
| {'data_'+k: getattr(r, k) for k in (
|
||||
| {k: getattr(r, k) for k in (
|
||||
fields if fields is not None else DataResult._fields)})
|
||||
|
||||
# find previous results?
|
||||
@@ -580,15 +580,15 @@ def main(obj_paths, *,
|
||||
if not all(k in r and r[k] in vs for k, vs in defines):
|
||||
continue
|
||||
|
||||
if not any('data_'+k in r and r['data_'+k].strip()
|
||||
if not any(k in r and r[k].strip()
|
||||
for k in DataResult._fields):
|
||||
continue
|
||||
try:
|
||||
diff_results.append(DataResult(
|
||||
**{k: r[k] for k in DataResult._by
|
||||
if k in r and r[k].strip()},
|
||||
**{k: r['data_'+k] for k in DataResult._fields
|
||||
if 'data_'+k in r and r['data_'+k].strip()}))
|
||||
**{k: r[k] for k in DataResult._fields
|
||||
if k in r and r[k].strip()}))
|
||||
except TypeError:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
|
||||
Reference in New Issue
Block a user