internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ephios-dev/ephios

Issue:
API: `/api/users/by_email` returns 404 error for email addresses with dots before the @
**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to `[ephios-url]/api/users/by_email/vorname.nachname@url.de/`

**Expected behaviour**
Assuming the user exists, the information about the user should be returned.

**Screenshots**
Instead the page 404s.

<img width="1511" alt="Screenshot 2024-03-27 at 18 54 08" src="https://github.com/ephios-dev/ephios/assets/2546622/1383feee-28b0-4825-a31e-c39e2cc3f2ab">

**Environment**
State which device, operating system, browser and browser version you are using.
MacOS 14.2.1 (23C71), Version 17.2.1 (19617.1.17.11.12)

**Additional context**
* The problem does not appear for the test emails `usaaa@localhost/`, `admin@localhost/` or `user@localhost.com`.


Discussion:

Resolving patch:
diff --git a/ephios/api/views/users.py b/ephios/api/views/users.py
--- a/ephios/api/views/users.py
+++ b/ephios/api/views/users.py
@@ -96,6 +96,7 @@ class UserByMailView(RetrieveModelMixin, GenericViewSet):
     filter_backends = [ObjectPermissionsFilter]
     lookup_url_kwarg = "email"
     lookup_field = "email"
+    lookup_value_regex = "[^/]+"  # customize to allow dots (".") in the lookup value
     schema = AutoSchema(operation_id_base="UserProfileByMail")
 
 


Test patch:
diff --git a/tests/api/test_user.py b/tests/api/test_user.py
new file mode 100644
--- /dev/null
+++ b/tests/api/test_user.py
@@ -0,0 +1,21 @@
+from django.urls import reverse
+
+
+def test_user_profile_list(django_app, groups, superuser):
+    response = django_app.get(reverse("api:userprofile-list"), user=superuser)
+    assert superuser.email in response
+
+
+def test_api_user_profile_by_email(django_app, superuser):
+    superuser.email = "special-char.123@toplevel.berlin"
+    superuser.save()
+    response = django_app.get(
+        reverse(
+            "api:user-by-email-detail",
+            kwargs={
+                "email": superuser.email,
+            },
+        ),
+        user=superuser,
+    )
+    assert superuser.email in response
Repository: projectmesa/mesa

Issue:
Update Pypi record -- https://pypi.python.org/pypi/Mesa/0.0.0
After #64 -- update Pypi record -- https://pypi.python.org/pypi/Mesa/0.0.0



Discussion:
Is there a preferred system for versioning under-development software?

Please elaborate. (Preferred system meaning some other place to post other than PyPi? Or are you referring to the classifier in the PyPi record?)

As I understand it now, this is the system. However, we can do things to alert folks that this isn't a fully baked project with the version number and the classifiers. 
See "Development Status" on this page: https://pypi.python.org/pypi?:action=browse

I meant in general, are there rules for what should be considered v1.0 vs v0.5 vs v0.5.1, or do we just come up with our own version numbering scheme?

