<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
import os

from collector.acled_africa import generate_urls
from collector.parser import parse
from collector.register import create_datasets, create_resources, create_gallery_items


def main():
    '''
    Wrapper.

    '''
    server = 'http://test-data.hdx.rwlabs.org'
    objects = generate_urls()
    parsed_data = parse(objects)

    create_datasets(datasets=parsed_data['datasets'],
                    hdx_site=server, apikey=os.getenv('HDX_KEY'))

    create_resources(resources=parsed_data['resources'],
                     hdx_site=server, apikey=os.getenv('HDX_KEY'))

    create_gallery_items(gallery_items=parsed_data['gallery_items'],
                         hdx_site=server, apikey=os.getenv('HDX_KEY'))


if __name__ == '__main__':
    main()<commit_msg>Make subsequent runs only update resources<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
import os

from collector.acled_africa import generate_urls
from collector.parser import parse
from collector.register import create_datasets, create_resources, create_gallery_items


def main():
    '''
    Wrapper.

    '''
    firstrun = False
    server = 'http://test-data.hdx.rwlabs.org'
    objects = generate_urls()
    parsed_data = parse(objects)

    if firstrun:
        create_datasets(datasets=parsed_data['datasets'],
                        hdx_site=server, apikey=os.getenv('HDX_KEY'))
        create_gallery_items(gallery_items=parsed_data['gallery_items'],
                             hdx_site=server, apikey=os.getenv('HDX_KEY'))

    create_resources(resources=parsed_data['resources'],
                     hdx_site=server, apikey=os.getenv('HDX_KEY'))



if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.11919770773638969, 'fraction_numerical': 0.001146131805157593, 'mean_word_length': 3.311111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6756905', 'n_tokens_mistral': 562, 'n_tokens_neox': 538, 'n_words': 90}