Renamed internal script result types * -> R*
So Int -> RInt, Frac -> RFrac, etc. This just helps distinguish these types from builtin types, which could be confusing.
This commit is contained in:
+4
-4
@@ -29,10 +29,10 @@ OBJDUMP_PATH = ['objdump']
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -110,12 +110,12 @@ class CodeResult(co.namedtuple('CodeResult', [
|
|||||||
_by = ['file', 'function']
|
_by = ['file', 'function']
|
||||||
_fields = ['size']
|
_fields = ['size']
|
||||||
_sort = ['size']
|
_sort = ['size']
|
||||||
_types = {'size': Int}
|
_types = {'size': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='', size=0):
|
def __new__(cls, file='', function='', size=0):
|
||||||
return super().__new__(cls, file, function,
|
return super().__new__(cls, file, function,
|
||||||
Int(size))
|
RInt(size))
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return CodeResult(self.file, self.function,
|
return CodeResult(self.file, self.function,
|
||||||
|
|||||||
+17
-16
@@ -29,10 +29,10 @@ GCOV_PATH = ['gcov']
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -104,16 +104,16 @@ class Int(co.namedtuple('Int', 'x')):
|
|||||||
return self.__class__(self.x * other.x)
|
return self.__class__(self.x * other.x)
|
||||||
|
|
||||||
# fractional fields, a/b
|
# fractional fields, a/b
|
||||||
class Frac(co.namedtuple('Frac', 'a,b')):
|
class RFrac(co.namedtuple('RFrac', 'a,b')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, a=0, b=None):
|
def __new__(cls, a=0, b=None):
|
||||||
if isinstance(a, Frac) and b is None:
|
if isinstance(a, RFrac) and b is None:
|
||||||
return a
|
return a
|
||||||
if isinstance(a, str) and b is None:
|
if isinstance(a, str) and b is None:
|
||||||
a, b = a.split('/', 1)
|
a, b = a.split('/', 1)
|
||||||
if b is None:
|
if b is None:
|
||||||
b = a
|
b = a
|
||||||
return super().__new__(cls, Int(a), Int(b))
|
return super().__new__(cls, RInt(a), RInt(b))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '%s/%s' % (self.a, self.b)
|
return '%s/%s' % (self.a, self.b)
|
||||||
@@ -132,15 +132,15 @@ class Frac(co.namedtuple('Frac', 'a,b')):
|
|||||||
else '%.1f%%' % (100*t)]
|
else '%.1f%%' % (100*t)]
|
||||||
|
|
||||||
def diff(self, other):
|
def diff(self, other):
|
||||||
new_a, new_b = self if self else (Int(0), Int(0))
|
new_a, new_b = self if self else (RInt(0), RInt(0))
|
||||||
old_a, old_b = other if other else (Int(0), Int(0))
|
old_a, old_b = other if other else (RInt(0), RInt(0))
|
||||||
return '%11s' % ('%s/%s' % (
|
return '%11s' % ('%s/%s' % (
|
||||||
new_a.diff(old_a).strip(),
|
new_a.diff(old_a).strip(),
|
||||||
new_b.diff(old_b).strip()))
|
new_b.diff(old_b).strip()))
|
||||||
|
|
||||||
def ratio(self, other):
|
def ratio(self, other):
|
||||||
new_a, new_b = self if self else (Int(0), Int(0))
|
new_a, new_b = self if self else (RInt(0), RInt(0))
|
||||||
old_a, old_b = other if other else (Int(0), Int(0))
|
old_a, old_b = other if other else (RInt(0), RInt(0))
|
||||||
new = new_a.x/new_b.x if new_b.x else 1.0
|
new = new_a.x/new_b.x if new_b.x else 1.0
|
||||||
old = old_a.x/old_b.x if old_b.x else 1.0
|
old = old_a.x/old_b.x if old_b.x else 1.0
|
||||||
return new - old
|
return new - old
|
||||||
@@ -176,14 +176,15 @@ class CovResult(co.namedtuple('CovResult', [
|
|||||||
_fields = ['calls', 'hits', 'funcs', 'lines', 'branches']
|
_fields = ['calls', 'hits', 'funcs', 'lines', 'branches']
|
||||||
_sort = ['funcs', 'lines', 'branches', 'hits', 'calls']
|
_sort = ['funcs', 'lines', 'branches', 'hits', 'calls']
|
||||||
_types = {
|
_types = {
|
||||||
'calls': Int, 'hits': Int,
|
'calls': RInt, 'hits': RInt,
|
||||||
'funcs': Frac, 'lines': Frac, 'branches': Frac}
|
'funcs': RFrac, 'lines': RFrac, 'branches': RFrac}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='', line=0,
|
def __new__(cls, file='', function='', line=0,
|
||||||
calls=0, hits=0, funcs=0, lines=0, branches=0):
|
calls=0, hits=0, funcs=0, lines=0, branches=0):
|
||||||
return super().__new__(cls, file, function, int(Int(line)),
|
return super().__new__(cls, file, function, int(RInt(line)),
|
||||||
Int(calls), Int(hits), Frac(funcs), Frac(lines), Frac(branches))
|
RInt(calls), RInt(hits),
|
||||||
|
RFrac(funcs), RFrac(lines), RFrac(branches))
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return CovResult(self.file, self.function, self.line,
|
return CovResult(self.file, self.function, self.line,
|
||||||
@@ -265,7 +266,7 @@ def collect(gcda_paths, *,
|
|||||||
results.append(CovResult(
|
results.append(CovResult(
|
||||||
file_name, func_name, func['start_line'],
|
file_name, func_name, func['start_line'],
|
||||||
func['execution_count'], 0,
|
func['execution_count'], 0,
|
||||||
Frac(1 if func['execution_count'] > 0 else 0, 1),
|
RFrac(1 if func['execution_count'] > 0 else 0, 1),
|
||||||
0,
|
0,
|
||||||
0))
|
0))
|
||||||
|
|
||||||
@@ -282,8 +283,8 @@ def collect(gcda_paths, *,
|
|||||||
file_name, func_name, line['line_number'],
|
file_name, func_name, line['line_number'],
|
||||||
0, line['count'],
|
0, line['count'],
|
||||||
0,
|
0,
|
||||||
Frac(1 if line['count'] > 0 else 0, 1),
|
RFrac(1 if line['count'] > 0 else 0, 1),
|
||||||
Frac(
|
RFrac(
|
||||||
sum(1 if branch['count'] > 0 else 0
|
sum(1 if branch['count'] > 0 else 0
|
||||||
for branch in line['branches']),
|
for branch in line['branches']),
|
||||||
len(line['branches']))))
|
len(line['branches']))))
|
||||||
|
|||||||
+4
-4
@@ -29,10 +29,10 @@ OBJDUMP_PATH = ['objdump']
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -110,12 +110,12 @@ class DataResult(co.namedtuple('DataResult', [
|
|||||||
_by = ['file', 'function']
|
_by = ['file', 'function']
|
||||||
_fields = ['size']
|
_fields = ['size']
|
||||||
_sort = ['size']
|
_sort = ['size']
|
||||||
_types = {'size': Int}
|
_types = {'size': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='', size=0):
|
def __new__(cls, file='', function='', size=0):
|
||||||
return super().__new__(cls, file, function,
|
return super().__new__(cls, file, function,
|
||||||
Int(size))
|
RInt(size))
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return DataResult(self.file, self.function,
|
return DataResult(self.file, self.function,
|
||||||
|
|||||||
+9
-7
@@ -38,10 +38,10 @@ THRESHOLD = (0.5, 0.85)
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -121,16 +121,18 @@ class PerfResult(co.namedtuple('PerfResult', [
|
|||||||
_fields = ['cycles', 'bmisses', 'branches', 'cmisses', 'caches']
|
_fields = ['cycles', 'bmisses', 'branches', 'cmisses', 'caches']
|
||||||
_sort = ['cycles', 'bmisses', 'cmisses', 'branches', 'caches']
|
_sort = ['cycles', 'bmisses', 'cmisses', 'branches', 'caches']
|
||||||
_types = {
|
_types = {
|
||||||
'cycles': Int,
|
'cycles': RInt,
|
||||||
'bmisses': Int, 'branches': Int,
|
'bmisses': RInt, 'branches': RInt,
|
||||||
'cmisses': Int, 'caches': Int}
|
'cmisses': RInt, 'caches': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='', line=0,
|
def __new__(cls, file='', function='', line=0,
|
||||||
cycles=0, bmisses=0, branches=0, cmisses=0, caches=0,
|
cycles=0, bmisses=0, branches=0, cmisses=0, caches=0,
|
||||||
children=[]):
|
children=[]):
|
||||||
return super().__new__(cls, file, function, int(Int(line)),
|
return super().__new__(cls, file, function, int(RInt(line)),
|
||||||
Int(cycles), Int(bmisses), Int(branches), Int(cmisses), Int(caches),
|
RInt(cycles),
|
||||||
|
RInt(bmisses), RInt(branches),
|
||||||
|
RInt(cmisses), RInt(caches),
|
||||||
children)
|
children)
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
|
|||||||
+5
-5
@@ -29,10 +29,10 @@ THRESHOLD = (0.5, 0.85)
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -111,14 +111,14 @@ class PerfBdResult(co.namedtuple('PerfBdResult', [
|
|||||||
_by = ['file', 'function', 'line']
|
_by = ['file', 'function', 'line']
|
||||||
_fields = ['readed', 'proged', 'erased']
|
_fields = ['readed', 'proged', 'erased']
|
||||||
_sort = ['erased', 'proged', 'readed']
|
_sort = ['erased', 'proged', 'readed']
|
||||||
_types = {'readed': Int, 'proged': Int, 'erased': Int}
|
_types = {'readed': RInt, 'proged': RInt, 'erased': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='', line=0,
|
def __new__(cls, file='', function='', line=0,
|
||||||
readed=0, proged=0, erased=0,
|
readed=0, proged=0, erased=0,
|
||||||
children=[]):
|
children=[]):
|
||||||
return super().__new__(cls, file, function, int(Int(line)),
|
return super().__new__(cls, file, function, int(RInt(line)),
|
||||||
Int(readed), Int(proged), Int(erased),
|
RInt(readed), RInt(proged), RInt(erased),
|
||||||
children)
|
children)
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
|
|||||||
+4
-4
@@ -20,10 +20,10 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -100,13 +100,13 @@ class StackResult(co.namedtuple('StackResult', [
|
|||||||
_by = ['file', 'function']
|
_by = ['file', 'function']
|
||||||
_fields = ['frame', 'limit']
|
_fields = ['frame', 'limit']
|
||||||
_sort = ['limit', 'frame']
|
_sort = ['limit', 'frame']
|
||||||
_types = {'frame': Int, 'limit': Int}
|
_types = {'frame': RInt, 'limit': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', function='',
|
def __new__(cls, file='', function='',
|
||||||
frame=0, limit=0, children=set()):
|
frame=0, limit=0, children=set()):
|
||||||
return super().__new__(cls, file, function,
|
return super().__new__(cls, file, function,
|
||||||
Int(frame), Int(limit),
|
RInt(frame), RInt(limit),
|
||||||
children)
|
children)
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
|
|||||||
+4
-4
@@ -25,10 +25,10 @@ OBJDUMP_PATH = ['objdump']
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -104,12 +104,12 @@ class StructResult(co.namedtuple('StructResult', ['file', 'struct', 'size'])):
|
|||||||
_by = ['file', 'struct']
|
_by = ['file', 'struct']
|
||||||
_fields = ['size']
|
_fields = ['size']
|
||||||
_sort = ['size']
|
_sort = ['size']
|
||||||
_types = {'size': Int}
|
_types = {'size': RInt}
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, file='', struct='', size=0):
|
def __new__(cls, file='', struct='', size=0):
|
||||||
return super().__new__(cls, file, struct,
|
return super().__new__(cls, file, struct,
|
||||||
Int(size))
|
RInt(size))
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return StructResult(self.file, self.struct,
|
return StructResult(self.file, self.struct,
|
||||||
|
|||||||
+24
-24
@@ -30,14 +30,14 @@ OPS = {
|
|||||||
'prod': lambda xs: m.prod(xs[1:], start=xs[0]),
|
'prod': lambda xs: m.prod(xs[1:], start=xs[0]),
|
||||||
'min': min,
|
'min': min,
|
||||||
'max': max,
|
'max': max,
|
||||||
'avg': lambda xs: Float(sum(float(x) for x in xs) / len(xs)),
|
'avg': lambda xs: RFloat(sum(float(x) for x in xs) / len(xs)),
|
||||||
'stddev': lambda xs: (
|
'stddev': lambda xs: (
|
||||||
lambda avg: Float(
|
lambda avg: RFloat(
|
||||||
m.sqrt(sum((float(x) - avg)**2 for x in xs) / len(xs)))
|
m.sqrt(sum((float(x) - avg)**2 for x in xs) / len(xs)))
|
||||||
)(sum(float(x) for x in xs) / len(xs)),
|
)(sum(float(x) for x in xs) / len(xs)),
|
||||||
'gmean': lambda xs: Float(m.prod(float(x) for x in xs)**(1/len(xs))),
|
'gmean': lambda xs: RFloat(m.prod(float(x) for x in xs)**(1/len(xs))),
|
||||||
'gstddev': lambda xs: (
|
'gstddev': lambda xs: (
|
||||||
lambda gmean: Float(
|
lambda gmean: RFloat(
|
||||||
m.exp(m.sqrt(sum(m.log(float(x)/gmean)**2 for x in xs) / len(xs)))
|
m.exp(m.sqrt(sum(m.log(float(x)/gmean)**2 for x in xs) / len(xs)))
|
||||||
if gmean else m.inf)
|
if gmean else m.inf)
|
||||||
)(m.prod(float(x) for x in xs)**(1/len(xs))),
|
)(m.prod(float(x) for x in xs)**(1/len(xs))),
|
||||||
@@ -45,10 +45,10 @@ OPS = {
|
|||||||
|
|
||||||
|
|
||||||
# integer fields
|
# integer fields
|
||||||
class Int(co.namedtuple('Int', 'x')):
|
class RInt(co.namedtuple('RInt', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0):
|
def __new__(cls, x=0):
|
||||||
if isinstance(x, Int):
|
if isinstance(x, RInt):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -120,10 +120,10 @@ class Int(co.namedtuple('Int', 'x')):
|
|||||||
return self.__class__(self.x * other.x)
|
return self.__class__(self.x * other.x)
|
||||||
|
|
||||||
# float fields
|
# float fields
|
||||||
class Float(co.namedtuple('Float', 'x')):
|
class RFloat(co.namedtuple('RFloat', 'x')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, x=0.0):
|
def __new__(cls, x=0.0):
|
||||||
if isinstance(x, Float):
|
if isinstance(x, RFloat):
|
||||||
return x
|
return x
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
@@ -150,8 +150,8 @@ class Float(co.namedtuple('Float', 'x')):
|
|||||||
def __float__(self):
|
def __float__(self):
|
||||||
return float(self.x)
|
return float(self.x)
|
||||||
|
|
||||||
none = Int.none
|
none = RInt.none
|
||||||
table = Int.table
|
table = RInt.table
|
||||||
|
|
||||||
def diff(self, other):
|
def diff(self, other):
|
||||||
new = self.x if self else 0
|
new = self.x if self else 0
|
||||||
@@ -164,22 +164,22 @@ class Float(co.namedtuple('Float', 'x')):
|
|||||||
else:
|
else:
|
||||||
return '%+7.1f' % diff
|
return '%+7.1f' % diff
|
||||||
|
|
||||||
ratio = Int.ratio
|
ratio = RInt.ratio
|
||||||
__add__ = Int.__add__
|
__add__ = RInt.__add__
|
||||||
__sub__ = Int.__sub__
|
__sub__ = RInt.__sub__
|
||||||
__mul__ = Int.__mul__
|
__mul__ = RInt.__mul__
|
||||||
|
|
||||||
# fractional fields, a/b
|
# fractional fields, a/b
|
||||||
class Frac(co.namedtuple('Frac', 'a,b')):
|
class RFrac(co.namedtuple('RFrac', 'a,b')):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
def __new__(cls, a=0, b=None):
|
def __new__(cls, a=0, b=None):
|
||||||
if isinstance(a, Frac) and b is None:
|
if isinstance(a, RFrac) and b is None:
|
||||||
return a
|
return a
|
||||||
if isinstance(a, str) and b is None:
|
if isinstance(a, str) and b is None:
|
||||||
a, b = a.split('/', 1)
|
a, b = a.split('/', 1)
|
||||||
if b is None:
|
if b is None:
|
||||||
b = a
|
b = a
|
||||||
return super().__new__(cls, Int(a), Int(b))
|
return super().__new__(cls, RInt(a), RInt(b))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '%s/%s' % (self.a, self.b)
|
return '%s/%s' % (self.a, self.b)
|
||||||
@@ -198,15 +198,15 @@ class Frac(co.namedtuple('Frac', 'a,b')):
|
|||||||
else '%.1f%%' % (100*t)]
|
else '%.1f%%' % (100*t)]
|
||||||
|
|
||||||
def diff(self, other):
|
def diff(self, other):
|
||||||
new_a, new_b = self if self else (Int(0), Int(0))
|
new_a, new_b = self if self else (RInt(0), RInt(0))
|
||||||
old_a, old_b = other if other else (Int(0), Int(0))
|
old_a, old_b = other if other else (RInt(0), RInt(0))
|
||||||
return '%11s' % ('%s/%s' % (
|
return '%11s' % ('%s/%s' % (
|
||||||
new_a.diff(old_a).strip(),
|
new_a.diff(old_a).strip(),
|
||||||
new_b.diff(old_b).strip()))
|
new_b.diff(old_b).strip()))
|
||||||
|
|
||||||
def ratio(self, other):
|
def ratio(self, other):
|
||||||
new_a, new_b = self if self else (Int(0), Int(0))
|
new_a, new_b = self if self else (RInt(0), RInt(0))
|
||||||
old_a, old_b = other if other else (Int(0), Int(0))
|
old_a, old_b = other if other else (RInt(0), RInt(0))
|
||||||
new = new_a.x/new_b.x if new_b.x else 1.0
|
new = new_a.x/new_b.x if new_b.x else 1.0
|
||||||
old = old_a.x/old_b.x if old_b.x else 1.0
|
old = old_a.x/old_b.x if old_b.x else 1.0
|
||||||
return new - old
|
return new - old
|
||||||
@@ -236,9 +236,9 @@ class Frac(co.namedtuple('Frac', 'a,b')):
|
|||||||
|
|
||||||
# available types
|
# available types
|
||||||
TYPES = co.OrderedDict([
|
TYPES = co.OrderedDict([
|
||||||
('int', Int),
|
('int', RInt),
|
||||||
('float', Float),
|
('float', RFloat),
|
||||||
('frac', Frac)
|
('frac', RFrac)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user