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

Issue:
Zipped images not included in examples
Zips from [this](https://github.com/kivy/kivy/tree/master/examples/widgets/sequenced_images/data/images) folder aren't available in installed examples (excluding installation from git clone).

There should be also included a license to the files in the example, ref #3110.
Zipped images not included in examples
Zips from [this](https://github.com/kivy/kivy/tree/master/examples/widgets/sequenced_images/data/images) folder aren't available in installed examples (excluding installation from git clone).

There should be also included a license to the files in the example, ref #3110.


Discussion:
@KeyWeeUsr as a simple fix; do you plan to unzip the files? Or do you need someone to do that?
The files need to be zipped to preserve the functionality of the example showing an `Image` being able to open `.zip` files as a gif → [here](https://github.com/kivy/kivy/blob/master/examples/widgets/sequenced_images/main.kv#L27) and [here](https://github.com/kivy/kivy/blob/master/kivy/core/image/__init__.py#L240).
@KeyWeeUsr, are you referring to windows wheels specifically?
@dessant At first I thought so, but I think it's `setup.py`'s fault, as I don't see the zips even after installing from repo. Which means it's broken everywhere. 
Just a guess, but this may be the place to add it: https://github.com/kivy/kivy/blob/master/MANIFEST.in.

Edit: it already lists everything from the examples folder.
```
recursive-include examples *
```
This is it: https://github.com/kivy/kivy/blob/master/setup.py#L864.
@KeyWeeUsr as a simple fix; do you plan to unzip the files? Or do you need someone to do that?
The files need to be zipped to preserve the functionality of the example showing an `Image` being able to open `.zip` files as a gif → [here](https://github.com/kivy/kivy/blob/master/examples/widgets/sequenced_images/main.kv#L27) and [here](https://github.com/kivy/kivy/blob/master/kivy/core/image/__init__.py#L240).
@KeyWeeUsr, are you referring to windows wheels specifically?
@dessant At first I thought so, but I think it's `setup.py`'s fault, as I don't see the zips even after installing from repo. Which means it's broken everywhere. 
Just a guess, but this may be the place to add it: https://github.com/kivy/kivy/blob/master/MANIFEST.in.

Edit: it already lists everything from the examples folder.
```
recursive-include examples *
```
This is it: https://github.com/kivy/kivy/blob/master/setup.py#L864.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -863,7 +863,7 @@ def get_extensions_from_sources(sources):
 examples = {}
 examples_allowed_ext = ('readme', 'py', 'wav', 'png', 'jpg', 'svg', 'json',
                         'avi', 'gif', 'txt', 'ttf', 'obj', 'mtl', 'kv', 'mpg',
-                        'glsl')
+                        'glsl', 'zip')
 for root, subFolders, files in walk('examples'):
     for fn in files:
         ext = fn.split('.')[-1].lower()


Test patch:
Repository: kivy/kivy

Issue:
Typo:  _reslove_last_node
@ `kivy/uix/behaviors/compoundselection.py`

code is written
_res`lo`ve_last_node
instead of
_res`ol`ve_last_node


Discussion:

Resolving patch:
diff --git a/kivy/uix/behaviors/compoundselection.py b/kivy/uix/behaviors/compoundselection.py
--- a/kivy/uix/behaviors/compoundselection.py
+++ b/kivy/uix/behaviors/compoundselection.py
@@ -314,7 +314,7 @@ def select_with_touch(self, node, touch=None):
 
         if touch and 'button' in touch.profile and touch.button in\
             ('scrollup', 'scrolldown', 'scrollleft', 'scrollright'):
-            node_src, idx_src = self._reslove_last_node()
+            node_src, idx_src = self._resolve_last_node()
             node, idx = self.goto_node(touch.button, node_src, idx_src)
             if node == node_src:
                 return False
@@ -363,7 +363,7 @@ def select_with_key_down(self, keyboard, scancode, codepoint, modifiers,
             return False
         keys = self._key_list
         multi = self.multiselect
-        node_src, idx_src = self._reslove_last_node()
+        node_src, idx_src = self._resolve_last_node()
         text = scancode[1]
 
         if text == 'shift':
@@ -454,7 +454,7 @@ def _update_counts(self, *largs):
         'down': uc, 'right': rc, 'left': -rc, 'scrollup': sc,
         'scrolldown': -sc, 'scrollright': -sc, 'scrollleft': sc}
 
-    def _reslove_last_node(self):
+    def _resolve_last_node(self):
         # for offset selection, we have a anchor, and we select everything
         # between anchor and added offset relative to last node
         sister_nodes = self.get_selectable_nodes()


Test patch:
Repository: kivy/kivy

Issue:
Examples: canvas/line.py
### Versions

* Python: 2.7, 3.5
* OS: Win8.1, 64bit
* Kivy: master, wheels

### Description

Doesn't change any of the cap/joint values, but it works with an ordinary kv file:

```
from kivy.app import runTouchApp
from kivy.lang import Builder
runTouchApp(Builder.load_string('''
Widget:
    canvas:
        Color:
            rgb: 1,0,0
        Line:
            width: 5
            points: [100,100,250,170,300,50]
            joint: 'none'
            cap: 'square'
            close: False
'''))
```


Discussion:
ref #2968, in the example there's `SmoothLine`, not the `Line` alone. As the example literally talks about `SmoothLine`, I'm not sure how to handle it. On the other hand:

> [:attr:`~Line.cap`, :attr:`~Line.joint` and :attr:`~Line.dash` properties are not supported.](https://github.com/kivy/kivy/blob/069cc8cd68a972fb11b9513959fdd09b0ab0ed0d/kivy/graphics/vertex_instructions_line.pxi#L1202)

but still the change `Line` → `SmoothLine` was intended (ref https://github.com/kivy/kivy/commit/3070a93b89d6896805def2b59bc9d2a19d42d89e).

Any ideas @tito ?

Resolving patch:
diff --git a/examples/canvas/lines.py b/examples/canvas/lines.py
--- a/examples/canvas/lines.py
+++ b/examples/canvas/lines.py
@@ -24,7 +24,7 @@
     canvas:
         Color:
             rgba: .4, .4, 1, root.alpha
-        SmoothLine:
+        Line:
             points: self.points
             joint: self.joint
             cap: self.cap
@@ -32,12 +32,12 @@
             close: self.close
         Color:
             rgba: .8, .8, .8, root.alpha_controlline
-        SmoothLine:
+        Line:
             points: self.points
             close: self.close
         Color:
             rgba: 1, .4, .4, root.alpha
-        SmoothLine:
+        Line:
             points: self.points2
             joint: self.joint
             cap: self.cap


Test patch:
Repository: kivy/kivy

Issue:
Kivy breaks Clipboard
### Versions

* Python: 2.7.12
* OS: Windows 10
* Kivy: 1.9.2-dev0
* Kivy installation method: wheel

### Description

When pasting some data into a `TextInput`, the clipboard breaks across the system, and copying and pasting is not possible until the Kivy app is terminated. Specifically, I found the following steps to reproduce the problem:
1. Try copying a file into the `TextInput` box (nothing will paste in as expected)
2. Try copying some text somewhere else (does not have to be in the `TextInput`)

After step 1, nothing is copied or pasted and the Kivy application must be terminated before the clipboard starts working again.


Discussion:

Resolving patch:
diff --git a/kivy/core/clipboard/clipboard_winctypes.py b/kivy/core/clipboard/clipboard_winctypes.py
--- a/kivy/core/clipboard/clipboard_winctypes.py
+++ b/kivy/core/clipboard/clipboard_winctypes.py
@@ -27,9 +27,13 @@ def get(self, mimetype='text/plain'):
         GetClipboardData.restype = wintypes.HANDLE
 
         user32.OpenClipboard(user32.GetActiveWindow())
-        # 1 is CF_TEXT
+        # Standard Clipboard Format "1" is "CF_TEXT"
         pcontents = GetClipboardData(13)
+
+        # if someone pastes a FILE, the content is None for SCF 13
+        # and the clipboard is locked if not closed properly
         if not pcontents:
+            user32.CloseClipboard()
             return ''
         data = c_wchar_p(pcontents).value.encode(self._encoding)
         user32.CloseClipboard()


Test patch:
Repository: kivy/kivy

Issue:
Touch in overlapping TextInputs
### Versions

* Python: 2.7, 3.5
* OS: Win8.1, 64bit
* Kivy: master
* Kivy installation method: wheels

### Description

I found an [interesting question](http://stackoverflow.com/q/41974770/5994041) on StackOverflow, which probably shows a bug in a TextInput. Apparently when 2+ TextInputs overlap, a user can select only a single one of them. The first one added to the parent most likely. It doesn't appear to behave the same with ordinary Buttons though, so either it's a bug, or an intended thing in the FocusBehavior?

### Code and Logs

```python
from kivy.app import runTouchApp
from kivy.lang import Builder
runTouchApp(Builder.load_string('''
FloatLayout:
    TextInput:
        size_hint_y: 0.95
    TextInput:
        pos: 50, 50
'''))
```

```kv
FloatLayout:
    Button:
        pos: 50, 50
    Button:
        size_hint_y: 0.95
```


Discussion:

Resolving patch:
diff --git a/kivy/uix/textinput.py b/kivy/uix/textinput.py
--- a/kivy/uix/textinput.py
+++ b/kivy/uix/textinput.py
@@ -1334,22 +1334,22 @@ def on_touch_down(self, touch):
             if scroll_type == 'down':
                 if self.multiline:
                     if self.scroll_y <= 0:
-                        return
+                        return True
                     self.scroll_y -= self.line_height
                 else:
                     if self.scroll_x <= 0:
-                        return
+                        return True
                     self.scroll_x -= self.line_height
             if scroll_type == 'up':
                 if self.multiline:
                     if (self._lines_rects[-1].pos[1] > self.y +
                             self.line_height):
-                        return
+                        return True
                     self.scroll_y += self.line_height
                 else:
                     if (self.scroll_x + self.width >=
                             self._lines_rects[-1].texture.size[0]):
-                        return
+                        return True
                     self.scroll_x += self.line_height
 
         touch.grab(self)
@@ -1378,7 +1378,7 @@ def on_touch_down(self, touch):
             self.insert_text(CutBuffer.get_cutbuffer())
             return True
 
-        return False
+        return True
 
     def on_touch_move(self, touch):
         if touch.grab_current is not self:


Test patch:
Repository: kivy/kivy

Issue:
Installation from stable repository doesn't include kivy.tools
When kivy is installed via `sudo apt-get install python3-kivy`, the installation is missing kivy.tools, thus crashing when I try to build a linux distro for my project. Otherwise it's working kivy1.9.1 installation with which I've succesfully developed software. I've used python3.4 and stable repository at `ppa:kivy-team/kivy`.
I've fixed the problem by removing python3-kivy package and installing kivy-master from github as @alexhayes suggested at #3002 so it's probably an outdated version at repository.


Discussion:
I think it's similar to the wheels, where I too don't see kivy.tools. At least not everything from the repo.
@SynedraAcus The `kivy.tools` folder is missing completely, or only a part of it, e.g. `gles` header or something...? Probably it's only missing [here](https://github.com/kivy/kivy/blob/master/setup.py#L968).
There was no `tools` folder at all *in installed library* at, if my memory serves, `/usr/lib/python3.4/dist-packages`. I have very little idea how kivy gets packaged and installed, so I cannot say why this issue come to be.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1009,16 +1009,18 @@ def get_extensions_from_sources(sources):
             'tests/*.png',
             'tests/*.ttf',
             'tests/*.ogg',
-            'tools/highlight/*.vim',
-            'tools/highlight/*.el',
+            'tools/gles_compat/*',
+            'tools/highlight/*',
             'tools/packaging/README.txt',
             'tools/packaging/win32/kivy.bat',
             'tools/packaging/win32/kivyenv.sh',
             'tools/packaging/win32/README.txt',
             'tools/packaging/osx/Info.plist',
             'tools/packaging/osx/InfoPlist.strings',
-            'tools/gles_compat/*.h',
-            'tools/packaging/osx/kivy.sh'] + binary_deps},
+            'tools/packaging/osx/kivy.sh',
+            'tools/pep8checker/*',
+            'tools/theming/defaulttheme/*',
+        ] + binary_deps},
         data_files=[] if split_examples else list(examples.items()),
         classifiers=[
             'Development Status :: 5 - Production/Stable',


Test patch:
Repository: kivy/kivy

Issue:
setup.py should not depend on the existence of `git` on the system
### Versions

* Python: 3.5.3
* OS: nixos
* Kivy: 1.10.0
* Kivy installation method: nix

### Description

I tried to package kivy for nixos, a Purely Functional Linux Distribution.

```
 Traceback (most recent call last):
   File "nix_run_setup.py", line 8, in <module>
     exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
   File "setup.py", line 934, in <module>
     version=get_version(),
   File "setup.py", line 47, in get_version
     ['git', 'rev-parse', 'HEAD']
   File "/nix/store/kgh0z7i2n7xl6pvanmi0v8dw4qy63932-python3-3.5.3/lib/python3.5/subprocess.py", line 316, in check_output
     **kwargs).stdout
   File "/nix/store/kgh0z7i2n7xl6pvanmi0v8dw4qy63932-python3-3.5.3/lib/python3.5/subprocess.py", line 383, in run
     with Popen(*popenargs, **kwargs) as process:
   File "/nix/store/kgh0z7i2n7xl6pvanmi0v8dw4qy63932-python3-3.5.3/lib/python3.5/subprocess.py", line 676, in __init__
     restore_signals, start_new_session)
   File "/nix/store/kgh0z7i2n7xl6pvanmi0v8dw4qy63932-python3-3.5.3/lib/python3.5/subprocess.py", line 1282, in _execute_child
     raise child_exception_type(errno_num, err_msg)
 FileNotFoundError: [Errno 2] No such file or directory: 'git'
```
This can be attributed to `setup.py` attempting to run `git`. This was introduced here:

https://github.com/kivy/kivy/pull/4949/commits/ffcb437fc6d183f3e34db180c9b0f0220bf2e08b

I would postulate that the install-time dependency on `git` is unnecessary and bad practice. 


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,7 @@ def get_version(filename='kivy/version.py'):
         GIT_REVISION = check_output(
             ['git', 'rev-parse', 'HEAD']
         ).strip().decode('ascii')
-    except CalledProcessError:
+    except (CalledProcessError, FileNotFoundError):
         GIT_REVISION = "Unknown"
 
     cnt = (


Test patch:
Repository: kivy/kivy

Issue:
TextInput selection disappearing on <enter> key
### Versions

* Python: 3.5
* OS: Windows 8.1
* Kivy: master
* Kivy installation method: wheel

### Description

1. Write some text e.g. "somelongtext"
2. press `<enter>`
3. write some text again, preferably something short e.g. "text"
4. press `<enter>`
5. `<shift> + <up>` (aka select the text)
6. press 7x `<enter>` and look at the selection disappearing

### Code and Logs

```python
from kivy.app import runTouchApp
from kivy.uix.textinput import TextInput
runTouchApp(TextInput())
```


Discussion:
What is the desired functionality? I would rather expect the selected text to be replaced with a new line when pressing enter
@BoyanH yeah, that should be the behavior. More precisely the contents of the selection should completely disappear and then the new line inserted at the end of the previous selection on the first enter key and then 6 times new line.

Try with multiple simple text editors and you should get the result I'm talking about.

Resolving patch:
diff --git a/kivy/uix/textinput.py b/kivy/uix/textinput.py
--- a/kivy/uix/textinput.py
+++ b/kivy/uix/textinput.py
@@ -2286,7 +2286,10 @@ def _key_down(self, key, repeat=False):
         elif internal_action == 'backspace':
             self.do_backspace()
         elif internal_action == 'enter':
-            if self.multiline:
+            if self.multiline and self._selection:
+                self.delete_selection()
+                self.insert_text(u'\n')
+            elif self.multiline:
                 self.insert_text(u'\n')
             else:
                 self.dispatch('on_text_validate')


Test patch:
Repository: kivy/kivy

Issue:
DragBehavior dispatching touch event incorrectly
<!--
The issue tracker is a tool to address bugs.
Please use the #kivy IRC channel on freenode or Stack Overflow for
support questions, more information at https://git.io/vM1yQ.

Before opening a new issue, make sure you do the following:
    * check that your issue isn't already filed: https://git.io/vM1iE
    * prepare a short, runnable example that reproduces the issue
    * reproduce the problem with the latest development version of Kivy
    * double-check that the issue is indeed a bug and not a support request
-->

### Versions

* Python: 3.6.0
* OS: Linux Mint ver17.3  (based on Ubuntu 14.04)
* Kivy: 1.10
* Kivy installation method: pip (using pyenv)

### Description

on_press() isn't called when holding down button A or B or D.

### Code and Logs

```python
from kivy.lang import Builder
from kivy.base import runTouchApp

root = Builder.load_string(r'''
<DraggableButton@DragBehavior+Button>:
    font_size: 40
    drag_rectangle: [*self.pos, *self.size, ]
    size_hint: None, None
    on_touch_down: print(self.text, 'on_touch_down')
    on_press: print(self.text, 'on_press')

GridLayout:
    on_touch_down: print('------------------------------------------')
    cols: 2
    RelativeLayout:
        DraggableButton:
            text: 'A'
    RelativeLayout:
        DraggableButton:
            text: 'B'
    RelativeLayout:
        DraggableButton:
            text: 'C'
    RelativeLayout:
        DraggableButton:
            text: 'D'
''')

runTouchApp(root)
```

##### hold down A

```text
------------------------------------------
D on_touch_down
C on_touch_down
B on_touch_down
A on_touch_down
```

##### hold down B

```text
------------------------------------------
D on_touch_down
C on_touch_down
B on_touch_down
```

##### hold down C

```text
------------------------------------------
D on_touch_down
C on_touch_down
C on_press
```

##### hold down D

```text
------------------------------------------
D on_touch_down
```


Discussion:
👋 Thanks for opening your first issue here! Be sure to follow the issue template!


Resolving patch:
diff --git a/kivy/uix/behaviors/drag.py b/kivy/uix/behaviors/drag.py
--- a/kivy/uix/behaviors/drag.py
+++ b/kivy/uix/behaviors/drag.py
@@ -227,5 +227,8 @@ def _change_touch_mode(self, *largs):
             return
         touch.ungrab(self)
         self._drag_touch = None
+        touch.push()
+        touch.apply_transform_2d(self.parent.to_widget)
         super(DragBehavior, self).on_touch_down(touch)
+        touch.pop()
         return


Test patch:
Repository: kivy/kivy

Issue:
No exception is thrown if root widget already has a parent
### Versions

* Python: 3.6.1
* OS: Windows
* Kivy: 1.10
* Kivy installation method: pip

### Description

Using a root widget that already has a parent doesn't throw an exception.

### Code and Logs

```python
from kivy.base import runTouchApp
from kivy.factory import Factory as F

A = F.BoxLayout()
B = F.Button()
A.add_widget(B)

runTouchApp(B)
```

With BoxLayout for A this floods console with clock iteration errors (using Widget for A doesn't)


Discussion:

Resolving patch:
diff --git a/kivy/core/window/__init__.py b/kivy/core/window/__init__.py
--- a/kivy/core/window/__init__.py
+++ b/kivy/core/window/__init__.py
@@ -1240,6 +1240,13 @@ def _update_childsize(self, instance, value):
 
     def add_widget(self, widget, canvas=None):
         '''Add a widget to a window'''
+        if widget.parent:
+            from kivy.uix.widget import WidgetException
+            raise WidgetException(
+                'Cannot add %r to window, it already has a parent %r' %
+                (widget, widget.parent)
+            )
+
         widget.parent = self
         self.children.insert(0, widget)
         canvas = self.canvas.before if canvas == 'before' else \


Test patch:
Repository: kivy/kivy

Issue:
Probesysfs provider requires getconf
<!--
The issue tracker is a tool to address bugs.
Please use the #kivy IRC channel on freenode or Stack Overflow for
support questions, more information at https://git.io/vM1yQ.

Before opening a new issue, make sure you do the following:
    * check that your issue isn't already filed: https://git.io/vM1iE
    * prepare a short, runnable example that reproduces the issue
    * reproduce the problem with the latest development version of Kivy
    * double-check that the issue is indeed a bug and not a support request
-->

### Versions

* Python: 3.6.4
* OS: Linux
* Kivy: 1.10.0
* Kivy installation method: setuptools

### Description

Kivy's probesysfs provider requires getconf, provided by glibc, to get the platform's LONG_BIT value.

This dependency precludes the use of other C libraries, such as musl, as well as platforms that choose not to install getconf.



Discussion:

Resolving patch:
diff --git a/kivy/input/providers/probesysfs.py b/kivy/input/providers/probesysfs.py
--- a/kivy/input/providers/probesysfs.py
+++ b/kivy/input/providers/probesysfs.py
@@ -47,6 +47,7 @@
     ProbeSysfsHardwareProbe = None
 
 else:
+    import ctypes
     from re import match, IGNORECASE
     from glob import glob
     from subprocess import Popen, PIPE
@@ -89,7 +90,7 @@ def get_capabilities(self):
                 return []
 
             capabilities = []
-            long_bit = getconf("LONG_BIT")
+            long_bit = ctypes.sizeof(ctypes.c_long) * 8
             for i, word in enumerate(line.split(" ")):
                 word = int(word, 16)
                 subcapabilities = [bool(word & 1 << i)
@@ -112,10 +113,6 @@ def getout(*args):
         except OSError:
             return ''
 
-    def getconf(var):
-        output = getout("getconf", var)
-        return int(output)
-
     def query_xinput():
         global _cache_xinput
         if _cache_xinput is None:


Test patch:
Repository: kivy/kivy

Issue:
The "data" parameter for add_panel_json() is undocumented
https://github.com/kivy/kivy/blob/fb8c0b9c5c367514f1c6949f86efbc0cae207c2c/kivy/uix/settings.py#L967

The "data" parameter can be used to provide JSON data, instead  of using a file, which I figured out by reading the source. It should be documented in the method description.


Discussion:

Resolving patch:
diff --git a/kivy/uix/settings.py b/kivy/uix/settings.py
--- a/kivy/uix/settings.py
+++ b/kivy/uix/settings.py
@@ -966,7 +966,8 @@ def on_config_change(self, config, section, key, value):
 
     def add_json_panel(self, title, config, filename=None, data=None):
         '''Create and add a new :class:`SettingsPanel` using the configuration
-        `config` with the JSON definition `filename`.
+        `config` with the JSON definition `filename`. If `filename` is not set,
+        then the JSON definition is read from the `data` parameter instead.
 
         Check the :ref:`settings_json` section in the documentation for more
         information about JSON format and the usage of this function.


Test patch: