# File: csp.py # ------------ # Uses recipe data from Yummly and nutrition data from nutrition.gov to # make good recipes that satisfy certain constraints. ## import collections, itertools, copy, Queue import numpy, scipy, math, random import os, sys, time, importlib import tokenize, re, string import json, unicodedata import thread import constraint sys.path.append(os.path.dirname(os.path.dirname(__file__))) from lib import util, constants, nutrition, search, nutrientdatabase, cspclasses constants.init(os.path.dirname(os.path.dirname(__file__))) ## # Function: run # ------------- # csp.py's version of main(). This function is called by write_recipes.py # with arguments given to it. # # verbose: If verbose is True, then status updates should # be printed as csp.py progresses through its solution. ## def run(verbose): traits = initializeTraits(verbose) if traits["verbose"]:
import inspect import json from multiprocessing import Pool from contextlib import closing import thread import threading import time print __file__ sys.path.append(os.path.dirname(os.path.dirname(__file__))) from lib import util from lib import database from lib import constants as c from lib import nutrientdatabase as ndb c.init(os.path.dirname(os.path.dirname(__file__))) #import constraint def printFunctionName(): print "" print "" print "Function: " + inspect.stack()[1][3] print "---------" def test_makeTrigrams(): printFunctionName() myStr = """1 teaspoon's coarse salt, plus more for cooking water. """ correctSplit = [word for word in re.split("([^a-zA-Z0-9_\''])", myStr) if word is not '' and word is not ' ']
import inspect import json from multiprocessing import Pool from contextlib import closing import thread import threading import time print __file__ sys.path.append(os.path.dirname(os.path.dirname(__file__))) from lib import util from lib import database from lib import constants as c from lib import nutrientdatabase as ndb c.init(os.path.dirname(os.path.dirname(__file__))) #import constraint def printFunctionName(): print "" print "" print "Function: " + inspect.stack()[1][3] print "---------" def test_exception1(): printFunctionName() var1 = "yooooo" myDict = {"hi": 1} try:
import collections, itertools, copy import numpy, scipy, math, random import os, sys, time, importlib import tokenize, re, string import json, unicodedata # Import Constants class defined in "./lib/constants.py" # need to create a Constants object with an initialization # argument that is the path of the folder __main__.py is in # because of some weird command line thing import lib.constants as c import bin c.init(os.path.dirname(os.path.realpath(__file__))) ## # Note to Bruno/Alex # ------------------ # Change this variable to change which executable .py file you want to run # if you do not want to specify that file name from the command line. # Choices include "process_recipes", "query_online_db", "write_recipes" ## DEFAULT_EXE_CHOICE = "setup" ## # Function: main # -------------- # argv = ["main.py", <executable>, <args..>] # <executable> is one of: "process_recipes", "query_online_db", "write_recipes" def main(argv): print("In __main__.py, c.PATH_TO_ROOT: ", c.PATH_TO_ROOT) print("In __main__.py, os.path.dirname(__file__): ", os.path.dirname(os.path.realpath(__file__)))
import collections, itertools, copy import numpy, scipy, math, random import os, sys, time, importlib import tokenize, re, string import json, unicodedata # Import Constants class defined in "./lib/constants.py" # need to create a Constants object with an initialization # argument that is the path of the folder __main__.py is in # because of some weird command line thing import lib.constants as c import bin c.init(os.path.dirname(os.path.realpath(__file__))) ## # Note to Bruno/Alex # ------------------ # Change this variable to change which executable .py file you want to run # if you do not want to specify that file name from the command line. # Choices include "process_recipes", "query_online_db", "write_recipes" ## DEFAULT_EXE_CHOICE = "setup" ## # Function: main # -------------- # argv = ["main.py", <executable>, <args..>] # <executable> is one of: "process_recipes", "query_online_db", "write_recipes" def main(argv): print("In __main__.py, c.PATH_TO_ROOT: ", c.PATH_TO_ROOT)