<commit_before># -*- coding: utf-8 -*-

from glob import glob
import os
import random
import sys
import threading
import time

sys.path.append(os.path.join(sys.path[0], '../../'))
import schedule
from instabot import Bot

import config

bot = Bot(comments_file=config.COMMENTS_FILE,
          blacklist_file=config.BLACKLIST_FILE,
          whitelist_file=config.WHITELIST_FILE,
          friends_file=config.FRIENDS_FILE)
bot.login()
bot.logger.info("ULTIMATE script. 24hours save")

random_user_file = instabot.utils.file(config.USERS_FILE)
random_hashtag_file = instabot.utils.file(config.HASHTAGS_FILE)
photo_captions = instabot.utils.file(config.PHOTO_CAPTIONS_FILE)
posted_pic_list = instabot.utils.file(config.POSTED_PICS_FILE).list

# Get the filenames of the photos in the path ->
pics = [os.path.basename(x) for x in glob(config.PICS_PATH + "/*.jpg")]
pics = sorted(pics)


def stats():
    bot.save_user_stats(bot.user_id)


def job1():
    bot.like_hashtag(random_hashtag_file.random(), amount=int(700 / 24))


def job2():
    bot.like_timeline(amount=int(300 / 24))


def job3():
    bot.like_followers(random_user_file.random(), nlikes=3)


def job4():
    bot.follow_followers(random_user_file.random(), nfollows=config.NUMBER_OF_FOLLOWERS_TO_FOLLOW)


def job5():
    bot.comment_medias(bot.get_timeline_medias())


def job6():
    bot.unfollow_non_followers(n_to_unfollows=config.NUMBER_OF_NON_FOLLOWERS_TO_UNFOLLOW)


def job7():
    bot.follow_users(bot.get_hashtag_users(random_hashtag_file.random()))


def job8():  # Comment posts with an hashtag in HASHTAGS_FILE
    hashtag = random_hashtag_file.random()
    bot.logger.info("Commenting on hashtag: " + hashtag)
    bot.comment_hashtag(hashtag)


def job9():  # Automatically post a pic in 'pics' folder
    try:
        for pic in pics:
            if pic in posted_pic_list:
                continue

            caption = photo_captions.random()
            full_caption = caption + "\n" + config.FOLLOW_MESSAGE
            bot.logger.info("Uploading pic with caption: " + caption)
            bot.upload_photo(config.PICS_PATH + pic, caption=full_caption)
            if bot.last_response.status_code != 200:
                bot.logger.error("Something went wrong, read the following ->\n")
                bot.logger.error(bot.last_response)
                break

            if pic not in posted_pic_list:
                # After posting a pic, comment it with all the hashtags specified
                # In config.PICS_HASHTAGS
                posted_pic_list.append(pic)
                with open('pics.txt', 'a') as f:
                    f.write(pic + "\n")
                bot.logger.info("Succesfully uploaded: " + pic)
                bot.logger.info("Commenting uploaded photo with hashtags...")
                medias = bot.get_your_medias()
                last_photo = medias[0]  # Get the last photo posted
                bot.comment(last_photo, config.PICS_HASHTAGS)
                break
    except Exception as e:<commit_msg>Use a more sensible variable name in 'ultimate.py'<commit_after># -*- coding: utf-8 -*-

from glob import glob
import os
import random
import sys
import threading
import time

sys.path.append(os.path.join(sys.path[0], '../../'))
import schedule
from instabot import Bot

import config

bot = Bot(comments_file=config.COMMENTS_FILE,
          blacklist_file=config.BLACKLIST_FILE,
          whitelist_file=config.WHITELIST_FILE,
          friends_file=config.FRIENDS_FILE)
bot.login()
bot.logger.info("ULTIMATE script. 24hours save")

random_user_file = instabot.utils.file(config.USERS_FILE)
random_hashtag_file = instabot.utils.file(config.HASHTAGS_FILE)
photo_captions_file = instabot.utils.file(config.PHOTO_CAPTIONS_FILE)
posted_pic_list = instabot.utils.file(config.POSTED_PICS_FILE).list

# Get the filenames of the photos in the path ->
pics = [os.path.basename(x) for x in glob(config.PICS_PATH + "/*.jpg")]
pics = sorted(pics)


def stats():
    bot.save_user_stats(bot.user_id)


def job1():
    bot.like_hashtag(random_hashtag_file.random(), amount=int(700 / 24))


def job2():
    bot.like_timeline(amount=int(300 / 24))


def job3():
    bot.like_followers(random_user_file.random(), nlikes=3)


def job4():
    bot.follow_followers(random_user_file.random(), nfollows=config.NUMBER_OF_FOLLOWERS_TO_FOLLOW)


def job5():
    bot.comment_medias(bot.get_timeline_medias())


def job6():
    bot.unfollow_non_followers(n_to_unfollows=config.NUMBER_OF_NON_FOLLOWERS_TO_UNFOLLOW)


def job7():
    bot.follow_users(bot.get_hashtag_users(random_hashtag_file.random()))


def job8():  # Comment posts with an hashtag in HASHTAGS_FILE
    hashtag = random_hashtag_file.random()
    bot.logger.info("Commenting on hashtag: " + hashtag)
    bot.comment_hashtag(hashtag)


def job9():  # Automatically post a pic in 'pics' folder
    try:
        for pic in pics:
            if pic in posted_pic_list:
                continue

            caption = photo_captions_file.random()
            full_caption = caption + "\n" + config.FOLLOW_MESSAGE
            bot.logger.info("Uploading pic with caption: " + caption)
            bot.upload_photo(config.PICS_PATH + pic, caption=full_caption)
            if bot.last_response.status_code != 200:
                bot.logger.error("Something went wrong, read the following ->\n")
                bot.logger.error(bot.last_response)
                break

            if pic not in posted_pic_list:
                # After posting a pic, comment it with all the hashtags specified
                # In config.PICS_HASHTAGS
                posted_pic_list.append(pic)
                with open('pics.txt', 'a') as f:
                    f.write(pic + "\n")
                bot.logger.info("Succesfully uploaded: " + pic)
                bot.logger.info("Commenting uploaded photo with hashtags...")
                medias = bot.get_your_medias()
                last_photo = medias[0]  # Get the last photo posted
                bot.comment(last_photo, config.PICS_HASHTAGS)
                break
    except Exception as e:
{'fraction_non_alphanumeric': 0.10388970950270802, 'fraction_numerical': 0.0091908747743312, 'mean_word_length': 2.8692063492063493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6872943', 'n_tokens_mistral': 2103, 'n_tokens_neox': 1974, 'n_words': 410}