c9e7c3ffaba09850ddcd90b88528028fbbde22d6,perfkitbenchmarker/flag_util.py,UnitsParser,Parse,#UnitsParser#Any#,251
Before Change
if not isinstance(quantity, units.Quantity):
raise ValueError("Expression %r evaluates to a unitless value." % inp)
if self.convertible_to is not None:
try:
quantity.to(self.convertible_to)
except units.DimensionalityError:
raise ValueError("Expression %s is not convertible to %s" %
(inp, self.convertible_to))
return quantity
class UnitsSerializer(flags.ArgumentSerializer):
After Change
if not isinstance(quantity, units.Quantity):
raise ValueError("Expression %r evaluates to a unitless value." % inp)
for unit in self.convertible_to:
try:
quantity.to(unit)
break
except units.DimensionalityError:
pass
else:
raise ValueError(
"Expression {0!r} is not convertible to an acceptable unit "
"({1}).".format(inp, ", ".join(str(u) for u in self.convertible_to)))
return quantity
class UnitsSerializer(flags.ArgumentSerializer):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: c9e7c3ffaba09850ddcd90b88528028fbbde22d6
Time: 2016-04-20
Author: skschneider@users.noreply.github.com
File Name: perfkitbenchmarker/flag_util.py
Class Name: UnitsParser
Method Name: Parse
Project Name: matplotlib/matplotlib
Commit Name: 81b0efcf65c904ab00b8188fdc1b9e3500a4b0e5
Time: 2017-12-26
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/bezier.py
Class Name:
Method Name: split_path_inout
Project Name: pymanopt/pymanopt
Commit Name: 618c1cac7908e5aa61fd95e0d1c6c1f31a2db95d
Time: 2016-02-19
Author: niklas.koep@gmail.com
File Name: pymanopt/core/problem.py
Class Name: Problem
Method Name: backend