def push(OK): with open('ok.py', 'wt') as f: json.dump(OK, f) from client.api.notebook import Notebook ok = Notebook('ok.py') ok.auth(inline=True) ok.submit()
def __client__(assignment_type, force_auth): ok = Notebook(assignment_type) if force_auth: ok.auth(force=True) elif not _os.path.exists( _os.path.join(_os.environ.get("HOME"), ".config/ok/auth_refresh")): ok.auth(force=True) else: ok.auth(inline=True) return ok
from datascience import * import matplotlib.pyplot as plots plots.style.use('fivethirtyeight') import numpy as np from client.api.notebook import Notebook ok = Notebook('project01.ok') _ = ok.auth(inline=True)
#NEWCELL #Checks function. #def check_get_hashtags(file,hashtag,answer): # with open(file) as json_file: # statuses = json.load(json_file) # other_hashtags = get_hashtags(statuses, hashtag) # #print(other_hashtags) # other_hashtags = [s.replace('#', '') for s in other_hashtags] # if other_hashtags==answer: # return True # else: # return False #NEWCELL ok = Notebook(cf['ok_file']) _ = ok.auth(inline=False) results = { q[:-3]: ok.grade(q[:-3]) for q in os.listdir("tests") if q.startswith('q') } #NEWCELL import autograde as ag importlib.reload(ag) def output_tests(cf, results): autograde = {} autograde['github_id'] = cf['github_id'] #This is a selection of variables from config file. for s in cf['variables']: