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

Issue:
Relocation for osx-64 packages doesn't work with cross compiling
<!--
Thanks for opening an issue! A few things to keep in mind:

- This issue tracker is for issues with or enhancements for conda-build.

Anaconda Community Code of Conduct: https://www.anaconda.com/community-code-of-conduct/

For conda issues, you should open an issue at https://github.com/conda/conda/issues
For Anaconda issues, you should open an issue at https://github.com/ContinuumIO/anaconda-issues/issues
For an issue with a particular conda-forge package, you should open an issue on the 
corresponding feedstock: https://github.com/conda-forge
-->

### Actual Behavior

<!-- What actually happens? -->

### Expected Behavior

<!-- What do you think should happen? -->

### Steps to Reproduce

<!-- Steps to reproduce issue. -->


##### `Output of conda info`
<!-- Between the ticks below, paste the output of 'conda info' -->
```

```


`mk_relative_osx` looks at the build platform instead of the host platform at,

https://github.com/conda/conda-build/blob/f100a1ce48a8d1718db95cf8f69055e48f1f7590/conda_build/post.py#L401


Discussion:

Resolving patch:
diff --git a/conda_build/post.py b/conda_build/post.py
--- a/conda_build/post.py
+++ b/conda_build/post.py
@@ -398,10 +398,6 @@ def osx_ch_link(path, link_dict, host_prefix, build_prefix, files):
 
 
 def mk_relative_osx(path, host_prefix, build_prefix, files, rpaths=('lib',)):
