Skip to content
Snippets Groups Projects
Commit c06d979e authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

white spaces

parent c2c54a68
No related branches found
No related tags found
No related merge requests found
...@@ -53,23 +53,25 @@ class AbstractCFood(object): ...@@ -53,23 +53,25 @@ class AbstractCFood(object):
@staticmethod @staticmethod
def find_existing(entity): def find_existing(entity):
query_string = "FIND Record "+ entity.get_parents()[0].name query_string = "FIND Record " + entity.get_parents()[0].name
query_string += " with " + "and".join(["'" + p.name + "'='" + p.value +"'" query_string += " with " + "and".join(["'" + p.name + "'='" + p.value + "'"
for p in entity.get_properties()]) for p in entity.get_properties()])
print(query_string) print(query_string)
q = db.Query(query_string) q = db.Query(query_string)
try: try:
r = q.execute(unique=True) r = q.execute(unique=True)
except TransactionError as er: except TransactionError as er:
r = None r = None
return r return r
class ExampleCFood(AbstractCFood): class ExampleCFood(AbstractCFood):
def create_identifiables(self, filename, match): def create_identifiables(self, filename, match):
entities = {} entities = {}
entities["exp"] = db.Record() entities["exp"] = db.Record()
#import IPython #import IPython
#IPython.embed() # IPython.embed()
entities["exp"].add_parent(name="Experiment") entities["exp"].add_parent(name="Experiment")
entities["exp"].add_property(name="species", value=match.group) entities["exp"].add_property(name="species", value=match.group)
...@@ -80,6 +82,7 @@ class ExampleCFood(AbstractCFood): ...@@ -80,6 +82,7 @@ class ExampleCFood(AbstractCFood):
value=datetime.today().isoformat()) value=datetime.today().isoformat())
db.Container().extend(entities.values).update() db.Container().extend(entities.values).update()
def get_parser(): def get_parser():
parser = argparse.ArgumentParser(description=__doc__, parser = argparse.ArgumentParser(description=__doc__,
formatter_class=RawTextHelpFormatter) formatter_class=RawTextHelpFormatter)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment