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

Issue:
[BUG] get_mgmt blowing error if provider_key is a dict
This piece of code
https://github.com/ManageIQ/integration_tests/blob/3ccb7ac459f98df2da3c6b522ee257c80ae29aba/cfme/utils/providers.py#L389-L393
is causing  `TypeError: unhashable type: 'AttrDict'` if `provider_key` is a unhashable type (dict).
using the first argument as a dict can be found in here
https://github.com/ManageIQ/integration_tests/blob/4df0616bdea9cfb14974ab29d8b0590894189d92/cfme/utils/template/base.py#L141-L153
and here
https://github.com/ManageIQ/integration_tests/blob/ad10e312a53c5ac21c3a66fcb230de454f4850f9/cfme/cloud/provider/vcloud.py#L57-L65


Discussion:

Resolving patch:
diff --git a/cfme/utils/providers.py b/cfme/utils/providers.py
--- a/cfme/utils/providers.py
+++ b/cfme/utils/providers.py
@@ -358,6 +358,7 @@ def get_mgmt(provider_key, providers=None, credentials=None):
     # TODO rename the parameter; might break things
     if isinstance(provider_key, Mapping):
         provider_data = provider_key
+        provider_key = provider_data['name']
     else:
         provider_data = providers[provider_key]
 


Test patch:
Repository: ManageIQ/integration_tests

