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

Function annotation_update_web

shared/annotation.py:2283–2348  ·  view source on GitHub ↗
(
    session,
    project_string_id,
    file_id,
    log = regular_log.default())

Source from the content-addressed store, hash-verified

2281
2282# From STUDIO
2283def annotation_update_web(
2284 session,
2285 project_string_id,
2286 file_id,
2287 log = regular_log.default()):
2288 data = request.get_json(force = True) # Force = true if not set as application/json'
2289
2290 if file_id is None: return "error file_id is None", 400
2291
2292 instance_list_new = data.get('instance_list', None)
2293 and_complete = data.get('and_complete', None)
2294
2295 project = Project.get(session, project_string_id)
2296 user = User.get(session)
2297 try:
2298 file = File.get_by_id_and_project(
2299 session = session,
2300 project_id = project.id,
2301 file_id = file_id)
2302 except Exception as e:
2303 trace = traceback.format_exc()
2304 logger.error(f"File {file_id} is Locked")
2305 logger.error(trace)
2306 log['error']['file_locked'] = 'File is being saved by another process, please try again later.'
2307 return False, None
2308
2309 # If file permission error make sure it's sending image_file
2310 # and not video file.
2311 # We can't use jsonify here yet
2312 if file is None: return "error file_id permission", 400
2313
2314 video_data = data.get('video_data', None)
2315
2316 annotation_update = Annotation_Update(
2317 session = session,
2318 file = file,
2319 project = project,
2320 instance_list_new = instance_list_new,
2321 video_data = video_data
2322 )
2323 """
2324 TODO
2325 Do we want more clarity in terms of how it's
2326 "Converting" the file back into a video?
2327 it's kind of confusing because this could return a video
2328 and flags could convert it back...
2329
2330 """
2331
2332 new_file = annotation_update.main()
2333
2334 if and_complete is True:
2335 new_file = new_file.toggle_flag_shared(session)
2336
2337 member_id = user.member_id if user else None
2338
2339 Event.new(
2340 session = session,

Callers 1

Calls 7

mainMethod · 0.95
Annotation_UpdateClass · 0.85
get_by_id_and_projectMethod · 0.80
toggle_flag_sharedMethod · 0.80
serialize_with_typeMethod · 0.80
getMethod · 0.45
newMethod · 0.45

Tested by

no test coverage detected