Exemplo n.º 1
0
 def create_data_file(self,
                      data: JsonType,
                      user: User,
                      data_file_source: DataFileSourceBase,
                      label_info=None):
     data_file = django_file_utils.convert_str_to_file(
         JsonUtils.dumps(data), filetype=FileType.JSON)
     # label_info = label_info or build_label_info(data_file_source)
     data_file_object = DataFile.objects.create(
         data_file=data_file,
         user=user,
         label_info=label_info,
         data_provider=data_file_source.data_provider)
     self._update_source_object(data_file_object, data_file_source)
     return data_file_object
Exemplo n.º 2
0
 def build_test_data_file(self):
     data = data_fetch_json_strava_activity()
     data_str = JsonUtils.dumps(data)
     return django_file_utils.convert_str_to_file(
         data_str, filetype=django_file_utils.FileType.JSON)
Exemplo n.º 3
0
 def dummy_json_string(self):
     return JsonUtils.dumps(self.dummy_json_data_structure())
 def write_data_to_json_file(cls, data, filename=data_providers_filename):
     with open(filename, 'w+') as data_providers_file:
         data_providers_file.write(JsonUtils.dumps(data))