OSDN Git Service

PEP8対応
authorunknown <shupeluter@hotmail.com>
Sat, 9 Jun 2018 23:25:18 +0000 (08:25 +0900)
committerunknown <shupeluter@hotmail.com>
Sat, 9 Jun 2018 23:25:18 +0000 (08:25 +0900)
src/main/Python/DataReader.py

index 6818e6a..3975be8 100644 (file)
@@ -2,15 +2,16 @@ import os
 import Data
 import yaml
 
+
 class DataReader:
-    DATA_SOURCE =""
+    DATA_SOURCE  = ""
 
     def __init__(self):
-        with open('config\\toolconf.yml','r') as config:
+        with open('config\\toolconf.yml', 'r') as config:
             confdata = yaml.load(config)
             self.DATA_SOURCE = confdata['dataPath']
 
-    def createLearningData(self):
+    def parse_data_files(self):
         data = []
 
         for file in self.walkDataDirectory(self.DATA_SOURCE):
@@ -18,14 +19,13 @@ class DataReader:
 
         return data
 
-    #FIXME このメソッド間違えてる
-    def walkDataDirectory(self,directory):
-        for root,dirs,files in os.walk(directory):
+    def walkDataDirectory(self, directory):
+        for root, dirs, files in os.walk(directory):
 
             for file in files:
                 yield os.path.join(root,file)
 
-    def read(self,file):
+    def read(self, file: str):
         result = Data.Data()
         if os.path.isfile(file):
             datafile = open(file)
@@ -39,5 +39,6 @@ class DataReader:
                 line_data = orgdata[i].replace("\n","")
                 data.append(line_data.split(','))
             result.setData(data)
+            result.set_org_data(file)
 
-        return result
\ No newline at end of file
+        return result