<commit_before>

import googlemaps
import json
import threading
import time
from pgoapi import PGoApi
from pgoapi.utilities import f2i, h2f
from math import radians, sqrt, sin, cos, atan2

GOOGLEMAPS_KEY = "<KEY>"

working_thread=None
gmaps = googlemaps.Client(key=GOOGLEMAPS_KEY)

def spawn_point_work(spawn_point,api,position):
	lat=spawn_point['latitude']
	lng=spawn_point['longitude']
	position=(lat,lng,0.0)
	api.set_position(*position)
	api.player_update(latitude=lat,longitude=lng)
	response_dict = api.call()
	print('Response dictionary 1: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(2)
	api.player_update(latitude=lat,longitude=lng)
	response_dict = api.call()
	print('Response dictionary 1: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(2)
def convert_toposition(lat,lng,art):
    return (lat, lng, art)
def encount_and_catch_pokemon(pokemon,api,position):
	encounter_id=pokemon['encounter_id']
	spawnpoint_id = pokemon['spawnpoint_id']
	player_latitude = pokemon['latitude']
	player_longitude = pokemon['longitude']
	api.encounter(encounter_id=encounter_id,spawnpoint_id=spawnpoint_id,player_latitude=player_latitude,player_longitude=player_longitude)
	response_dict = api.call()
	print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	if 'responses' in response_dict:
		if 'ENCOUNTER' in response_dict['responses']:
			if 'status' in response_dict['responses']['ENCOUNTER']:
				if response_dict['responses']['ENCOUNTER']['status'] is 1:
					api.catch_pokemon(encounter_id = encounter_id,
						pokeball = 1,
						normalized_reticle_size = 1.950,
						spawn_point_guid = spawnpoint_id,
						hit_pokemon = 1,
						spin_modifier = 1,
						NormalizedHitPosition = 1)
					response_dict = api.call()
					print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(5)

def transfer_low_cp_pokomon(api,value):
	api.get_inventory()
	response_dict = api.call()
	print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	if 'responses' in response_dict:
		if 'GET_INVENTORY' in response_dict['responses']:
			if 'inventory_delta' in response_dict['responses']['GET_INVENTORY']:
				if 'inventory_items' in response_dict['responses']['GET_INVENTORY']['inventory_delta']:
					for item in response_dict['responses']['GET_INVENTORY']['inventory_delta']['inventory_items']:
						#print('item {}'.format(item))
						if 'inventory_item_data' in item:
							if 'pokemon' in item['inventory_item_data']:
								pokemon = item['inventory_item_data']['pokemon']
								if 'cp' in pokemon and pokemon['cp'] < value:
									print('need release this pokemon: {}'.format(pokemon))
									api.release_pokemon(pokemon_id=pokemon['id'])
									response_dict = api.call()
									print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
									time.sleep(1.2)

def search_seen_fort(fort,api,position):<commit_msg>Fixed exception.<commit_after>

import googlemaps
import json
import threading
import time
from pgoapi import PGoApi
from pgoapi.utilities import f2i, h2f
from math import radians, sqrt, sin, cos, atan2

GOOGLEMAPS_KEY = "<KEY>"

working_thread=None
gmaps = googlemaps.Client(key=GOOGLEMAPS_KEY)

def spawn_point_work(spawn_point,api,position):
	lat=spawn_point['latitude']
	lng=spawn_point['longitude']
	position=(lat,lng,0.0)
	api.set_position(*position)
	api.player_update(latitude=lat,longitude=lng)
	response_dict = api.call()
	print('Response dictionary 1: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(2)
	api.player_update(latitude=lat,longitude=lng)
	response_dict = api.call()
	print('Response dictionary 1: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(2)
def convert_toposition(lat,lng,art):
    return (lat, lng, art)
def encount_and_catch_pokemon(pokemon,api,position):
	encounter_id=pokemon['encounter_id']
	spawnpoint_id = pokemon['spawnpoint_id']
	player_latitude = pokemon['latitude']
	player_longitude = pokemon['longitude']
	api.encounter(encounter_id=encounter_id,spawnpoint_id=spawnpoint_id,player_latitude=player_latitude,player_longitude=player_longitude)
	response_dict = api.call()
	print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	if response_dict and 'responses' in response_dict:
		if 'ENCOUNTER' in response_dict['responses']:
			if 'status' in response_dict['responses']['ENCOUNTER']:
				if response_dict['responses']['ENCOUNTER']['status'] is 1:
					api.catch_pokemon(encounter_id = encounter_id,
						pokeball = 1,
						normalized_reticle_size = 1.950,
						spawn_point_guid = spawnpoint_id,
						hit_pokemon = 1,
						spin_modifier = 1,
						NormalizedHitPosition = 1)
					response_dict = api.call()
					print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	time.sleep(5)
def _transfer_low_cp_pokemon(api,value,pokemon):
	if 'cp' in pokemon and pokemon['cp'] < value:
		print('need release this pokemon: {}'.format(pokemon))
		api.release_pokemon(pokemon_id=pokemon['id'])
		response_dict = api.call()
		print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))

def transfer_low_cp_pokomon(api,value):
	api.get_inventory()
	response_dict = api.call()
	print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
	if 'responses' in response_dict:
		if 'GET_INVENTORY' in response_dict['responses']:
			if 'inventory_delta' in response_dict['responses']['GET_INVENTORY']:
				if 'inventory_items' in response_dict['responses']['GET_INVENTORY']['inventory_delta']:
					for item in response_dict['responses']['GET_INVENTORY']['inventory_delta']['inventory_items']:
						#print('item {}'.format(item))
						if 'inventory_item_data' in item:
							if 'pokemon' in item['inventory_item_data']:
								pokemon = item['inventory_item_data']['pokemon']
								_transfer_low_cp_pokemon(api,value,pokemon)
								time.sleep(1.2)

def search_seen_fort(fort,api,position):
{'fraction_non_alphanumeric': 0.1382059800664452, 'fraction_numerical': 0.008970099667774087, 'mean_word_length': 6.117021276595745, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7164244', 'n_tokens_mistral': 2415, 'n_tokens_neox': 2145, 'n_words': 359}