comparison 2.00/config.py @ 24:c23d81f4a1a3

Score returned by TestCase.__call__() is now normalized to 0..1 TestCase.__call__() now returns the fraction (a number from 0 to 1) of case.points that is to be awarded. Bug fix: %-patterns in configuration variables common to all problems are now substituted.
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 23 Sep 2010 00:11:24 +0000
parents f07b7a431ea6
children b500e117080e
comparison
equal deleted inserted replaced
23:c1f52b5d80d6 24:c23d81f4a1a3
116 except TypeError: 116 except TypeError:
117 module.paddummies = module.padwithzeroestolength 117 module.paddummies = module.padwithzeroestolength
118 for name in defaults_problem: 118 for name in defaults_problem:
119 if not hasattr(globalconf, name): 119 if not hasattr(globalconf, name):
120 setattr(module, name, getattr(module, name, defaults_problem[name])) 120 setattr(module, name, getattr(module, name, defaults_problem[name]))
121 for name in patterns:
122 if hasattr(module, name):
123 setattr(module, name, getattr(module, name).replace('%', problem_name))
124 if not hasattr(module, 'path'): 121 if not hasattr(module, 'path'):
125 if hasattr(module, 'name'): 122 if hasattr(module, 'name'):
126 module.path = module.name 123 module.path = module.name
127 elif sys.platform != 'win32': 124 elif sys.platform != 'win32':
128 module.path = os.path.join(os.path.curdir, problem_name) 125 module.path = os.path.join(os.path.curdir, problem_name)
129 else: 126 else:
130 module.path = problem_name 127 module.path = problem_name
131 if options.no_maxtime: 128 if options.no_maxtime:
132 module.maxtime = 0 129 module.maxtime = 0
133 sys.dont_write_bytecode = dwb 130 sys.dont_write_bytecode = dwb
134 return Config(module, globalconf) 131 module = Config(module, globalconf)
132 for name in patterns:
133 if hasattr(module, name):
134 setattr(module, name, getattr(module, name).replace('%', problem_name))
135 return module
135 136
136 def load_global(): 137 def load_global():
137 dwb = sys.dont_write_bytecode 138 dwb = sys.dont_write_bytecode
138 sys.dont_write_bytecode = True 139 sys.dont_write_bytecode = True
139 metafile = files.File('testconf.py', True, 'configuration') 140 metafile = files.File('testconf.py', True, 'configuration')