internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: django-cms/django-cms

Issue:
Frontend editing "Revert to live" left disabled erroneously.
Steps to reproduce:
- Hit "Edit this page"
- Go to structure mode, if not already
- Drag and drop to re-order a plugin's position.
- Note that the "Revert to live" action remains inactive.
- Refresh the page
- Note that "Revert to live" is now active.

Given nothing has changed, beyond my refreshing the page, I'd expect the "Revert to live" action state to be the same at both points (whether disabled or enabled, I don't know)



Discussion:
Confirmed in a fresh install. Apparently changing the order of a placeholder's plugins does not mark the page dirty.

@digi604 Can you have a look at this one? IIRC, you have a mastery of this area.

This is actually a problem with the JS handling the drag&drop: page is marked as dirty by the backend but the javascript does not update the toolbar accordingly


Resolving patch:
diff --git a/cms/cms_toolbar.py b/cms/cms_toolbar.py
--- a/cms/cms_toolbar.py
+++ b/cms/cms_toolbar.py
@@ -526,5 +526,6 @@ def add_history_menu(self):
             revert_action = admin_reverse('cms_page_revert_page', args=(self.page.pk, self.current_lang))
             revert_question = _('Are you sure you want to revert to live?')
             history_menu.add_ajax_item(_('Revert to live'), action=revert_action, question=revert_question,
-                                       disabled=not self.page.is_dirty(self.current_lang), on_success=refresh)
+                                       disabled=not self.page.is_dirty(self.current_lang),
+                                       on_success=refresh, extra_classes=('cms_toolbar-revert',))
             history_menu.add_modal_item(_('View history'), url=admin_reverse('cms_page_history', args=(self.page.pk,)))


Test patch:
Repository: django-cms/django-cms

Issue:
Nested plugins are not rendered when using fallback due to recursion in assign_plugins
Due to the recursion, `build_plugin_tree` is called twice, which on the second pass deletes all the `child_plugin_instances` that were assigned in the first pass. The result is that only the root plugins can ever be rendered.



Discussion:

Resolving patch:
diff --git a/cms/utils/plugins.py b/cms/utils/plugins.py
--- a/cms/utils/plugins.py
+++ b/cms/utils/plugins.py
@@ -38,7 +38,7 @@ def requires_reload(action, plugins):
                for p in plugins)
 
 
