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

Method new

shared/database/source_control/file.py:911–1003  ·  view source on GitHub ↗

"file_added" case Given a new image create a new file to track this image This assumes a new image is completely new We are always creating a new file at init so there will be A file, question is if there is a previous file too It was confusing it

(session,
            working_dir_id = None,
            project_id = None,
            file_type = None,
            image_id = None,
            point_cloud_id = None,
            text_file_id = None,
            audio_file_id = None,
            video_id = None,
            connection_id = None,
            bucket_name = None,
            frame_number = None,
            label_id = None,
            colour = None,
            original_filename = None,
            video_parent_file = None,
            text_tokenizer = None,
            input_id = None,
            parent_id = None,
            task = None,
            file_metadata = None,
            ordinal: int = None
            )

Source from the content-addressed store, hash-verified

909
910 @staticmethod
911 def new(session,
912 working_dir_id = None,
913 project_id = None,
914 file_type = None,
915 image_id = None,
916 point_cloud_id = None,
917 text_file_id = None,
918 audio_file_id = None,
919 video_id = None,
920 connection_id = None,
921 bucket_name = None,
922 frame_number = None,
923 label_id = None,
924 colour = None,
925 original_filename = None,
926 video_parent_file = None,
927 text_tokenizer = None,
928 input_id = None,
929 parent_id = None,
930 task = None,
931 file_metadata = None,
932 ordinal: int = None
933 ):
934 """
935 "file_added" case
936
937 Given a new image create a new file to track this image
938 This assumes a new image is completely new
939
940 We are always creating a new file at init so there will be A
941 file, question is if there is a previous file too
942
943 It was confusing it to have two different ways to assign project here
944 so remove in favour of just having one.
945
946 Careful with object.id, since if the object can be None it
947 won't work as expected then...
948
949
950 video_parent_file_id issue
951 video_parent_file (not id ) FAILs because it
952 does NOT exist, we have it as a function
953 due to a work around issue with sql alchemy
954 so MUST store the actual id
955
956 """
957 from shared.database.source_control.working_dir import WorkingDirFileLink
958
959 video_parent_file_id = None
960 if video_parent_file:
961 video_parent_file_id = video_parent_file.id
962
963 file = File(
964 original_filename = original_filename,
965 image_id = image_id,
966 point_cloud_id = point_cloud_id,
967 state = "added",
968 type = file_type,

Callers 1

new_label_fileMethod · 0.45

Calls 4

hash_updateMethod · 0.95
FileClass · 0.85
new_file_new_frameMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected