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

Function build_image_packet

shared/export/export_generation.py:480–515  ·  view source on GitHub ↗

Generic method to generate a dict of information given a file

(
    file,
    session = None)

Source from the content-addressed store, hash-verified

478
479
480def build_image_packet(
481 file,
482 session = None):
483 """
484 Generic method to generate a dict of information given a file
485 """
486
487 file.image.serialize_for_source_control(session = session)
488
489 image_dict = {'width': file.image.width,
490 'height': file.image.height,
491 'rotation_degrees': file.image.rotation_degrees,
492 'image_signed_expiry': file.image.url_signed_expiry,
493 'image_signed_url': file.image.url_signed,
494 'original_filename': file.image.original_filename}
495
496 instance_dict_list = []
497
498
499 instance_list = Instance.list(
500 session = session,
501 file_id = file.id)
502 for instance in instance_list:
503 instance_dict_list.append(build_instance(instance, file))
504
505
506 return {'file': {
507 'id': file.id,
508 'original_filename': file.original_filename,
509 'blob_url': file.image.url_signed,
510 'created_time': str(file.created_time),
511 'ann_is_complete': file.ann_is_complete,
512 'type': file.type
513 },
514 'image': image_dict,
515 'instance_list': instance_dict_list}
516
517
518def build_text_packet(

Callers 1

build_packetFunction · 0.85

Calls 3

build_instanceFunction · 0.85
listMethod · 0.45

Tested by

no test coverage detected