sio3pack.django.sinolpack.handler

Module Contents

class sio3pack.django.sinolpack.handler.SinolpackDjangoHandler(package, problem_id)[source]

Bases: sio3pack.django.common.handler.DjangoHandler

Handler for Sinolpack packages in Django. Has additional properties like config, model_solutions, additional_files and attachments.

Parameters:
  • package (Sinolpack) – The Sinolpack package to handle.

  • problem_id (int) – The problem ID.

save_to_db()[source]

Save the package to the database.

property config: dict[str, Any]

Config file of the package.

Return type:

dict[str, Any]

property model_solutions: list[dict[str, Any]]

A list of model solutions, where each element is a dictionary containing a RemoteFile object and the sio3pack.packages.sinolpack.enums.ModelSolutionKind kind.

Return type:

list[dict[str, Any]]

property additional_files: list[sio3pack.files.remote_file.RemoteFile]

A list of additional files (as RemoteFile) for the problem.

Return type:

list[sio3pack.files.remote_file.RemoteFile]

property special_files: dict[str, sio3pack.files.remote_file.RemoteFile]

A dictionary of special files (as RemoteFile) for the problem. The keys are the types of the special files.

Return type:

dict[str, sio3pack.files.remote_file.RemoteFile]

property extra_execution_files: list[sio3pack.files.remote_file.RemoteFile]

A list of extra execution files (as RemoteFile) specified in the config file.

Return type:

list[sio3pack.files.remote_file.RemoteFile]

property extra_compilation_files: list[sio3pack.files.remote_file.RemoteFile]

A list of extra compilation files (as RemoteFile) specified in the config file.

Return type:

list[sio3pack.files.remote_file.RemoteFile]

property attachments: list[sio3pack.files.remote_file.RemoteFile]

A list of attachments (as RemoteFile) related to the problem.

Return type:

list[sio3pack.files.remote_file.RemoteFile]

property extra_files: dict[str, sio3pack.files.remote_file.RemoteFile]

A dictionary of extra files (as RemoteFile) for the problem, as specified in the config file. The keys are the paths of the files in the package.

Return type:

dict[str, sio3pack.files.remote_file.RemoteFile]

get_extra_file(package_path)[source]

Get an extra file (as RemoteFile) for the problem.

Parameters:

package_path (str) – The path of the file in the package.

Returns:

The extra file (as RemoteFile) or None if it does not exist.

Return type:

sio3pack.files.remote_file.RemoteFile | None

package
problem_id
get_executable_path(program)

Get the executable path for the given program.

Parameters:
  • program (django.core.files.File | str) – The program to get the path for.

  • program

Returns:

The executable path or None if not found.

Return type:

str | None

property short_name: str

Short name of the problem.

Return type:

str

property full_name: str

Full name of the problem.

Return type:

str

property lang_titles: dict[str, str]

A dictionary of problem titles, where keys are language codes and values are titles.

Return type:

dict[str, str]

property main_model_solution: sio3pack.files.remote_file.RemoteFile

The main model solution as a RemoteFile.

Return type:

sio3pack.files.remote_file.RemoteFile

property lang_statements: dict[str, sio3pack.files.remote_file.RemoteFile]

A dictionary of problem statements, where keys are language codes and values are files.

Return type:

dict[str, sio3pack.files.remote_file.RemoteFile]

property tests: list[sio3pack.test.Test]

A list of tests, where each element is a dictionary containing

Return type:

list[sio3pack.test.Test]

property workflows: dict[str, sio3pack.workflow.Workflow]

A dictionary of workflows, where keys are workflow names and values are Workflow objects.

Return type:

dict[str, sio3pack.workflow.Workflow]