oioioi.problems.package¶
This module contains a problem package backend interface. You should
create a package.py file in your new app and implement your package
backend (inheriting from
ProblemPackageBackend)
whenever you introduce a new problem package format.
Module Contents¶
Classes¶
A class which manages problem packages. |
Functions¶
|
Finds a backend suitable for unpacking the given package and returns |
Attributes¶
- exception oioioi.problems.package.ProblemPackageError[source]¶
Bases:
ExceptionA generic exception to be used by or subclassed by backends.
- exception oioioi.problems.package.PackageProcessingError(func_name, func_doc)[source]¶
Bases:
ProblemPackageErrorA generic exception to be used by or subclassed by backends.
- class oioioi.problems.package.ProblemPackageBackend[source]¶
Bases:
oioioi.base.utils.RegisteredSubclassesBase,oioioi.base.utils.ObjectWithMixinsA class which manages problem packages.
The main functionality is extracting archives with problem statements, data, model solutions etc. and building
Probleminstances.- abstract identify(path, original_filename=None)[source]¶
Checks if the backend is suitable for processing the specified problem package.
- Parameters
path – a path to the processed problem package
original_filename – the name of the package specified by the
uploading user.
Returns
Trueif the backend can handle the specified problem package file.
- abstract get_short_name(path, original_filename=None)[source]¶
Returns the problem’s short name.
- Parameters
path – a path to the processed problem package
original_filename – the name of the package specified by the
uploading user.
- abstract unpack(env)[source]¶
Processes a package, creating a new
Problemor updating an existing one.This function will be called either from
unpackmgr_job()(Celery task) or fromsimple_unpack()(e.g. when a problem is added from a command line).- Used
envkeys: package_id: an id of theProblemPackageinstance with the package file to unpack.- Produced
envkeys: problem_id: an id of theProbleminstance representing the created or modified problem.
- Used
- exception oioioi.problems.package.NoBackend[source]¶
Bases:
NotImplementedErrorMethod or function hasn’t been implemented yet.
- oioioi.problems.package.backend_for_package(filename, original_filename=None)[source]¶
Finds a backend suitable for unpacking the given package and returns its dotted name.
- Parameters
filename – a path to the processed problem package
original_filename – the name of the package specified by the
uploading user.