-def assign_plugins(request, placeholders, template, lang=None, no_fallback=False):
+def assign_plugins(request, placeholders, template, lang=None, is_fallback=False):
     """
     Fetch all plugins for the given ``placeholders`` and
     cast them down to the concrete instances in one query
@@ -53,14 +53,14 @@ def assign_plugins(request, placeholders, template, lang=None, no_fallback=False
     plugins = list(qs.order_by('placeholder', 'path'))
     # If no plugin is present in the current placeholder we loop in the fallback languages
     # and get the first available set of plugins
-    if (not no_fallback and
+    if (not is_fallback and
         not (hasattr(request, 'toolbar') and request.toolbar.edit_mode)):
         disjoint_placeholders = (ph for ph in placeholders
                                  if all(ph.pk != p.placeholder_id for p in plugins))
         for placeholder in disjoint_placeholders:
             if get_placeholder_conf("language_fallback", placeholder.slot, template, False):
                 for fallback_language in get_fallback_languages(lang):
-                    assign_plugins(request, (placeholder,), template, fallback_language, no_fallback=True)
+                    assign_plugins(request, (placeholder,), template, fallback_language, is_fallback=True)
                     fallback_plugins = placeholder._plugins_cache
                     if fallback_plugins:
                         plugins += fallback_plugins
@@ -71,7 +71,7 @@ def assign_plugins(request, placeholders, template, lang=None, no_fallback=False
     plugins = downcast_plugins(plugins, placeholders)
     # split the plugins up by placeholder
     # Plugins should still be sorted by placeholder
-    groups = dict((ph_id, build_plugin_tree(ph_plugins))
+    groups = dict((ph_id, build_plugin_tree(ph_plugins) if not is_fallback else ph_plugins)
                   for ph_id, ph_plugins
                   in groupby(plugins, attrgetter('placeholder_id')))
     for placeholder in placeholders:


Test patch:
Repository: django-cms/django-cms

Issue:
Fix #3942
`build_plugin_tree` should only be called once, in the end, after recursion.



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

Coverage remained the same at 91.14% when pulling **8884b0b7fa5cad558882bebb67a6d468b2ddfd8b on samluescher:develop** into **cc1a9fbd42f31c4822376471bf1c08dea4c04926 on divio:develop**.


Resolving patch:
diff --git a/cms/utils/plugins.py b/cms/utils/plugins.py
--- a/cms/utils/plugins.py
+++ b/cms/utils/plugins.py
@@ -71,7 +71,7 @@ def assign_plugins(request, placeholders, template, lang=None, is_fallback=False
     plugins = downcast_plugins(plugins, placeholders)
     # split the plugins up by placeholder
     # Plugins should still be sorted by placeholder
-    groups = dict((ph_id, build_plugin_tree(ph_plugins) if not is_fallback else ph_plugins)
+    groups = dict((ph_id, build_plugin_tree(ph_plugins))
                   for ph_id, ph_plugins
                   in groupby(plugins, attrgetter('placeholder_id')))
     for placeholder in placeholders:


Test patch:
Repository: django-cms/django-cms

Issue:
Alias plugin keeps causing typeerror
I have no idea how you are supposed to use the alias plugin, but every time I have tried adding it to a page, it has completely broken that page and made it uneditable. The first time I ran some command line option to fix it, but this time neither fix-mptt or delete_orphaned_plugins is working to fix it. I finally just gave up and ran "uninstall plugins AliasPlugin" so that no editors can break entire pages by accident.

Django Version: 1.6.6
django-cms (3.0.12)
django-mptt (0.6.1)
Exception Type: TypeError
Exception Value:  
unorderable types: NoneType() < int()
Exception Location: /home/XXX/.virtualenvs/djangocms3/lib/python3.4/site-packages/cms/utils/plugins.py in build_plugin_tree, line 312
Python Executable:  /usr/local/bin/uwsgi
Python Version: 3.4.0



Discussion:
I have been able to reproduce this by creating an alias out of a plugin and then pasting it from the clipboard
Tanks @lablua for raising the issue


Resolving patch:
diff --git a/cms/utils/plugins.py b/cms/utils/plugins.py
--- a/cms/utils/plugins.py
+++ b/cms/utils/plugins.py
@@ -309,7 +309,7 @@ def build_plugin_tree(plugin_list):
         else:
             parent = cache[plugin.parent_id]
             parent.child_plugin_instances.append(plugin)
-    root.sort(key=lambda x: x.position)
+    root.sort(key=lambda x: (x.position is None, x.position))
     for plugin in plugin_list:
         if plugin.child_plugin_instances and len(plugin.child_plugin_instances) > 1:
             plugin.child_plugin_instances.sort(key=lambda x: x.position)


Test patch:
Repository: django-cms/django-cms

Issue:
Ensure that ToolbarPool.get_watch_models is a list 
Cast `toolbar.watch_models` to a list at https://github.com/divio/django-cms/blob/develop/cms/toolbar_pool.py#L58

Without this change, you'll get a `*** TypeError: can only concatenate list (not "tuple") to list` when `watch_models` is a tuple.



Discussion:

Resolving patch:
diff --git a/cms/toolbar_pool.py b/cms/toolbar_pool.py
--- a/cms/toolbar_pool.py
+++ b/cms/toolbar_pool.py
@@ -55,7 +55,7 @@ def get_toolbars(self):
         return self.toolbars
 
     def get_watch_models(self):
-        return sum((getattr(tb, 'watch_models', [])
+        return sum((list(getattr(tb, 'watch_models', []))
                     for tb in self.toolbars.values()), [])
 
 


Test patch:
diff --git a/cms/test_utils/project/placeholderapp/cms_toolbar.py b/cms/test_utils/project/placeholderapp/cms_toolbar.py
--- a/cms/test_utils/project/placeholderapp/cms_toolbar.py
+++ b/cms/test_utils/project/placeholderapp/cms_toolbar.py
@@ -12,7 +12,7 @@
 
 @toolbar_pool.register
 class Example1Toolbar(CMSToolbar):
-    watch_models = [Example1, CharPksExample]
+    watch_models = (Example1, CharPksExample)
 
     def populate(self):
         admin_menu = self.toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
diff --git a/cms/tests/toolbar_pool.py b/cms/tests/toolbar_pool.py
--- a/cms/tests/toolbar_pool.py
+++ b/cms/tests/toolbar_pool.py
@@ -60,3 +60,7 @@ def test_settings(self):
                 response = self.client.get("/en/?%s" % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))
                 self.assertEqual(response.status_code, 200)
         toolbar_pool.toolbars = toolbars
+
+    def test_watch_models(self):
+        toolbar_pool.discover_toolbars()
+        self.assertEqual(type(toolbar_pool.get_watch_models()), list)
Repository: swcarpentry/python-novice-inflammation

Issue:
What is wrong with the inflammation data?
I am preparing for teaching next week, and I have some questions:
1. Throughout the lesson, it is indicated that there is something wrong with the data. I have yet to figure out what exactly the problem is?
2. A more teaching technical thing: in 02 Checking our data, it is indicated that you can stuff the shown if statement into the for loop shown in 01 Processing multiple files. Do people do that when they teach, or do they just show them on screen and explain?
3. When I do put that if statement in there, I get either suspicious maxima or adding up to zero on all of them. Is this actually correct?



Discussion:
Hi Karin,

#3 is right - the data is synthetic (see tools/gen-inflammation.py), and 
as soon as you plot min/max, you can see the ramp and staircase.  
Learners get excited when we start talking about detecting fraud :-)

Cheers,
Greg

Seems like this discussion should be added to `instructors.md`. If anyone's keen, assign yourself this issue; otherwise, I'll get to it before the 5.3 release.


Resolving patch:
diff --git a/tools/gen_inflammation.py b/tools/gen_inflammation.py
new file mode 100755
--- /dev/null
+++ b/tools/gen_inflammation.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+'''Generate pseudo-random patient inflammation data.'''
+
+import random
+
+n_patients = 60
+n_days = 40
+n_range = 20
+
+middle = n_days / 2
+
+for p in range(n_patients):
+    vals = []
+    for d in range(n_days):
+        upper = max(n_range - abs(d - middle), 0)
+        vals.append(random.randint(upper/4, upper))
+    print ','.join([str(v) for v in vals])


Test patch:
Repository: swcarpentry/python-novice-inflammation

Issue:
Lesson 10 - numpy.mean(data) and data.mean
In lesson 10, when the lesson refers to readings_03.py, the code shows that to calculate the mean over 'data' across all days, numpy.mean is used: numpy.mean(data, axis=1). However when looking at the file readings_03.py (at least the version I downloaded recently) uses the instruction  data.mean(axis=1). Both lead to the same result, but for consistency I would suggest to either  modify the readings_*.py to use numpy.mean (as this is what it has been used throughout the entire lesson), or explain explicitly that both expressions lead to the same result (it would be a good time to remind students about object attributes). 


Discussion:
Thank you, @HeatherAn! A while back, The Council of the Wise of this lesson decided that it is preferable to teach functions over methods (where it makes sense to do so), see #244.
This means that we should use `numpy.something(data, ...)` instead of `data.something(...)` .
Please feel free to submit a pull request to fix `readings_03.py`.



Resolving patch:
diff --git a/code/readings_03.py b/code/readings_03.py
--- a/code/readings_03.py
+++ b/code/readings_03.py
@@ -6,7 +6,7 @@ def main():
     script = sys.argv[0]
     for filename in sys.argv[1:]:
         data = numpy.loadtxt(filename, delimiter=',')
-        for m in data.mean(axis=1):
+        for m in numpy.mean(data, axis=1):
             print(m)
 
 


Test patch:
Repository: swcarpentry/python-novice-inflammation

Issue:
Code provided for students contain python code not compatible with python 3
At least one file in the `code` directory, e.g., `gen_inflammation.py` fails when running it with python 3. The [problem is the "division" not giving an integer](https://github.com/swcarpentry/python-novice-inflammation/blob/11643f14d31726f2f60873c4ca1230fff0bbf108/code/gen_inflammation.py#L19). It needs to be changed to
```diff
- upper / 4
+ upper // 4
```

This was spotted by a student trying to check their installation and running different files.
Other files may have similar errors. I'd suggest running and testing via CI everything we provide to the students.



Discussion:

Resolving patch:
diff --git a/code/gen_inflammation.py b/code/gen_inflammation.py
--- a/code/gen_inflammation.py
+++ b/code/gen_inflammation.py
@@ -16,5 +16,5 @@
     vals = []
     for d in range(n_days):
         upper = max(n_range - abs(d - middle), 0)
-        vals.append(random.randint(upper/4, upper))
+        vals.append(random.randint(upper//4, upper))
     print(','.join([str(v) for v in vals]))


Test patch:
Repository: SCons/scons

Issue:
html special characters are visible
This issue was originally created at: 2015-03-30 03:43:52.
This issue was reported by: `knut3`.
knut3 said at 2015-03-30 03:43:52
>There are visible < and > text fragments especially in context of #include.
> 
>http://www.scons.org/doc/latest/HTML/scons-user.html
> 
>search for: lt;

wblevins001 said at 2015-07-25 09:53:18
>Request submitted.

wblevins001 said at 2015-07-25 09:55:26
>I wish Tigris didn't change Issue numbers on interactions.




Discussion:
There are no &lt; but plenty of &gt;. All, as far as I can tell, in example output, so it's probably a single fix. Current doc (3.1.1) showed 43 matches.
This is what's actually happening - all < and most > are correctly encoded in the generated examples, but some ended up like this - the leading `&` ended up itself encoded, so we have an incorrect entity.  Not sure where that's coming from...
```
'Dir': &lt;SCons.Defaults.Variable_Method_Caller object at 0x700000&amp;gt;,
```

Resolving patch:
diff --git a/bin/SConsExamples.py b/bin/SConsExamples.py
--- a/bin/SConsExamples.py
+++ b/bin/SConsExamples.py
@@ -882,7 +882,7 @@ def create_scons_output(e):
             lines = ExecuteCommand(args, command, t, {'osname':o.os, 'tools':o.tools})
             if not command.output and lines:
                 ncontent = '\n'.join(lines)
-                ncontent = address_re.sub(r' at 0x700000&gt;', ncontent)
+                ncontent = address_re.sub(r' at 0x700000>', ncontent)
                 ncontent = engine_re.sub(r' File "bootstrap/src/engine/SCons/', ncontent)
                 ncontent = file_re.sub(r'\1 <module>', ncontent)
                 ncontent = nodelist_re.sub(r"\1 'NodeList' object \2", ncontent)


Test patch:
Repository: SCons/scons

Issue:
Update SCons API sphinx config to pull version from SCons/__init__.py
Update SCons API sphinx config to pull version from `SCons/__init__.py`

See `doc/sphinx/conf.py`


Discussion:

Resolving patch:
diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
--- a/doc/sphinx/conf.py
+++ b/doc/sphinx/conf.py
@@ -76,11 +76,12 @@
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
-# TODO: fill these in externally
+from SCons import __version__
+# The full version, including alpha/beta/rc tags:
+release = __version__
 # The short X.Y version.
-version = '4.1'
-# The full version, including alpha/beta/rc tags.
-release = '4.1.0'
+major, minor, _ = __version__.split('.')
+version = '.'.join([major, minor])
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


Test patch:
Repository: SCons/scons

Issue:
Building versioned shared library fails when using MinGW
This issue was originally created at: 2016-11-15 18:47:49.
This issue was reported by: `yarmond`.
yarmond said at 2016-11-15 18:47:49
>Specifying a value for SHLIBVERSION in order to generate a versioned shared 
>library fails when compiling with MinGW. A minimal SConstruct:
> 
```
env = Environment(tools=['mingw'])
lib = env.SharedLibrary('foo', ['foo.cpp'], SHLIBVERSION='2.4')
env.AlwaysBuild(lib)

```
> 
>Generates the following output:
> 
```
scons: Reading SConscript files ...
scons: *** A shared library should have exactly one target with the suffix: .dll
    File "<...>\SConstruct", line 2, in <module>


```




Discussion:
Just came across this one, and tested since there have been shlib-versioning changes - and it still fails, though the failure is different now.
```
scons: Reading SConscript files ...

scons: *** Multiple ways to build the same target were specified for: foo.dll
File "C:/users/mats/Documents/github/scons/exp/issue3035/SConstruct", line 2, in <module>
```
Hmm. sounds like other issues which popped up and got fixed with the new logic.. 
I should probably stick some debug output in there similar to msvc test logic.. 

Resolving patch:
diff --git a/SCons/Tool/linkCommon/SharedLibrary.py b/SCons/Tool/linkCommon/SharedLibrary.py
--- a/SCons/Tool/linkCommon/SharedLibrary.py
+++ b/SCons/Tool/linkCommon/SharedLibrary.py
@@ -28,7 +28,7 @@
 
 
 def shlib_symlink_emitter(target, source, env, **kw):
-    verbose = False
+    verbose = True
 
     if "variable_prefix" in kw:
         var_prefix = kw["variable_prefix"]
diff --git a/SCons/Tool/mingw.py b/SCons/Tool/mingw.py
--- a/SCons/Tool/mingw.py
+++ b/SCons/Tool/mingw.py
@@ -198,6 +198,11 @@ def generate(env):
     env['_SHLIBSUFFIX'] = '$SHLIBSUFFIX'
     env["SHLIBPREFIX"] = ""
 
+    # Disable creating symlinks for versioned shared library.
+    env['SHLIBNOVERSIONSYMLINKS'] = True
+    env['LDMODULENOVERSIONSYMLINKS'] = True
+    env['IMPLIBNOVERSIONSYMLINKS'] = True
+
 
 
 def exists(env):


Test patch:
diff --git a/test/MinGW/MinGWSharedLibrary.py b/test/MinGW/MinGWSharedLibrary.py
--- a/test/MinGW/MinGWSharedLibrary.py
+++ b/test/MinGW/MinGWSharedLibrary.py
@@ -58,7 +58,13 @@
 DefaultEnvironment(tools=[])
 env = Environment(tools=['mingw','link','g++'])
 #env.Tool('mingw')
-env.SharedLibrary('foobar', 'foobar.cc')
+foobar_obj = env.SharedObject('foobar.cc')
+env.SharedLibrary('foobar', foobar_obj)
+
+# Now verify versioned shared library doesn't fail
+env.SharedLibrary('foobar_ver', foobar_obj, SHLIBVERSION='2.4')
+
+
 """ % locals())
 
 test.run(arguments = ".")
