MCPcopy
hub / github.com/diffgram/diffgram / save_raw_text_file

Method save_raw_text_file

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

Source from the content-addressed store, hash-verified

1899 new_offset_in_seconds)
1900
1901 def save_raw_text_file(self):
1902 new_offset_in_seconds = settings.SIGNED_URL_CACHE_NEW_OFFSET_SECONDS_VALID
1903 self.new_text_file.url_signed_expiry = int(new_offset_in_seconds)
1904
1905 self.new_text_file.url_signed_blob_path = '{}{}/{}'.format(settings.PROJECT_TEXT_FILES_BASE_DIR,
1906 str(self.project_id),
1907 str(self.new_text_file.id))
1908
1909 # TODO: Please review. On image there's a temp directory for resizing. But I don't feel the need for that here.
1910 logger.debug(f"Uploading text file from {self.input.temp_dir_path_and_filename}")
1911 if self.input.type == 'from_text_data':
1912 data_tools.upload_from_string(
1913 string_data = self.input.text_data,
1914 blob_path = self.new_text_file.url_signed_blob_path,
1915 content_type = "text/plain",
1916 )
1917 else:
1918 data_tools.upload_to_cloud_storage(
1919 temp_local_path = self.input.temp_dir_path_and_filename,
1920 blob_path = self.new_text_file.url_signed_blob_path,
1921 content_type = "text/plain",
1922 )
1923
1924 self.new_text_file.url_signed = data_tools.build_secure_url(self.new_text_file.url_signed_blob_path,
1925 new_offset_in_seconds)
1926
1927 # Now Save Tokens
1928
1929 def save_raw_image_thumb(self):
1930 """

Callers 1

process_one_text_fileMethod · 0.95

Calls 3

upload_from_stringMethod · 0.45
build_secure_urlMethod · 0.45

Tested by

no test coverage detected