internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: projectmesa/mesa

Issue:
JupyterViz space view limits
**What's the problem this feature will solve?**
At the moment, when drawing spaces with JupyterViz, the axes limits are left to be automatically determined by Matplotlib. Would it not make more sense (in particular of continuous spaces, to derive xlim and xmax from the space itself?

**Describe the solution you'd like**
The simplest fix would be to adapt `_draw_grid` to use `space.width` and `space.height` while `_draw_continuos_space` uses `space.x_min`, `space.x_max`, `space.y_min`, and `space.y_max`. Are there reasons where the user might want to rely on matpltolib's automatic determination of the bounds? If so, then a slightly more sophisticated solution would be needed where kwargs are passed to from jupyterviz to the underlying space_drawer function. So you would add a `space_drawer_kwargs` keyword argument.




Discussion:

Resolving patch:
diff --git a/mesa/experimental/components/matplotlib.py b/mesa/experimental/components/matplotlib.py
--- a/mesa/experimental/components/matplotlib.py
+++ b/mesa/experimental/components/matplotlib.py
@@ -55,6 +55,8 @@ def portray(g):
             out["c"] = c
         return out
 
+    space_ax.set_xlim(-1, space.width)
+    space_ax.set_ylim(-1, space.height)
     space_ax.scatter(**portray(space))
 
 
@@ -91,6 +93,14 @@ def portray(space):
             out["c"] = c
         return out
 
+    width = space.x_max - space.x_min
+    x_padding = width / 20
+    height = space.y_max - space.y_min
+    y_padding = height / 20
+    space_ax.set_xlim(space.x_min - x_padding, space.x_max + x_padding)
+    space_ax.set_ylim(space.y_min - y_padding, space.y_max + y_padding)
+    space_ax.scatter(**portray(space))
+
     space_ax.scatter(**portray(space))
 
 


Test patch:
Repository: projectmesa/mesa

Issue:
JupyterViz: the default grid space drawer doesn't scale to large size
**Describe the bug**
<!-- A clear and concise description the bug -->
Here is Schelling space for 60x60:
![2023-07-24-102909_468x350_scrot](https://github.com/projectmesa/mesa/assets/395821/0949b124-dfeb-48ff-9205-4d242e99c833)

**Expected behavior**
<!-- A clear and concise description of what you expected to happen -->
Should either scale down the circle marker size automatically, or scale up the figure size automatically.


Discussion:
I vote for scaling up the figure size (which I'm understanding as allocating more space for the agent space figure on the page). Not sure how you would determine the threshold for this - would it have to be user configurable, or could a certain grid size automatically require 3/4 of the width, full width?
I think we should do both simultaneously.
I started looking into this-- some upfront ideas here:

1.  If we need to make the figure scalable , I would be better if we make the plots one per row (so that the scaling can be done to the whole screen).

2. I think it would be better to implement it as a test feature that can be enabled via a checkbox. 

3. The agents size looks straight forward to scale based on number of agents. I look into ways to scale the figure. `GridDraggable` in solara looks like a promising feature in this regard.

There shouldn't be upfront customization from the user unless necessary. This should behave like how LaTeX renders documents, where people focus on the content of the writing, not the layout. Automatically deciding when to use the entire row or not, scaling down marker size, increasing figure size, should be the library's responsibility.
Sure, I have opened a draft PR #1820.

Resolving patch:
diff --git a/mesa/experimental/components/matplotlib.py b/mesa/experimental/components/matplotlib.py
--- a/mesa/experimental/components/matplotlib.py
+++ b/mesa/experimental/components/matplotlib.py
@@ -48,6 +48,9 @@ def portray(g):
                     if "color" in data:
                         c.append(data["color"])
         out = {"x": x, "y": y}
+        # This is the default value for the marker size, which auto-scales
+        # according to the grid area.
+        out["s"] = (180 / min(g.width, g.height)) ** 2
         if len(s) > 0:
             out["s"] = s
         if len(c) > 0:


Test patch:
Repository: projectmesa/mesa

Issue:
move_agent_to_one_of is deterministic when pos has multiple closest  choices and selection="closest"
**Describe the bug**

move_agent_to_one_of is deterministic when pos has multiple closest  choices and selection="closest"

**Expected behavior**

expected that when using move_agent_to_one_of() in a sugarscape agent's motion will be random within a sugar plateau for low vision agents, but noticed that such agents now exhibit periodic motion.

**To Reproduce**

use the following test 

```Python
def test_move_agent_closest_selection_multiple(self):
    random_locations = []
    agent = self.agents[0]
    agent.pos = (5, 5)
    repetititions = 10

    for _ in range(repetititions):
        possible_positions = [(4, 4), (6, 6), (10, 10), (20, 20)]
        self.space.move_agent_to_one_of(
            agent, possible_positions, selection="closest"
        )
        random_locations.append(agent.pos)
        assert agent.pos in possible_positions
        self.space.move_agent_to_one_of(agent, [(5, 5)], selection="closest")
    non_random_locations = [random_locations[0]] * repetititions
    assert random_locations != non_random_locations
```

**Additional context**



Discussion:

Resolving patch:
diff --git a/mesa/space.py b/mesa/space.py
--- a/mesa/space.py
+++ b/mesa/space.py
@@ -461,6 +461,7 @@ def move_agent_to_one_of(
                 # Find the closest position without sorting all positions
                 closest_pos = None
                 min_distance = float("inf")
+                agent.random.shuffle(pos)
                 for p in pos:
                     distance = self._distance_squared(p, current_pos)
                     if distance < min_distance:


Test patch:
Repository: projectmesa/mesa

Issue:
Fix error in failing flocking benchmark
Our benchmarks are failing: https://github.com/projectmesa/mesa/actions/workflows/benchmarks.yml

```bash
08:41:17 starting benchmarks.
08:41:35 Schelling      (small) timings: Init 0.00771 s; Run 0.0472 s
08:41:55 Schelling      (large) timings: Init 0.05062 s; Run 0.4629 s
08:42:01 WolfSheep      (small) timings: Init 0.00333 s; Run 0.0124 s
08:42:[15](https://github.com/projectmesa/mesa/actions/runs/8813652146/job/24191834761#step:7:16) WolfSheep      (large) timings: Init 0.05334 s; Run 0.2206 s
  File "/home/runner/work/mesa/mesa/benchmarks/global_benchmark.py", line 62, in <module>
    results = run_experiments(model, config)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/mesa/mesa/benchmarks/global_benchmark.py", line 47, in run_experiments
    init_time, run_time = run_model(model_class, seed, config["parameters"])
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/mesa/mesa/benchmarks/global_benchmark.py", line [21](https://github.com/projectmesa/mesa/actions/runs/8813652146/job/24191834761#step:7:22), in run_model
    model = model_class(simulator=simulator, seed=seed, **parameters)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/mesa/mesa/benchmarks/Flocking/flocking.py", line 139, in __init__
    boid = Boid(
           ^^^^^
TypeError: Boid.__init__() got an unexpected keyword argument 'pos'
Error: Process completed with exit code 1.
```
Most likely something was changed in [benchmarks/Flocking/flocking.py](https://github.com/projectmesa/mesa/blob/main/benchmarks/Flocking/flocking.py) that needs to be fixed/reverted.


Discussion:

Resolving patch:
diff --git a/benchmarks/Flocking/flocking.py b/benchmarks/Flocking/flocking.py
--- a/benchmarks/Flocking/flocking.py
+++ b/benchmarks/Flocking/flocking.py
@@ -139,7 +139,6 @@ def __init__(
             boid = Boid(
                 unique_id=i,
                 model=self,
-                pos=pos,
                 speed=speed,
                 direction=direction,
                 vision=vision,


Test patch:
Repository: Rurusetto/rurusetto

Issue:
Redirect ruleset's old link page to the new link
On the old website using the URL path `pages/<RulesetsName>` . The old path must be redirect to the new path to avoid the 404 not found error on the old path.


Discussion:

Resolving patch:
diff --git a/rurusetto/wiki/urls.py b/rurusetto/wiki/urls.py
--- a/rurusetto/wiki/urls.py
+++ b/rurusetto/wiki/urls.py
@@ -27,5 +27,7 @@
     path('action/update/action_log/<int:log_id>', views.check_action_log, name='check_action_log'),
     # URL path for API
     path('api/rulesets', views.ruleset_list),
-    path('api/rulesets/<slug:slug>', views.ruleset_detail)
+    path('api/rulesets/<slug:slug>', views.ruleset_detail),
+    # Fallback URL path for redirect user who use old website link to the new website path
+    path('pages/<slug:slug>', views.redirect_from_old_link, name='redirect_from_old_link')
 ]
\ No newline at end of file
diff --git a/rurusetto/wiki/views.py b/rurusetto/wiki/views.py
--- a/rurusetto/wiki/views.py
+++ b/rurusetto/wiki/views.py
@@ -814,6 +814,24 @@ def archived_rulesets(request):
     return render(request, 'wiki/archived_rulesets.html', context)
 
 
+# Fallback view for redirect user from old website URL to the new website's path
+
+
+def redirect_from_old_link(request, slug):
+    """
+    View for redirect the user that use the old link path (pages/<RulesetsName>) to the new path
+    that we currently use (rulesets/<RulesetsName>)
+
+    :param request: WSGI request from user
+    :param slug: Ruleset slug (slug in Ruleset model)
+    :return: Redirect the user to the cuurent wiki_page's link
+    """
+    if Ruleset.objects.filter(slug=slug).exists():
+        return redirect('wiki', slug=slug)
+    else:
+        return HttpResponse(status=404)
+
+
 # Views for API
 
 


Test patch:
diff --git a/rurusetto/wiki/tests.py b/rurusetto/wiki/tests.py
--- a/rurusetto/wiki/tests.py
+++ b/rurusetto/wiki/tests.py
@@ -93,3 +93,19 @@ def test_ruleset_default_value(self):
         self.assertEqual(blank_ruleset.source, '')
         self.assertEqual(blank_ruleset.last_edited_by, '0')
         self.assertEqual(blank_ruleset.verified, False)
+
+
+class RedirectFromOldLinkTest(TestCase):
+    """Test for fallback URL view that will be redirect to the new URL view"""
+
+    def test_is_redirect_on_valid_rulesets(self):
+        """Test that the redirect view is redirect the link on the valid rulesets"""
+        Ruleset.objects.create(name='dummy', slug='dummy')
+        self.assertTrue(Ruleset.objects.filter(slug='dummy'))
+        response = self.client.get('/pages/dummy')
+        self.assertRedirects(response, '/rulesets/dummy')
+
+    def test_is_404_on_not_valid_rulesets(self):
+        """Test that the view will redirect to 404 id the query rulesets is not found"""
+        response = self.client.get('/pages/peeppy')
+        self.assertEqual(response.status_code, 404)
Repository: Rurusetto/rurusetto

Issue:
The URL is not ignore the trailing slashes
The current URL path is not support the trailing slash. Since the URL that specified in Django not have the slash at the end.

https://github.com/Rurusetto/rurusetto/blob/8362f98a6c71c4a6b3f9bbf36a90e2ef9f2762ba/rurusetto/api/urls.py#L1-L13


Discussion:

Resolving patch:
diff --git a/rurusetto/rurusetto/settings.py b/rurusetto/rurusetto/settings.py
--- a/rurusetto/rurusetto/settings.py
+++ b/rurusetto/rurusetto/settings.py
@@ -201,6 +201,10 @@
 
 CRISPY_TEMPLATE_PACK = 'bootstrap4'
 
+# Add support for trailing URL slash support
+
+APPEND_SLASH = True
+
 # API key and API configuration
 
 OSU_OAUTH_CLIENT_ID = config('OSU_OAUTH_CLIENT_ID', default="")
diff --git a/rurusetto/wiki/urls.py b/rurusetto/wiki/urls.py
--- a/rurusetto/wiki/urls.py
+++ b/rurusetto/wiki/urls.py
@@ -3,10 +3,10 @@
 
 urlpatterns = [
     path('', views.home, name='home'),
-    path('rulesets/', views.listing, name='listing'),
-    path('archived/', views.archived_rulesets, name='archived_rulesets'),
-    path('new/', views.create_ruleset, name='create_ruleset'),
-    path('changelog/', views.changelog, name='changelog'),
+    path('rulesets', views.listing, name='listing'),
+    path('archived', views.archived_rulesets, name='archived_rulesets'),
+    path('new', views.create_ruleset, name='create_ruleset'),
+    path('changelog', views.changelog, name='changelog'),
     path('rulesets/<slug:slug>', views.wiki_page, name='wiki'),
     path('rulesets/<slug:slug>/beatmaps', views.recommend_beatmap, name='recommend_beatmap'),
     path('rulesets/<slug:slug>/edit', views.edit_ruleset_wiki, name='edit_wiki'),


Test patch:
Repository: genialis/resolwe

Issue:
Ordering of processes does not work
Tested on the QA server:

https://qa.genialis.com/api/process?slug=alignment-bwa-mem&ordering=-version

For the above query, the `alignment-bwa-mem` processes should be sorted by version, descending. The version 16777232 should be at the top, but comes second.


Discussion:
The issue was discovered by @jkokosar. The bug is a blocker, pease fix ASAP. Also, do not forget to write tests.

Resolving patch:
diff --git a/resolwe/flow/views.py b/resolwe/flow/views.py
--- a/resolwe/flow/views.py
+++ b/resolwe/flow/views.py
@@ -512,7 +512,7 @@ class ProcessViewSet(ResolweCreateModelMixin,
     serializer_class = ProcessSerializer
     permission_classes = (permissions_cls,)
     filter_class = ProcessFilter
-    ordering_fields = ('id', 'created', 'modified', 'name')
+    ordering_fields = ('id', 'created', 'modified', 'name', 'version')
     ordering = ('id',)
 
 


Test patch:
diff --git a/resolwe/flow/tests/test_ordering.py b/resolwe/flow/tests/test_ordering.py
new file mode 100644
--- /dev/null
+++ b/resolwe/flow/tests/test_ordering.py
@@ -0,0 +1,35 @@
+# pylint: disable=missing-docstring
+from __future__ import absolute_import, division, print_function, unicode_literals
+
+from django.contrib.auth import get_user_model
+from django.contrib.auth.models import AnonymousUser
+from django.core.urlresolvers import reverse
+
+from guardian.shortcuts import assign_perm
+from rest_framework.test import APITestCase
+
+from resolwe.flow.models import Process
+
+
+class ProcessOrderingTest(APITestCase):
+    def setUp(self):
+        user_model = get_user_model()
+        user = user_model.objects.create(username='user')
+
+        self.proc_1 = Process.objects.create(name='My process', contributor=user, version=1)
+        self.proc_2 = Process.objects.create(name='My process', contributor=user, version=2)
+
+        assign_perm('view_process', AnonymousUser(), self.proc_1)
+        assign_perm('view_process', AnonymousUser(), self.proc_2)
+
+        self.url = reverse('resolwe-api:process-list')
+
+    def test_ordering_version(self):
+        # pylint: disable=no-member
+        response = self.client.get(self.url, {'ordering': 'version'}, format='json')
+        self.assertEqual(response.data[0]['id'], self.proc_1.id)
+        self.assertEqual(response.data[1]['id'], self.proc_2.id)
+
+        response = self.client.get(self.url, {'ordering': '-version'}, format='json')
+        self.assertEqual(response.data[0]['id'], self.proc_2.id)
+        self.assertEqual(response.data[1]['id'], self.proc_1.id)
Repository: genialis/resolwe

Issue:
Process crashes if rendered data name is too long
After process is done, names of all child objects are re-rendered. If any of the names is longer than 100 characters (limit specified in name field), process crashes.

Names of data object should probably be trimmed to that limit. Increasing of the limit should also be considered (in combination with trimming).


Discussion:
@evasardina, how many characters should we allow for the sample/data object name? The limit is not 100 characters. In my opinion, names should be short so they fit in a table cell.

I would not increase the length. What is a good solution then? Automatic trimming? Error or warning on the data object? Automatic trimming + warning? No trimming + error?

@jkokosar, @kostko, @tjanez, please share your opinion.
I would go for automatic trimming.

Resolving patch:
diff --git a/resolwe/flow/models.py b/resolwe/flow/models.py
--- a/resolwe/flow/models.py
+++ b/resolwe/flow/models.py
@@ -595,13 +595,19 @@ def _render_name(self):
         template_context = inputs
 
         try:
-            self.name = render_template(
+            name = render_template(
                 self.process,
                 self.process.data_name,  # pylint: disable=no-member
                 template_context
             )
         except EvaluationError:
-            self.name = '?'
+            name = '?'
+
+        name_max_len = self._meta.get_field('name').max_length
+        if len(name) > name_max_len:
+            name = name[:(name_max_len - 3)] + '...'
+
+        self.name = name
 
 
 class DescriptorSchema(BaseModel):


Test patch:
diff --git a/resolwe/flow/tests/test_models.py b/resolwe/flow/tests/test_models.py
--- a/resolwe/flow/tests/test_models.py
+++ b/resolwe/flow/tests/test_models.py
@@ -127,6 +127,13 @@ def test_name(self):
         self.assertEqual(second.name, 'User\' data name')
         self.assertTrue(second.named_by_user)
 
+    def test_trim_name(self):
+        process = Process.objects.create(contributor=self.user, data_name='test' * 50)
+        data = Data.objects.create(contributor=self.user, process=process)
+
+        self.assertEqual(len(data.name), 100)
+        self.assertEqual(data.name[-3:], '...')
+
     def test_hydrate_file_size(self):
         proc = Process.objects.create(
             name='Test process',
Repository: genialis/resolwe

Issue:
Elasticserach returns paginated results when querying/mapping features using RESDK
In resolwe-bio tools/goea.py `org_features = res.feature.filter(source=args.source_db, query=genes)` should return all genes, not just the first 10.


Discussion:

Resolving patch:
diff --git a/resolwe/elastic/viewsets.py b/resolwe/elastic/viewsets.py
--- a/resolwe/elastic/viewsets.py
+++ b/resolwe/elastic/viewsets.py
@@ -15,6 +15,7 @@
 from django.conf import settings
 from django.contrib.auth import get_user_model
 
+from rest_framework.exceptions import APIException
 from rest_framework.response import Response
 from rest_framework.viewsets import GenericViewSet
 
@@ -24,6 +25,16 @@
     'ElasticSearchBaseViewSet',
 )
 
+ELASTICSEARCH_SIZE = 10000  # maximum number of results returned by ElasticSearch
+
+
+class TooManyResults(APIException):
+    """Exception when elastic query returns more than ``ELASTICSEARCH_SIZE`` results."""
+
+    status_code = 400
+    default_detail = 'Query returned too many results. Please, add more filters or use pagination.'
+    default_code = 'bad_request'
+
 
 class ElasticSearchMixin(object):
     """Mixin to use Django REST Framework with ElasticSearch based querysets.
@@ -155,6 +166,11 @@ def list_with_post(self, request):
         search = self.order_search(search)
         search = self.filter_permissions(search)
 
+        if search.count() > ELASTICSEARCH_SIZE:
+            raise TooManyResults()
+
+        search = search.extra(size=ELASTICSEARCH_SIZE)
+
         return self.paginate_response(search)
 
     def list(self, request):


Test patch:
Repository: genialis/resolwe

Issue:
Validate descriptor_schema's basic:string with choices
`basic:string:` fields with `choices` and without `allow_custom_choice` seem to still allow any string value. It should only allow values from the choices list.


Discussion:
Related to field validation: https://github.com/genialis/resolwe/pull/277
Do not forget to write a test. Thanks.

Resolving patch:
diff --git a/resolwe/flow/models/utils.py b/resolwe/flow/models/utils.py
--- a/resolwe/flow/models/utils.py
+++ b/resolwe/flow/models/utils.py
@@ -159,6 +159,12 @@ def validate_data(data_pk, type_):
             except jsonschema.exceptions.ValidationError as ex:
                 raise ValidationError(ex.message)
 
+            choices = _schema.get('choices', [])
+            allow_custom_choice = _schema.get('allow_custom_choice', False)
+            if choices and not allow_custom_choice and field not in choices:
+                raise ValidationError(
+                    "Value must match one of predefined choices.")
+
             if type_ == 'basic:file:':
                 validate_file(field, _schema.get('validate_regex'))
 


Test patch:
diff --git a/resolwe/flow/tests/test_validation.py b/resolwe/flow/tests/test_validation.py
--- a/resolwe/flow/tests/test_validation.py
+++ b/resolwe/flow/tests/test_validation.py
@@ -274,6 +274,28 @@ def test_required(self):
         instance = {}
         validate_schema(instance, schema, test_required=False)
 
+    def test_choices(self):
+        schema = [
+            {'name': 'value', 'type': 'basic:integer:', 'choices': [7, 13]},
+        ]
+
+        instance = {'value': 7}
+        validate_schema(instance, schema)
+
+        instance = {'value': 8}
+        with six.assertRaisesRegex(self, ValidationError, 'Value must match one of predefined choices.'):
+            validate_schema(instance, schema)
+
+        schema = [
+            {'name': 'value', 'type': 'basic:integer:', 'choices': [7, 13], 'allow_custom_choice': True},
+        ]
+
+        instance = {'value': 7}
+        validate_schema(instance, schema)
+
+        instance = {'value': 8}
+        validate_schema(instance, schema)
+
     def test_missing_in_schema(self):
         schema = [
             {'name': 'result', 'type': 'basic:integer:', 'required': False}
Repository: getpelican/pelican

Issue:
``-r, --autoreload`` doesn't watch theme dir
If the autoreload option is enabled, only the sources are checked. Especially when editing the templates often and the theme directory changes because of new or edited static files (CSS, JavaScript, images, …), it would be really helpful to have the theme directory watched recursively as well. 



Discussion:

Resolving patch:
diff --git a/pelican/__init__.py b/pelican/__init__.py
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -140,7 +140,13 @@ def main():
         if args.autoreload:
             while True:
                 try:
-                    if files_changed(pelican.path, pelican.markup):
+                    # Check source dir for changed files ending with the given
+                    # extension in the settings. In the theme dir is no such
+                    # restriction; all files are recursively checked if they
+                    # have changed, no matter what extension the filenames
+                    # have.
+                    if files_changed(pelican.path, pelican.markup) or \
+                            files_changed(pelican.theme, ['']):
                         pelican.run()
                     time.sleep(.5)  # sleep to avoid cpu load
                 except KeyboardInterrupt:


Test patch: