oioioi.problems.tests
¶
Submodules¶
Package Contents¶
Classes¶
Contains the contest logic and rules. |
|
A class which manages problem packages. |
|
Defines rules for handling specific problem. |
Functions¶
|
- class oioioi.problems.tests.DummyContestController(contest)[source]¶
Bases:
oioioi.programs.controllers.ProgrammingContestController
Contains the contest logic and rules.
This is the computerized implementation of the contest’s official rules.
- adjust_upload_form(request, existing_problem, form)¶
- fill_upload_environ(request, form, env)¶
- class oioioi.problems.tests.DummyPackageBackend[source]¶
Bases:
oioioi.problems.package.ProblemPackageBackend
A class which manages problem packages.
The main functionality is extracting archives with problem statements, data, model solutions etc. and building
Problem
instances.- description = Dummy Package¶
- identify(path, original_filename=None)¶
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
True
if the backend can handle the specified problem package file.
- get_short_name(path, original_filename=None)¶
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.
- unpack(env)¶
Processes a package, creating a new
Problem
or 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
env
keys: package_id
: an id of theProblemPackage
instance with the package file to unpack.- Produced
env
keys: problem_id
: an id of theProblem
instance representing the created or modified problem.
- Used
- pack(problem)¶
Creates a package from problem, returns a
django.http.HttpResponse
instance.Should raise
NotImplementedError
if creating packages is not supported.
- class oioioi.problems.tests.DummySource[source]¶
Bases:
oioioi.problems.problem_sources.UploadedPackageSource
- create_env(*args, **kwargs)¶
Creates an environment which will be later passed to
unpackmgr_job()
.
- class oioioi.problems.tests.TestProblemController(problem)[source]¶
Bases:
oioioi.problems.controllers.ProblemController
Defines rules for handling specific problem.
Every method should:
be called from contest controller
or be specific for problems that this controller controls
Please note that a global problem instance exists for each problem. That problem instance has no contest (
contest
isNone
), so methods can’t be overridden by a contest controller which means they behave in a default way.- __test__ = False¶
- abstract fill_evaluation_environ(environ, submission, **kwargs)¶
Fills a minimal environment with evaluation receipt and other values required by the evaluation machinery.
Passed
environ
should already contain entries for the actiual data to be judged (for example the source file to evaluate).Details on which keys need to be present should be specified by particular subclasses.
As the result,
environ
will be filled at least with a suitable evaluationrecipe
.