Ah got it.... there are _some rules_ and some interpretation. The [wikipedia article](http://en.wikipedia.org/wiki/Software_versioning) isn't that bad. 
0.0.0
- First number is major version
- Second number is minor version
- Third is bug fix

So, 1.0.0 should be our first stable release that is considered beta. 
< 1.0.0 is alpha -- which means that we are telling folks that this is something that could change drastically from the way it looks not and is not stable yet. 

I picked tentatively picked 0.5.0, which is arbitrary. This means we have something, but gives us remove to move up before we tag as stable.

The quicker we get to what we want to call "1.0" the better, because the people will believe in us. 

That make sense?


Resolving patch:
diff --git a/setup.py b/setup.py
new file mode 100644
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+requires = [
+    'tornado',
+    'numpy',
+    'pandas',
+]
+
+setup(
+    name='Mesa',
+    version='0.5.1',
+    description='Agent-based modeling framework in Python.',
+    author='Project Mesa Team',
+    author_email='projectmesa@googlegroups.com',
+    url='https://github.com/projectmesa/mesa',
+    packages=['mesa'],
+    package_data={'': ['LICENSE.md', ], },
+    package_dir={'mesa': 'mesa'},
+    include_package_data=True,
+    install_requires=requires,
+    license='MIT',
+    zip_safe=False,
+    classifiers=[
+        'Development Status :: 3 - Alpha',
+        'Programming Language :: Python :: 3 :: Only',
+        'Intended Audience :: Science/Research',
+        'Natural Language :: English',
+        'License :: OSI Approved :: MIT License',
+        'Topic :: Scientific/Engineering',
+    ],
+)


Test patch:
Repository: projectmesa/mesa

Issue:
DataCollector bug
Found a minor bug in DataCollector, where some variables are not initialized in the instance, and become class variables instead. Fixing.



Discussion:

Resolving patch:
diff --git a/mesa/datacollection.py b/mesa/datacollection.py
--- a/mesa/datacollection.py
+++ b/mesa/datacollection.py
@@ -80,6 +80,9 @@ def __init__(self, model_reporters={}, agent_reporters={}, tables={}):
 
         self.model_reporters = {}
         self.agent_reporters = {}
+
+        self.model_vars = {}
+        self.agent_vars = {}
         self.tables = {}
 
         for name, func in model_reporters.items():


Test patch:
Repository: projectmesa/mesa

Issue:
Grid move_agent to same position
Grid's move_agent method errors out when trying to move the agent to the same position.



Discussion:

Resolving patch:
diff --git a/mesa/space.py b/mesa/space.py
--- a/mesa/space.py
+++ b/mesa/space.py
@@ -220,9 +220,8 @@ def move_agent(self, agent, pos):
                    stored in a 'pos' tuple.
             pos: Tuple of new position to move the agent to.
         '''
-
-        self._place_agent(pos, agent)
         self._remove_agent(agent.pos, agent)
+        self._place_agent(pos, agent)
         agent.pos = pos
 
     def place_agent(self, agent, pos):


Test patch:
Repository: projectmesa/mesa

Issue:
Bug with building docs - Readme is not correct
I was just trying to follow the [Readme.md](https://github.com/projectmesa/mesa/blob/master/docs/README.md) to build the docs, and I get the following error: 

```
mesa/docs [git fix-docs] $ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.3.6

Recursion error:
maximum recursion depth exceeded while calling a Python object

This can happen with very large or deeply nested source files.  You can carefully increase the default Python recursion limit of 1000 in conf.py with e.g.:
    import sys; sys.setrecursionlimit(1500)
make: *** [html] Error 1
```

Not sure why I am running into this. I feel like I have come across this before, but I can't remember how I fixed. 



Discussion:
@lowcloudnine any thoughts? Is the readme correct? 


Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -17,19 +17,6 @@
 import os
 
 
-# Adding mock imports to see if this builds
-from unittest.mock import MagicMock
-
-class Mock(MagicMock):
-    @classmethod
-    def __getattr__(cls, name):
-            return Mock()
-
-MOCK_MODULES = ['numpy', 'pandas']
-sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
-
-# End of mock
-
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.


Test patch:
Repository: projectmesa/mesa

Issue:
MultiGrid docstring missing methods
The following methods are missing from the 'methods' section of MultiGrid object docstring: get_cell_list_contents, coord_iter, place_agent, and move_agent.



Discussion:

Resolving patch:
diff --git a/mesa/space.py b/mesa/space.py
--- a/mesa/space.py
+++ b/mesa/space.py
@@ -55,6 +55,18 @@ class Grid:
         get_neighborhood: Returns the cells surrounding a given cell.
         get_cell_list_contents: Returns the contents of a list of cells
             ((x,y) tuples)
+        neighbor_iter: Iterates over position neightbors.
+        coord_iter: Returns coordinates as well as cell contents.
+        place_agent: Positions an agent on the grid, and set its pos variable.
+        move_agent: Moves an agent from its current position to a new position.
+        iter_neighborhood: Returns an iterator over cell coordinates that are in the
+        neighborhood of a certain point.
+        torus_adj: Converts coordinate, handles torus looping.
+        out_of_bounds: Determines whether position is off the grid, returns the out of bounds coordinate.
+        iter_cell_list_contents: Returns an iterator of the contents of the cells identified in cell_list.
+        get_cell_list_contents: Returns a list of the contents of the cells identified in cell_list.
+        remove_agent: Removes an agent from the grid.
+        is_cell_empty: Returns a bool of the contents of a cell.
 
     """
     def __init__(self, height, width, torus):
@@ -238,7 +250,7 @@ def torus_adj(self, coord, dim_len):
         return coord
 
     def out_of_bounds(self, pos):
-        """ Is pos off the grid? """
+        """ Determines whether position is off the grid, returns the out of bounds coordinate."""
         x, y = pos
         return x < 0 or x >= self.width or y < 0 or y >= self.height
 
@@ -249,7 +261,7 @@ def iter_cell_list_contents(self, cell_list):
             cell_list: Array-like of (x, y) tuples, or single tuple.
 
         Returns:
-            A iterator of the contents of the cells identified in cell_list
+            An iterator of the contents of the cells identified in cell_list
 
         """
         return (


Test patch:
Repository: projectmesa/mesa

Issue:
Documentation is not reflecting latest changes wrt width-height argument order in Grid()
As many people start with reading  mesa on readthedocs, the documentation should be inline with the code changes wrt width-height argument order in Grid functions.This is not yet reflected.



Discussion:

Resolving patch:
diff --git a/examples/Basic/basic/server.py b/examples/Basic/basic/server.py
--- a/examples/Basic/basic/server.py
+++ b/examples/Basic/basic/server.py
@@ -19,8 +19,8 @@ def agent_draw(agent):
                      "Layer": 2,
                      "Color": "green",
                      "Filled": "true",
-                     "heading0": agent.heading[0],
-                     "heading1": agent.heading[1],
+                     "heading_x": agent.heading[0],
+                     "heading_y": agent.heading[1],
                      "text": agent.unique_id,
                      "text_color": "white",
                      "scale": 0.8,
diff --git a/mesa/visualization/modules/CanvasGridVisualization.py b/mesa/visualization/modules/CanvasGridVisualization.py
--- a/mesa/visualization/modules/CanvasGridVisualization.py
+++ b/mesa/visualization/modules/CanvasGridVisualization.py
@@ -22,13 +22,17 @@ class CanvasGrid(VisualizationElement):
 
     A portrayal as a dictionary with the following structure:
         "x", "y": Coordinates for the cell in which the object is placed.
-        "Shape": Can be either "circle" or "rect"
+        "Shape": Can be either "circle", "rect" or "arrowHead"
             For Circles:
                 "r": The radius, defined as a fraction of cell size. r=1 will
                      fill the entire cell.
-            For rectangles:
+            For Rectangles:
                 "w", "h": The width and height of the rectangle, which are in
                           fractions of cell width and height.
+            For arrowHead:
+            "scale": Proportion scaling as a fraction of cell size.
+            "heading_x": represents x direction unit vector.
+            "heading_y": represents y direction unit vector.
         "Color": The color to draw the shape in; needs to be a valid HTML
                  color, e.g."Red" or "#AA08F8"
         "Filled": either "true" or "false", and determines whether the shape is


Test patch:
Repository: projectmesa/mesa

Issue:
When server is launched, browser window should open automagically 
When guest lecturing at GMU, I observed that users did not read the instructions to visit 127.0.0.1... in their browser. I think jupyter spoiled them ;-). We should add functionality to have the browser auto launch when someone kicks off a model.



Discussion:

Resolving patch:
diff --git a/mesa/visualization/ModularVisualization.py b/mesa/visualization/ModularVisualization.py
--- a/mesa/visualization/ModularVisualization.py
+++ b/mesa/visualization/ModularVisualization.py
@@ -81,12 +81,13 @@
 import os
 
 import tornado.ioloop
-import tornado.template
 import tornado.web
 import tornado.websocket
 import tornado.escape
 import tornado.gen
 
+import webbrowser
+
 # Suppress several pylint warnings for this file.
 # Attributes being defined outside of init is a Tornado feature.
 # pylint: disable=attribute-defined-outside-init
@@ -255,6 +256,8 @@ def launch(self, port=None):
         """ Run the app. """
         if port is not None:
             self.port = port
-        print('Interface starting at http://127.0.0.1:{PORT}'.format(PORT=self.port))
+        url = 'http://127.0.0.1:{PORT}'.format(PORT=self.port)
+        print('Interface starting at {url}'.format(url=url))
         self.listen(self.port)
+        webbrowser.open(url)
         tornado.ioloop.IOLoop.instance().start()


Test patch:
Repository: projectmesa/mesa

Issue:
Allow fixed seed for replication
Figure out how to best handle running a model with a fixed seed, to ensure that it will produce the same result. and implement that.



Discussion:
This is already done in the PD example's notebook.  There's support for seeding in the Model parent class, too.

Resolving patch:
diff --git a/mesa/model.py b/mesa/model.py
--- a/mesa/model.py
+++ b/mesa/model.py
@@ -7,6 +7,7 @@
 """
 import datetime as dt
 import random
+import numpy
 
 
 class Model:
@@ -23,11 +24,14 @@ def __init__(self, seed=None):
             running: a bool indicating if the model should continue running
 
         """
+        # seed both the numpy and Python random number generators
         if seed is None:
             self.seed = dt.datetime.now()
         else:
             self.seed = seed
         random.seed(seed)
+        numpy.random.seed(seed)
+
         self.running = True
         self.schedule = None
 


Test patch:
Repository: projectmesa/mesa

Issue:
error launching Flocker
I've Anaconda with python 3.6 & Mesa 0.8.1

I launch Flocker's run.py and I get this error:
```
Flockers e$ python run.py
Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from flockers.server import server
  File "/Users/e/Dropbox/devlib/notebooks/mesa-master/examples/Flockers/flockers/server.py", line 20, in <module>
    server = ModularServer(BoidModel, [boid_canvas], "Boids", model_params)
  File "/Users/e/anaconda3/lib/python3.6/site-packages/mesa/visualization/ModularVisualization.py", line 287, in __init__
    self.reset_model()
  File "/Users/e/anaconda3/lib/python3.6/site-packages/mesa/visualization/ModularVisualization.py", line 313, in reset_model
    self.model = self.model_cls(**model_params)
TypeError: __init__() got an unexpected keyword argument 'N'
```


Discussion:
Trying to recreate this issue now....

@smartinsightsfromdata -- a bandaid for you is to comment out this line https://github.com/projectmesa/mesa/blob/master/examples/Flockers/flockers/server.py#L12 & try running again. 

@dmasad, when I started to look into this issue, it looks like it is related to this change -https://github.com/projectmesa/mesa/commit/2ca1de70147ea36a93b912a196ed3a64c7d10b4d#diff-3221e8b9ab8c2773dd44dd9fea582ff0... N is set on model init to 100. Then there "N" under model params. As stated above, if you remove the "N", then it "fixes" the problem. Making something work versus properly fixings it are 2 different.  Because you more familiar with these changes ---  If this is an easy fix / problem for you to identify, I would like to punt to you, otherwise, I will look into this further. Let me know. 
I think it's a variable naming issue, where `N` should have been `population` (https://github.com/projectmesa/mesa/blob/master/examples/Flockers/flockers/model.py#L25 (I didn't use a hashed link here :/)) instead.

Resolving patch:
diff --git a/examples/Flockers/flockers/server.py b/examples/Flockers/flockers/server.py
--- a/examples/Flockers/flockers/server.py
+++ b/examples/Flockers/flockers/server.py
@@ -9,7 +9,7 @@ def boid_draw(agent):
 
 boid_canvas = SimpleCanvas(boid_draw, 500, 500)
 model_params = {
-    "N": 100,
+    "population": 100,
     "width": 100,
     "height": 100,
     "speed": 5,


Test patch:
diff --git a/tests/test_end_to_end_viz.sh b/tests/test_end_to_end_viz.sh
new file mode 100755
--- /dev/null
+++ b/tests/test_end_to_end_viz.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+cd examples/Flockers
+python run.py &
+PID=$!
+sleep 3
+curl localhost:8521 | grep Boids
+kill $PID
Repository: projectmesa/mesa

Issue:
Datacollector fix
Simplify the `DataCollector` API by allowing the user-provided model- and agent-level reporters to be the names of attributes, in addition to methods. e.g. instead of needing to write

```
agent_reporters={"Wealth": lambda a: a.wealth}
```

you can write
```
agent_reporters={"Wealth":"wealth"}
```

This PR implements this feature, and updates the tests and documentation accordingly.


Discussion:

[![Coverage Status](https://coveralls.io/builds/14859399/badge)](https://coveralls.io/builds/14859399)

Coverage increased (+0.2%) to 81.46% when pulling **d2d299948bf5710b934af2018c0716597b4be956 on datacollector_fix** into **d147ff67ba9306da10775e43da0cd55edbeb91fd on master**.


Resolving patch:
diff --git a/mesa/__init__.py b/mesa/__init__.py
--- a/mesa/__init__.py
+++ b/mesa/__init__.py
@@ -14,6 +14,6 @@
 __all__ = ["Model", "Agent"]
 
 __title__ = 'mesa'
-__version__ = '0.8.2'
+__version__ = '0.8.3'
 __license__ = 'Apache 2.0'
 __copyright__ = 'Copyright %s Project Mesa Team' % datetime.date.today().year


Test patch:
Repository: projectmesa/mesa

Issue:
[Feature Request]: Agent data on mouse over visualization
Is it possible to bundle agent data into the web browser side json so that when I mouse over an agent I can view that agent's data? Seems like it would mean adding some more fields to the portrayal method to include data that would only available on a mouse over. And of course javascript code to display that data on a mouse over. I don't know if the performance penalty would be too great? This would be particularly useful in early stages of model debugging and perhaps even later. If performance is an issue, it could be feature invoked only if needed.
Thanks


Discussion:
This seems pretty doable with a second canvas layered over top and and a lookup table to map mouse coordinates back to the agent array. I can put together a pull request.

Resolving patch:
diff --git a/mesa/visualization/modules/CanvasGridVisualization.py b/mesa/visualization/modules/CanvasGridVisualization.py
--- a/mesa/visualization/modules/CanvasGridVisualization.py
+++ b/mesa/visualization/modules/CanvasGridVisualization.py
@@ -54,7 +54,7 @@ class CanvasGrid(VisualizationElement):
         template: "canvas_module.html" stores the module's HTML template.
 
     """
-    package_includes = ["GridDraw.js", "CanvasModule.js"]
+    package_includes = ["GridDraw.js", "CanvasModule.js", "InteractionHandler.js"]
 
     def __init__(self, portrayal_method, grid_width, grid_height,
                  canvas_width=500, canvas_height=500):
diff --git a/mesa/visualization/modules/HexGridVisualization.py b/mesa/visualization/modules/HexGridVisualization.py
--- a/mesa/visualization/modules/HexGridVisualization.py
+++ b/mesa/visualization/modules/HexGridVisualization.py
@@ -39,7 +39,7 @@ class CanvasHexGrid(VisualizationElement):
         template: "canvas_module.html" stores the module's HTML template.
 
     """
-    package_includes = ["HexDraw.js", "CanvasHexModule.js"]
+    package_includes = ["HexDraw.js", "CanvasHexModule.js", "InteractionHandler.js"]
     portrayal_method = None  # Portrayal function
     canvas_width = 500
     canvas_height = 500


Test patch:
Repository: projectmesa/mesa

Issue:
Issue 523
add networkx to the dependency specified in setup.py for #523 to allow all the tests to run without error when installing with the `pip install -e .` command.


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -7,6 +7,7 @@
 
 requires = [
     'tornado >= 4.2, < 5.0.0',
+    'networkx',
     'numpy',
     'pandas',
     'tqdm',


Test patch:
diff --git a/tests/test_lifespan.py b/tests/test_lifespan.py
--- a/tests/test_lifespan.py
+++ b/tests/test_lifespan.py
@@ -81,8 +81,8 @@ def test_ticks_seen(self):
         assert self.df.steps.max() == 1
 
     def test_agent_lifetime(self):
-        lifetimes = self.df.groupby(["AgentID"]).Step.agg({"Step":
-                                                           lambda x: len(x)})
+        lifetimes = self.df.groupby(["AgentID"]).agg(
+            {"Step": lambda x: len(x)})
         assert lifetimes.Step.max() == 2
Repository: projectmesa/mesa

Issue:
epstein_civil_violence box doesn't fit grid
<img width="431" alt="screen shot 2018-04-01 at 10 05 11 pm" src="https://user-images.githubusercontent.com/166734/38180219-de2decf8-35f8-11e8-8d9b-562d2fb7c58b.png">

^^ Fix the outline grid on this model. The grid should be the same size as the outline.


Discussion:

Resolving patch:
diff --git a/examples/epstein_civil_violence/civil_violence/server.py b/examples/epstein_civil_violence/civil_violence/server.py
--- a/examples/epstein_civil_violence/civil_violence/server.py
+++ b/examples/epstein_civil_violence/civil_violence/server.py
@@ -43,6 +43,6 @@ def citizen_cop_portrayal(agent):
                     legitimacy=.8,
                     max_jail_term=1000)
 
-canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 500, 500)
+canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 480, 480)
 server = ModularServer(CivilViolenceModel, [canvas_element],
                        "Epstein Civil Violence", model_params)


Test patch:
Repository: projectmesa/mesa

Issue:
Update tests to use pytest, not nose
Update tests to use pytest, not nose. nose is not maintained anymore. 


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,8 @@
     'dev': [
         'coverage',
         'flake8',
-        'nose',
+        'pytest',
+        'pytest-cov',
         'sphinx',
     ],
     'docs': [


Test patch: