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

Method __copy_file

walrus/methods/input/process_media.py:556–605  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

554 return new_file
555
556 def __copy_file(self):
557 logger.debug(f"Copying file type: {self.input.media_type} {self.input.file_id}")
558 self.input.newly_copied_file = File.copy_file_from_existing(
559 session = self.session,
560 working_dir = None,
561 working_dir_id = self.input.directory_id,
562 existing_file = self.input.file,
563 copy_instance_list = self.input.copy_instance_list,
564 add_link = self.input.add_link,
565 remove_link = self.input.remove_link,
566 sequence_map = None,
567 previous_video_parent_id = None,
568 flush_session = True,
569 )
570 if self.input.file.type == 'compound':
571 child_files = self.input.file.get_child_files(session = self.session)
572 for child in child_files:
573 File.copy_file_from_existing(
574 session = self.session,
575 working_dir = None,
576 working_dir_id = self.input.directory_id,
577 existing_file = child,
578 copy_instance_list = self.input.copy_instance_list,
579 add_link = self.input.add_link,
580 remove_link = self.input.remove_link,
581 sequence_map = None,
582 previous_video_parent_id = None,
583 flush_session = True,
584 new_parent_id = self.input.newly_copied_file.id
585 )
586
587 self.declare_success(self.input)
588
589 # Perform sync operations
590 source_dir = WorkingDir.get_by_id(self.session, self.input.source_directory_id)
591 dest_dir = WorkingDir.get_by_id(self.session, self.input.directory_id)
592 perform_sync_events_after_file_transfer(
593 session = self.session,
594 source_directory = None, # We just provide destination directory to attach incoming dir to task.
595 destination_directory = dest_dir,
596 log = self.log,
597 log_sync_events = True,
598 transfer_action = 'copy',
599 file = self.input.file,
600 member = self.member,
601 new_file = self.input.newly_copied_file,
602 defer_sync = False,
603 sync_event_manager = None,
604 )
605 return self.input.newly_copied_file
606
607 def __start_copy_file(self):
608 # Prep work

Callers 1

__start_copy_fileMethod · 0.95

Calls 5

declare_successMethod · 0.95
get_child_filesMethod · 0.80
get_by_idMethod · 0.45

Tested by

no test coverage detected