- class oioioi.base.utils.ObjectWithMixins(*args, **kwargs)¶
Base class for objects which support mixins.
Mixins are nice tools in Python. But they have one drawback – you have to specify new class’ mixins at the point where you declare it. This class solves this problem. Mixins can be now be added on the fly by
mix_in()method. This allows for a more flexible modular design.
# base.py class UserController(ObjectWithMixins): def render_user_info(self, user): return "Login: " + user.username # some_external_module.py class UserControllerBeautifier(object): def render_user_info(self, user): super_info = super(UserControllerBeautifier, self) .render_user_info(user) return '<font color="red">' + super_info + '</font>' UserController.mix_in(UserControllerBeautifier)
Mixins can also be specified by providing a
mixinsclass attribute or by passing an additional keyword argument
mixinsto the constructor.
A class with a mixin behave as if it was replaced with a subclass which bases are the mixin and the original class.
The actual class with the mixins is created when the constructor is called or a subclass defined. Mixing in a new mixin to a class which have instances has an undefined effect on them.
- mixins = ¶
A list of mixins to be automatically mixed in to all instances of the particular class and its subclasses.
- allow_too_late_mixins = False¶
Setting this to
Trueallows adding mixins to the class after it has been instantiated. Existing instances will not have new mixins added.
- classmethod mix_in(mixin)¶
Appends the given mixin to the list of class mixins.
Baseclasses that allow for adding mixins¶
Admin panel mixins¶
- class oioioi.complaints.admin.ComplaintsAdminMixin(*args, **kwargs)¶
ComplaintConfigto an admin panel.
- class oioioi.balloons.admin.BalloonsDeliveryAccessDataAdminMixin(*args, **kwargs)¶
BalloonsDeliveryAccessDatafields to an admin panel.
- class oioioi.contestexcl.admin.ContestAdminWithExclusivenessInlineMixin(*args, **kwargs)¶
ExclusivenessConfigto an admin panel.
- class oioioi.contestlogo.admin.ContestLogoAdminMixin(*args, **kwargs)¶
ContestLogoto an admin panel.
- class oioioi.contestlogo.admin.ContestIconAdminMixin(*args, **kwargs)¶
ContestIconto an admin panel.
- class oioioi.mailsubmit.admin.MailSubmissionConfigAdminMixin(*args, **kwargs)¶
MailSubmissionConfigto an admin panel.
- class oioioi.oisubmit.admin.OISubmitSubmissionAdminMixin(*args, **kwargs)¶
Adds oisubmit specific information (e.g. suspected submissions) to an admin panel.
- class oioioi.pa.admin.PAProblemInstanceAdminMixin(*args, **kwargs)¶
PAProblemInstanceDatato an admin panel.
- class oioioi.participants.admin.OnsiteSubmissionAdminMixin(*args, **kwargs)¶
RegionListFilterfilter to an admin panel.
- class oioioi.participants.admin.UserWithParticipantsAdminMixin(*args, **kwargs)¶
Participantto an admin panel.
- class oioioi.participants.admin.ParticipantsRoundTimeExtensionMixin¶
Adds contest participants to an admin panel.
- class oioioi.problems.admin.StatementConfigAdminMixin(*args, **kwargs)¶
ProblemStatementConfigto an admin panel.
- class oioioi.programs.admin.LibraryProblemDataAdminMixin(*args, **kwargs)¶
LibraryProblemDatato an admin panel.
- class oioioi.programs.admin.ProgrammingProblemAdminMixin(*args, **kwargs)¶
- class oioioi.programs.admin.ProgrammingProblemInstanceAdminMixin(*args, **kwargs)¶
Testto an admin panel.
- class oioioi.programs.admin.ProgrammingMainProblemInstanceAdminMixin(*args, **kwargs)¶
Testto an admin panel.
- class oioioi.programs.admin.ProblemPackageAdminMixin¶
Adds model solutions action to an admin panel.
- class oioioi.programs.admin.ModelSubmissionAdminMixin¶
Adds model submission to an admin panel.
- class oioioi.programs.admin.ProgramSubmissionAdminMixin(*args, **kwargs)¶
Adds submission diff action, language display and language filter to an admin panel.
- class oioioi.questions.admin.MessageNotifierContestAdminMixin(*args, **kwargs)¶
MessageNotifierConfigto an admin panel.
- class oioioi.scoresreveal.admin.ScoresRevealSubmissionAdminMixin(*args, **kwargs)¶
Adds reveal info and filter to an admin panel.
- class oioioi.sinolpack.admin.SinolpackProblemAdminMixin(*args, **kwargs)¶
- class oioioi.statistics.admin.StatisticsAdminMixin(*args, **kwargs)¶
StatisticsConfigto an admin panel.
- class oioioi.suspendjudge.admin.SuspendJudgeProblemInstanceAdminMixin(*args, **kwargs)¶
Sets up admin panel for suspendjudge app.
- class oioioi.teachers.admin.ContestAdminMixin(*args, **kwargs)¶
Adjusts contest admin panel for teachers app usage. Superusers continue to work as usual but teachers have special options.
- class oioioi.testspackages.admin.TestsPackageAdminMixin(*args, **kwargs)¶
TestsPackageto an admin panel.
- class oioioi.acm.controllers.NotificationsMixinForACMContestController¶
Modifies default contest notification settings from
NotificationsMixinForContestController. It enables sending notifications about new public messages to all participants and modifies submission notification messages so that
- class oioioi.balloons.controllers.BalloonsDeliveryACMControllerMixin¶
BalloonDeliveryobject for every submission that has been successfully judged, but only if it’s the first judged submission for that problem instance or a BalloonDelivery object was already created for that problem instance.
- class oioioi.confirmations.controllers.ConfirmationContestControllerMixin¶
Adds an option to contest controllers to send participants a proof of receiving their submissions.
- class oioioi.contestlogo.controllers.LogoContestControllerMixin¶
Sets default empty contest logo and icons settings.
- class oioioi.contests.controllers.NotificationsMixinForContestController¶
Sets default contest notification settings.
- class oioioi.contests.controllers.PastRoundsHiddenContestControllerMixin¶
ContestController mixin that hides past rounds if another round is starting soon.
The period when the past rounds are hidden is called round’s preparation time.
Do not use it with overlapping rounds.
- class oioioi.contests.controllers.ProblemUploadingContestControllerMixin¶
ContestController mixin that declares empty methods for extending problem uploading process.
- class oioioi.dashboard.controllers.DashboardDefaultViewMixin¶
ContestController mixin that sets contest dashboard as a default contest view.
- class oioioi.disqualification.controllers.DisqualificationContestControllerMixin¶
ContestController mixin that adds a disqualification functionality to the contest.
- class oioioi.disqualification.controllers.DisqualificationProgrammingContestControllerMixin¶
ContestController mixin that renders submission disqualification info.
- class oioioi.disqualification.controllers.WithDisqualificationRankingControllerMixin¶
RankingController mixin that manages disqualification module influence on rankings.
- class oioioi.ipauthsync.controllers.IpAuthSyncControllerMixin¶
ContestController mixin that sets up the ipauthsync app.
- class oioioi.ipauthsync.controllers.IpAuthSyncRegistrationControllerMixin¶
RegistrationController mixin that adds a functionality to validate IP address.
- class oioioi.livedata.controllers.LivedataContestControllerMixin¶
ContestController mixin that sets a default setting for livedata visibility.
- class oioioi.oisubmit.controllers.OiSubmitContestControllerMixin¶
ContestController mixin that adds extra information about submission from the oisubmit app to the submission footer.
- class oioioi.participants.controllers.EmailShowContestControllerMixin¶
Contest controller defines whether in participants’ data view email should be shown. That is a case in OI-type contest.
- class oioioi.participants.controllers.AnonymousContestControllerMixin¶
ContestController mixin that adds participants info for anonymous contests.
- class oioioi.participants.controllers.OnsiteContestControllerMixin¶
ContestController mixin that sets up an onsite contest.
- class oioioi.participants.middleware.ExclusiveContestsWithParticipantsMiddlewareMixin¶
Now, a contest with
ExclusivenessConfigwhich has participants is exclusive only for its participants.
Note that this feature makes greater sense when combined with automatic login, see
- class oioioi.printing.controllers.PrintingContestControllerMixin¶
Disallow printing by default.
- class oioioi.publicsolutions.controllers.PublicSolutionsContestControllerMixin¶
ContestController mixin that sets up publicsolutions app.
- class oioioi.questions.controllers.QuestionsContestControllerMixin¶
ContestController mixin that adds participants’ questions to his info.
- class oioioi.rankings.controllers.RankingMixinForContestController¶
ContestController mixin that sets up rankings app.
- class oioioi.scoresreveal.controllers.ScoresRevealContestControllerMixin¶
ContestController mixin that sets up scoresreveal app.
- class oioioi.similarsubmits.controllers.SimilarityDisqualificationMixin¶
ContestController mixin that sets up similarsubmits app.
- class oioioi.statistics.controllers.StatisticsMixinForContestController¶
The basic unit of statistics module is a plot group. It is a group of plots. A plot group is calculated for an object. The object can be a contest or a problem.
Example plot groups are:
1. Contest – Data is calculated for a whole contest. 1. Problem XYZ – Data is calculated for a XYZ problem.
A cluster of plot groups for a certain type of object is a category.
A plot group is represented by a category identifier and an object name. The name is identifying an object for which statistics will be calculated. The type of the object depends on the category. It can be a contest or a problem. The meaning of the name also depends on category. For a problem it is a short name. In some cases the string is not necessary (for example for current contest), so an empty string is also possible.
A plot is a graphical representation of some data. For example: a histogram of results for a contest, a pie chart of AC and WA for a problem, a table with lengths of the shortest solutions for problems or even some text with the total number of submissions.
Plot kind tells what information we want to get. For example: a distribution of points for a problem, length of the shortest solution for a problem, numbers of solution for each problem in a contest. It also defines the type of object for which data will be calculated.
Example plot kinds for a problem:
1. Number of submissions. 1. Histogram of points. 1. Structure of results – how many AC, WA or TLE were reported.
Example plot kinds for a contest:
1. Number of accepted solutions. 1. Time of the first AC for every problem. 1. Number of accepted solutions for each problem. 1. Size of the shortest solution for each problem. 1. Structure of the results – how many AC, WA or TLE were reported.
Plot data is a portion of information sufficient to render a plot. To get plot data we need two pieces of information. One is the desired kind of plot. The other is the name of the object. The meaning of the name depends on the object type. For problem, the name is short_name.
Plot data is represented as a dict containing several entries:
plot_name– Title of the plot. 1.
plot_type– An object of
PlotType. It determines a way to render data. For example a histogram, plain text or x-y plot.
Additional dict entries depend on
plot_type. Look at
Plot kind is represented as a pair of an enum entry and a string.
- class oioioi.submitservice.controllers.SubmitServiceMixinForProgrammingContestController¶
ContestController mixin that adds information about the possibility to submit solutions from terminal.
- class oioioi.suspendjudge.controllers.SuspendJudgeContestControllerMixin¶
ContestController mixin that adds suspendjudge app’s handlers to environ recipe.
- class oioioi.teams.controllers.TeamsMixinForContestController¶
Mixin for contests containing teams. Gives information about permissions to modifications of teams.
- class oioioi.testrun.controllers.TestRunProblemControllerMixin¶
ProblemController mixin that adds testrun handlers to the recipe and adds testrun config to contest’s admin panel.
- class oioioi.testrun.controllers.TestRunContestControllerMixin¶
ContestController mixin that sets up testrun app for the contest.