Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RezSat committed May 11, 2024
1 parent 015f625 commit b307c9c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Empty file added src/nodes/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions src/nodes/node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Node:
def __init__(self):
pass
24 changes: 24 additions & 0 deletions src/nodes/number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from node import Node

class Number(Node):
def __init__(self, value: str):
self.value = value

@property
def is_float(self):
if '.' in self.value:
return True
return False

@property
def to_dict(self):
return {
"Number": self.value
}

@property
def to_latex(self):
return '\\mathtt{' + self.value + '}'

def __float__(self):
return float(self._as_decimal())

0 comments on commit b307c9c

Please sign in to comment.