81ac05cfd756e6c43261660b5c6bfb44703ebe36,brian2/stateupdaters/base.py,StateUpdateMethod,determine_stateupdater,#Any#Any#Any#,111
Before Change
logger.info("Using manually specified state updater: %r" % method)
return method
if method is not None:
method = method.lower() // normalize name to lower case
stateupdater = None
for name, registered_stateupdater in StateUpdateMethod.stateupdaters:
if name == method:
stateupdater = registered_stateupdater
break
if stateupdater is None:
raise ValueError("No state updater with the name "%s" "
"is known" % method)
if not stateupdater.can_integrate(equations, variables):
raise ValueError(("The state updater "%s" cannot be used for "
"the given equations" % method))
return stateupdater
// determine the best suitable state updater
best_stateupdater = None
for name, stateupdater in StateUpdateMethod.stateupdaters:
try:
if stateupdater.can_integrate(equations, variables):
best_stateupdater = (name, stateupdater)
break
except KeyError:
logger.debug(("It could not be determined whether state "
"updater "%s" is able to integrate the equations, "
After Change
return stateupdater
elif isinstance(method, collections.Iterable):
for name in method:
if name not in StateUpdateMethod.stateupdaters:
logger.warn("No state updater with the name "%s" "
"is known" % name, "unkown_stateupdater")
else:
stateupdater = StateUpdateMethod.stateupdaters[name]
try:
if stateupdater.can_integrate(equations, variables):
logger.info("Using stateupdater "%s"" % name)
return stateupdater
except KeyError:
logger.debug(("It could not be determined whether state "
"updater "%s" is able to integrate the equations, "
"it appears the namespace is not yet complete."
% name))
raise ValueError(("No stateupdater that is suitable for the given "
"equations has been found"))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: brian-team/brian2
Commit Name: 81ac05cfd756e6c43261660b5c6bfb44703ebe36
Time: 2015-03-02
Author: marcel.stimberg@inserm.fr
File Name: brian2/stateupdaters/base.py
Class Name: StateUpdateMethod
Method Name: determine_stateupdater
Project Name: Esri/raster-functions
Commit Name: 6b642c8e0fa07c971a89e4fb70bdf539b04042cc
Time: 2015-05-25
Author: rsumbaly@esri.com
File Name: functions/KeyMetadata.py
Class Name: KeyMetadata
Method Name: updateKeyMetadata
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 9121332c18e024d417d1aeb189ec98f295ffc694
Time: 2020-07-28
Author: chriswilkes@google.com
File Name: perfkitbenchmarker/linux_packages/epel_release.py
Class Name:
Method Name: YumInstall