Repository: SCons/scons

Issue:
Configure.CheckLib() error with -Wstrict-prototypes
This is a continuation of #3095. As noted in [this comment](https://github.com/SCons/scons/pull/3096/files#r1257532304), there was one more instance that was missed in PR #3096:

https://github.com/SCons/scons/blob/810ca6c8895b01cbd636d83079f6a848dc36adf6/SCons/Conftest.py#L677-L684


Discussion:

Resolving patch:
diff --git a/SCons/Conftest.py b/SCons/Conftest.py
--- a/SCons/Conftest.py
+++ b/SCons/Conftest.py
@@ -676,8 +676,7 @@ def CheckLib(context, libs, func_name = None, header = None,
 
     # if no function to test, leave main() blank
     text = text + """
-int
-main() {
+int main(void) {
   %s
 return 0;
 }


Test patch:
Repository: edgedb/edgedb

Issue:
Create 'array_contains' function
We need `array_contains` to test membership of an element within an array.


Discussion:

Resolving patch:
diff --git a/edgedb/server/pgsql/delta.py b/edgedb/server/pgsql/delta.py
--- a/edgedb/server/pgsql/delta.py
+++ b/edgedb/server/pgsql/delta.py
@@ -416,6 +416,15 @@ def compile_args(self, func: s_funcs.Function, schema):
         if not func.paramtypes:
             return
 
+        # TODO: Refactor to move this logic closer to pg_type_from_object,
+        # or add another layer of abstraction for typing for complex
+        # objects.
+        has_anyarray = (
+            (isinstance(func.returntype, s_obj.Array) and
+                func.returntype.element_type.name == 'std::any') or
+            any(isinstance(at, s_obj.Array) and
+                at.element_type.name == 'std::any' for at in func.paramtypes))
+
         args = []
         for an, at, ad in itertools.zip_longest(func.paramnames,
                                                 func.paramtypes,
@@ -424,7 +433,11 @@ def compile_args(self, func: s_funcs.Function, schema):
             if ad is not None:
                 pg_ad = self.compile_default(func, ad, schema)
 
-            pg_at = self.get_pgtype(func, at, schema)
+            if has_anyarray and at.name == 'std::any':
+                pg_at = ('anyelement',)
+            else:
+                pg_at = self.get_pgtype(func, at, schema)
+
             args.append((an, pg_at, pg_ad))
 
         return args


Test patch:
diff --git a/tests/test_edgeql_functions.py b/tests/test_edgeql_functions.py
--- a/tests/test_edgeql_functions.py
+++ b/tests/test_edgeql_functions.py
@@ -41,6 +41,19 @@ async def test_edgeql_functions_array_enumerate_01(self):
             [100, 101],
         ])
 
+    async def test_edgeql_functions_array_contains_01(self):
+        await self.assert_query_result(r'''
+            SELECT std::array_contains(<array<int>>[], {1, 3});
+            SELECT array_contains([1], {1, 3});
+            SELECT array_contains([1, 2], 1);
+            SELECT array_contains([1, 2], 3);
+        ''', [
+            [False, False],
+            [True, False],
+            [True],
+            [False],
+        ])
+
     @unittest.expectedFailure
     async def test_edgeql_functions_array_enumerate_02(self):
         # Fix type inference for functions.