Skip to content

Commit

Permalink
Cut Num.__init__
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Sep 11, 2023
1 parent ed1540a commit a6d2cfc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tm/num.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class Num:
join: str
op: Callable[[int, int], int]

def __init__(self, l: Count, r: Count):
self.l = l
self.r = r

def __repr__(self) -> str:
# pylint: disable = line-too-long

Expand Down Expand Up @@ -182,7 +178,8 @@ def __init__(self, l: Count, r: Num):
if isinstance(l, Num) and l.depth > r.depth:
l, r = r, l

super().__init__(l, r)
self.l = l
self.r = r

def estimate(self) -> int:
return round(max(self.estimate_l(), self.estimate_r()))
Expand Down Expand Up @@ -273,7 +270,8 @@ def __init__(self, l: Count, r: Num):
if isinstance(l, Num) and l.depth > r.depth:
l, r = r, l

super().__init__(l, r)
self.l = l
self.r = r

def __repr__(self) -> str:
if self.l == -1:
Expand Down Expand Up @@ -394,7 +392,8 @@ def den(self) -> int:
def __init__(self, l: Num, r: int):
assert r > 0

super().__init__(l, r)
self.l = l
self.r = r

def __neg__(self) -> Count:
return -(self.num) // self.den
Expand Down Expand Up @@ -476,7 +475,8 @@ def __init__(self, l: Count, r: Count):
r *= int(log(l, root))
l = int(root)

super().__init__(l, r)
self.l = l
self.r = r

def estimate(self) -> int:
return round(self.estimate_l() * 10 ** self.estimate_r())
Expand Down

0 comments on commit a6d2cfc

Please sign in to comment.