Skip to content

Commit

Permalink
sytax fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 authored Oct 23, 2024
1 parent 9591f20 commit 00fa409
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/uk/ac/ebi/vfb/neo4j/flybase2neo/fb_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ def query_fb(self, query, max_retries=5, delay=30):
print(f"OperationalError encountered. Retrying {retries}/{max_retries} in {delay} seconds...")
time.sleep(delay)
self.conn = get_fb_conn() # Re-establish the connection

def clean_placeholders(template):
import re
# This pattern matches placeholders like { line.short_form } with possible spaces
pattern = re.compile(r'{\s*([^{}\s]+(?:\.[^{}\s]+)*)\s*}')
return pattern.sub(lambda m: '{' + m.group(1).strip() + '}', template)


def commit_via_csv(self, statement_template, dict_list):
if not dict_list:
Expand All @@ -137,7 +130,13 @@ def cypher_escape(value):
else:
# For numbers and booleans
return str(value).lower()


def clean_placeholders(template):
import re
# This pattern matches placeholders like { line.short_form } with possible spaces
pattern = re.compile(r'{\s*([^{}\s]+(?:\.[^{}\s]+)*)\s*}')
return pattern.sub(lambda m: '{' + m.group(1).strip() + '}', template)

# Clean the placeholders in the statement_template
statement_template = clean_placeholders(statement_template)

Expand Down

0 comments on commit 00fa409

Please sign in to comment.