def saveas_json(self, save_name):
        """
        Save :attr:`data`, :attr:`param_file`, original :attr:`data_reader`
        and UTC modification time as keys in JSON file. If data is edited then
        it should be saved using this method. Non-JSON data files are also
        saved using this method.

        :param save_name: Name to save JSON file as, ".json" is appended.
        :type save_name: str
        """
        # make pycharm by defining inferred objects
        meta = getattr(self, DataSourceBase._meta_attr)
        param_file = getattr(self, DataSourceBase._param_file)
        # JSONEncoder removes units and converts arrays to lists
        # save last time file was modified
        utc_mod_time = list(time.gmtime(os.path.getmtime(save_name)))
        json_data = {'data': self.data, 'utc_mod_time': utc_mod_time,
                     'param_file': param_file,
                     'data_reader': meta.data_reader.__name__,
                     'data_source': self.__class__.__name__}
        if not save_name.endswith('.json'):
            save_name += '.json'
        with open(save_name, 'w') as fp:
            json.dump(json_data, fp, cls=SimKitJSONEncoder)
        # TODO: test file save successful
        # TODO: need to update model
        self._is_saved = True
def saveas_json ( self , save_name ) : meta = getattr ( self , DataSourceBase . _meta_attr ) param_file = getattr ( self , DataSourceBase . _param_file ) utc_mod_time = list ( time . gmtime ( os . path . getmtime ( save_name ) ) ) json_data = { 'data' : self . data , 'utc_mod_time' : utc_mod_time , 'param_file' : param_file , 'data_reader' : meta . data_reader . __name__ , 'data_source' : self . __class__ . __name__ } if not save_name . endswith ( '.json' ) : save_name += '.json' with open ( save_name , 'w' ) as fp : json . dump ( json_data , fp , cls = SimKitJSONEncoder ) self . _is_saved = True
Save :attr:`data`, :attr:`param_file`, original :attr:`data_reader`
        and UTC modification time as keys in JSON file. If data is edited then
        it should be saved using this method. Non-JSON data files are also
        saved using this method.

        :param save_name: Name to save JSON file as, ".json" is appended.
        :type save_name: str