-    if sys.platform != 'darwin':
-        log = utils.get_logger(__name__)
-        log.warn("Found Mach-O file but patching is only supported on macOS, skipping: %s", path)
-        return
     prefix = build_prefix if exists(build_prefix) else host_prefix
     names = macho.otool(path, prefix)
     s = macho.install_name_change(path, prefix,
@@ -1259,6 +1255,10 @@ def post_process_shared_lib(m, f, files, host_prefix=None):
         mk_relative_linux(f, m.config.host_prefix, rpaths=rpaths,
                           method=m.get_value('build/rpaths_patcher', None))
     elif codefile_t == 'machofile':
+        if m.config.host_platform != 'osx':
+            log = utils.get_logger(__name__)
+            log.warn("Found Mach-O file but patching is only supported on macOS, skipping: %s", path)
+            return
         mk_relative_osx(path, host_prefix, m.config.build_prefix, files=files, rpaths=rpaths)
 
 


Test patch:
Repository: conda/conda-build

Issue:
conda build calls `sys.exit` when downloading the source
<!--
Thanks for opening an issue! A few things to keep in mind:

- This issue tracker is for issues with or enhancements for conda-build.

Anaconda Community Code of Conduct: https://www.anaconda.com/community-code-of-conduct/

For conda issues, you should open an issue at https://github.com/conda/conda/issues
For Anaconda issues, you should open an issue at https://github.com/ContinuumIO/anaconda-issues/issues
For an issue with a particular conda-forge package, you should open an issue on the 
corresponding feedstock: https://github.com/conda-forge
-->

### Actual Behavior

If you use the `provide` function and a patch cannot be applied to the source, conda build calls `sys.exit`.

See https://github.com/conda/conda-build/blob/master/conda_build/source.py#L615

<!-- What actually happens? -->

### Expected Behavior

conda-build should raise a suitable error.

<!-- What do you think should happen? -->

### Steps to Reproduce

<!-- Steps to reproduce issue. -->


##### `Output of conda info`

This happens for the latest version of conda build in my CI jobs so I do not have the info output.

<!-- Between the ticks below, paste the output of 'conda info' -->
```

```

cc @mingwandroid @isuruf @scopatz @CJ-Wright 




Discussion:

Resolving patch:
diff --git a/conda_build/source.py b/conda_build/source.py
--- a/conda_build/source.py
+++ b/conda_build/source.py
@@ -612,7 +612,7 @@ def patch_or_reverse(patch, patch_args, cwd, stdout, stderr):
 
     exception = None
     if not isfile(path):
-        sys.exit('Error: no such patch: %s' % path)
+        raise RuntimeError('Error: no such patch: %s' % path)
 
     if config.verbose:
         stdout = None


Test patch:
Repository: conda/conda-build

Issue:
ImportError: cannot import name 'itervalues' from 'conda.common.compat'
This line https://github.com/conda/conda-build/blob/1ed8da062f123e1fbca604df26b064b267a3d094/conda_build/utils.py#L2085 references `from conda.common.compat import itervalues` which was   removed from conda 4.13. See also https://github.com/conda/conda/pull/11364


Discussion:

Resolving patch:
diff --git a/conda_build/utils.py b/conda_build/utils.py
--- a/conda_build/utils.py
+++ b/conda_build/utils.py
@@ -2081,10 +2081,11 @@ def linked_data_no_multichannels(prefix):
     """
     from conda.core.prefix_data import PrefixData
     from conda.models.dist import Dist
-    pd = PrefixData(prefix)
-    from conda.common.compat import itervalues
-    return {Dist.from_string(prefix_record.fn, channel_override=prefix_record.channel.name):
-                prefix_record for prefix_record in itervalues(pd._prefix_records)}
+
+    return {
+        Dist.from_string(prec.fn, channel_override=prec.channel.name): prec
+        for prec in PrefixData(prefix)._prefix_records.values()
+    }
 
 
 def shutil_move_more_retrying(src, dest, debug_name):


Test patch:
Repository: pymedusa/Medusa

Issue:
Subs extra scripts is broken (wrong arguments)
This commit https://github.com/pymedusa/SickRage/commit/d0c5e9c89fc9076e5733f79a7734503867d130a7

changed the extra scripts arguments to an array where the 3rd element is another array. Look the logs below:

```
2016-05-14 15:28:51 INFO     FINDSUBTITLES :: [24ddc49] Running subtitle pre-script: /usr/bin/python /scripts/library-scripts/sickrage/cleanit.py
2016-05-14 15:28:51 INFO     FINDSUBTITLES :: [24ddc49] Executing command: ['/usr/bin/python', '/scripts/library-scripts/sickrage/cleanit.py', "[u'/library/series/The 100/Season 03/The 100 - S03E15 - Perverse Instantiation Part One.mkv', u'/library/series/The 100/Season 03/The 100 - S03E15 - Perverse Instantiation Part One.pt-BR.srt', u'pob', u'The 100', 3, 15, u'Perverse Instantiation (1)', 268592]"]
2016-05-14 15:28:52 DEBUG    FINDSUBTITLES :: [24ddc49] Script result: Traceback (most recent call last):
  File "/scripts/library-scripts/sickrage/cleanit.py", line 21, in <module>
    subtitle_path = sys.argv[2]
IndexError: list index out of range
```

Note the list/array:

```
['/usr/bin/python', '/scripts/library-scripts/sickrage/cleanit.py', "[u'/library/series/The 100/Season 03/The 100 - S03E15 - Perverse Instantiation Part One.mkv', u'/library/series/The 100/Season 03/The 100 - S03E15 - Perverse Instantiation Part One.pt-BR.srt', u'pob', u'The 100', 3, 15, u'Perverse Instantiation (1)', 268592]"]
```

On another note, this log message is shown only on debug level (maybe it should be changed to a higher level)



Discussion:

Resolving patch:
diff --git a/sickbeard/subtitles.py b/sickbeard/subtitles.py
--- a/sickbeard/subtitles.py
+++ b/sickbeard/subtitles.py
@@ -897,7 +897,7 @@ def run_subs_pre_scripts(video_path):
     :param video_path: the video path
     :type video_path: str
     """
-    run_subs_scripts(video_path, sickbeard.SUBTITLES_PRE_SCRIPTS, [video_path])
+    run_subs_scripts(video_path, sickbeard.SUBTITLES_PRE_SCRIPTS, video_path)
 
 
 def run_subs_extra_scripts(video_path, subtitle_path, subtitle_language, show_name, season, episode, episode_name,
@@ -921,9 +921,8 @@ def run_subs_extra_scripts(video_path, subtitle_path, subtitle_language, show_na
     :param show_indexerid: the show indexer id
     :type show_indexerid: int
     """
-    run_subs_scripts(video_path, sickbeard.SUBTITLES_EXTRA_SCRIPTS,
-                     [video_path, subtitle_path, subtitle_language.opensubtitles, show_name, season, episode,
-                      episode_name, show_indexerid])
+    run_subs_scripts(video_path, sickbeard.SUBTITLES_EXTRA_SCRIPTS, video_path, subtitle_path,
+                     subtitle_language.opensubtitles, show_name, season, episode, episode_name, show_indexerid)
 
 
 def run_subs_scripts(video_path, scripts, *args):


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: 'NoneType' object has no attribute 'find'
### INFO

Python Version: **2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2]**
Operating System: **Linux-3.19.0-56-generic-i686-with-Ubuntu-14.04-trusty**
Locale: UTF-8
Branch: **develop**
Commit: PyMedusa/SickRage@3351698fd0d3b554f0dd6bbd8d0cbee0b60ce128
Link to Log: https://gist.github.com/ccfdecf2fda706d0b052e92834a2e71e
### ERROR

```
SEARCHQUEUE-MANUAL-311937 :: [Speedcd] :: [3351698] Unknown exception while searching Speedcd. Error: "'NoneType' object has no attribute 'find'"
Traceback (most recent call last):
  File "/home/home/SickRage/sickbeard/search.py", line 547, in searchProviders
    forced_search, downCurQuality, manual_search, manual_search_type)
  File "/home/home/SickRage/sickrage/providers/GenericProvider.py", line 149, in find_search_results
    items_list += self.search(search_string, ep_obj=episode)
  File "/home/home/SickRage/sickbeard/providers/speedcd.py", line 133, in search
    torrent_table = html.find('div', class_='boxContent').find('table')
AttributeError: 'NoneType' object has no attribute 'find'
```

---

_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:

Resolving patch:
diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py
--- a/sickbeard/providers/speedcd.py
+++ b/sickbeard/providers/speedcd.py
@@ -49,7 +49,7 @@ def __init__(self):
         # URLs
         self.url = 'https://speed.cd'
         self.urls = {
-            'login': urljoin(self.url, 'take.login.php'),
+            'login': urljoin(self.url, 'takelogin.php'),
             'search': urljoin(self.url, 'browse.php'),
         }
 
@@ -130,7 +130,8 @@ def process_column_header(td):
                     continue
 
                 with BS4Parser(data, 'html5lib') as html:
-                    torrent_table = html.find('div', class_='boxContent').find('table')
+                    torrent_table = html.find('div', class_='boxContent')
+                    torrent_table = torrent_table.find('table') if torrent_table else None
                     torrent_rows = torrent_table('tr') if torrent_table else []
 
                     # Continue only if at least one Release is found


Test patch:
Repository: pymedusa/Medusa

Issue:
UnicodeError in notifications
### Before submitting your issue:

Enable debug logging in SickRage settings, reproduce the error (be sure to disable after the bug is fixed)

Branch/Commit:Develop v0.1.2
OS: Win 10
What you did: Manual searched an episode that had unicode in the episode title
What happened: Received unicode error traceback
What you expected: No errors
Logs:

```
Not available
```

UnicodeError in notifications
### Before submitting your issue:

Enable debug logging in SickRage settings, reproduce the error (be sure to disable after the bug is fixed)

Branch/Commit:Develop v0.1.2
OS: Win 10
What you did: Manual searched an episode that had unicode in the episode title
What happened: Received unicode error traceback
What you expected: No errors
Logs:

```
Not available
```



Discussion:

Resolving patch:
diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py
--- a/sickbeard/search_queue.py
+++ b/sickbeard/search_queue.py
@@ -331,10 +331,10 @@ def run(self):
                 self.results = search_result
                 self.success = True
                 if self.manual_search_type == 'season':
-                    ui.notifications.message("We have found season pack results for {0}".format(self.show.name),
+                    ui.notifications.message("We have found season packs for {0}".format(self.show.name),
                                              "These should become visible in the manual select page.")
                 else:
-                    ui.notifications.message("We have found single results for {0}".format(self.segment[0].prettyName()),
+                    ui.notifications.message("We have found results for {0}".format(self.segment[0].prettyName()),
                                              "These should become visible in the manual select page.")
             else:
                 ui.notifications.message('No results were found')
diff --git a/sickbeard/server/web/core/base.py b/sickbeard/server/web/core/base.py
--- a/sickbeard/server/web/core/base.py
+++ b/sickbeard/server/web/core/base.py
@@ -472,9 +472,9 @@ def get_messages(self):
         cur_notification_num = 1
         for cur_notification in ui.notifications.get_notifications(self.request.remote_ip):
             messages['notification-{number}'.format(number=cur_notification_num)] = {
-                'title': cur_notification.title,
-                'message': cur_notification.message,
-                'type': cur_notification.type,
+                'title': '{0}'.format(cur_notification.title),
+                'message': '{0}'.format(cur_notification.message),
+                'type': '{0}'.format(cur_notification.type),
             }
             cur_notification_num += 1
 


Test patch:
Repository: pymedusa/Medusa

Issue:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u014d' in position 31: ordinal not in range(128)
```
Traceback (most recent call last):
  File "/home/orangepi/.sickrage/lib/subliminal/core.py", line 543, in refine
    refiner_manager[refiner].plugin(video, **kwargs)
  File "/home/orangepi/.sickrage/sickbeard/refiners/release.py", line 54, in refine
    release_file = get_release_file(dirpath, fileroot, extension) or release_file
  File "/home/orangepi/.sickrage/sickbeard/refiners/release.py", line 90, in get_release_file
    if os.path.isfile(release_file):
  File "/usr/lib/python2.7/genericpath.py", line 37, in isfile
    st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u014d' in position 31: ordinal not in range(128)
```

This happens because the subtitle contains a non-ascii char and my locale is set to None.
To fix this we would need to use ek() for isfile() or (better imo) use a similar solution to what we du in subtitles.py. What do you think @ratoaq2?



Discussion:

Resolving patch:
diff --git a/sickbeard/refiners/release.py b/sickbeard/refiners/release.py
--- a/sickbeard/refiners/release.py
+++ b/sickbeard/refiners/release.py
@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
 """Release refiner."""
-from __future__ import unicode_literals
 
 import logging
 import os
@@ -10,7 +9,7 @@
 logger = logging.getLogger(__name__)
 
 MOVIE_ATTRIBUTES = {'title': 'title', 'year': 'year', 'format': 'format', 'release_group': 'release_group',
-                    'resolution': 'screen_size',  'video_codec': 'video_codec', 'audio_codec': 'audio_codec'}
+                    'resolution': 'screen_size', 'video_codec': 'video_codec', 'audio_codec': 'audio_codec'}
 EPISODE_ATTRIBUTES = {'series': 'title', 'season': 'season', 'episode': 'episode', 'title': 'episode_title',
                       'year': 'year', 'format': 'format', 'release_group': 'release_group', 'resolution': 'screen_size',
                       'video_codec': 'video_codec', 'audio_codec': 'audio_codec'}


Test patch:
Repository: pymedusa/Medusa

Issue:
FINDSUBTITLES :: [3824246] Failed to refine video Traceback (most recent call last)
### Before submitting your issue:

Enable debug logging in SickRage settings, reproduce the error (be sure to disable after the bug is fixed)

Branch/Commit: develop/3824246
OS: Linux
What you did: nothing
What happened: ~~rato appeared~~ warning
What you expected: no warning
Logs:

```
2016-09-05 17:55:06 WARNING  FINDSUBTITLES :: [3824246] Failed to refine video
Traceback (most recent call last):
  File "/home/**********/.sickrage/lib/subliminal/core.py", line 543, in refine
    refiner_manager[refiner].plugin(video, **kwargs)
  File "/home/**********/.sickrage/sickbeard/refiners/tvepisode.py", line 62, in refine
    enrich({'resolution': guess['screen_size'], 'format': guess['format']}, video, overwrite=False)
KeyError: u'screen_size'
```



Discussion:
@medariox filename/release name?

should be guess.get() there

Nothing special, should be this one:
`Keep.Down.with.the.Kabas.S12E13.HDTV.x264-CRIMSON.mkv`

I think rato knows what's up 😃 


Resolving patch:
diff --git a/sickbeard/refiners/tvepisode.py b/sickbeard/refiners/tvepisode.py
--- a/sickbeard/refiners/tvepisode.py
+++ b/sickbeard/refiners/tvepisode.py
@@ -59,7 +59,7 @@ def refine(video, tv_episode=None, **kwargs):
     enrich(EPISODE_MAPPING, video, tv_episode)
     enrich({'release_group': tv_episode.release_group}, video, overwrite=False)
     guess = Quality.to_guessit(tv_episode.status)
-    enrich({'resolution': guess['screen_size'], 'format': guess['format']}, video, overwrite=False)
+    enrich({'resolution': guess.get('screen_size'), 'format': guess.get('format')}, video, overwrite=False)
 
 
 def enrich(attributes, target, source=None, overwrite=True):


Test patch:
Repository: pymedusa/Medusa

Issue:
View Log and Submit Errors broken
### Before submitting your issue:

Enable debug logging in SickRage settings, reproduce the error (be sure to disable after the bug is fixed)

**Branch/Commit**: Develop / 6eca5cd5343536f4ca9df32097e872c1a74dc4de
**OS**: Win 10x64
**What you did**: View Logs in GUI by either `Tools -> View` or getting redirected to the View Logs page by clearing errors or warnings in the GUI.
**What happened**: GUI message "Oops You have reached this page by accident, please check the url."
**What you expected**:  View Logs as before
**Logs**:  Traceback included below

```
2016-10-19 21:48:16 ERROR    Thread-24 :: [6eca5cd] Failed doing web ui callback: Traceback (most recent call last):
  File "H:\usr\local\medusa\medusa\server\web\core\base.py", line 271, in async_call
    result = function(**kwargs)
  File "H:\usr\local\medusa\medusa\server\web\core\error_logs.py", line 133, in viewlog
    predicate=lambda l: filter_logline(l, min_level=min_level,
  File "H:\usr\local\medusa\medusa\logger.py", line 137, in read_loglines
    for line in reverse_readlines(f):
  File "H:\usr\local\medusa\medusa\logger.py", line 196, in reverse_readlines
    buf = text_type(buf.decode(sys.getfilesystemencoding()) if os.name == 'nt' else buf, errors='replace')
TypeError: decoding Unicode is not supported
Traceback (most recent call last):
  File "H:\usr\local\medusa\medusa\server\web\core\base.py", line 271, in async_call
    result = function(**kwargs)
  File "H:\usr\local\medusa\medusa\server\web\core\error_logs.py", line 133, in viewlog
    predicate=lambda l: filter_logline(l, min_level=min_level,
  File "H:\usr\local\medusa\medusa\logger.py", line 137, in read_loglines
    for line in reverse_readlines(f):
  File "H:\usr\local\medusa\medusa\logger.py", line 196, in reverse_readlines
    buf = text_type(buf.decode(sys.getfilesystemencoding()) if os.name == 'nt' else buf, errors='replace')
TypeError: decoding Unicode is not supported
```



Discussion:
This first appears @ fcf84481bcbcab7d489aaf9d33d03386d3892ca2.

Same issue with Windows 10.


Resolving patch:
diff --git a/medusa/logger.py b/medusa/logger.py
--- a/medusa/logger.py
+++ b/medusa/logger.py
@@ -193,7 +193,10 @@ def reverse_readlines(filename, buf_size=2097152, encoding=default_encoding):
             offset = min(file_size, offset + buf_size)
             fh.seek(file_size - offset)
             buf = fh.read(min(remaining_size, buf_size))
-            buf = text_type(buf.decode(sys.getfilesystemencoding()) if os.name == 'nt' else buf, errors='replace')
+            if os.name == 'nt':
+                buf = buf.decode(sys.getfilesystemencoding())
+            if not isinstance(buf, text_type):
+                buf = text_type(buf, errors='replace')
             remaining_size -= buf_size
             lines = buf.split(new_line)
             # the first line of the buffer is probably not a complete line so


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: TypeEError: 'int' object has no attribute '__getitem__'
### INFO
**Python Version**: `2.7.9 (default, Aug 13 2016, 17:56:53) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.27-1-osmc-armv7l-with-debian-8.6`
**Locale**: `UTF-8`
**Branch**: [optimized2](../tree/optimized2)
**Database**: `44.3`
**Commit**: pymedusa/Medusa@ff8dcfa6034366fa6c9d0b526b67e3cdb02fafe6
**Link to Log**: https://gist.github.com/2f6af155ba86624566e4d31c88f94e40
### ERROR
<pre>
2016-10-31 12:46:51 ERROR    SEARCHQUEUE-MANUAL-248835 :: [T411] :: [ff8dcfa] Unknown exception while searching T411. Error: "'int' object has no attribute '__getitem__'"
Traceback (most recent call last):
  File "/home/osmc/Medusa/<a href="../blob/ff8dcfa6034366fa6c9d0b526b67e3cdb02fafe6/medusa/search/core.py#L621">medusa/search/core.py</a>", line 621, in searchProviders
    downCurQuality, manual_search, manual_search_type)
  File "/home/osmc/Medusa/<a href="../blob/ff8dcfa6034366fa6c9d0b526b67e3cdb02fafe6/medusa/providers/generic_provider.py#L182">medusa/providers/generic_provider.py</a>", line 182, in find_search_results
    items_list += self.search(search_string, ep_obj=episode)
  File "/home/osmc/Medusa/<a href="../blob/ff8dcfa6034366fa6c9d0b526b67e3cdb02fafe6/medusa/providers/torrent/json/t411.py#L106">medusa/providers/torrent/json/t411.py</a>", line 106, in search
    results += self.parse(jdata, mode)
  File "/home/osmc/Medusa/<a href="../blob/ff8dcfa6034366fa6c9d0b526b67e3cdb02fafe6/medusa/providers/torrent/json/t411.py#L121">medusa/providers/torrent/json/t411.py</a>", line 121, in parse
    torrent_rows = sorted(unsorted_torrent_rows, key=itemgetter('added'), reverse=True)
TypeError: 'int' object has no attribute '__getitem__'
</pre>

---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:

Resolving patch:
diff --git a/medusa/providers/torrent/json/t411.py b/medusa/providers/torrent/json/t411.py
--- a/medusa/providers/torrent/json/t411.py
+++ b/medusa/providers/torrent/json/t411.py
@@ -119,13 +119,14 @@ def parse(self, data, mode):
         items = []
 
         unsorted_torrent_rows = data.get('torrents') if mode != 'RSS' else data
-        torrent_rows = sorted(unsorted_torrent_rows, key=itemgetter('added'), reverse=True)
 
-        if not torrent_rows or not isinstance(torrent_rows, list):
+        if not unsorted_torrent_rows or not isinstance(unsorted_torrent_rows, dict):
             logger.log('Data returned from provider does not contain any {0}torrents'.format(
                 'confirmed ' if self.confirmed else ''), logger.DEBUG)
             return items
 
+        torrent_rows = sorted(unsorted_torrent_rows, key=itemgetter('added'), reverse=True)
+
         for row in torrent_rows:
             if not isinstance(row, dict):
                 logger.log('Invalid data returned from provider', logger.WARNING)


Test patch: