def get(self, dset_name): dset = get_dset(dset_name) classical = dset.classical worker_jobs.calculate_entailments(dset_name) return render_template('entailments.html', dset_name=dset_name, apriori=dset.apriori_ranking.string, classical=classical)
def test_guest_dset_user_logged_in(self): # john, Kiparsky --> correct dset with self.client: self.client.post(url_for('users.login'), data={'username': '******', 'password': '******'}) dset = get_dset('Kiparsky') assert dset.user == "guest" assert dset.name == "Kiparsky"
def test_user_dset_logged_in_dset(self): # john, test --> correct dset if logged in with self.client: self.client.post(url_for('users.login'), data={'username': '******', 'password': '******'}) dset = get_dset('test') assert dset.name == 'test' assert dset.user == 'john'
def post(self): data = json.loads(request.data) try: data['apriori_ranking'] = json.dumps(data['apriori_ranking']) except KeyError: data['apriori_ranking'] = '[]' dset = Dataset(data, data_is_from_form=True) dset.user = get_username() try: old_dset = get_dset(dset.name) old_dset.remove_old_files() old_dset.delete() except HTTPException: pass try: dset.save() except: abort(422) return 'successfully saved'
def _create_copy_of_dset(self): self.dset = get_dset(self.dset_name) self.dset.name = self.dset.name + "-copy" self.dset.id = None
def _initialize_dset(self, dset_name): self.dset = get_dset(dset_name) self.dset.global_stats_calculated = False self.dset.grammar_stats_calculated = False self.dset.save()
def post(self, dset_name): dset = get_dset(dset_name) dset.apriori_ranking = json.loads(request.form['apriori']) dset.entailments_calculated = False dset.save() return redirect(url_for('.entailments', dset_name=dset_name))
def _setup_for_get(self, dset_name, sort_value): self.dset_name = dset_name self.dset = get_dset(dset_name) self.sort_value = sort_value self.classical, self.page, self.sort_by = get_url_args()
def _setup_for_get(self, dset_name, sort_value): self.dset = get_dset(dset_name) self.dset_name = dset_name self.sort_value = sort_value self.classical, self.page, self.sort_by = get_url_args() self.return_dict = {'finished': False}
def get(self, dset_name): dset = get_dset(dset_name) if dset.entailments_calculated and dset.entailments_visualized: return "true" else: return "false"
def _edit_get_html(self): dset = get_dset(self.dset_name) return json.dumps(dset.create_form_data())
def test_user_dset_not_logged_in_using_username(self): # test, john --> correct dset dset = get_dset('test', username='******') assert dset.name == 'test' assert dset.user == 'john'
def _delete_old_version(self): self.dset = Dataset(data=self.form.data, data_is_from_form=True) old_dset = get_dset(self.dset_name) self.dset.user = old_dset.user old_dset.delete() self.dset.remove_old_files()
def _change_dset_user(self): dset = get_dset(self.dset_name) dset.user = get_username() dset.save() flash("Saved %s as %s!" % (dset.name, dset.user))
def get(self, dset_name): d = get_dset(dset_name) d.delete() return "deletion of %s successful" % d.name
def test_user_dset_not_logged_in(self): # john, test --> 404 if not logged in get_dset('test')
def test_guest_dset_url_unquoted(self): # guest, CV Syllabification --> correct dset dset = get_dset("CV Syllabification") assert dset.user == "guest" assert dset.name == "CV Syllabification"
def test_guest_dset_no_urlquote(self): # guest, Kiparsky --> correct dset dset = get_dset("Kiparsky") assert dset.user == "guest" assert dset.name == "Kiparsky"