{"action":"created","comment":{"url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/comments/72295972","id":72295972,"diff_hunk":"@@ -439,31 +441,39 @@ def cleanup_pokemon(self, inventory_items=None):\n             if len(pokemons) > self.MIN_SIMILAR_POKEMON:\n                 # highest CP pokemon first\n                 pokemons = sorted(pokemons, key=lambda pok: (pok.cp, pok.iv), reverse=True)\n-                pokemons_keep_counter = 0\n-                pokemons_keep_iv_counter = 0\n+                self._pokemons_keep_counter = 0\n+                self._pokemons_keep_iv_counter = 0\n \n                 for pokemon in pokemons:\n-                    # never release favorites and other defined pokemons\n-                    if pokemon.is_favorite or pokemon.pokemon_id in self.keep_pokemon_ids:\n-                        pokemons_keep_counter += 1\n-                        continue\n-                    # release defined throwaway pokemons\n-                    elif pokemon.pokemon_id in self.throw_pokemon_ids:\n-                        self.do_release_pokemon(pokemon)\n-                    # keep high-iv pokemons based on config values\n-                    elif pokemon.iv > self.KEEP_IV_OVER and pokemons_keep_iv_counter < self.MAX_POKEMON_HIGH_IV and \\\n-                                    pokemon.cp > (pokemons[0].cp * self.KEEP_IV_MIN_PERCENT_CP / 100):\n-                        pokemons_keep_iv_counter += 1\n-                        pokemons_keep_counter += 1\n-                        continue\n-                    # keep high-cp pokemons and first MIN_SIMILAR_POKEMON amount of pokemons\n-                    elif pokemon.cp > self.KEEP_CP_OVER or pokemons_keep_counter < self.MIN_SIMILAR_POKEMON:\n-                        pokemons_keep_counter += 1\n-                        continue\n-                    # release all other pokemons\n-                    else:\n+                    if self.is_pokemon_eligible_for_transfer(pokemon, pokemons[0]):\n                         self.do_release_pokemon(pokemon)\n \n+                # reset the counters just in case\n+                self._pokemons_keep_iv_counter = 0\n+                self._pokemons_keep_counter = 0\n+\n+    def is_pokemon_eligible_for_transfer(self, pokemon, best_pokemon=None):","path":"pgoapi/pgoapi.py","position":89,"original_position":54,"commit_id":"5429e785bbb62a6177b1cbfbd82e5bd2ead2b7e0","original_commit_id":"892d52f2f3e1ab46288dce89ad7b80991d14387b","user":{"login":"joychugh","id":6256216,"avatar_url":"https://avatars.githubusercontent.com/u/6256216?v=3","gravatar_id":"","url":"https://api.github.com/users/joychugh","html_url":"https://github.com/joychugh","followers_url":"https://api.github.com/users/joychugh/followers","following_url":"https://api.github.com/users/joychugh/following{/other_user}","gists_url":"https://api.github.com/users/joychugh/gists{/gist_id}","starred_url":"https://api.github.com/users/joychugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joychugh/subscriptions","organizations_url":"https://api.github.com/users/joychugh/orgs","repos_url":"https://api.github.com/users/joychugh/repos","events_url":"https://api.github.com/users/joychugh/events{/privacy}","received_events_url":"https://api.github.com/users/joychugh/received_events","type":"User","site_admin":false},"body":"i'll do that, ill merge this.","created_at":"2016-07-26T17:21:30Z","updated_at":"2016-07-26T17:21:30Z","html_url":"https://github.com/j-e-k/pgoapi/pull/110#discussion_r72295972","pull_request_url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110","_links":{"self":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/comments/72295972"},"html":{"href":"https://github.com/j-e-k/pgoapi/pull/110#discussion_r72295972"},"pull_request":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110","id":78853679,"html_url":"https://github.com/j-e-k/pgoapi/pull/110","diff_url":"https://github.com/j-e-k/pgoapi/pull/110.diff","patch_url":"https://github.com/j-e-k/pgoapi/pull/110.patch","issue_url":"https://api.github.com/repos/j-e-k/pgoapi/issues/110","number":110,"state":"open","locked":false,"title":"New release algorythm","user":{"login":"destiny117","id":3976393,"avatar_url":"https://avatars.githubusercontent.com/u/3976393?v=3","gravatar_id":"","url":"https://api.github.com/users/destiny117","html_url":"https://github.com/destiny117","followers_url":"https://api.github.com/users/destiny117/followers","following_url":"https://api.github.com/users/destiny117/following{/other_user}","gists_url":"https://api.github.com/users/destiny117/gists{/gist_id}","starred_url":"https://api.github.com/users/destiny117/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/destiny117/subscriptions","organizations_url":"https://api.github.com/users/destiny117/orgs","repos_url":"https://api.github.com/users/destiny117/repos","events_url":"https://api.github.com/users/destiny117/events{/privacy}","received_events_url":"https://api.github.com/users/destiny117/received_events","type":"User","site_admin":false},"body":"changed config value `MIN_KEEP_IV` to `KEEP_IV_OVER` to better reflect its functionality\r\n\r\nadded config values:\r\n```\r\n\"KEEP_IV_MIN_PERCENT_CP\": 0,\r\n\"MAX_POKEMON_HIGH_IV\": 999,\r\n```\r\n\r\nwith the default values, the behavior will be the same as before\r\n\r\nexample of using those values:\r\n\r\n- setting `KEEP_IV_MIN_PERCENT_CP` to 60 means whenever we want to keep a pokemon because of `KEEP_IV_OVER`, we also check if it has at least 60% of the CP the best pokemon of its type has, so if our best Eevee has 100 CP and the one with 100 IV has only 20 CP, it will be ignored because its below 60 (60% of 100)\r\n- setting `MAX_POKEMON_HIGH_IV` to 2 means we will throw away any pokemon with high IV values after we kept the first 2 above the IV threshold (order still based on their CP)\r\n\r\nI implemented this because its basically the way i do it when i play normally. I dont want to keep very low CP pokemons just because they have a good IV value.\r\n\r\nMabye its a bit complicated to understand? Though with default values it should not change the previous behavior.\r\n\r\nOpen for any feedback","created_at":"2016-07-26T13:42:59Z","updated_at":"2016-07-26T17:21:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b083af5d9fa8f104d53361aa9175a824fe4de321","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110/commits","review_comments_url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110/comments","review_comment_url":"https://api.github.com/repos/j-e-k/pgoapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/j-e-k/pgoapi/issues/110/comments","statuses_url":"https://api.github.com/repos/j-e-k/pgoapi/statuses/5429e785bbb62a6177b1cbfbd82e5bd2ead2b7e0","head":{"label":"destiny117:new-release-algorythm","ref":"new-release-algorythm","sha":"5429e785bbb62a6177b1cbfbd82e5bd2ead2b7e0","user":{"login":"destiny117","id":3976393,"avatar_url":"https://avatars.githubusercontent.com/u/3976393?v=3","gravatar_id":"","url":"https://api.github.com/users/destiny117","html_url":"https://github.com/destiny117","followers_url":"https://api.github.com/users/destiny117/followers","following_url":"https://api.github.com/users/destiny117/following{/other_user}","gists_url":"https://api.github.com/users/destiny117/gists{/gist_id}","starred_url":"https://api.github.com/users/destiny117/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/destiny117/subscriptions","organizations_url":"https://api.github.com/users/destiny117/orgs","repos_url":"https://api.github.com/users/destiny117/repos","events_url":"https://api.github.com/users/destiny117/events{/privacy}","received_events_url":"https://api.github.com/users/destiny117/received_events","type":"User","site_admin":false},"repo":{"id":64219656,"name":"pgoapi","full_name":"destiny117/pgoapi","owner":{"login":"destiny117","id":3976393,"avatar_url":"https://avatars.githubusercontent.com/u/3976393?v=3","gravatar_id":"","url":"https://api.github.com/users/destiny117","html_url":"https://github.com/destiny117","followers_url":"https://api.github.com/users/destiny117/followers","following_url":"https://api.github.com/users/destiny117/following{/other_user}","gists_url":"https://api.github.com/users/destiny117/gists{/gist_id}","starred_url":"https://api.github.com/users/destiny117/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/destiny117/subscriptions","organizations_url":"https://api.github.com/users/destiny117/orgs","repos_url":"https://api.github.com/users/destiny117/repos","events_url":"https://api.github.com/users/destiny117/events{/privacy}","received_events_url":"https://api.github.com/users/destiny117/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/destiny117/pgoapi","description":"A basic poorly hacked together bot for Pokemon go (But actually, the first and probably most advanced)","fork":true,"url":"https://api.github.com/repos/destiny117/pgoapi","forks_url":"https://api.github.com/repos/destiny117/pgoapi/forks","keys_url":"https://api.github.com/repos/destiny117/pgoapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/destiny117/pgoapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/destiny117/pgoapi/teams","hooks_url":"https://api.github.com/repos/destiny117/pgoapi/hooks","issue_events_url":"https://api.github.com/repos/destiny117/pgoapi/issues/events{/number}","events_url":"https://api.github.com/repos/destiny117/pgoapi/events","assignees_url":"https://api.github.com/repos/destiny117/pgoapi/assignees{/user}","branches_url":"https://api.github.com/repos/destiny117/pgoapi/branches{/branch}","tags_url":"https://api.github.com/repos/destiny117/pgoapi/tags","blobs_url":"https://api.github.com/repos/destiny117/pgoapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/destiny117/pgoapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/destiny117/pgoapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/destiny117/pgoapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/destiny117/pgoapi/statuses/{sha}","languages_url":"https://api.github.com/repos/destiny117/pgoapi/languages","stargazers_url":"https://api.github.com/repos/destiny117/pgoapi/stargazers","contributors_url":"https://api.github.com/repos/destiny117/pgoapi/contributors","subscribers_url":"https://api.github.com/repos/destiny117/pgoapi/subscribers","subscription_url":"https://api.github.com/repos/destiny117/pgoapi/subscription","commits_url":"https://api.github.com/repos/destiny117/pgoapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/destiny117/pgoapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/destiny117/pgoapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/destiny117/pgoapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/destiny117/pgoapi/contents/{+path}","compare_url":"https://api.github.com/repos/destiny117/pgoapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/destiny117/pgoapi/merges","archive_url":"https://api.github.com/repos/destiny117/pgoapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/destiny117/pgoapi/downloads","issues_url":"https://api.github.com/repos/destiny117/pgoapi/issues{/number}","pulls_url":"https://api.github.com/repos/destiny117/pgoapi/pulls{/number}","milestones_url":"https://api.github.com/repos/destiny117/pgoapi/milestones{/number}","notifications_url":"https://api.github.com/repos/destiny117/pgoapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/destiny117/pgoapi/labels{/name}","releases_url":"https://api.github.com/repos/destiny117/pgoapi/releases{/id}","deployments_url":"https://api.github.com/repos/destiny117/pgoapi/deployments","created_at":"2016-07-26T12:30:28Z","updated_at":"2016-07-26T12:30:29Z","pushed_at":"2016-07-26T15:05:53Z","git_url":"git://github.com/destiny117/pgoapi.git","ssh_url":"git@github.com:destiny117/pgoapi.git","clone_url":"https://github.com/destiny117/pgoapi.git","svn_url":"https://github.com/destiny117/pgoapi","homepage":"","size":2417,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"j-e-k:develop","ref":"develop","sha":"7c826674b97f03813344085f38aa07bbf0f07267","user":{"login":"j-e-k","id":2546697,"avatar_url":"https://avatars.githubusercontent.com/u/2546697?v=3","gravatar_id":"","url":"https://api.github.com/users/j-e-k","html_url":"https://github.com/j-e-k","followers_url":"https://api.github.com/users/j-e-k/followers","following_url":"https://api.github.com/users/j-e-k/following{/other_user}","gists_url":"https://api.github.com/users/j-e-k/gists{/gist_id}","starred_url":"https://api.github.com/users/j-e-k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-e-k/subscriptions","organizations_url":"https://api.github.com/users/j-e-k/orgs","repos_url":"https://api.github.com/users/j-e-k/repos","events_url":"https://api.github.com/users/j-e-k/events{/privacy}","received_events_url":"https://api.github.com/users/j-e-k/received_events","type":"User","site_admin":false},"repo":{"id":63714996,"name":"pgoapi","full_name":"j-e-k/pgoapi","owner":{"login":"j-e-k","id":2546697,"avatar_url":"https://avatars.githubusercontent.com/u/2546697?v=3","gravatar_id":"","url":"https://api.github.com/users/j-e-k","html_url":"https://github.com/j-e-k","followers_url":"https://api.github.com/users/j-e-k/followers","following_url":"https://api.github.com/users/j-e-k/following{/other_user}","gists_url":"https://api.github.com/users/j-e-k/gists{/gist_id}","starred_url":"https://api.github.com/users/j-e-k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-e-k/subscriptions","organizations_url":"https://api.github.com/users/j-e-k/orgs","repos_url":"https://api.github.com/users/j-e-k/repos","events_url":"https://api.github.com/users/j-e-k/events{/privacy}","received_events_url":"https://api.github.com/users/j-e-k/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/j-e-k/pgoapi","description":"A basic poorly hacked together bot for Pokemon go (But actually, the first and probably most advanced)","fork":true,"url":"https://api.github.com/repos/j-e-k/pgoapi","forks_url":"https://api.github.com/repos/j-e-k/pgoapi/forks","keys_url":"https://api.github.com/repos/j-e-k/pgoapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/j-e-k/pgoapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/j-e-k/pgoapi/teams","hooks_url":"https://api.github.com/repos/j-e-k/pgoapi/hooks","issue_events_url":"https://api.github.com/repos/j-e-k/pgoapi/issues/events{/number}","events_url":"https://api.github.com/repos/j-e-k/pgoapi/events","assignees_url":"https://api.github.com/repos/j-e-k/pgoapi/assignees{/user}","branches_url":"https://api.github.com/repos/j-e-k/pgoapi/branches{/branch}","tags_url":"https://api.github.com/repos/j-e-k/pgoapi/tags","blobs_url":"https://api.github.com/repos/j-e-k/pgoapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/j-e-k/pgoapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/j-e-k/pgoapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/j-e-k/pgoapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/j-e-k/pgoapi/statuses/{sha}","languages_url":"https://api.github.com/repos/j-e-k/pgoapi/languages","stargazers_url":"https://api.github.com/repos/j-e-k/pgoapi/stargazers","contributors_url":"https://api.github.com/repos/j-e-k/pgoapi/contributors","subscribers_url":"https://api.github.com/repos/j-e-k/pgoapi/subscribers","subscription_url":"https://api.github.com/repos/j-e-k/pgoapi/subscription","commits_url":"https://api.github.com/repos/j-e-k/pgoapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/j-e-k/pgoapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/j-e-k/pgoapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/j-e-k/pgoapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/j-e-k/pgoapi/contents/{+path}","compare_url":"https://api.github.com/repos/j-e-k/pgoapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/j-e-k/pgoapi/merges","archive_url":"https://api.github.com/repos/j-e-k/pgoapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/j-e-k/pgoapi/downloads","issues_url":"https://api.github.com/repos/j-e-k/pgoapi/issues{/number}","pulls_url":"https://api.github.com/repos/j-e-k/pgoapi/pulls{/number}","milestones_url":"https://api.github.com/repos/j-e-k/pgoapi/milestones{/number}","notifications_url":"https://api.github.com/repos/j-e-k/pgoapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/j-e-k/pgoapi/labels{/name}","releases_url":"https://api.github.com/repos/j-e-k/pgoapi/releases{/id}","deployments_url":"https://api.github.com/repos/j-e-k/pgoapi/deployments","created_at":"2016-07-19T17:38:59Z","updated_at":"2016-07-26T17:13:51Z","pushed_at":"2016-07-26T17:21:01Z","git_url":"git://github.com/j-e-k/pgoapi.git","ssh_url":"git@github.com:j-e-k/pgoapi.git","clone_url":"https://github.com/j-e-k/pgoapi.git","svn_url":"https://github.com/j-e-k/pgoapi","homepage":"","size":2589,"stargazers_count":72,"watchers_count":72,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":21,"forks":38,"open_issues":21,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110"},"html":{"href":"https://github.com/j-e-k/pgoapi/pull/110"},"issue":{"href":"https://api.github.com/repos/j-e-k/pgoapi/issues/110"},"comments":{"href":"https://api.github.com/repos/j-e-k/pgoapi/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/j-e-k/pgoapi/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/j-e-k/pgoapi/statuses/5429e785bbb62a6177b1cbfbd82e5bd2ead2b7e0"}}}}
{"actor":{"display_login":"joychugh"}}