Mercurial > ~astiob > upreckon > hgweb
comparison config.py @ 76:0e5ae28e0b2b
Points are now weighted on a test context basis
In particular, this has allowed for simple extensions to the format
of testconf to award points to whole test groups without at the same time
compromising the future ability of giving partial score for correct
but slow solutions. Specifically, the groupweight configuration variable
has been added and normally has the format {groupindex: points} where
groupindex is the group's index in the tests configuration variable.
The backwards incompatible change is that test contexts are no longer
guaranteed to learn the score awarded or the maximum possible score
for every test case and may instead be notified about them in batches.
In other news, the pointmap and groupweight configuration variables can
(now) be given as sequences in addition to mappings. (Technically,
the distinction currently made is dict versus everything else.) Items
of a sequence pointmap/groupweight correspond directly to the test cases/
groups defined in the tests configuration variable; in particular,
when groups are used, tests=[1],[2,3];pointmap={1:1,2:2,3:3} can now be
written as pointmap=tests=[1],[2,3]. Missing items are handled in the same
way in which they are handled when the variable is a mapping. Note
that the items of groupweight correspond to whole test groups rather
than individual test cases.
In other news again, the wording of problem total lines has been changed
from '<unweighted> points; weighted score: <weighted>' to '<weighted>
points (<unweighted> before weighting)', and group total lines now
properly report fractional numbers of points (this is a bug fix).
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Sat, 08 Jan 2011 16:03:35 +0200 |
parents | aea4fc87698a |
children | d46bd7ee3e69 |
comparison
equal
deleted
inserted
replaced
75:007f7eb6fb2b | 76:0e5ae28e0b2b |
---|---|
31 'dummies': {}, | 31 'dummies': {}, |
32 'testsexcluded': (), | 32 'testsexcluded': (), |
33 'padtests': 0, | 33 'padtests': 0, |
34 'paddummies': 0, | 34 'paddummies': 0, |
35 'taskweight': 100, | 35 'taskweight': 100, |
36 'groupweight': {}, | |
36 'pointmap': {}, | 37 'pointmap': {}, |
37 'stdio': False, | 38 'stdio': False, |
38 'dummyinname': '', | 39 'dummyinname': '', |
39 'dummyoutname': '', | 40 'dummyoutname': '', |
40 'tester': None, | 41 'tester': None, |
137 module.path = module.name | 138 module.path = module.name |
138 elif sys.platform != 'win32': | 139 elif sys.platform != 'win32': |
139 module.path = os.path.join(os.path.curdir, problem_name) | 140 module.path = os.path.join(os.path.curdir, problem_name) |
140 else: | 141 else: |
141 module.path = problem_name | 142 module.path = problem_name |
142 newpointmap = {} | 143 for name in 'pointmap', 'groupweight': |
143 for key in module.pointmap: | 144 oldmap = getattr(module, name) |
144 if not options.legacy and isinstance(key, basestring): | 145 if isinstance(oldmap, dict): |
145 newpointmap[key] = module.pointmap[key] | 146 newmap = {} |
146 else: | 147 for key in oldmap: |
147 try: | 148 if not options.legacy and isinstance(key, basestring): |
148 for k in key: | 149 newmap[key] = oldmap[key] |
149 newpointmap[k] = module.pointmap[key] | 150 else: |
150 except TypeError: | 151 try: |
151 newpointmap[key] = module.pointmap[key] | 152 for k in key: |
152 module.pointmap = newpointmap | 153 newmap[k] = oldmap[key] |
154 except TypeError: | |
155 newmap[key] = oldmap[key] | |
156 setattr(module, name, newmap) | |
153 if options.no_maxtime: | 157 if options.no_maxtime: |
154 module.maxtime = 0 | 158 module.maxtime = 0 |
155 sys.dont_write_bytecode = dwb | 159 sys.dont_write_bytecode = dwb |
156 for name in patterns: | 160 for name in patterns: |
157 if hasattr(module, name): | 161 if hasattr(module, name): |