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

Issue:
Add support for new subreddit restrictions. 
## Issue Description

Reddit has added support for finer controls on subreddit restrictions. We should support these. 

## References

- https://www.reddit.com/r/modnews/comments/bp3tx0/restricted_communities_now_offer_3_approved_user/


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
@@ -1741,6 +1741,9 @@ def update(self, **settings):
         :param comment_score_hide_mins: The number of minutes to hide comment
             scores.
         :param description: Shown in the sidebar of your subreddit.
+        :param disable_contributor_requests: Specifies whether redditors may
+            send automated modmail messages requesting approval as a submitter.
+        :type disable_contributor_requests: bool
         :param domain: Domain name with a cname that points to
             {subreddit}.reddit.com.
         :param exclude_banned_modqueue: Exclude posts by site-wide banned users
@@ -1757,6 +1760,12 @@ def update(self, **settings):
         :param public_description: Public description blurb. Appears in search
             results and on the landing page for private subreddits.
         :param public_traffic: Make the traffic stats page public.
+        :param restrict_commenting: Specifies whether approved users have the
+            ability to comment.
+        :type restrict_commenting: bool
+        :param restrict_posting: Specifies whether approved users have the
+            ability to submit posts.
+        :type restrict_posting: bool
         :param show_media: Show thumbnails on submissions.
         :param show_media_preview: Expand media previews on comments pages.
         :param spam_comments: Spam filter strength for comments.


Test patch:
Repository: praw-dev/praw

Issue:
Misleading information in SubredditWiki docstring
## Issue Description

Docstring of the __init__ method of the SubredditWiki class contains mentions of SubredditModeration class:

https://github.com/praw-dev/praw/blob/ac1a7402360079b8b35f8d8c3ba2675828cd113d/praw/models/reddit/subreddit.py#L2853

https://github.com/praw-dev/praw/blob/ac1a7402360079b8b35f8d8c3ba2675828cd113d/praw/models/reddit/subreddit.py#L2855

## System Information

- PRAW Version: master




Discussion:
Would you like to submit a PR to fix this?
I haven't contributed before, so I would need to learn about the correct procedures/conventions first. Since it's just a very small update I would rather leave it on regular contributors.
If you'd like to make the PR, just make the changes and add yourself to `AUTHORS.rst`. Since you wouldn't be touching any code, you wouldn't have to worry about tests. 

I can make the PR if you'd like, but if you want to do it, then you should! Let me know if you have any further questions 😊

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
@@ -2832,7 +2832,7 @@ def upload_mobile_icon(self, image_path):
 
 
 class SubredditWiki:
-    """Provides a set of moderation functions to a Subreddit."""
+    """Provides a set of wiki functions to a Subreddit."""
 
     def __getitem__(self, page_name):
         """Lazily return the WikiPage for the subreddit named ``page_name``.
@@ -2850,9 +2850,9 @@ def __getitem__(self, page_name):
         )
 
     def __init__(self, subreddit):
-        """Create a SubredditModeration instance.
+        """Create a SubredditWiki instance.
 
-        :param subreddit: The subreddit to moderate.
+        :param subreddit: The subreddit whose wiki to work with.
 
         """
         self.banned = SubredditRelationship(subreddit, "wikibanned")


Test patch:
Repository: praw-dev/praw

Issue:
`reddit.user.moderator_subreddits()` has a limit of 100 subreddits that is not documented.
## Issue Description

`reddit.user.moderator_subreddits()` is a method for `reddit.user` that [returns a ListingGenerator of the subreddits that the currently authenticated user is a moderator of](https://praw.readthedocs.io/en/latest/code_overview/reddit/user.html). It works fine, but there is actually a **hard limit of 100 subreddits returned** through this method, and that limit is currently not documented for the method. I tested this with my bot u/AssistantBOT, which is currently moderating 600+ public and private subreddits, and the method only returns the top 100 subreddits it's a mod of, sorted by most subscribers to least subscribers. 

I believe this limit should be documented in the method. It's true that the vast majority of users are unlikely to encounter this issue, but it is something that could dramatically affect what a user is expecting in their results.

I would make a pull request, but I already have one PR #1137  that's awaiting review for a feature addition and I don't want to add something unrelated to that PR directly. The new method I proposed, `.moderated()`, can actually overcome the limitations of `moderator_subreddits()`, however, so if it's a good idea to add this documentation to that PR, then I'll do so. 


**Edit:** I'll make a new Documentation PR once ##1137 gets merged.

## System Information

- PRAW Version: 6.4.0
- Python Version: 3.5.1
- Operating System: Windows 10 Pro



Discussion:

Resolving patch:
diff --git a/praw/models/user.py b/praw/models/user.py
--- a/praw/models/user.py
+++ b/praw/models/user.py
@@ -105,6 +105,18 @@ def moderator_subreddits(self, **generator_kwargs):
         Additional keyword arguments are passed in the initialization of
         :class:`.ListingGenerator`.
 
+        .. note:: This method will return a maximum of 100 moderated
+           subreddits, ordered by subscriber count. To retrieve more than
+           100 moderated subreddits, please see :meth:`.Redditor.moderated`.
+
+        Usage:
+
+        .. code-block:: python
+
+           for subreddit in reddit.user.moderator_subreddits():
+               print(subreddit.display_name)
+
+
         """
         return ListingGenerator(
             self._reddit, API_PATH["my_moderator"], **generator_kwargs


Test patch:
Repository: praw-dev/praw

Issue:
Typing `NoReturn` requires Python 3.5.4
**Describe the bug**
Attempting to run PRAW 6.5.0 under <Python 3.5.4  (I'm using 3.5.1) will result in:

https://docs.python.org/3/library/typing.html#typing.NoReturn

```
Traceback (most recent call last):
  File "F:\testing_routine.py", line 11, in <module>
    import praw
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35-32\lib\site-packages\praw\__init__.py", line 14, in <module>
    from .reddit import Reddit  # NOQA
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35-32\lib\site-packages\praw\reddit.py", line 5, in <module>
    from typing import (
ImportError: cannot import name 'NoReturn'
```

Typing `NoReturn` was only introduced in [3.5.4](https://docs.python.org/3/library/typing.html#typing.NoReturn) of Python, and PRAW allows for installation on 3.5.0 <= version <3.5.4 (3.5.0, 1, 2, 3) versions so users with these versions are going to encounter this. And this will be an issue unless a minimum version of 3.5.4 is set.  

This was also introduced in 3.6.2, so I believe the versions 3.6.0 and 3.6.1 are also invalid.

TBH I may be a noob but I don't understand why the typing additions were made in #1184. 

**To Reproduce**
Steps to reproduce the behavior:
1. Run any script using PRAW on a version of Python 3.5 that's below 3.5.4.

**System Info**
 - OS: Windows 10 Pro
 - Python: 3.5.1
 - PRAW Version: 6.5.0



Discussion:
This is a pretty significant issue. Thanks.

Resolving patch:
diff --git a/praw/models/auth.py b/praw/models/auth.py
--- a/praw/models/auth.py
+++ b/praw/models/auth.py
@@ -1,5 +1,5 @@
 """Provide the Auth class."""
-from typing import Dict, List, NoReturn, Optional, Set, Union
+from typing import Dict, List, Optional, Set, Union
 
 from prawcore import (
     Authorizer,
@@ -60,9 +60,7 @@ def authorize(self, code: str) -> Optional[str]:
         self._reddit._core = self._reddit._authorized_core = authorized_session
         return authorizer.refresh_token
 
-    def implicit(
-        self, access_token: str, expires_in: int, scope: str
-    ) -> NoReturn:
+    def implicit(self, access_token: str, expires_in: int, scope: str) -> None:
         """Set the active authorization to be an implicit authorization.
 
         :param access_token: The access_token obtained from Reddit's callback.
diff --git a/praw/reddit.py b/praw/reddit.py
--- a/praw/reddit.py
+++ b/praw/reddit.py
@@ -2,17 +2,7 @@
 import configparser
 import os
 from itertools import islice
-from typing import (
-    IO,
-    Any,
-    Dict,
-    Generator,
-    NoReturn,
-    Optional,
-    Sequence,
-    Type,
-    Union,
-)
+from typing import IO, Any, Dict, Generator, Optional, Sequence, Type, Union
 
 from prawcore import (
     Authorizer,
@@ -76,7 +66,7 @@ def read_only(self) -> bool:
         return self._core == self._read_only_core
 
     @read_only.setter
-    def read_only(self, value: bool) -> NoReturn:
+    def read_only(self, value: bool) -> None:
         """Set or unset the use of the ReadOnlyAuthorizer.
 
         Raise :class:`ClientException` when attempting to unset ``read_only``


Test patch:
Repository: praw-dev/praw

Issue:
Unclear how to sort comments
I was investigating comment sort, and it’s really unclear what sort types we have. Maybe a disclaimer, like: “You can sort comments by best, top, etc.” would be useful.


Discussion:
Can you make a PR for this?

Resolving patch:
diff --git a/praw/models/reddit/comment.py b/praw/models/reddit/comment.py
--- a/praw/models/reddit/comment.py
+++ b/praw/models/reddit/comment.py
@@ -116,6 +116,9 @@ def replies(self) -> CommentForest:
            comment.refresh()
            replies = comment.replies
 
+        .. note:: The appropriate values for ``reply_sort`` include ``best``,
+            ``top``, ``new``, ``controversial``, ``old`` and ``q&a``.
+
         """
         if isinstance(self._replies, list):
             self._replies = CommentForest(self.submission, self._replies)
diff --git a/praw/models/reddit/submission.py b/praw/models/reddit/submission.py
--- a/praw/models/reddit/submission.py
+++ b/praw/models/reddit/submission.py
@@ -445,6 +445,9 @@ def comments(self) -> CommentForest:
            submission.comment_sort = 'new'
            comments = submission.comments.list()
 
+        .. note:: The appropriate values for ``comment_sort`` include ``best``,
+            ``top``, ``new``, ``controversial``, ``old`` and ``q&a``.
+
         See :ref:`extracting_comments` for more on working with a
         :class:`.CommentForest`.
 


Test patch:
Repository: praw-dev/praw

Issue:
Sphinx stops emitting warnings if it encounters only one
**Describe the bug**
<!-- A clear and concise description of what the bug is. --> When running pre_push, if Sphinx runs into an warning, it does does print any more. When there are lots of warnings, it takes a lot of time to re-run pre_push per warning

I recommend adding the command line argument `--keep-going`. This will cause it to print all warnings.

**System Info**
 - PRAW Version: Latest



Discussion:

Resolving patch:
diff --git a/pre_push.py b/pre_push.py
--- a/pre_push.py
+++ b/pre_push.py
@@ -53,7 +53,9 @@ def run_static():
 
     tmp_dir = mkdtemp()
     try:
-        success &= do_process(["sphinx-build", "-W", "docs", tmp_dir])
+        success &= do_process(
+            ["sphinx-build", "-W", "--keep-going", "docs", tmp_dir]
+        )
     finally:
         rmtree(tmp_dir)
 


Test patch:
Repository: praw-dev/praw

Issue:
PRAW installed by pip is missing the `images` directory and its contents
## Issue Description

PRAW's video submit method uses a placeholder image as a video thumbnail when the user doesn't provide a thumbnail. Here's the relevant code:

https://github.com/praw-dev/praw/blob/54f8b3f998008b81988aac057d33fe38d5ac7739/praw/models/reddit/subreddit.py#L511-L514

That image is at [`praw/images/PRAW logo.png`](https://github.com/praw-dev/praw/blob/master/praw/images/PRAW%20logo.png). Unfortunately the current release on PyPI is missing the file and the entire `images` directory, so the `submit_video` method fails when another thumbnail isn't provided.

It isn't just the wheel on PyPI that is missing the image. The source tarball is as well.

I suspect that a change to [`MANIFEST.in`](https://github.com/praw-dev/praw/blob/master/MANIFEST.in) might solve this problem. Or maybe not, as [this Stack Overflow answer](https://stackoverflow.com/a/25964691/8033766) suggests that `MANIFEST.in` is just for Python 2.6 and earlier.

Adding an `__init__.py` to the `images` folder would probably [make `find_packages()` in `setup.py`](https://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages) notice the folder, but this would be a mis-use of an `__init__.py` since that folder is not a Python package.

[This page](https://docs.python.org/3.3/distutils/setupscript.html#installing-additional-files) suggests using the `data_files` argument in `setup.py`, but I tried that and couldn't get it to work ([branch here](https://github.com/jarhill0/praw/tree/image-upload-fix), [PyPI testing push here](https://test.pypi.org/project/praw/)).


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -61,7 +61,10 @@
     keywords="reddit api wrapper",
     license="Simplified BSD License",
     long_description=README,
-    package_data={"": ["LICENSE.txt"], PACKAGE_NAME: ["*.ini"]},
+    package_data={
+        "": ["LICENSE.txt"],
+        PACKAGE_NAME: ["*.ini", "images/*.jpg"],
+    },
     packages=find_packages(exclude=["tests", "tests.*", "tools", "tools.*"]),
     url="https://praw.readthedocs.org/",
     version=VERSION,


Test patch:
Repository: praw-dev/praw

Issue:
Document request timeout settings
**Describe the bug**

Please document prawcore settings that may be useful in both prawcore and praw.

The environment variable setting `prawcore_timeout` is only mentioned in `prawcore/CHANGES.rst`.

The `prawcore.requestor.TIMEOUT` setting isn't mentioned anywhere.



Discussion:
I'm changing PRAWCore to add a parameter for timeout, which I can add onto Reddit. 

Resolving patch:
diff --git a/praw/config.py b/praw/config.py
--- a/praw/config.py
+++ b/praw/config.py
@@ -137,5 +137,5 @@ def _initialize_attributes(self):
         ):
             setattr(self, attribute, self._fetch_or_not_set(attribute))
 
-        for required_attribute in ("oauth_url", "reddit_url"):
+        for required_attribute in ("oauth_url", "reddit_url", "timeout"):
             setattr(self, required_attribute, self._fetch(required_attribute))
diff --git a/praw/reddit.py b/praw/reddit.py
--- a/praw/reddit.py
+++ b/praw/reddit.py
@@ -655,7 +655,12 @@ def request(
         """
         try:
             return self._core.request(
-                method, path, data=data, files=files, params=params
+                method,
+                path,
+                data=data,
+                files=files,
+                params=params,
+                timeout=self.config.timeout,
             )
         except BadRequest as exception:
             try:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -58,7 +58,7 @@
     ),
     extras_require=extras,
     install_requires=[
-        "prawcore >=1.2.0, <2.0",
+        "prawcore >=1.3.0, <2.0",
         "update_checker >=0.16",
         "websocket-client >=0.54.0",
     ],


Test patch:
Repository: praw-dev/praw

Issue:
PRAW 6.5.1 and 7.0.0 require Python versions above 3.5.2
**Describe the bug**

At https://praw.readthedocs.io/en/latest/getting_started/installation.html, it says:

> PRAW supports Python 3.5+

3.5.2 seems to be insufficient for PRAW versions after 6.4.0. I *think* 3.5.3 is probably sufficient based on what I have read searching for information on this error message, but I am skipping that version on this particular system so I haven't confirmed.

**To Reproduce**
Steps to reproduce the behavior:
1. Upgrade PRAW to either version 6.5.1 or 7.0.0

2. Run a simple PRAW script

3. Get this error:

```
$ python3 ~/test.py
Traceback (most recent call last):
  File "/home/myusername/test.py", line 5, in <module>
    import praw
  File "/home/myusername/.local/lib/python3.5/site-packages/praw/__init__.py", line 14, in <module>
    from .reddit import Reddit  # NOQA
  File "/home/myusername/.local/lib/python3.5/site-packages/praw/reddit.py", line 50, in <module>
    class Reddit:
  File "/home/myusername/.local/lib/python3.5/site-packages/praw/reddit.py", line 128, in Reddit
    requestor_kwargs: Dict[str, Any] = None,
  File "/usr/lib/python3.5/typing.py", line 649, in __getitem__
    return Union[arg, type(None)]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__
    if super().__subclasscheck__(cls):
  File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__
    for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
```

**Expected behavior**

Python 3.5.2 works fine with PRAW 6.4.0 and earlier.

**Code/Logs**

`import praw` will do the trick.

**System Info**
 - OS: Linux
 - Python: 3.5.2
 - PRAW Version: 6.5.1 or 7.0.0




Discussion:
Per python/typing#266, I think I will set the limit to >3.5.3. There is no reason not to upgrade minor versions of Python. 
AFAIK while we support 3.5, we technically only support the latest 3.5.x (same is true for other supported versions). There's no reason not to upgrade point releases.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -35,7 +35,7 @@
     name=PACKAGE_NAME,
     author="Bryce Boe",
     author_email="bbzbryce@gmail.com",
-    python_requires=">=3.5",
+    python_requires=">3.5.3",
     classifiers=[
         "Development Status :: 5 - Production/Stable",
         "Environment :: Console",


Test patch:
Repository: praw-dev/praw

Issue:
Use deprecated directive
Sphinx provides a directive for marking deprecations. This should be used throughout the documentation. 


Discussion:

Resolving patch:
diff --git a/praw/exceptions.py b/praw/exceptions.py
--- a/praw/exceptions.py
+++ b/praw/exceptions.py
@@ -64,7 +64,12 @@ def __str__(self):
 
 
 class APIException(PRAWException):
-    """Old class preserved for alias purposes."""
+    """Old class preserved for alias purposes.
+
+    .. deprecated:: 7.0
+        Class :class:`.APIException` has been deprecated in favor of
+        :class:`.RedditAPIException`. This class will be removed in PRAW 8.0.
+    """
 
     @staticmethod
     def parse_exception_list(
@@ -84,17 +89,47 @@ def parse_exception_list(
 
     @property
     def error_type(self) -> str:
-        """Get error_type."""
+        """Get error_type.
+
+        .. deprecated:: 7.0
+
+            Accessing attributes through instances of
+            :class:`.RedditAPIException` is deprecated. This behavior will be
+            removed in PRAW 8.0. Check out the
+            :ref:`PRAW 7 Migration tutorial <Exception_Handling>` on how to
+            migrate code from this behavior.
+
+        """
         return self._get_old_attr("error_type")
 
     @property
     def message(self) -> str:
-        """Get message."""
+        """Get message.
+
+        .. deprecated:: 7.0
+
+            Accessing attributes through instances of
+            :class:`.RedditAPIException` is deprecated. This behavior will be
+            removed in PRAW 8.0. Check out the
+            :ref:`PRAW 7 Migration tutorial <Exception_Handling>` on how to
+            migrate code from this behavior.
+
+        """
         return self._get_old_attr("message")
 
     @property
     def field(self) -> str:
-        """Get field."""
+        """Get field.
+
+        .. deprecated:: 7.0
+
+            Accessing attributes through instances of
+            :class:`.RedditAPIException` is deprecated. This behavior will be
+            removed in PRAW 8.0. Check out the
+            :ref:`PRAW 7 Migration tutorial <Exception_Handling>` on how to
+            migrate code from this behavior.
+
+        """
         return self._get_old_attr("field")
 
     def _get_old_attr(self, attrname):
diff --git a/praw/reddit.py b/praw/reddit.py
--- a/praw/reddit.py
+++ b/praw/reddit.py
@@ -97,7 +97,14 @@ def read_only(self, value: bool) -> None:
 
     @property
     def validate_on_submit(self) -> bool:
-        """Get validate_on_submit."""
+        """Get validate_on_submit.
+
+        .. deprecated:: 7.0
+            If property :attr:`.validate_on_submit` is set to False, the
+            behavior is deprecated by Reddit. This attribute will be removed
+            around May-June 2020.
+
+        """
         value = self._validate_on_submit
         if value is False:
             warn(


Test patch: