mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 09:13:04 +01:00
Quote all non-numeric CSV output
This commit is contained in:
committed by
=Michael Hohn
parent
03a9ef0477
commit
235acf6b93
@@ -6,6 +6,7 @@ from sarif_cli import signature, signature_multi
|
||||
from sarif_cli import typegraph
|
||||
from sarif_cli import snowflake_id
|
||||
import argparse
|
||||
import csv
|
||||
import dataclasses as dc
|
||||
import json
|
||||
import pandas as pd
|
||||
@@ -148,7 +149,7 @@ p = pathlib.Path(args.outdir)
|
||||
p.mkdir(exist_ok=True)
|
||||
def write(path, frame):
|
||||
with p.joinpath(path + ".csv").open(mode='wb') as fh:
|
||||
frame.to_csv(fh, index=False)
|
||||
frame.to_csv(fh, index=False, quoting=csv.QUOTE_NONNUMERIC)
|
||||
for field in dc.fields(bt):
|
||||
table = getattr(bt, field.name)
|
||||
write(field.name, table)
|
||||
|
||||
@@ -6,6 +6,7 @@ from sarif_cli import signature, signature_single
|
||||
from sarif_cli import typegraph
|
||||
from sarif_cli import snowflake_id
|
||||
import argparse
|
||||
import csv
|
||||
import dataclasses as dc
|
||||
import json
|
||||
import logging
|
||||
@@ -208,7 +209,7 @@ p.mkdir(exist_ok=True)
|
||||
|
||||
def write(path, frame):
|
||||
with p.joinpath(path + ".csv").open(mode='wb') as fh:
|
||||
frame.to_csv(fh, index=False)
|
||||
frame.to_csv(fh, index=False, quoting=csv.QUOTE_NONNUMERIC)
|
||||
|
||||
def _write_dataframes_of(tables_dataclass):
|
||||
for field in dc.fields(tables_dataclass):
|
||||
|
||||
@@ -18,6 +18,7 @@ from sarif_cli import signature, signature_single
|
||||
from sarif_cli import typegraph
|
||||
from sarif_cli import snowflake_id
|
||||
import argparse
|
||||
import csv
|
||||
import dataclasses as dc
|
||||
import json
|
||||
import pandas as pd
|
||||
@@ -136,7 +137,7 @@ p = pathlib.Path(args.outdir)
|
||||
p.mkdir(exist_ok=True)
|
||||
def write(path, frame):
|
||||
with p.joinpath(path + ".csv").open(mode='wb') as fh:
|
||||
frame.to_csv(fh, index=False)
|
||||
frame.to_csv(fh, index=False, quoting=csv.QUOTE_NONNUMERIC)
|
||||
for field in dc.fields(bt):
|
||||
table = getattr(bt, field.name)
|
||||
write(field.name, table)
|
||||
|
||||
Reference in New Issue
Block a user