Issue:
cfme.log only showing on first test in a run.
cfme.log link only appears on the first test from a selection but shows all logs from all tests in that run. Expected to have a separate log link for each test specific to that test. See attached
![screenshot from 2018-08-14 15-50-11](https://user-images.githubusercontent.com/18352403/44099182-fca60de6-9fd9-11e8-8525-27ca6032229f.png)



Discussion:

Resolving patch:
diff --git a/artifactor/plugins/logger.py b/artifactor/plugins/logger.py
--- a/artifactor/plugins/logger.py
+++ b/artifactor/plugins/logger.py
@@ -26,7 +26,7 @@ def __init__(self, ident):
             self.handler = None
 
         def close(self):
-            if self.handle is not None:
+            if self.handler is not None:
                 self.handler.close()
                 self.handler = None
 


Test patch:
diff --git a/artifactor/example_tests/artifactor_simple_example.py b/artifactor/example_tests/artifactor_simple_example.py
new file mode 100644
--- /dev/null
+++ b/artifactor/example_tests/artifactor_simple_example.py
@@ -0,0 +1,21 @@
+from cfme.utils.log import logger as log
+import pytest
+
+
+def test_pass():
+    log.info("pass")
+
+
+@pytest.mark.skip(reason="example")
+def test_skip():
+    pass
+
+
+def test_skip_imp():
+    log.info("skip")
+    pytest.skip("example")
+
+
+def test_fail():
+    log.info("fail")
+    raise ValueError()
Repository: ManageIQ/integration_tests

Issue:
Search miq widget need `is_displayed` method
Current implementation `is_displayed` pointed to `View` not that  particular `widget`

need to add check for `search_input`  


Discussion:

Resolving patch:
diff --git a/widgetastic_manageiq/__init__.py b/widgetastic_manageiq/__init__.py
--- a/widgetastic_manageiq/__init__.py
+++ b/widgetastic_manageiq/__init__.py
@@ -2527,6 +2527,10 @@ def remove_search_filters(self):
             self.filter_clear_button.click()
         self.clear_simple_search()
 
+    @property
+    def is_displayed(self):
+        return self.search_input.is_displayed
+
 
 class UpDownSelect(View):
     """Multiselect with two arrows (up/down) next to it. Eg. in AE/Domain priority selection.


Test patch:
Repository: ManageIQ/integration_tests

Issue:
Catalog exists property throws "CandidateNotFound" Exception
When we call <catalog_obj>.exists , it throws  "CandidateNotFound" Exception, where as in our test cases  we expect a Boolean value "False"
>> https://github.com/ManageIQ/integration_tests/blob/master/cfme/services/catalogs/catalog.py#L119 

Steps to Reproduce: <catalog_obj>.exists
Actual Result:  Trace-back of   "CandidateNotFound" Exception
Expected Result: False 


Discussion:

Resolving patch:
diff --git a/cfme/services/catalogs/catalog.py b/cfme/services/catalogs/catalog.py
--- a/cfme/services/catalogs/catalog.py
+++ b/cfme/services/catalogs/catalog.py
@@ -3,7 +3,7 @@
 from widgetastic.utils import Parameter
 from widgetastic.widget import Text
 from widgetastic_manageiq import MultiBoxSelect
-from widgetastic_patternfly import Button, Input
+from widgetastic_patternfly import Button, CandidateNotFound, Input
 from navmazing import NavigateToAttribute, NavigateToSibling
 
 from cfme.common import Taggable
@@ -120,7 +120,7 @@ def exists(self):
         try:
             navigate_to(self, 'Details')
             return True
-        except NameError:
+        except (NameError, CandidateNotFound):
             return False
 
 


Test patch:
Repository: ManageIQ/integration_tests

Issue:
is_displayed for catalog all page is not working as expected
Currently the is_display of catalog all page returns True even if the view is on Add catalog page.


Discussion:

Resolving patch:
diff --git a/cfme/services/catalogs/catalog.py b/cfme/services/catalogs/catalog.py
--- a/cfme/services/catalogs/catalog.py
+++ b/cfme/services/catalogs/catalog.py
@@ -49,6 +49,7 @@ def is_displayed(self):
         return (
             self.in_explorer and
             self.catalogs.is_opened and
+            self.title.text == "All Catalogs" and
             self.catalogs.tree.currently_selected == ["All Catalogs"])
 
 


Test patch:
Repository: ManageIQ/integration_tests

Issue:
Appliance DB schema upgrade might cause chaos
The tables and columns are cached inside the Db() object. If we update an appliance and the DB schema changes, it will need `del appliance.db` in order to invalidate that cache.



Discussion:

Resolving patch:
diff --git a/cfme/utils/appliance/__init__.py b/cfme/utils/appliance/__init__.py
--- a/cfme/utils/appliance/__init__.py
+++ b/cfme/utils/appliance/__init__.py
@@ -1371,6 +1371,10 @@ def upgrade(self, upgrade_to, cfme_only=True, reboot=False):
         except socket.timeout:
             logger.error(f"SSH timed out while updating appliance: {result.output}")
 
+        # clear cached properties for DB instances, in case of schema change during upgrade
+        del self.db.__dict__['client']  # client DB instance caches tables/rows/columns
+        del self.__dict__['db_service']  # service name might change, depends on self.db
+
         # May be chance to update kernel with all update.
         if reboot or not cfme_only:
             self.reboot()


Test patch:
Repository: ethereum/consensus-specs

Issue:
Simplify sync protocol and update to calculate optimistic heads
1. Simplify `valid_updates` to `best_valid_update` so the `LightClientStore` only needs to store O(1) data
2. Track an optimistic head, by looking for the highest-slot header which passes a safety threshold


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -683,6 +683,7 @@ def combine_dicts(old_dict: Dict[str, T], new_dict: Dict[str, T]) -> Dict[str, T
     'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',
     'bytes', 'byte', 'ByteList', 'ByteVector',
     'Dict', 'dict', 'field', 'ceillog2', 'floorlog2', 'Set',
+    'Optional',
 ]
 
 


Test patch:
Repository: ethereum/consensus-specs

Issue:
Double check linting settings
@potuz raised the issue that phase0's `get_validator_from_deposit` takes an additional `state` argument that is not used.

From a cursory look, it seems like our linting stack *should* have caught this in the `pyspec`.

Let's double-check it is working as intended and add if missing.


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -514,7 +514,7 @@ def get_pow_block(hash: Bytes32) -> Optional[PowBlock]:
     return PowBlock(block_hash=hash, parent_hash=Bytes32(), total_difficulty=uint256(0))
 
 
-def get_execution_state(execution_state_root: Bytes32) -> ExecutionState:
+def get_execution_state(_execution_state_root: Bytes32) -> ExecutionState:
     pass
 
 
@@ -1008,7 +1008,7 @@ def run(self):
     python_requires=">=3.8, <4",
     extras_require={
         "test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
-        "lint": ["flake8==3.7.7", "mypy==0.812"],
+        "lint": ["flake8==3.7.7", "mypy==0.812", "pylint==2.12.2"],
         "generator": ["python-snappy==0.5.4"],
     },
     install_requires=[


Test patch:
Repository: praw-dev/praw

Issue:
Unable to use multiple OAuth scopes
If I authorize a user with the 'identity' scope, it works just fine and I can use the get_me() function. If I authorize the user with the ['identity', 'submit'] scope, the user is authorized, but when I call get_me(), it I am getting the following error:

> OAuthScopeRequired: get_me requires the OAuth2 scope identity

When I print the access_information object, the following is contained in the scope variable:

```
set([u'identity submit'])
```

Is it possible that multiple scopes is not being parsed properly by PRAW?

This started happening in both of my applications that run similar authorizations. My guess is that reddit changed the way it sends back multiple OAuth scopes and PRAW isn't handling that correctly anymore.



Discussion:

Resolving patch:
diff --git a/praw/__init__.py b/praw/__init__.py
--- a/praw/__init__.py
+++ b/praw/__init__.py
@@ -614,7 +614,7 @@ def get_access_information(self, code):
         retval = self._handle_oauth_request(data)
         return {'access_token': retval['access_token'],
                 'refresh_token': retval.get('refresh_token'),
-                'scope': set(retval['scope'].split(','))}
+                'scope': set(retval['scope'].split(' '))}
 
     @decorators.require_oauth
     def get_authorize_url(self, state, scope='identity', refreshable=False):
@@ -657,7 +657,7 @@ def refresh_access_information(self, refresh_token):
         retval = self._handle_oauth_request(data)
         return {'access_token': retval['access_token'],
                 'refresh_token': refresh_token,
-                'scope': set(retval['scope'].split(','))}
+                'scope': set(retval['scope'].split(' '))}
 
     def set_oauth_app_info(self, client_id, client_secret, redirect_uri):
         """Set the App information to use with OAuth2.


Test patch:
Repository: praw-dev/praw

Issue:
Support the '*' scope in OAuth
I have a script based OAuth that uses the password based grant as shown in the [reddit Quick Start example](https://github.com/reddit/reddit/wiki/OAuth2-Quick-Start-Example). The problem arises that the scope returned by the response, e.g.:

```
{
    "access_token": "J1qK1c18UUGJFAzz9xnH56584l4", 
    "expires_in": 3600, 
    "scope": "*", 
    "token_type": "bearer"
}
```

Uses an asterisk and PRAW does not seem to handle this case when using `set_access_credentials`. I understand that this type of auth is seemingly unsupported by PRAW though.

The first exception I got was a `TypeError`, stating that it had to be a set. Changing the `scope` passed to `set_access_credentials` to a set just yields `LoginOrScopeRequired` exceptions upon usage of the API.



Discussion:
Great find! If it's as trivial as allowing the `*` scope to match any of the required scopes, then I am all for supporting this feature. However, if there are other issues to resolve requiring supporting two different flows I will be hesitant to add support at this time. Check back for updates! Thanks for filing.

If it helps what I currently do is this:

``` python
if result['scope'] == '*':
    result['scope'] = set('creddits edit flair history identity modconfig modcontributors '
                          'modflair modlog modothers modposts modself modwiki mysubreddits '
                          'privatemessages read report save submit subscribe vote wikiedit wikiread'.split(' '))
```

And it seems to work fine with no issues.

n.b.: obviously I do not need all these permissions but I added them all in for testing purposes.


Resolving patch:
diff --git a/praw/__init__.py b/praw/__init__.py
--- a/praw/__init__.py
+++ b/praw/__init__.py
@@ -1353,10 +1353,13 @@ def get_me(self):
 
     def has_scope(self, scope):
         """Return True if OAuth2 authorized for the passed in scope(s)."""
+        if not self.is_oauth_session():
+            return False
+        if '*' in self._authentication:
+            return True
         if isinstance(scope, six.string_types):
             scope = [scope]
-        return self.is_oauth_session() and all(s in self._authentication
-                                               for s in scope)
+        return all(s in self._authentication for s in scope)
 
     def is_logged_in(self):
         """Return True when the session is authenticated via username/password.


Test patch:
Repository: praw-dev/praw

Issue:
Add MIN_PNG_SIZE and MIN_JPEG_SIZE to allow for images below 128 bytes
See https://github.com/praw-dev/praw/issues/561



Discussion:

Resolving patch:
diff --git a/praw/__init__.py b/praw/__init__.py
--- a/praw/__init__.py
+++ b/praw/__init__.py
@@ -52,7 +52,8 @@
 
 __version__ = '3.3.0'
 
-MIN_IMAGE_SIZE = 128
+MIN_PNG_SIZE = 67
+MIN_JPEG_SIZE = 128
 MAX_IMAGE_SIZE = 512000
 JPEG_HEADER = b'\xff\xd8\xff'
 PNG_HEADER = b'\x89\x50\x4e\x47\x0d\x0a\x1a\x0a'
@@ -1687,17 +1688,19 @@ def upload_image(self, subreddit, image_path, name=None, header=False):
         # Verify image is a jpeg or png and meets size requirements
         with open(image_path, 'rb') as image:
             size = os.path.getsize(image.name)
-            if size < MIN_IMAGE_SIZE:
-                raise errors.ClientException('`image` is not a valid image')
-            elif size > MAX_IMAGE_SIZE:
+            if size < MIN_PNG_SIZE:
+                raise errors.ClientException('png image is too small.')
+            if size > MAX_IMAGE_SIZE:
                 raise errors.ClientException('`image` is too big. Max: {0} '
                                              'bytes'.format(MAX_IMAGE_SIZE))
-            first_bytes = image.read(MIN_IMAGE_SIZE)
+            first_bytes = image.read(MIN_PNG_SIZE)
             image.seek(0)
-            if first_bytes.startswith(JPEG_HEADER):
-                image_type = 'jpg'
-            elif first_bytes.startswith(PNG_HEADER):
+            if first_bytes.startswith(PNG_HEADER):
                 image_type = 'png'
+            elif first_bytes.startswith(JPEG_HEADER):
+                if size < MIN_JPEG_SIZE:
+                    raise errors.ClientException('jpeg image is too small.')
+                image_type = 'jpg'
             else:
                 raise errors.ClientException('`image` must be either jpg or '
                                              'png.')


Test patch:
diff --git a/tests/files/invalid.jpg b/tests/files/invalid.jpg
Binary files a/tests/files/invalid.jpg and b/tests/files/invalid.jpg differ
Repository: praw-dev/praw

Issue:
Subreddit docs use wrong argument name for ban reason
## Issue Description

https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html

This example:

    reddit.subreddit('SUBREDDIT').banned.add('NAME', reason='a reason')

should be

    reddit.subreddit('SUBREDDIT').banned.add('NAME', ban_reason='a reason')

At least if the reddit api docs are to be trusted:

https://www.reddit.com/dev/api/#POST_api_friend

## System Information

not relevant


Discussion:

Resolving patch:
diff --git a/praw/models/reddit/subreddit.py b/praw/models/reddit/subreddit.py
--- a/praw/models/reddit/subreddit.py
+++ b/praw/models/reddit/subreddit.py
@@ -122,7 +122,7 @@ def banned(self):
 
         .. code-block:: python
 
-           reddit.subreddit('SUBREDDIT').banned.add('NAME', reason='a reason')
+           reddit.subreddit('SUBREDDIT').banned.add('NAME', ban_reason='...')
 
         To list the banned users along with any notes, try:
 


Test patch:
Repository: praw-dev/praw

Issue:
Explain "PRAW is not thread safe" in the documentation.
It would be great to provide an example of why it is not thread safe.

Relevant comment:

https://www.reddit.com/r/redditdev/comments/63ugl5/praw_mulitprocessing_handler_prawhandler_is_not_a/dfx9oet/?context=3


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -4,7 +4,7 @@
 
 from praw import __version__
 
-copyright = '2016, Bryce Boe'
+copyright = '2017, Bryce Boe'
 exclude_patterns = ['_build']
 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
 html_static_path = ['_static']
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@
       description=('PRAW, an acronym for `Python Reddit API Wrapper`, is a '
                    'python package that allows for simple access to '
                    'reddit\'s API.'),
-      install_requires=['prawcore >=0.9.0, <0.10',
+      install_requires=['prawcore >=0.10.1, <0.11',
                         'update_checker >=0.16'],
       keywords='reddit api wrapper',
       license='Simplified BSD License',


Test patch:
Repository: praw-dev/praw

Issue:
Clarify that subreddit filtering does not work for comment listings
[Original post in r/redditdev](https://www.reddit.com/r/redditdev/comments/6yhalr/cant_block_subreddits_with_praw/) and [response](https://www.reddit.com/r/redditdev/comments/6yhalr/cant_block_subreddits_with_praw/dmnfdl3/) from @bboe.

Subreddit filtering does not have any effect on comment listings, and this should be clarified in the PRAW documentation. [The current documentation for the Subreddit class](http://praw.readthedocs.io/en/v5.1.0/code_overview/models/subreddit.html) only states "Subreddits can be filtered from combined listings," followed by a code example. This should be clarified to reflect that they can only be filtered for certain purposes, like `hot()` and `new()`.

See the following code for an example of the issue.

```
for comment in reddit.subreddit("all-the_donald").comments(limit=250):
  if comment.subreddit == 'the_donald':
    print(comment.id)
```

This code snippet ends up printing comment IDs from r/the_donald despite its exclusion in the declaration of the for loop.


Discussion:
I plan to fix this and submit a PR.
Testing reveals it also doesn't work for `gilded()`.

```
>>> print([p.id for p in reddit.subreddit('all-the_donald').gilded(limit=99999) if p.subreddit == 'the_donald'])
['dmnjseg', '6yc3y4', '6y5h9u']
```

Resolving patch:
diff --git a/praw/models/reddit/subreddit.py b/praw/models/reddit/subreddit.py
--- a/praw/models/reddit/subreddit.py
+++ b/praw/models/reddit/subreddit.py
@@ -41,7 +41,11 @@ class Subreddit(RedditBase, MessageableMixin, SubredditListingMixin):
        for submission in reddit.subreddit('redditdev+learnpython').top('all'):
            print(submission)
 
-    Subreddits can be filtered from combined listings as follows:
+    Subreddits can be filtered from combined listings as follows. Note that
+    these filters are ignored by certain methods, including
+    :attr:`~praw.models.Subreddit.comments`,
+    :meth:`~praw.models.Subreddit.gilded`, and
+    :meth:`.SubredditStream.comments`.
 
     .. code:: python
 


Test patch:
Repository: praw-dev/praw

Issue:
Updating subreddit settings resets allow_post_crossposts to default ( True )
## Issue Description
Updating a sub's settings (`.mod.update()`), and not supplying allow_post_crossposts resets allow_post_crossposts.

## System Information

    PRAW Version: Version: 5.2.0
    Python Version: Python 3.4.2 
    Operating System: Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.43-2 (2017-04-30)



Discussion:
Would you be interested in making a pull request to add that field?
Definitely.  I shot a PM over to reddit.com because I noticed the field didn't exist when you GET the information.  Once they resolve that I'll make a PR for it.
@Eegras do you know of any update on this issue?
Looks like they did update edit.json to contain at least the noted fields, so that's good.  I haven't had time to look at updating PRAW to make sure it works, or even testing to see if it might just work.

Resolving patch:
diff --git a/praw/models/reddit/subreddit.py b/praw/models/reddit/subreddit.py
--- a/praw/models/reddit/subreddit.py
+++ b/praw/models/reddit/subreddit.py
@@ -60,7 +60,8 @@ class Subreddit(RedditBase, MessageableMixin, SubredditListingMixin):
     MESSAGE_PREFIX = '#'
 
     @staticmethod
-    def _create_or_update(_reddit, allow_images=None, allow_top=None,
+    def _create_or_update(_reddit, allow_images=None,
+                          allow_post_crossposts=None, allow_top=None,
                           collapse_deleted_comments=None,
                           comment_score_hide_mins=None, description=None,
                           domain=None, exclude_banned_modqueue=None,
@@ -78,6 +79,7 @@ def _create_or_update(_reddit, allow_images=None, allow_top=None,
                           wikimode=None, **other_settings):
         # pylint: disable=invalid-name,too-many-locals
         model = {'allow_images': allow_images,
+                 'allow_post_crossposts': allow_post_crossposts,
                  'allow_top': allow_top,
                  'collapse_deleted_comments': collapse_deleted_comments,
                  'comment_score_hide_mins': comment_score_hide_mins,
@@ -1183,6 +1185,8 @@ def update(self, **settings):
 
         :param allow_images: Allow users to upload images using the native
             image hosting. Only applies to link-only subreddits.
+        :param allow_post_crossposts: Allow users to crosspost submissions from
+            other subreddits.
         :param allow_top: Allow the subreddit to appear on ``/r/all`` as well
             as the default and trending lists.
         :param collapse_deleted_comments: Collapse deleted and removed comments


Test patch:
Repository: praw-dev/praw

Issue:
Documentation - Error in reports example code
Hi there, I've found an error in the documentation:

Line 1618 of praw/models/reddit/subreddit.py

```
           for item in reddit.subreddit('mod').mod.reports():
               print("User Reports: {}".format(report.user_reports))
               print("Mod Reports: {}".format(report.mod_reports))
```

This throws a NameError: name 'report' is not defined. It should be:

```
           for item in reddit.subreddit('mod').mod.reports():
               print("User Reports: {}".format(item.user_reports))
               print("Mod Reports: {}".format(item.mod_reports))
```
Documentation - Error in reports example code
Hi there, I've found an error in the documentation:

Line 1618 of praw/models/reddit/subreddit.py

```
           for item in reddit.subreddit('mod').mod.reports():
               print("User Reports: {}".format(report.user_reports))
               print("Mod Reports: {}".format(report.mod_reports))
```

This throws a NameError: name 'report' is not defined. It should be:

```
           for item in reddit.subreddit('mod').mod.reports():
               print("User Reports: {}".format(item.user_reports))
               print("Mod Reports: {}".format(item.mod_reports))
```


Discussion:

Resolving patch:
diff --git a/praw/models/reddit/subreddit.py b/praw/models/reddit/subreddit.py
--- a/praw/models/reddit/subreddit.py
+++ b/praw/models/reddit/subreddit.py
@@ -1615,9 +1615,9 @@ def reports(self, only=None, **generator_kwargs):
 
         .. code:: python
 
-           for item in reddit.subreddit('mod').mod.reports():
-               print("User Reports: {}".format(report.user_reports))
-               print("Mod Reports: {}".format(report.mod_reports))
+           for reported_item in reddit.subreddit('mod').mod.reports():
+               print("User Reports: {}".format(reported_item.user_reports))
+               print("Mod Reports: {}".format(reported_item.mod_reports))
 
         """
         self._handle_only(only, generator_kwargs)


Test patch: