internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Crash on Level Up
I'm gonna guess an issue with:
https://github.com/PokemonGoF/PokemonGo-Bot/pull/5016

which is also the version im on

```
Traceback (most recent call last):
  File "pokecli.py", line 781, in <module>
    main()
  File "pokecli.py", line 139, in main
    bot.tick()
  File "C:\Users\Steve\Downloads\PokemonGo-Bot\pokemongo_bot\__init__.py", line 658, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "C:\Users\Steve\Downloads\PokemonGo-Bot\pokemongo_bot\cell_workers\collect_level_up_reward.py", line 37, in work
    self._collect_level_reward()
  File "C:\Users\Steve\Downloads\PokemonGo-Bot\pokemongo_bot\cell_workers\collect_level_up_reward.py", line 70, in _collect_level_reward
    'items': ', '.join(["{}x {}".format(data[x], x) for x in data])
TypeError: list indices must be integers, not dict
```



Discussion:
@rawgni 

Maybe changing `line 70` to:
`'items': ', '.join(["{}x {}".format(x['item_count'], x['name']) for x in data])`
Might work, haven't tested yet.


Resolving patch:
diff --git a/pokemongo_bot/cell_workers/collect_level_up_reward.py b/pokemongo_bot/cell_workers/collect_level_up_reward.py
--- a/pokemongo_bot/cell_workers/collect_level_up_reward.py
+++ b/pokemongo_bot/cell_workers/collect_level_up_reward.py
@@ -62,13 +62,11 @@ def _collect_level_reward(self):
                     item['name'] = got_item
                     count = 'item_count' in item and item['item_count'] or 0
                     inventory.items().get(item['item_id']).add(count)
-            try:
-                self.emit_event(
-                    'level_up_reward',
-                    formatted='Received level up reward: {items}',
-                    data={
-                        'items': ', '.join(["{}x {}".format(data[x], x) for x in data])
-                    }
-                )
-            except TypeError:
-                pass
+            self.emit_event(
+                'level_up_reward',
+                formatted='Received level up reward: {items}',
+                data={
+                    # [{'item_id': 3, 'name': u'Ultraball', 'item_count': 10}, {'item_id': 103, 'name': u'Hyper Potion', 'item_count': 10}]
+                    'items': ', '.join(["{}x {}".format(x['item_count'], x['name']) for x in data])
+                }
+            )


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Trying to Incubate Eggs Always
Same issue for me
 #4875 

> I was listening to events via websocket. I realized that it always try to incubate eggs. While I'm listening events these logs appear every 5-10 secs.
> 
> Attempting to apply incubator EggIncubatorProto7823468502291754353 to egg 14174621514891967477
> Incubator in use.

But restarting bot is not a solution for me. 



Discussion:
This happened to me too. It flooded the whole screen with the messages. 

I've look into it and I guess I found what's the problem. I don't have enough time now for a PR but I'll do it later.


Resolving patch:
diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py
--- a/pokemongo_bot/cell_workers/incubate_eggs.py
+++ b/pokemongo_bot/cell_workers/incubate_eggs.py
@@ -176,14 +176,10 @@ def _check_inventory(self, lookup_ids=[]):
                 continue
             if "player_stats" in inv_data:
                 self.km_walked = inv_data.get("player_stats", {}).get("km_walked", 0)
-        if temp_used_incubators:
-            self.used_incubators = temp_used_incubators
-        if temp_ready_breakable_incubators:
-            self.ready_breakable_incubators = temp_ready_breakable_incubators
-        if temp_ready_infinite_incubators:
-            self.ready_infinite_incubators = temp_ready_infinite_incubators
-        if temp_eggs:
-            self.eggs = temp_eggs
+        self.used_incubators = temp_used_incubators
+        self.ready_breakable_incubators = temp_ready_breakable_incubators
+        self.ready_infinite_incubators = temp_ready_infinite_incubators
+        self.eggs = temp_eggs
         return matched_pokemon
 
     def _hatch_eggs(self):


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Incense being used when false
### Expected Behavior

Don't use Incense when set to false in config
### Actual Behavior

Bot using incense when set to false in config
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://pastebin.com/YEHMRMiE
### Output when issue occurred

[2016-09-02 15:43:55] [UseIncense] [INFO] [use_incense] Using Ordinary incense. 8 incense remaining
### Steps to Reproduce

Run bot with Incense false in config
### Other Information

OS: Linux
Branch: Dev
Git Commit: 1cc9da7a79c421f11a4b13359f6a6c1abfcd061a
Python Version: 2.7.12
Any other relevant files/configs (eg: path files) 
config.json



Discussion:

Resolving patch:
diff --git a/pokemongo_bot/cell_workers/use_incense.py b/pokemongo_bot/cell_workers/use_incense.py
--- a/pokemongo_bot/cell_workers/use_incense.py
+++ b/pokemongo_bot/cell_workers/use_incense.py
@@ -42,7 +42,10 @@ def _update_inventory(self):
     def _has_count(self):
       return self.incense_ordinary_count > 0 or self.incense_spicy_count > 0 or self.incense_cool_count > 0 or self.incense_floral_count > 0
             
-    def _should_run(self):         
+    def _should_run(self):
+      if not self.use_incense:
+        return False
+
       if self._has_count() > 0 and self.start_time == 0:
         return True      
       


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Pokemon transfer? crashes
Expected Behavior

Pokemon to transfer when Pokemon bag is full.

Actual Behavior

Whenever my Pokemon bag gets to 245/250, it will crash after every Pokemon it catches and does not release any.

Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://pastebin.com/HyXizCFc

Output when issue occurred

When the bot crashes, everything appears normal until this - http://pastebin.com/V6GRKZje

Steps to Reproduce

Simply restarting the bot recreates this crash, because the Pokemon bag is still full. I have gone into the app and transferred ~20 Pokemon to see if it was just a hiccup where it did not initiate the transfer process, but the same crash happened again.

Other Information

OS: Mac (El Capitan)

Branch: master

Git Commit:

Python Version:

Any other relevant files/configs (eg: path files)

Short Description

Possible solution

How it would help others



Discussion:
Can you tell me if you have any Eevee or one of its evolution in your bag ?

It's happen to me too...

@Anakin5 Yes, I have three Vaporeon

I see the issue, will commit something to fix.


Resolving patch:
diff --git a/pokemongo_bot/cell_workers/pokemon_optimizer.py b/pokemongo_bot/cell_workers/pokemon_optimizer.py
--- a/pokemongo_bot/cell_workers/pokemon_optimizer.py
+++ b/pokemongo_bot/cell_workers/pokemon_optimizer.py
@@ -285,17 +285,18 @@ def get_multi_best_pokemon_for_rule(self, family_list, rule, nb_branch):
                 try_upgrade_all += try_upgrade
                 keep_all += keep
 
-            if len(senior_pids) < nb_branch:
-                # We did not get every combination yet = All other Pokemon are potentially good to keep
-                worst = other_family_list[-1]
-            else:
-                best = try_evolve_all + try_upgrade_all + keep_all
-                worst = self.sort_pokemon_list(best, rule)[-1]
-
-            try_evolve, try_upgrade, keep = self.get_better_pokemon_for_rule(other_family_list, rule, worst, 12)
-            try_evolve_all += try_evolve
-            try_upgrade_all += try_upgrade
-            keep_all += keep
+            if len(other_family_list) > 0:
+                if len(senior_pids) < nb_branch:
+                    # We did not get every combination yet = All other Pokemon are potentially good to keep
+                    worst = other_family_list[-1]
+                else:
+                    best = try_evolve_all + try_upgrade_all + keep_all
+                    worst = self.sort_pokemon_list(best, rule)[-1]
+
+                try_evolve, try_upgrade, keep = self.get_better_pokemon_for_rule(other_family_list, rule, worst, 12)
+                try_evolve_all += try_evolve
+                try_upgrade_all += try_upgrade
+                keep_all += keep
 
         return try_evolve_all, try_upgrade_all, keep_all
 


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
bot crashes on MoveToMapPokemon  task
### Expected Behavior

I want to use move to map without sniping
### Actual Behavior

bot crashes
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://pastebin.com/AZKkmqm3
### Output when issue occurred

Traceback (most recent call last):
  File "pokecli.py", line 803, in <module>
    main()
  File "pokecli.py", line 162, in main
    bot.tick()
  File "/home/houkop/dev/PokemonGo-Bot/pokemongo_bot/**init**.py", line 685, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/houkop/dev/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 381, in work
    step_walker = self._move_to_pokemon_througt_fort(nearest_fort, pokemon)
  File "/home/houkop/dev/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 521, in _move_to_pokemon_througt_fort
    data= pokemon_throught_fort_event_data
  File "/home/houkop/dev/PokemonGo-Bot/pokemongo_bot/base_task.py", line 43, in emit_event
    data=data
  File "/home/houkop/dev/PokemonGo-Bot/pokemongo_bot/event_manager.py", line 72, in emit
    formatted_msg = formatted.format(**data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
### Steps to Reproduce

enable MoveToMapPokemon
### Other Information

OS: 
Debian GNU/Linux 8 
Branch: 
last dev
Git Commit: 
6aea15fc0a201d529de8c9d4cb3bf19cebc1cbb4
Python Version: 
Python 2.7.9



Discussion:

Resolving patch:
diff --git a/pokemongo_bot/cell_workers/move_to_map_pokemon.py b/pokemongo_bot/cell_workers/move_to_map_pokemon.py
--- a/pokemongo_bot/cell_workers/move_to_map_pokemon.py
+++ b/pokemongo_bot/cell_workers/move_to_map_pokemon.py
@@ -53,6 +53,7 @@
             last_lon: Trainer's last known longitude
 
 """
+from __future__ import unicode_literals
 
 import os
 import time


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
transfer_pokemon: Show candies with pokemon name without evolve
**Expected Behavior**
Keeping best 1 Pidgeotto, based on iv
*Pidgeotto Released* You now have 4 Pidgey candies

**Actual Behavior**
Keeping best 1 Pidgeotto, based on iv
*Pidgeotto Released* You now have 4 Pidgeotto candies

**Steps to Reproduce**
Update to the latest dev commit



Discussion:
I have seen the change, however isn't the issue that pidgeotto candy is in the log instead of pidgey candy?

I see. I misunderstood.

There is no such thing as "Pidgeotto candies". Candies for Pokemon of the same family bear the same name and that is the name of the non evolved Pokemon.
Pidgey, Pidgeotto and Pidgeot all use "Pidgey candies"

I think that's the point. Log is showing pidgeotto where it should be showing pidgey. 

oh ok, I got it reversed


Resolving patch:
diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -573,7 +573,7 @@ def _register_events(self):
         )
         self.event_manager.register_event(
             'pokemon_release',
-            parameters=('pokemon', 'iv', 'cp', 'ivcp', 'candy')
+            parameters=('pokemon', 'iv', 'cp', 'ivcp', 'candy', 'candy_type')
         )
         self.event_manager.register_event(
             'pokemon_keep',
diff --git a/pokemongo_bot/cell_workers/transfer_pokemon.py b/pokemongo_bot/cell_workers/transfer_pokemon.py
--- a/pokemongo_bot/cell_workers/transfer_pokemon.py
+++ b/pokemongo_bot/cell_workers/transfer_pokemon.py
@@ -242,10 +242,13 @@ def release_pokemon(self, pokemon):
                 'iv': pokemon.iv,
                 'cp': pokemon.cp,
                 'ivcp': pokemon.ivcp,
-                'candy': candy.quantity
+                'candy': candy.quantity,
+                'candy_type': candy.type
             },
-
-            formatted="Released {} (CP: {}, IV: {}, IVCP: {:.2f}) You now have {} {} candies".format(pokemon.name, pokemon.cp, pokemon.iv, pokemon.ivcp, candy.quantity, pokemon.name),
+            formatted="Released {} (CP: {}, IV: {}, IVCP: {:.2f}) You now have"
+                      " {} {} candies".format(pokemon.name, pokemon.cp,
+                                              pokemon.iv, pokemon.ivcp,
+                                              candy.quantity, candy.type)
         )
         with self.bot.database as conn:
             c = conn.cursor()


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Stardust count error on new account
### Expected Behavior
No crash, just set it to 0 and continue


### Actual Behavior
```
Traceback (most recent call last):
  File "pokecli.py", line 865, in <module>
    main()
  File "pokecli.py", line 206, in main
    bot.tick()
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/__init__.py", line 770, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_optimizer.py", line 127, in work
    self.open_inventory()
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_optimizer.py", line 294, in open_inventory
    self.ongoing_stardust_count = self.bot.stardust
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/__init__.py", line 75, in stardust
    return filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount']
KeyError: u'amount'
```
This happens on a fresh new account.

### Output when issue occurred
Se above


### Steps to Reproduce
Create a new account, run the bot from master.


### Other Information
OS:  Ubuntu
Branch: master 
Git Commit:  ce549716d20b5a512a65cfa9de93e808218cfb9e




Discussion:

Resolving patch:
diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -72,11 +72,17 @@ def player_data(self):
 
     @property
     def stardust(self):
-        return filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount']
+        dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]
+        if 'amount' in dust:
+            return dust['amount']
+        else:
+            return 0
 
     @stardust.setter
     def stardust(self, value):
-        filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount'] = value
+        dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]
+        if 'amount' in dust:
+            dust['amount'] = value
 
     def __init__(self, db, config):
 


Test patch:
Repository: PokemonGoF/PokemonGo-Bot

Issue:
Stardust count error on new account
### Expected Behavior
No crash, just set it to 0 and continue


### Actual Behavior
```
Traceback (most recent call last):
  File "pokecli.py", line 865, in <module>
    main()
  File "pokecli.py", line 206, in main
    bot.tick()
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/__init__.py", line 770, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_optimizer.py", line 127, in work
    self.open_inventory()
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_optimizer.py", line 294, in open_inventory
    self.ongoing_stardust_count = self.bot.stardust
  File "/home/david/Broncode/personal/PokemonGo-Bot/pokemongo_bot/__init__.py", line 75, in stardust
    return filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount']
KeyError: u'amount'
```
This happens on a fresh new account.

### Output when issue occurred
Se above


### Steps to Reproduce
Create a new account, run the bot from master.


### Other Information
OS:  Ubuntu
Branch: master 
Git Commit:  ce549716d20b5a512a65cfa9de93e808218cfb9e




Discussion:

Resolving patch:
diff --git a/pokemongo_bot/cell_workers/pokemon_optimizer.py b/pokemongo_bot/cell_workers/pokemon_optimizer.py
--- a/pokemongo_bot/cell_workers/pokemon_optimizer.py
+++ b/pokemongo_bot/cell_workers/pokemon_optimizer.py
@@ -264,6 +264,9 @@ def check_buddy(self):
 
         if distance_walked >= distance_needed:
             self.get_buddy_walked(pokemon)
+            # self.buddy["start_km_walked"] can be empty here
+            if 'start_km_walked' not in self.buddy:
+                self.buddy["start_km_walked"] = 0
             self.buddy["last_km_awarded"] = self.buddy["start_km_walked"] + distance_needed * int(distance_walked / distance_needed)
             self.lock_buddy = False
         else:
@@ -917,7 +920,7 @@ def get_buddy_walked(self, pokemon):
             action_delay(self.config_action_wait_min, self.config_action_wait_max)
 
         return True
-        
+
     def _get_buddyid(self):
         if self.buddy and'id' in self.buddy:
             return self.buddy['id']


Test patch:
Repository: spack/spack

Issue:
spack clean --dist?
I've noticed this discrepancy before, but am still not quite sure what to make of it.  Consider this spack output:

```
=> Warning: The contents of /g/g12/scogland/spack/var/spack/stage/judy-1.0.5-yglmhlllrlexvgi5f6pl267qagasjt3g/Judy-1.0.5.tar.gz look like HTML.
  The checksum will likely be bad.  If it is, you can use
  'spack clean --dist' to remove the bad archive, then fix
  your internet gateway issue and install again.
==> Error: md5 checksum failed for /g/g12/scogland/spack/var/spack/stage/judy-1.0.5-yglmhlllrlexvgi5f6pl267qagasjt3g/Judy-1.0.5.tar.gz.
Expected 115a0d26302676e962ae2f70ec484a54 but got d99fae1fc48fd56a9469a69176abbaa7.

shell returned 1

Press ENTER or type command to continue
usage: spack [-h] [-d] [-k] [-m] [-p] [-v] [-V] SUBCOMMAND ...
spack: error: unrecognized arguments: --dist
```

The download/check failure message directs users to use the `spack clean --dist` command to clean up the dead file, but that command appears to not work/exist.  Is there an alternative that should be swapped in?



Discussion:
It got renamed to just `spack clean` for simplicity.  Clean used to do what purge, restage, and clean do.  Can you correct and PR?


Resolving patch:
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -190,7 +190,7 @@ def fetch(self):
         if content_types and 'text/html' in content_types[-1]:
             tty.warn("The contents of " + self.archive_file + " look like HTML.",
                      "The checksum will likely be bad.  If it is, you can use",
-                     "'spack clean --dist' to remove the bad archive, then fix",
+                     "'spack clean <package>' to remove the bad archive, then fix",
                      "your internet gateway issue and install again.")
 
         if not self.archive_file:


Test patch:
Repository: spack/spack

Issue:
uninstall -a <pkg> causes a ValueError exception
With 2+ versions of a package installed, under some circumstances the `-a` flag to uninstall will cause DirectoryLayout to emit an exception about specs.  See below:

```
scogland at rzalastor1 in ~/spack (shell-arg-handling-fix●●)
$ spack uninstall cram
spack uninstall cram
==> Error: cram matches multiple packages:

-- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
m3vzgwx cram@1.0.1

-- chaos_5_x86_64_ib / gcc@4.9.2 --------------------------------
uj2ipaz cram@1.0.1

You can either:
  a) Use a more specific spec, or
  b) use spack uninstall -a to uninstall ALL matching specs.

scogland at rzalastor1 in ~/spack (shell-arg-handling-fix●●)   !1!
$ spack uninstall -a cram
spack uninstall -a cram
Traceback (most recent call last):
  File "/g/g12/scogland/spack/bin/spack", line 146, in <module>
    main()
  File "/g/g12/scogland/spack/bin/spack", line 127, in main
    return_val = command(parser, args)
  File "/g/g12/scogland/spack/lib/spack/spack/cmd/uninstall.py", line 95, in uninstall
    pkg.do_uninstall(force=args.force)
  File "/g/g12/scogland/spack/lib/spack/spack/package.py", line 916, in do_uninstall
    spack.hooks.pre_uninstall(self)
  File "/g/g12/scogland/spack/lib/spack/spack/hooks/__init__.py", line 69, in __call__
    hook(pkg)
  File "/g/g12/scogland/spack/lib/spack/spack/hooks/extensions.py", line 35, in pre_uninstall
    if pkg.activated:
  File "/g/g12/scogland/spack/lib/spack/spack/package.py", line 518, in activated
    exts = spack.install_layout.extension_map(self.extendee_spec)
  File "/g/g12/scogland/spack/lib/spack/spack/directory_layout.py", line 346, in extension_map
    _check_concrete(spec)
  File "/g/g12/scogland/spack/lib/spack/spack/directory_layout.py", line 45, in _check_concrete
    raise ValueError('Specs passed to a DirectoryLayout must be concrete!')
ValueError: Specs passed to a DirectoryLayout must be concrete!
```



Discussion:
@lee218llnl, @trws: I actually fixed this problem here: https://github.com/LLNL/spack/pull/210/files#diff-104f190bab262c2d346a5813c06926aaL214

However, that is not merged yet and I need to tweak it a bit first.  I will commit a quick fix.


Resolving patch:
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -212,8 +212,10 @@ def read_spec(self, path):
             spec = Spec.from_yaml(f)
 
         # Specs read from actual installations are always concrete
-        spec._normal = True
-        spec._concrete = True
+        for s in spec.traverse():
+            s._normal = True
+            s._concrete = True
+
         return spec
 
 


Test patch:
Repository: spack/spack

Issue:
two users using spack on one system can conflict with each other
User A on a system has a spack instance in her home directory.  She installs a bunch of packages.  In the process of building the packages, temporary files are put in /tmp/spack-staging.  This directory is owned by user A with permissions drwx------.

User B on the same system also creates a spack instance in her home directory.  When she tries to install packages, spack attempts to write to create temporary files in /tmp/spack-staging which fails because this directory is owned by user A.



Discussion:

Resolving patch:
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -112,8 +112,9 @@
 tmp_dirs = []
 _default_tmp = tempfile.gettempdir()
 if _default_tmp != os.getcwd():
-    tmp_dirs.append(os.path.join(_default_tmp, 'spack-stage'))
-tmp_dirs.append('/nfs/tmp2/%u/spack-stage')
+    tmp_dirs = [ join_path(_default_tmp, '%u', 'spack-stage'),
+                 join_path(_default_tmp, 'spack-stage') ]
+tmp_dirs.append('/nfs/tmp2/%u/spack-stage') # TODO: remove
 
 # Whether spack should allow installation of unsafe versions of
 # software.  "Unsafe" versions are ones it doesn't have a checksum


Test patch: