in remote_settings/client.py [0:0]
def _create_record_info(path, version):
"""Creates a record-info dictionary for a file at the given path.
Args:
path (str): The path to the file
version (str): The version of the record attachment
Returns:
dict: A dictionary containing the record metadata
"""
name = os.path.basename(path)
file_type = RemoteSettingsClient._determine_file_type(name)
from_lang, to_lang = RemoteSettingsClient._determine_language_pair(name)
filter_expression = RemoteSettingsClient._determine_filter_expression(version)
mimetype, _ = mimetypes.guess_type(path)
return {
"id": str(uuid.uuid4()),
"data": {
"name": os.path.basename(path),
"fromLang": from_lang,
"toLang": to_lang,
"version": version,
"fileType": file_type,
"filter_expression": filter_expression,
},
"attachment": {
"path": path,
"mimeType": mimetype,
},
}