fixed typos
This commit is contained in:
parent
fe8362b02c
commit
39e13a3454
|
|
@ -13,7 +13,7 @@ from argparse import ArgumentParser
|
||||||
def parse_ingredient(ingredient_text):
|
def parse_ingredient(ingredient_text):
|
||||||
units = ['teaspoon', 'tablespoon', 'gram', 'once', 'jar', 'cup', 'pinch',
|
units = ['teaspoon', 'tablespoon', 'gram', 'once', 'jar', 'cup', 'pinch',
|
||||||
'container', 'slice', 'package', 'pound', 'can', 'dash', 'spear',
|
'container', 'slice', 'package', 'pound', 'can', 'dash', 'spear',
|
||||||
'bunch', 'quart', 'cube', 'envelope', 'squars', 'sprig']
|
'bunch', 'quart', 'cube', 'envelope', 'square', 'sprig']
|
||||||
number_regex = '((?:[\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\s?(?:\(.+\))?)*)'
|
number_regex = '((?:[\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\s?(?:\(.+\))?)*)'
|
||||||
ingredient_regex = '([a-zA-Z \'\-]+)'
|
ingredient_regex = '([a-zA-Z \'\-]+)'
|
||||||
supplement_regex = ',?(.*)'
|
supplement_regex = ',?(.*)'
|
||||||
|
|
@ -77,7 +77,7 @@ def parse_recipe(session, recipe, site):
|
||||||
name_div = name_candidates[0]
|
name_div = name_candidates[0]
|
||||||
recipe.name = name_div.text
|
recipe.name = name_div.text
|
||||||
|
|
||||||
logging.info(f"Adding Recipe {recipe}")
|
logging.info(f"Adding Recipe {recipe.name} from {recipe_url}")
|
||||||
|
|
||||||
session.add(recipe)
|
session.add(recipe)
|
||||||
session.flush()
|
session.flush()
|
||||||
|
|
@ -156,7 +156,7 @@ with S.begin() as sess:
|
||||||
except KeyboardInterrupt as e:
|
except KeyboardInterrupt as e:
|
||||||
savepoint.rollback()
|
savepoint.rollback()
|
||||||
break
|
break
|
||||||
except IntegrityError as e:
|
except Exception as e:
|
||||||
savepoint.rollback()
|
savepoint.rollback()
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue