removing old __str__ and __repr__ debugging code

This commit is contained in:
Ozbolt Menegatti 2019-06-08 11:19:40 +02:00
parent b2baedca52
commit d83d619dc0

40
wani.py
View File

@ -415,14 +415,6 @@ class ComponentStatus(Enum):
Required = 1 Required = 1
Forbidden = 2 Forbidden = 2
def __str__(self):
if self == ComponentStatus.Optional:
return "?"
elif self == ComponentStatus.Required:
return "!"
else: #Forbidden
return "X"
def get_level(restriction): def get_level(restriction):
for feature in restriction: for feature in restriction:
@ -527,12 +519,6 @@ class Restriction:
return self.matcher(match_to) return self.matcher(match_to)
def __str__(self):
return "({:s} {})".format(str(self.type).split('.')[1], self.present)
def __repr__(self):
return str(self)
class Component: class Component:
def __init__(self, info): def __init__(self, info):
@ -603,25 +589,6 @@ class Component:
def name_str(self): def name_str(self):
return "_" if self.name is None else self.name return "_" if self.name is None else self.name
def __str__(self):
n = self.name_str()
return "{:s}) {:7s}:{} [{}] :{}".format(
self.idx, n, self.status, self.restriction, self.representation)
def tree(self):
el = []
for next, link, order in self.next_element:
s = "{:3} -- {:5} --> {:3}".format(self.idx, link, next.idx)
if order != Order.Any:
s += " " + str(order)[6:]
el.append(s)
el.extend(next.tree())
return el
def __repr__(self):
return str(self)
def match(self, word): def match(self, word):
m1 = self._match_self(word) m1 = self._match_self(word)
if m1 is None: if m1 is None:
@ -765,13 +732,6 @@ class SyntacticStructure:
continue continue
forms[n].append(to_add) forms[n].append(to_add)
def __str__(self):
comp_str = "\n".join(str(comp) for comp in self.components)
links_str = "\n".join(self.components[0].tree())
return "{} LBS {}\nCOMPONENTS\n{}\n\nLINKS\n{}\n{}".format(
self.id, self.lbs, comp_str, links_str, "-" * 40)
def get_component(self, idx): def get_component(self, idx):
for c in self.components: for c in self.components:
if c.idx == idx: if c.idx == idx: