Beispiel #1
0
def find_and_add_script_to_current_version(to_find):
    t = reversed(get_available_dictionary_version())
    for version in t:
        version.load()
        if to_find in version.terms:
            version = create_dictionary_version(merge=[version])
            version.upload_to_s3()
            break
Beispiel #2
0
def find_and_add_script_to_current_version(to_find):
    t = reversed(get_available_dictionary_version())
    for version in t:
        version.load()
        if to_find in version.terms:
            version = create_dictionary_version(merge=[version])
            version.upload_to_s3()
            break
Beispiel #3
0
def find_first_version_of_script(sc):
    last = None
    for v in get_available_dictionary_version():
        v = DictionaryVersion(v)
        v.load()
        if sc not in v.terms:
            return last

        last = v
Beispiel #4
0
def find_first_version_of_script(sc):
    last = None
    for v in get_available_dictionary_version():
        v = DictionaryVersion(v)
        v.load()
        if sc not in v.terms:
            return last

        last = v
Beispiel #5
0
def upload_to_s3(dictionary_version):
    s3 = boto3.resource('s3')
    bucket_name = 'ieml-dictionary-versions'
    bucket = s3.Bucket(bucket_name)
    obj = bucket.Object("%s.json" % str(dictionary_version))

    obj.upload_fileobj(io.BytesIO(bytes(dictionary_version.json(), 'utf-8')))
    obj.Acl().put(ACL='public-read')

    assert dictionary_version in get_available_dictionary_version()
Beispiel #6
0
def upload_to_s3(dictionary_version):
    s3 = boto3.resource('s3')
    bucket_name = 'ieml-dictionary-versions'
    bucket = s3.Bucket(bucket_name)
    obj = bucket.Object("%s.json" % str(dictionary_version))

    obj.upload_fileobj(io.BytesIO(bytes(dictionary_version.json(), 'utf-8')))
    obj.Acl().put(ACL='public-read')

    assert dictionary_version in get_available_dictionary_version()
Beispiel #7
0
 def test_dictionary(self):
     for v in get_available_dictionary_version()[:6]:
         d = Dictionary(v)
         for t in d:
             self.assertEqual(t.dictionary, d)
Beispiel #8
0
 def test_dictionary(self):
     for v in get_available_dictionary_version()[:6]:
         d = Dictionary(v)
         for t in d:
             self.assertEqual(t.dictionary, d)