

def main():
    init_app('website.settings', set_backends=True, routes=False)
    if ('dry' in sys.argv):
        if ('list' in sys.argv):
            logger.info('=== Users not provisioned in Piwik ===')
            for user in get_users():
                logger.info(user._id)
        else:
            logger.info('{} Users to be updated'.format(get_users().count()))
    else:
        scripts_utils.add_file_logger(logger, __file__)
        users = get_users()
        logger.info('=== Updating {} Users ==='.format(users.count()))
        for user in users:
            piwik._create_user(user)
            logger.info(user._id)

dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/consistency/ensure_piwik_users.py main/original