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

Issue:
Add 'body-html' attribute to comment
When accessing a comment through the reddit api, all comments have a `body-html` attribute. But, there is no such feature for praw comments.


Discussion:
Would you like to make a PR that adds this? It would mean modifying [this file](https://github.com/praw-dev/praw/blob/a09182253b1b3dd19db424b4f2386afd9e5d459d/praw/models/reddit/comment.py#L39), as well as adding yourself to [the authors file](https://github.com/praw-dev/praw/blob/master/AUTHORS.rst) as a documentation contributor.
There are multiple classes which have this attribute that are undocumented. Anything that is in markdown has a html counterpart to my knowledge. 

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
@@ -35,7 +35,8 @@ class Comment(InboxableMixin, UserContentMixin, FullnameMixin, RedditBase):
     Attribute               Description
     ======================= ===================================================
     ``author``              Provides an instance of :class:`.Redditor`.
-    ``body``                The body of the comment.
+    ``body``                The body of the comment, as Markdown.
+    ``body_html``           The body of the comment, as HTML.
     ``created_utc``         Time the comment was created, represented in
                             `Unix Time`_.
     ``distinguished``       Whether or not the comment is distinguished.
diff --git a/praw/models/reddit/message.py b/praw/models/reddit/message.py
--- a/praw/models/reddit/message.py
+++ b/praw/models/reddit/message.py
@@ -26,7 +26,8 @@ class Message(InboxableMixin, ReplyableMixin, FullnameMixin, RedditBase):
     Attribute               Description
     ======================= ===================================================
     ``author``              Provides an instance of :class:`.Redditor`.
-    ``body``                The body of the message.
+    ``body``                The body of the message, as Markdown.
+    ``body_html``           The body of the message, as HTML.
     ``created_utc``         Time the message was created, represented in
                             `Unix Time`_.
     ``dest``                Provides an instance of :class:`.Redditor`. The
@@ -113,7 +114,8 @@ class SubredditMessage(Message):
     Attribute               Description
     ======================= ===================================================
     ``author``              Provides an instance of :class:`.Redditor`.
-    ``body``                The body of the message.
+    ``body``                The body of the message, as Markdown.
+    ``body_html``           The body of the message, as HTML.
     ``created_utc``         Time the message was created, represented in
                             `Unix Time`_.
     ``dest``                Provides an instance of :class:`.Redditor`. The


Test patch:
Repository: praw-dev/praw

Issue:
'saved' attribute not mentioned in docs
For the comment and submission models the .save() and .unsave() methods are included but not the .saved attribute.


Discussion:
Attributes on almost all PRAW classes are dynamically provided. The attribute tables just list the most common attributes provided by the API. However, I think the `saved` attribute would be a great addition to the attribute tables for comments and submissions if you would like to open a PR for that.

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
@@ -49,6 +49,7 @@ class Comment(InboxableMixin, UserContentMixin, FullnameMixin, RedditBase):
     ``permalink``           A permalink for the comment. Comment objects from the inbox
                             have a ``context`` attribute instead.
     ``replies``             Provides an instance of :class:`.CommentForest`.
+    ``saved``               Whether or not the comment is saved.
     ``score``               The number of upvotes for the comment.
     ``stickied``            Whether or not the comment is stickied.
     ``submission``          Provides an instance of :class:`.Submission`. The submission
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
@@ -375,6 +375,7 @@ class Submission(SubmissionListingMixin, UserContentMixin, FullnameMixin, Reddit
     ``permalink``               A permalink for the submission.
     ``poll_data``               A :class:`.PollData` object representing the data of
                                 this submission, if it is a poll submission.
+    ``saved``                   Whether or not the submission is saved.
     ``score``                   The number of upvotes for the submission.
     ``selftext``                The submissions' selftext - an empty string if a link
                                 post.


Test patch:
Repository: praw-dev/praw

Issue:
Getting async praw warinings
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
I'm running praw in a jupyter notebook as I used to. When I run anything with praw, I get the warning "It appears that you are using PRAW in an asynchronous environment."

**To Reproduce**
`import praw`
`reddit=praw.Reddit('spez')`
`redditor=reddit.user.me()`
`print(redditor.name)`

**Expected behavior**
I should not be getting the async warning

**System Info**
 - OS: Windows 10
 - Python: Python 3.8.5
 - PRAW Version: 7.1.2

Why am I getting the warning and how can I disable it?



Discussion:
You can disable it by passing `check_for_async=False` in the initialization of the reddit instance: `praw.Reddit(check_for_async=False)`. See here for more info: https://praw.readthedocs.io/en/latest/getting_started/configuration/options.html#miscellaneous-configuration-options
@kneelesh48 are you explicitly using anything async in your code?

If not our async detection may be faulty. 
import praw
reddit=praw.Reddit('spez')
redditor=reddit.user.me()
print(redditor.name)

I run just these 4 lines in a new jupyter notebook on 2 different Windows machines and got the same warnings.
Of course I used another section instead of spez in my praw.ini file.
@bboe 
Thanks for the update @kneelesh48. I reopened this issue because jupyter is prolific enough that we should probably exclude it from our async detection. Thanks for reporting.

Resolving patch:
diff --git a/praw/reddit.py b/praw/reddit.py
--- a/praw/reddit.py
+++ b/praw/reddit.py
@@ -367,15 +367,21 @@ def request(self, *args, **kwargs):
         """
 
     def _check_for_async(self):
-        if self.config.check_for_async:
+        if self.config.check_for_async:  # pragma: no cover
+            try:
+                shell = get_ipython().__class__.__name__
+                if shell == "ZMQInteractiveShell":
+                    return
+            except NameError:
+                pass
             in_async = False
-            if sys.version_info >= (3, 7, 0):  # pragma: no cover
+            if sys.version_info >= (3, 7, 0):
                 try:
                     asyncio.get_running_loop()
                     in_async = True
                 except RuntimeError:
                     pass
-            else:  # pragma: no cover # not able to be covered in > Python 3.6.12
+            else:
                 in_async = asyncio.get_event_loop().is_running()
             if in_async:
                 logger.warning(


Test patch:
Repository: praw-dev/praw

Issue:
link_flair_template_id attribute missing from submissions w/ no flair
Submissions with no flair don't appear to have the `link_flair_template_id` attribute. The docs say it will be set to `None` in these cases.

I encountered this getting posts from a submission stream initially, but get the same results like this:

```python
# r is my praw.Reddit instance
>>> p = b.r.submission(" ID OF A SUBMISSION WITH A FLAIR ")
>>> p.link_flair_template_id
THE FLAIR ID
>>> p = b.r.submission(" ID OF A SUBMISSION WITH NO FLAIR ")
>>> p.link_flair_template_id
...
AttributeError: 'Submission' object has no attribute 'link_flair_template_id'
>>> p.link_flair_text
>>> p.link_flair_template_id
...
AttributeError: 'Submission' object has no attribute 'link_flair_template_id'
>>> pprint.pprint(vars(p))
...
 'likes': None,
 'link_flair_background_color': '',
 'link_flair_css_class': None,
 'link_flair_richtext': [],
 'link_flair_text': None,
 'link_flair_text_color': 'dark',
 'link_flair_type': 'text',
 'locked': False,
...

```

**System Info**
 - OS: Raspbian GNU/Linux 9.9 (stretch)
 - Python: 3.6.5
 - PRAW Version: 7.1.4



Discussion:
Most attributes are dynamically set by what is provided by the API. If you try and access an attribute that isn't set, it will raise an `AttributeError`.

That said, the documentation is incorrect when it says `None` will be returned when `link_flair_template_id` isn't set on the submission. This behavior is most likely due to the API no longer returning that attribute when it isn't on the submission.

If you'd like, you can open a PR to fix what the documentation says regarding `link_flair_template_id` not being set.

Resolving patch:
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
@@ -367,7 +367,7 @@ class Submission(SubmissionListingMixin, UserContentMixin, FullnameMixin, Reddit
     ``is_original_content``    Whether or not the submission has been set as original
                                content.
     ``is_self``                Whether or not the submission is a selfpost (text-only).
-    ``link_flair_template_id`` The link flair's ID, or None if not flaired.
+    ``link_flair_template_id`` The link flair's ID.
     ``link_flair_text``        The link flair's text content, or None if not flaired.
     ``locked``                 Whether or not the submission has been locked.
     ``name``                   Fullname of the submission.


Test patch:
Repository: praw-dev/praw

Issue:
Typo in the Docs
Just a tiny typo in the documentation of the `Comment` class:
https://github.com/praw-dev/praw/blob/66234a650e67bf0c997ee3d548ae38652795a744/praw/models/reddit/comment.py#L21-L22


Discussion:
Nice catch! Would you like to open a pull request to fix that?
With pleasure!

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
@@ -19,7 +19,7 @@
 
 
 class Comment(InboxableMixin, UserContentMixin, FullnameMixin, RedditBase):
-    """A class that represents a reddit comments.
+    """A class that represents a reddit comment.
 
     **Typical Attributes**
 


Test patch:
Repository: praw-dev/praw

Issue:
Problem with docs 
```
choices = list(subreddit.link_templates.user_selectable())
template_id = next(x for x in choices if x["flair_text"] == "news")["flair_template_id"]
subreddit.submit("title", url="https://www.news.com/", flair_id=template_id)
```

I found this code in the docs [here](https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html).

I use this code  to get the subreddit `subreddit = reddit.subreddit("anime")`

It gives me this error : 

```
Traceback (most recent call last):
  File "reddit_crawler.py", line 26, in <module>
    choices = list(subreddit.link_templates.user_selectable())
  File "C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\praw\models\reddit\base.py", line 35, in __getattr__
    return getattr(self, attribute)
  File "C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\praw\models\reddit\base.py", line 37, in __getattr__
    f"{self.__class__.__name__!r} object has no attribute {attribute!r}"
AttributeError: 'Subreddit' object has no attribute 'link_templates'

C:\Users\dell\Downloads\all_crawelers>py reddit_crawler.py
Traceback (most recent call last):
  File "reddit_crawler.py", line 26, in <module>
    choices = list(subreddit.flair.link_templates.user_selectable())
AttributeError: 'SubredditLinkFlairTemplates' object has no attribute 'user_selectable'
```

 


Discussion:
is anyone there ? can someeone direct me to a helpcenter or something? 

What version of PRAW are you using?
latest

Yep, you're right there is a mistake with the docs. It should be:

```py
choices = list(subreddit.flair.link_templates.user_selectable())
template_id = next(x for x in choices if x["flair_text"] == "news")["flair_template_id"]
subreddit.submit("title", url="https://www.news.com/", flair_id=template_id)
```

Would you like to open a PR and fix it?
never opened a PR before so best if u do it .
No worries! I'll get this taken care of.

Thanks again for catching this!

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
@@ -942,7 +942,7 @@ def submit(
 
             .. code-block::
 
-                choices = list(subreddit.link_templates.user_selectable())
+                choices = list(subreddit.flair.link_templates.user_selectable())
                 template_id = next(x for x in choices if x["flair_text"] == "news")["flair_template_id"]
                 subreddit.submit("title", url="https://www.news.com/", flair_id=template_id)
 


Test patch:
Repository: praw-dev/praw

Issue:
Failed to upload a video.
**Describe the bug**
Failed to upload a video.

**To Reproduce**
Steps to reproduce the behavior:
submit any video

**Code/Logs**
```
>>> s = sbrdt.submit_video ('video', 'myvideo.mp4')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gaspar/.local/lib/python3.9/site-packages/praw/models/reddit/subreddit.py", line 1383, in submit_video
    video_poster_url=self._upload_media(thumbnail_path)[0],
  File "/home/gaspar/.local/lib/python3.9/site-packages/praw/models/reddit/subreddit.py", line 695, in _upload_media
    with open(media_path, "rb") as media:
FileNotFoundError: [Errno 2] No such file or directory: '/home/gaspar/.local/lib/python3.9/site-packages/praw/images/PRAW logo.png'
```

**System Info**
 - OS: Arch Linux
 - Python: 3.9.5
 - PRAW Version: 7.4.0



Discussion:
This error will occur if you don't supply it with a thumbnail. If you don't supply a thumbnail, PRAW will automatically use the PRAW logo that is located at `'/home/gaspar/.local/lib/python3.9/site-packages/praw/images/PRAW logo.png'` (in your case). However, for some reason this file does not exist at this location.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -64,7 +64,7 @@
     keywords="reddit api wrapper",
     license="Simplified BSD License",
     long_description=README,
-    package_data={"": ["LICENSE.txt"], PACKAGE_NAME: ["*.ini", "images/*.jpg"]},
+    package_data={"": ["LICENSE.txt"], PACKAGE_NAME: ["*.ini", "images/*.png"]},
     packages=find_packages(exclude=["tests", "tests.*", "tools", "tools.*"]),
     project_urls={
         "Change Log": "https://praw.readthedocs.io/en/latest/package_info/change_log.html",


Test patch:
Repository: praw-dev/praw

Issue:
Requests imported but not included in install_requires
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->

Currently, `requests` is [imported](https://github.com/praw-dev/praw/blob/04600016c886d65206e298d6b503984ed13705e5/praw/models/reddit/subreddit.py#L17) one place in order to use it soley for [a single static type hint in a function signature](https://github.com/praw-dev/praw/blob/04600016c886d65206e298d6b503984ed13705e5/praw/models/reddit/subreddit.py#L590), but is not included in `install_requires`. Therefore, at least in theory (though probably not in practice, because I presume `prawcore` is unlikely to drop it any time soon), it is not declaring as dependencies the packages it imports and relying on mere circumstance (er, well, in this particular case, a relatively tightly-coupled dependency) to ensure it is available and avoid a crash on import.

Its not too much of a practical problem, but it is a good practice (explicit is better than implicit, per `import this`), and this is resulting in warnings in conda-forge/praw-feedstock#20 , of which I am now maintainer, when attempting to update the package to the latest version, and may cause issues with other tooling as well.

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->

Either `requests` should be added to the `install_requires`, or the import guarded behind `if TYPE_CHECKING` (after importing it from `typing`, of course), like so:

```python
if TYPE_CHECKING:
    from requests import Response
else
    Response = None
```

There's not too much objective practical difference between the two approaches, and they are both fairly trivial to implement, so I leave the choice to your judgement.

**System Info**
 - PRAW Version: 7.5.0, `master`


Discussion:
I think moving the import behind `if TYPE_CHECKING` and quoting `Response` would be the best option. 

Would you like to open PR to do that? If not, I can get it later today.
Sure :+1: 

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
@@ -14,7 +14,9 @@
 
 import websocket
 from prawcore import Redirect
-from requests import Response
+
+if TYPE_CHECKING:  # pragma: no cover
+    from requests import Response
 
 from ...const import API_PATH, JPEG_HEADER
 from ...exceptions import (
@@ -587,7 +589,7 @@ def _fetch(self):
         self.__dict__.update(other.__dict__)
         self._fetched = True
 
-    def _parse_xml_response(self, response: Response):
+    def _parse_xml_response(self, response: "Response"):
         """Parse the XML from a response and raise any errors found."""
         xml = response.text
         root = XML(xml)
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -26,6 +26,7 @@
         "betamax >=0.8, <0.9",
         "betamax-matchers >=0.3.0, <0.5",
         "pytest >=2.7.3",
+        "requests >=2.20.1, <3",
     ],
 }
 extras["dev"] += extras["lint"] + extras["test"]


Test patch:
Repository: praw-dev/praw

Issue:
Docs Enhancement
### Describe the solution you'd like

submission.author_flair_text should be added to docs

### Describe alternatives you've considered

_No response_

### Additional context

_No response_


Discussion:
We don't maintain the list of attributes of objects retrieved from Reddit's API. See the typical attributes note [here](https://praw.readthedocs.io/en/stable/code_overview/models/submission.html#praw.models.Submission) for more info.

You are certainly welcome to open a PR and add that attribute to the table.

Resolving patch:
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
@@ -396,6 +396,8 @@ class Submission(SubmissionListingMixin, UserContentMixin, FullnameMixin, Reddit
     Attribute                  Description
     ========================== =========================================================
     ``author``                 Provides an instance of :class:`.Redditor`.
+    ``author_flair_text``      The text content of the author's flair, or ``None`` if
+                               not flaired.
     ``clicked``                Whether or not the submission has been clicked by the
                                client.
     ``comments``               Provides an instance of :class:`.CommentForest`.


Test patch:
Repository: praw-dev/praw

Issue:
Issue in documentation
### Describe the Bug

Hey I think [this](https://praw.readthedocs.io/en/latest/code_overview/other/subredditlinkflairtemplates.html?highlight=link%20flair#:~:text=reddit.subreddit(%22test%22).flair.templates.add()) should be link_template.


<img width="1669" alt="Screenshot 2022-05-16 at 7 08 01 PM" src="https://user-images.githubusercontent.com/64275858/168733780-3543eac2-fd2b-4ac5-a066-64ffb8a8787c.png">


### Desired Result

It should be link_template.

### Relevant Logs

```shell
none.
```


### Code to reproduce the bug

```python
none.
```


### My code example does not include the `Reddit()` initialization to prevent credential leakage.

Yes

### This code has previously worked as intended.

No

### Operating System/Environment

linux

### Python Version

3.7.13

### PRAW Version

7.6.0

### Prawcore Version

2.3.0

### Anything else?

none.


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
@@ -2230,7 +2230,7 @@ def add(
 
         .. code-block:: python
 
-            reddit.subreddit("test").flair.templates.add(
+            reddit.subreddit("test").flair.link_templates.add(
                 "PRAW",
                 css_class="praw",
                 text_editable=True,


Test patch:
Repository: praw-dev/praw

Issue:
reddit.subreddit.mod.removal_reasons isn't indexed in display order
### Describe the Bug

reddit.subreddit.mod.removal_reasons isn't indexed in display order

### Desired Result

reddit.subreddit.mod.removal_reasons should be indexed in display order

### Relevant Logs

_No response_

### Code to reproduce the bug

_No response_

### My code example does not include the `Reddit()` initialization to prevent credential leakage.

Yes

### This code has previously worked as intended.

Yes

### Operating System/Environment

windows

### Python Version

python 3.9.1

### PRAW Version

7.4.0

### Prawcore Version

2.3.0

### Anything else?

_No response_


Discussion:
Could you elaborate or provide a code snippet showing how they aren't in order?
Sure thing, although since grabbing these is a .mod action, you will need to replace the subreddit with one you moderate.  Also it looks like it could be possible that they'd end up in order, but I am not seeing that happen on a reddit with 12 removal reasons. Misordering is consistent with new objects.

```
rrs = reddit.subreddit('yoursub').mod.removal_reasons

rrs[0].title # may not be the 0th index removal reason listed on reddit.com

# or just print em all out and compare to the list on reddit.com -- more likely to show mis-ordering

for rr in rrs:
    print(rr.title)
```
This issue is stale because it has been open for 30 days with no activity. 

Remove the Stale label or comment or this will be closed in 30 days.
Why would it be closed?  It's still an issue.

Resolving patch:
diff --git a/praw/models/reddit/removal_reasons.py b/praw/models/reddit/removal_reasons.py
--- a/praw/models/reddit/removal_reasons.py
+++ b/praw/models/reddit/removal_reasons.py
@@ -150,8 +150,10 @@ def _removal_reason_list(self) -> List[RemovalReason]:
             API_PATH["removal_reasons_list"].format(subreddit=self.subreddit)
         )
         return [
-            RemovalReason(self._reddit, self.subreddit, _data=reason_data)
-            for id, reason_data in response["data"].items()
+            RemovalReason(
+                self._reddit, self.subreddit, _data=response["data"][reason_id]
+            )
+            for reason_id in response["order"]
         ]
 
     def __getitem__(self, reason_id: Union[str, int, slice]) -> RemovalReason:


Test patch:
diff --git a/tests/integration/models/reddit/test_removal_reasons.py b/tests/integration/models/reddit/test_removal_reasons.py
--- a/tests/integration/models/reddit/test_removal_reasons.py
+++ b/tests/integration/models/reddit/test_removal_reasons.py
@@ -54,7 +54,7 @@ def test_update(self, reddit):
     def test_update_empty(self, reddit):
         reddit.read_only = False
         subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
-        reason = subreddit.mod.removal_reasons[0]
+        reason = subreddit.mod.removal_reasons[1]
         reason.update()