sio3pack.packages.package¶
Package Contents¶
- class sio3pack.packages.package.CompilerConfig(name, full_name, path, flags)[source]¶
Configuration class for a compiler. It holds the name, full name, path, and flags of the compiler.
- Parameters:
- class sio3pack.packages.package.SIO3PackConfig(django_settings=None, compilers_config=None, extensions_config=None, allow_unrecognized_files=False)[source]¶
Configuration class for SIO3Pack. It holds the configuration for compilers and file extensions. It can be initialized with Django settings or detected automatically.
- Parameters:
django_settings – Django settings object.
compilers_config (dict[str, CompilerConfig]) – Dictionary of compiler configurations. The keys are the compiler names, and the values are CompilerConfig objects.
extensions_config (dict[str, str]) – Dictionary of language configurations. The keys are the file extensions, and the values are the corresponding languages.
allow_unrecognized_files (bool)
- class sio3pack.packages.package.Package[source]¶
Bases:
sio3pack.utils.classinit.RegisteredSubclassesBase
Base class for all packages.
- Parameters:
short_name (str) – Short name of the problem.
full_name (str) – Full name of the problem.
is_from_db (bool) – If True, the package is created from the database.
lang_titles (dict[str, str]) – A dictionary of problem titles, where keys are language codes and values are titles.
lang_statements (dict[str, File]) – A dictionary of problem statements, where keys are language codes and values are files.
model_solutions (list[tuple[ModelSolutionKind, File]]) – A list of model solutions, where each element is a tuple containing a model solution kind and a file.
additional_files (list[File]) – A list of additional files for the problem.
attachments (list[File]) – A list of attachments related to the problem.
workflow_manager (WorkflowManager) – A workflow manager for the problem.
- classmethod identify(file)[source]¶
- Abstractmethod:
- Parameters:
file (sio3pack.files.LocalFile)
Identify if the package is of this type.
- classmethod from_file(file, configuration=None)[source]¶
Create a package from a file.
- Parameters:
file (sio3pack.files.LocalFile)
- classmethod identify_db(problem_id)[source]¶
- Abstractmethod:
- Parameters:
problem_id (int)
Identify if the package is of this type. Should check if there is a package of this type in the database with the given problem_id.
- classmethod from_db(problem_id, configuration=None)[source]¶
Create a package from the database. If sio3pack isn’t installed with Django support, it should raise an ImproperlyConfigured exception. If there is no package with the given problem_id, it should raise an UnknownPackageType exception.
- Parameters:
problem_id (int)
configuration (sio3pack.packages.package.configuration.SIO3PackConfig)
- abstractmethod get_statement(lang=None)[source]¶
- Parameters:
lang (str | None)
- Return type:
sio3pack.files.File | None
- get_run_operation(program, tests=None, return_func=None)[source]¶
Get the run graph for the package. If the package doesn’t have a run graph, it should return None.
- Parameters:
program (sio3pack.files.File)
tests (list[sio3pack.test.Test] | None)
return_func (callable)
- Return type:
- get_user_out_operation(program, test, return_func=None)[source]¶
Get the workflow for getting the user’s output for a given test.
- Parameters:
program (sio3pack.files.File)
test (sio3pack.test.Test)
return_func (callable)
- Return type:
- get_test_run_operation(program, test, return_func=None)[source]¶
Get the workflow for running a test run. This means that the user can provide a test and the program, and the workflow will run the program with the test.
- Parameters:
program (sio3pack.files.File)
test (sio3pack.files.File)
return_func (callable)
- Return type:
- get_executable_path(program)[source]¶
Get the executable path for a given program.
- Parameters:
program (sio3pack.files.File | str)
- Return type:
str | None
- get_file_language(file)[source]¶
Returns the language of the given file.
- Parameters:
file (sio3pack.files.File | str)
- Return type:
- save_to_db(problem_id)[source]¶
Save the package to the database. If sio3pack isn’t installed with Django support, it should raise an ImproperlyConfigured exception.
- Parameters:
problem_id (int)
- abstractmethod get_time_limit_for_test(test)[source]¶
Get the time limit for a given test.
- Parameters:
test (sio3pack.test.Test)
- Return type:
- abstractmethod get_memory_limit_for_test(test)[source]¶
Get the memory limit for a given test.
- Parameters:
test (sio3pack.test.Test)
- Return type: