Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions libosd/osdDbConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
import json
from xml.etree.ElementInclude import include
import jsbeautifier
import dateutil.parser
import sklearn.model_selection

Expand Down Expand Up @@ -115,7 +114,7 @@ def saveEventsToFile(self, eventIdLst, fname, pretty=False, useCacheDir = False)
fname : String
Filename of file to be written
pretty: Boolean
If true, use jsbeautifier to prettify output.
If true, prettify json output.
useCacheDir: Boolean
If true, save data to cache directory, other wise save to current working directory.

Expand All @@ -139,15 +138,12 @@ def saveEventsToFile(self, eventIdLst, fname, pretty=False, useCacheDir = False)
fp = open(fpath, "w")
if (pretty):
if (self.debug): print("OsdDbConnection.saveDbFile() - pretty output selected - saving prettified file")
jsonStr = json.dumps(eventsLst)
jsonStr = json.dumps(eventsLst, sort_keys=True, indent=2)
if (self.debug): print("OsdDbConnection.saveDbFile() - created JSON string")
options = jsbeautifier.default_options()
options.indent_size = 2
fp.write(jsbeautifier.beautify(jsonStr, options))
fp.write(jsonStr)
else:
if (self.debug): print("OsdDbConnection.saveDbFile() - saving unformatted file")
json.dump(eventsLst,fp)
fp.close()
if (self.debug):
print("OsdDbConnection.saveEventsToFile - fpath=%s closed." % fpath)
return True
Expand All @@ -169,7 +165,7 @@ def saveDbFile(self, fname, pretty=False, useCacheDir=False):
fname : String
Filename of file to be written
pretty: Boolean
If true, use jsbeautifier to prettify output.
If true, prettify json output.
useCacheDir: Boolean
If true, data is written to the cache directory, otherwise it is written to the current working directory.

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
imblearn
jsbeautifier
jinja2
matplotlib
numpy
Expand Down
9 changes: 2 additions & 7 deletions user_tools/dataSummariser/summariseData.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
import json
import sys
import os
import importlib
import dateutil.parser
import datetime
import numpy as np
import jinja2
import distutils.dir_util

import jsbeautifier

sys.path.append(os.path.join(os.path.dirname(__file__), '..','..'))
import libosd.osdDbConnection
import libosd.webApiConnection
Expand Down Expand Up @@ -167,10 +164,8 @@ def makeOutDir(eventObj, outDirParent="output"):
#print("makeEventSummary - outDir=%s" % outDir)

outFile = open(os.path.join(outDir,"rawData.json"),"w")
options = jsbeautifier.default_options()
options.indent_size = 2
jsonStr = json.dumps(eventObj,sort_keys=True)
outFile.write(jsbeautifier.beautify(jsonStr, options))
jsonStr = json.dumps(eventObj,sort_keys=True, indent=2)
outFile.write(jsonStr)

outFile.close()
return outDir
Expand Down