mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-18 17:28:12 +00:00
Add more docstrings
This commit is contained in:
@@ -18,6 +18,24 @@ logger = logging.getLogger()
|
||||
|
||||
|
||||
def handle_uploaded_project_files(request, jobs_list, upload_directory):
|
||||
"""
|
||||
Handles the uploaded project files.
|
||||
|
||||
This method takes a request with a file, a list of jobs, and an upload directory. It checks if the file was uploaded
|
||||
directly, if it needs to be downloaded from a URL, or if it's already present on the local file system. It then
|
||||
moves the file to the appropriate directory and returns the local path to the file and its name.
|
||||
|
||||
Args:
|
||||
request (Request): The request object containing the file.
|
||||
jobs_list (list): A list of jobs. The first job in the list is used to get the file's URL and local path.
|
||||
upload_directory (str): The directory where the file should be uploaded.
|
||||
|
||||
Raises:
|
||||
ValueError: If no valid project paths are found.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the local path to the loaded project file and its name.
|
||||
"""
|
||||
# Initialize default values
|
||||
loaded_project_local_path = None
|
||||
|
||||
@@ -95,7 +113,21 @@ def download_project_from_url(project_url):
|
||||
|
||||
|
||||
def process_zipped_project(zip_path):
|
||||
# Given a zip path, extract its content, and return the main project file path
|
||||
"""
|
||||
Processes a zipped project.
|
||||
|
||||
This method takes a path to a zip file, extracts its contents, and returns the path to the extracted project file.
|
||||
If the zip file contains more than one project file or none, an error is raised.
|
||||
|
||||
Args:
|
||||
zip_path (str): The path to the zip file.
|
||||
|
||||
Raises:
|
||||
ValueError: If there's more than 1 project file or none in the zip file.
|
||||
|
||||
Returns:
|
||||
str: The path to the main project file.
|
||||
"""
|
||||
work_path = os.path.dirname(zip_path)
|
||||
|
||||
try:
|
||||
@@ -125,8 +157,21 @@ def process_zipped_project(zip_path):
|
||||
|
||||
|
||||
def create_render_jobs(jobs_list, loaded_project_local_path, job_dir):
|
||||
results = []
|
||||
"""
|
||||
Creates render jobs.
|
||||
|
||||
This method takes a list of job data, a local path to a loaded project, and a job directory. It creates a render
|
||||
job for each job data in the list and appends the result to a list. The list of results is then returned.
|
||||
|
||||
Args:
|
||||
jobs_list (list): A list of job data.
|
||||
loaded_project_local_path (str): The local path to the loaded project.
|
||||
job_dir (str): The job directory.
|
||||
|
||||
Returns:
|
||||
list: A list of results from creating the render jobs.
|
||||
"""
|
||||
results = []
|
||||
for job_data in jobs_list:
|
||||
try:
|
||||
# get new output path in output_dir
|
||||
|
||||
Reference in New Issue
Block a user