<commit_before>import json

from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot import logger

class InitialTransferWorker(object):
    def __init__(self, bot):
        self.config = bot.config
        self.pokemon_list = bot.pokemon_list
        self.api = bot.api

    def work(self):
        if not self.config.initial_transfer:
            return

        logger.log('Cleaning up Pokemon Bag using the release config', 'cyan')

        pokemon_groups = self._initial_transfer_get_groups()

        for id in pokemon_groups:

            group_cp = pokemon_groups[id].keys()

            if len(group_cp) > 1:
                group_cp.sort()
                group_cp.reverse()


                for x in range(1, len(group_cp)):
                    pokemon_name = self.pokemon_list[id - 1]['Name']
                    pokemon_cp = group_cp[x]
                    pokemon_data = pokemon_groups[id][pokemon_cp]
                    pokemon_potential = self.get_pokemon_potential(pokemon_data)
                    if self.should_release_pokemon(pokemon_name, pokemon_cp, pokemon_potential):
                        logger.log('Exchanging {} [CP {}] [Potential {}]'.format(
                            pokemon_name, pokemon_cp, pokemon_potential))
                        self.api.release_pokemon(
                            pokemon_id=pokemon_data['id'])
                        response_dict = self.api.call()
                        sleep(2)

        logger.log('Pokemon Bag has been cleaned up!', 'green')
<commit_msg>Fixing logspam for transferring pokemon (#1164)<commit_after>import json

from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot import logger

class InitialTransferWorker(object):
    def __init__(self, bot):
        self.config = bot.config
        self.pokemon_list = bot.pokemon_list
        self.api = bot.api

    def work(self):
        if not self.config.initial_transfer:
            return

        pokemon_groups = self._initial_transfer_get_groups()


        has_transferred = False

        for id in pokemon_groups:

            group_cp = pokemon_groups[id].keys()

            if len(group_cp) > 1:
                group_cp.sort()
                group_cp.reverse()

                for x in range(1, len(group_cp)):
                    pokemon_name = self.pokemon_list[id - 1]['Name']
                    pokemon_cp = group_cp[x]
                    pokemon_data = pokemon_groups[id][pokemon_cp]
                    pokemon_potential = self.get_pokemon_potential(pokemon_data)
                    if self.should_release_pokemon(pokemon_name, pokemon_cp, pokemon_potential):
                        if not has_transferred:
                            logger.log('Cleaning up Pokemon Bag using the release config', 'cyan')
                            has_transferred = True

                        logger.log('Exchanging {} [CP {}] [Potential {}]'.format(
                            pokemon_name, pokemon_cp, pokemon_potential))
                        self.api.release_pokemon(
                            pokemon_id=pokemon_data['id'])
                        response_dict = self.api.call()
                        sleep(2)

        if has_transferred:
            logger.log('Pokemon Bag has been cleaned up!', 'green')

{'fraction_non_alphanumeric': 0.08297872340425531, 'fraction_numerical': 0.00364741641337386, 'mean_word_length': 1.7470784641068446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4760096', 'n_tokens_mistral': 966, 'n_tokens_neox': 912, 'n_words': 186}