How to use update_vocabulary method in localstack

Best Python code snippet using localstack_python

admin.py

Source:admin.py Github

copy

Full Screen

...31 super(AgeTermAdmin, self).__init__(*args, **kwargs)32 self.list_display_links = (None,)33 34class VocabAdmin(admin.ModelAdmin):35 def update_vocabulary(self, obj):36 return "<a href='/ncgmp/vocab/%s/update/'>Update</a>" % obj.id37 update_vocabulary.allow_tags = True38 39 def number_of_terms(self, obj):40 return obj.vocabularyconcept_set.all().count() + obj.ageterm_set.all().count()41 42 def view_terms(self, obj):43 if obj.name == "ICSTimeScale":44 return "<a href='/admin/ncgmp/ageterm/?vocabulary__id__exact=%s'>%s Terms</a>" % (obj.id, obj.name)45 else:46 return "<a href='/admin/ncgmp/vocabularyconcept/?vocabulary__id__exact=%s'>%s Terms</a>" % (obj.id, obj.name)47 view_terms.allow_tags = True48 49 list_display = ('__unicode__', 'number_of_terms', 'view_terms', 'update_vocabulary')...

Full Screen

Full Screen

_update_vocabulary.py

Source:_update_vocabulary.py Github

copy

Full Screen

1import os.path2import yaml3import natlink4import dragonfly5def update_vocabulary():6 file_name = os.path.join(os.path.dirname(__file__), "vocabulary.yaml")7 with open(file_name, "r") as stream:8 vocabulary = yaml.load(stream)9 for word in vocabulary["add"]:10 natlink.addWord(word)11 for word in vocabulary["delete"]:12 try:13 natlink.deleteWord(word)14 print "removed " + repr(word) + " from vocabulary"15 except natlink.UnknownName:16 pass17update_vocabulary()18class UpdateVocabulary(dragonfly.CompoundRule):19 spec = "update vocabulary"20 def _process_recognition(self, node, extras):21 update_vocabulary()22grammar = dragonfly.Grammar("update_vocabulary")23grammar.add_rule(UpdateVocabulary())24grammar.load()25def unload():26 global grammar27 if grammar:28 grammar.unload()...

Full Screen

Full Screen

events.py

Source:events.py Github

copy

Full Screen

...9 utility = queryUtility(IDynamicVocabUtility)10 utility.add_term_to_vocabulary(vocab, obj)11def unregister_vocabulary(obj, event):12 pass13def update_vocabulary(obj, event):14 utility = queryUtility(IDynamicVocabUtility)15 utility.update_vocabulary(obj)16def remove_term(obj, event):17 vocab = obj.aq_parent18 utility = queryUtility(IDynamicVocabUtility)19 utility.update_vocabulary(vocab)20def update_term(obj, event):21 vocab = obj.aq_parent22 utility = queryUtility(IDynamicVocabUtility)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful