forked from Imagelibrary/littlefs
scripts: Added __repr__ to RInt and friends
Just a minor quality of life feature to help debugging these scripts.
This commit is contained in:
@@ -51,6 +51,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -53,6 +53,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
@@ -143,6 +146,9 @@ class RFrac(co.namedtuple('RFrac', 'a,b')):
|
||||
b = a
|
||||
return super().__new__(cls, RInt(a), RInt(b))
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r, %r)' % (self.__class__.__name__, self.a.x, self.b.x)
|
||||
|
||||
def __str__(self):
|
||||
return '%s/%s' % (self.a, self.b)
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
@@ -145,6 +148,9 @@ class RFloat(co.namedtuple('RFloat', 'x')):
|
||||
x = float(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
@@ -234,6 +240,9 @@ class RFrac(co.namedtuple('RFrac', 'a,b')):
|
||||
b = a
|
||||
return super().__new__(cls, RInt(a), RInt(b))
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r, %r)' % (self.__class__.__name__, self.a.x, self.b.x)
|
||||
|
||||
def __str__(self):
|
||||
return '%s/%s' % (self.a, self.b)
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -51,6 +51,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -61,6 +61,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -52,6 +52,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -42,6 +42,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
@@ -47,6 +47,9 @@ class RInt(co.namedtuple('RInt', 'x')):
|
||||
x = int(x)
|
||||
return super().__new__(cls, x)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.x)
|
||||
|
||||
def __str__(self):
|
||||
if self.x == mt.inf:
|
||||
return '∞'
|
||||
|
||||
Reference in New Issue
Block a user