Пример #1
0
class DataCreator():
    def __init__(self):
        self.json_utils = JsonUtils()
        self.file_utils = FileUtils()
        self.data_merger = DataMerger()

    def create(self, param):
        json = self.__build_json(param)
        path = self.__build_path(param)
        self.__save(json, path)

    def __build_json(self, param):
        return self.data_merger.merge(param)

    def __build_path(self, param):
        if 'path' in param:
            return param['path']
        else:
            relative_path = '''{key}.json'''.format(key=param['stock_symbol'])
            return self.file_utils.join_paths(param['base_path'], relative_path)

    def __save(self, json, path):
        self.json_utils.save(json, path)
        
Пример #2
0
class DataCreator():
    def __init__(self):
        self.json_utils = JsonUtils()
        self.file_utils = FileUtils()
        self.data_merger = DataMerger()

    def create(self, param):
        json = self.__build_json(param)
        path = self.__build_path(param)
        self.__save(json, path)

    def __build_json(self, param):
        return self.data_merger.merge(param)

    def __build_path(self, param):
        if 'path' in param:
            return param['path']
        else:
            relative_path = '''{key}.json'''.format(key=param['stock_symbol'])
            return self.file_utils.join_paths(param['base_path'],
                                              relative_path)

    def __save(self, json, path):
        self.json_utils.save(json, path)
Пример #3
0
 def __init__(self):
     self.json_utils = JsonUtils()
     self.file_utils = FileUtils()
     self.data_merger = DataMerger()
Пример #4
0
 def __init__(self):
     self.json_utils = JsonUtils()
     self.file_utils = FileUtils()
     self.data_merger = DataMerger()