-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchem.py
38 lines (31 loc) · 1012 Bytes
/
chem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import re
from Comparison import Entity
class Chem(Entity):
def __init__(self):
super().__init__()
self.name = ""
self.id = ""
self.source = ""
self.recipe = None
self.metabolism = ""
self.overdose = ""
self.description = ""
self.color = "#000000"
def put_recipe(self, recipe):
self.recipe = {}
for match in re.findall("\"(.+?)\"\s=\s([0-9.]+)", recipe.properties["required_reagents"]):
self.recipe[match[0]] = match[1]
self.additional_info = 'Has Recipe'
def to_string(self):
return self.name
def equal_to(self, other):
return self.name.lower() == other.name.lower()
class Reaction(Entity):
def __init__(self):
super().__init__()
self.name = ''
self.recipe = None
def to_string(self):
return self.name
def equal_to(self, other):
return self.name.lower() == other.name.lower()