<commit_before># See: http://omz-forums.appspot.com/editorial/post/5906215083180032

# NOTE: This is probably superceeded by the "Sync with Dropbox" capability
# See: https://omz-forums.appspot.com/editorial/post/5906215083180032

import dropboxlogin, time  # noqa

dropbox_client = dropboxlogin.get_client()


def dropbox_change_watcher(file_path, seconds_to_sleep=2):
    original_revision = dropbox_client.metadata(file_path)['revision']
    while True:
        metadata = dropbox_client.metadata(file_path)
        if metadata['revision'] == original_revision:
            time.sleep(seconds_to_sleep)
        else:
            return metadata

if __name__ == '__main__':
    import os, pprint  # noqa
    file_path_to_watch = os.path.split(__file__)[1]  # just for testing/debug
    print(file_path_to_watch)
    pprint.pprint(dropbox_change_watcher(file_path_to_watch))
    print('Done.')<commit_msg>plac8 flake8<commit_after># See: http://omz-forums.appspot.com/editorial/post/5906215083180032

# NOTE: This is probably superceeded by the "Sync with Dropbox" capability
# See: https://omz-forums.appspot.com/editorial/post/5906215083180032

import dropboxlogin, time  # noqa

dropbox_client = dropboxlogin.get_client()


def dropbox_change_watcher(file_path, seconds_to_sleep=2):
    original_revision = dropbox_client.metadata(file_path)['revision']
    while True:
        metadata = dropbox_client.metadata(file_path)
        if metadata['revision'] == original_revision:
            time.sleep(seconds_to_sleep)
        else:
            return metadata


if __name__ == '__main__':
    import os, pprint  # noqa
    file_path_to_watch = os.path.split(__file__)[1]  # just for testing/debug
    print(file_path_to_watch)
    pprint.pprint(dropbox_change_watcher(file_path_to_watch))
    print('Done.')
{'fraction_non_alphanumeric': 0.10154525386313466, 'fraction_numerical': 0.03863134657836645, 'mean_word_length': 4.19484240687679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2611431', 'n_tokens_mistral': 656, 'n_tokens_neox': 611, 'n_words': 106}