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

Function build_instance

shared/export/export_generation.py:632–710  ·  view source on GitHub ↗
(instance, file, include_label = False)

Source from the content-addressed store, hash-verified

630
631
632def build_instance(instance, file, include_label = False):
633
634 out = base_instance_packet(instance)
635
636 if file.type == 'video':
637 out['frame_number'] = instance.frame_number
638 out['global_frame_number'] = instance.global_frame_number
639 out['local_sequence_number'] = instance.number
640 out['number'] = instance.number # legacy
641 out['interpolated'] = instance.interpolated
642
643 if instance.radius:
644 out['radius'] = instance.radius
645
646 if instance.bounds:
647 out['bounds'] = instance.bounds
648
649 if instance.angle:
650 out['angle'] = instance.angle
651
652 if instance.x_min or instance.y_min or instance.x_max or instance.y_max:
653 out['x_min'] = instance.x_min
654 out['y_min'] = instance.y_min
655 out['x_max'] = instance.x_max
656 out['y_max'] = instance.y_max
657
658 if instance.type == 'curve':
659 out['p1'] = instance.p1
660 out['p2'] = instance.p2
661 out['cp'] = instance.cp
662
663 if instance.type in ['geo_point', 'geo_circle', 'geo_polyline', 'geo_polygon', 'geo_box']:
664 out['lonlat'] = instance.lonlat
665 out['coords'] = instance.coords
666 out['bounds_lonlat'] = instance.bounds_lonlat
667
668 if instance.type == 'cuboid':
669 out['front_face'] = instance.front_face
670 out['rear_face'] = instance.rear_face
671
672 if instance.type == 'ellipse':
673 out['center_x'] = instance.center_x
674 out['center_y'] = instance.center_y
675 out['width'] = instance.width
676 out['height'] = instance.height
677
678 if instance.type == 'text_token':
679 out['start_char'] = instance.start_char
680 out['end_char'] = instance.end_char
681 out['start_token'] = instance.start_token
682 out['end_token'] = instance.end_token
683 out['start_sentence'] = instance.start_sentence
684 out['end_sentence'] = instance.end_sentence
685 out['sentence'] = instance.sentence
686
687 if instance.type == 'keypoints':
688 out['nodes'] = instance.nodes
689 out['edges'] = instance.edges

Callers 6

build_geopacketFunction · 0.85
build_video_packetFunction · 0.85
build_image_packetFunction · 0.85
build_text_packetFunction · 0.85

Calls 2

base_instance_packetFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected