MCPcopy Index your code
hub / github.com/diffgram/diffgram / serialize

Method serialize

shared/database/project.py:416–473  ·  view source on GitHub ↗

April 3, 2020 project.serialize() is called in a bunch of places where we don't need session yet so assume None.

(self,
                  session = None)

Source from the content-addressed store, hash-verified

414 self.label_dict['label_file_id_list'] = [file.id for file in file_list]
415
416 def serialize(self,
417 session = None):
418 """
419 April 3, 2020
420 project.serialize() is called in a bunch of places
421 where we don't need session yet so assume None.
422 """
423
424 # self.clear_cache()
425
426 settings = None
427 if self.settings:
428 settings = self.settings.serialize()
429
430 user_primary = None
431 if self.user_primary:
432 user_primary = self.user_primary.serialize_username_only()
433
434 time_created = None
435 if self.time_created:
436 time_created = self.time_created.isoformat()
437
438 self.session = None
439 if session:
440 self.session = session
441
442 project = {
443 'id': self.id,
444 'cache_info': self.cache_dict.get('__info') if self.cache_dict else None,
445 'settings': settings,
446 'star_count': self.star_count,
447 'name': self.name,
448 'credit_balance': self.credit_balance,
449 'highest_ai_version_number': self.highest_ai_version_number,
450 'images_count': True, # TODO Get right stats...
451 'labels_count': True,
452 'project_string_id': self.project_string_id,
453 'readme': self.readme,
454 'user_primary': user_primary,
455 'api_billing_enabled': self.api_billing_enabled,
456 'settings_input_video_fps': self.settings_input_video_fps,
457 'is_public': self.is_public,
458 'directory_list': self.get_with_cache(
459 cache_key = 'directory_list',
460 cache_miss_function = self.regenerate_directory_list_cache,
461 session = session),
462 'member_list': self.get_with_cache(
463 cache_key = 'member_list',
464 cache_miss_function = self.regenerate_member_list_cache,
465 session = session),
466 'preview_file_list': self.get_with_cache(
467 cache_key = 'preview_file_list',
468 cache_miss_function = self.regenerate_preview_file_list,
469 session = session),
470 'time_created': time_created,
471 'default_report_dashboard_id': self.default_report_dashboard_id
472 }
473 return project

Callers 3

serialize_branch_listMethod · 0.45
get_label_listMethod · 0.45
gen_initial_dir_listMethod · 0.45

Calls 3

get_with_cacheMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected