refactoring
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
class IOUtils:
|
class IOUtils:
|
||||||
|
|
||||||
@@ -32,6 +33,12 @@ class IOUtils:
|
|||||||
orient = "split",
|
orient = "split",
|
||||||
index = False)
|
index = False)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def saveDictAsJson(dict, file):
|
||||||
|
IOUtils.ensurePath(file)
|
||||||
|
with open(file, 'w') as outfile:
|
||||||
|
json.dump(dict, outfile)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ensurePath(file):
|
def ensurePath(file):
|
||||||
directory = os.path.dirname(file)
|
directory = os.path.dirname(file)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"from ColumnsAdder import ColumnsAdder\n",
|
"from ColumnsAdder import ColumnsAdder\n",
|
||||||
"from KreisOptionsSetter import KreisOptionsSetter\n",
|
"from KreisOptionsSetter import KreisOptionsSetter\n",
|
||||||
"from TestHelper import TestHelper\n",
|
"from TestHelper import TestHelper\n",
|
||||||
|
"from IOUtils import IOUtils\n",
|
||||||
"\n",
|
"\n",
|
||||||
"pd.set_option('display.max_rows', 100)\n",
|
"pd.set_option('display.max_rows', 100)\n",
|
||||||
"pd.set_option('display.max_columns', None)\n",
|
"pd.set_option('display.max_columns', None)\n",
|
||||||
@@ -253,31 +254,6 @@
|
|||||||
"saveKreisOptions(kreisOptions)"
|
"saveKreisOptions(kreisOptions)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "43c2f826",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import os\n",
|
|
||||||
"import json\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"class IOUtils:\n",
|
|
||||||
"\n",
|
|
||||||
" def saveDictAsJson(dict, file):\n",
|
|
||||||
" IOUtils.ensurePath(file)\n",
|
|
||||||
" with open(file, 'w') as outfile:\n",
|
|
||||||
" json.dump(dict, outfile)\n",
|
|
||||||
"\n",
|
|
||||||
" @staticmethod\n",
|
|
||||||
" def ensurePath(file):\n",
|
|
||||||
" directory = os.path.dirname(file)\n",
|
|
||||||
" if not os.path.exists(directory):\n",
|
|
||||||
" os.makedirs(directory)\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
|||||||
Reference in New Issue
Block a user