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

Issue:
font awesome external-link icon is broken
We just updated to the latest wiki and fa-external-link is no longer displaying the icon for external links in the wiki.
I believe when the project was updated for font awesome fa-external-link changed to fa-external-link-alt and needs to be changed below:
https://github.com/django-wiki/django-wiki/blob/a691267773c218479fe60c8ef04b7a2dd02fb393/src/wiki/plugins/links/mdx/urlize.py#L143

If I'm not mistaken the pro-version of font awesome still has fa-external-link but I'm not sure if there were plans on handling that.


Discussion:

Resolving patch:
diff --git a/src/wiki/plugins/links/mdx/urlize.py b/src/wiki/plugins/links/mdx/urlize.py
--- a/src/wiki/plugins/links/mdx/urlize.py
+++ b/src/wiki/plugins/links/mdx/urlize.py
@@ -140,7 +140,7 @@ def handleMatch(self, m):
 
         # Convenience link to distinguish external links more easily.
         icon = markdown.util.etree.Element("span")
-        icon.set("class", "fa fa-external-link")
+        icon.set("class", "fa fa-external-link-alt")
 
         # Link text.
         span_text = markdown.util.etree.Element("span")


Test patch:
diff --git a/tests/plugins/links/test_urlize.py b/tests/plugins/links/test_urlize.py
--- a/tests/plugins/links/test_urlize.py
+++ b/tests/plugins/links/test_urlize.py
@@ -8,7 +8,7 @@
 # Template accepts two strings - href value and link text value.
 EXPECTED_LINK_TEMPLATE = (
     '<a href="%s" rel="nofollow" target="_blank">'
-    '<span class="fa fa-external-link">'
+    '<span class="fa fa-external-link-alt">'
     "</span>"
     "<span>"
     " %s"
Repository: django-wiki/django-wiki

Issue:
Error 500 when trying to create a new user with an existing username
To reproduce :
1. create a first user
2. create a new user with same username as first one
3. IntegrityError at /_accounts/sign-up/ - (1062, "Duplicate entry '...' for key 'username'") (500 in production)

Expected :
An error message on creation form telling user that username already exists and asking him to user another one.


Discussion:
Thanks for opening this - I imagine that the ModelForm in front of the User model isn't compliant with the model's validation. As you say, it should be validating the uniqueness of the username.

Resolving patch:
diff --git a/src/wiki/__init__.py b/src/wiki/__init__.py
--- a/src/wiki/__init__.py
+++ b/src/wiki/__init__.py
@@ -17,5 +17,5 @@
 
 default_app_config = "wiki.apps.WikiConfig"
 
-VERSION = (0, 7, 9, "final", 0)
+VERSION = (0, 7, 10, "alpha", 0)
 __version__ = get_version(VERSION)
diff --git a/src/wiki/forms_account_handling.py b/src/wiki/forms_account_handling.py
--- a/src/wiki/forms_account_handling.py
+++ b/src/wiki/forms_account_handling.py
@@ -65,6 +65,7 @@ def __init__(self, *args, **kwargs):
             )
 
     def clean(self):
+        super().clean()
         for fieldname in self.honeypot_fieldnames:
             if self.cleaned_data[fieldname]:
                 raise forms.ValidationError(


Test patch:
diff --git a/tests/core/test_accounts.py b/tests/core/test_accounts.py
--- a/tests/core/test_accounts.py
+++ b/tests/core/test_accounts.py
@@ -16,6 +16,10 @@
 from ..testdata.models import CustomUser
 
 
+SIGNUP_TEST_USERNAME = "wiki"
+SIGNUP_TEST_PASSWORD = "wiki1234567"
+
+
 class AccountUpdateTest(
     RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase
 ):
@@ -114,11 +118,25 @@ def test_signup(self):
         response = self.client.post(
             wiki_settings.SIGNUP_URL,
             data={
-                "password1": "wiki",
-                "password2": "wiki",
-                "username": "wiki",
+                "password1": SIGNUP_TEST_PASSWORD,
+                "password2": SIGNUP_TEST_PASSWORD,
+                "username": SIGNUP_TEST_USERNAME,
                 "email": "wiki@wiki.com",
             },
         )
         self.assertIs(CustomUser.objects.filter(email="wiki@wiki.com").exists(), True)
         self.assertRedirects(response, reverse("wiki:login"))
+
+        # Test that signing up the same user again gives a validation error
+        # Regression test: https://github.com/django-wiki/django-wiki/issues/1152
+        response = self.client.post(
+            wiki_settings.SIGNUP_URL,
+            data={
+                "password1": SIGNUP_TEST_PASSWORD,
+                "password2": SIGNUP_TEST_PASSWORD,
+                "username": SIGNUP_TEST_USERNAME,
+                "email": "wiki@wiki.com",
+            },
+        )
+        self.assertIs(response.status_code, 200)
+        self.assertContains(response, "username already exists")
Repository: django-wiki/django-wiki

Issue:
Invalid version of popper.js
For bootstrap 4.4.1 it should be popper.js 1.16.0 ([proof](https://getbootstrap.com/docs/4.4/getting-started/introduction/)), not 2.0.5, which [is used now](https://github.com/django-wiki/django-wiki/blob/main/src/wiki/static/wiki/js/popper.js).

With wrong version I am getting error

```
bootstrap.min.js:formatted:991 Uncaught TypeError: u is not a constructor
    at c.t.show (bootstrap.min.js:formatted:991)
    at c.t.toggle (bootstrap.min.js:formatted:970)
    at HTMLButtonElement.<anonymous> (bootstrap.min.js:formatted:1102)
    at Function.each (jquery-3.4.1.min.js:2)
    at k.fn.init.each (jquery-3.4.1.min.js:2)
    at k.fn.init.c._jQueryInterface [as dropdown] (bootstrap.min.js:formatted:1095)
    at HTMLButtonElement.<anonymous> (bootstrap.min.js:formatted:1186)
    at HTMLDocument.dispatch (jquery-3.4.1.min.js:2)
    at HTMLDocument.v.handle (jquery-3.4.1.min.js:2)
```

and dropdowns on wiki pages don't work.

With correct version all is OK.


Discussion:
This sounds like a valid issue, fixing this with a PR is most welcome :+1: 

Resolving patch:
diff --git a/testproject/testproject/settings/base.py b/testproject/testproject/settings/base.py
--- a/testproject/testproject/settings/base.py
+++ b/testproject/testproject/settings/base.py
@@ -152,3 +152,5 @@
 WIKI_ANONYMOUS_CREATE = False
 
 SESSION_COOKIE_SECURE = True
+
+DEFAULT_AUTO_FIELD = "django.db.models.AutoField"


Test patch:
Repository: django-wiki/django-wiki

Issue:
Warning of illegal attachment types are auto collapsed and thus invisible
I am reporting a bug in the attachment plugin.

When you try to upload something illegal (SVG, jpg), it used to (just upgrade from 0.5 to 0.9) show a warning in red text and the Upload a new file section and the section is not collapsed.
Now it still has the warning text but the section is automatically collapsed. This is confusing. Also, the text is in black instead of red (I think it's okay).

After trying to upload SVG:
![image](https://user-images.githubusercontent.com/10136589/190052771-a521cfff-b537-4edf-b6b4-ccfe3a12d378.png)
No warning is shown, but when you click Upload a new file, it's just hidden there:
![image](https://user-images.githubusercontent.com/10136589/190052681-f511a0ac-83f8-4594-977e-8dda4ff206fd.png)

Django version: 4.0.7
Python version: 3.10.5
Platform: Windows 10
django-wiki version: 0.9


Discussion:
Hi @shao-wang-me ! Thanks for reporting this.

It definitely seems like a bug.

It should probably be fixed in this line, it might be because something has changed in Bootstrap or a wrong assumption about the use of `collapse` and `in`:

https://github.com/django-wiki/django-wiki/blob/main/src/wiki/plugins/attachments/templates/wiki/plugins/attachments/index.html#L79

Is this something you'd be able to patch up?

Resolving patch:
diff --git a/testproject/testproject/settings/dev.py b/testproject/testproject/settings/dev.py
--- a/testproject/testproject/settings/dev.py
+++ b/testproject/testproject/settings/dev.py
@@ -9,6 +9,15 @@
 
 EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
 
+INTERNAL_IPS = ["127.0.0.1"]
+ALLOWED_HOSTS = [
+    "localhost",
+    "0.0.0.0",
+    "127.0.0.1",
+]
+SESSION_COOKIE_DOMAIN = ".localhost"
+
+SESSION_COOKIE_SECURE = False
 
 try:
     import debug_toolbar  # @UnusedImport


Test patch:
Repository: django-wiki/django-wiki

Issue:
Release final 0.10 with Django 4.2 support
Issue title kind of says it :) Would be nice to do this soon :+1: 


Discussion:
Quick update here:

We need to also update `Django-nyt` to `Django 4.2` or we'll end with dependencies conflict.

See this https://github.com/django-wiki/django-wiki/pull/1275#issuecomment-1502116588

But the `circle ci` and environment matrixs are updated to `Django 4.2`
I think we can release `0.10` as Circle CI is passing on the latest update

https://app.circleci.com/pipelines/github/django-wiki/django-wiki/385/workflows/793d7dba-4c15-4012-9d3e-696edf677836
@benjaoming do you want me to create a new release or you'll do it?
@oscarmcm that sounds great, please do!! I usually do this to prepare a release:

1. Check translations (there aren't any) - command is `hatch run transifex:pull` - I've just tested that it works :)
2. Open PR with the final changes (version bump + release note upgrade)

Wen the repo is ready, I merge it and locally do this:

1. `git checkout main`
6. `git pull`
7. `git tag -s releases/0.10`
8. `git push --tags`
9. `hatch build`
10. `twine upload -s` (or maybe you have hatch operational for this one!)

Please feel free to do how you find is a good way!! Btw I was just reading the hatch documentation and it seems it has nice commands for bumping versions - I didn't know that. If there's anything you'd like to tweak, feel free :+1: 
Edit! There's an error in the `tx pull` command, I think the config file doesn't work with new client versions...
The issue with the transifex-client is that they finally switched off the API support for the old client. So we'll have to migrate to the new client.

I'm not so happy that it's a binary file you're supposed to download blindly and execute. But they have a reasonable Docker alternative:

https://github.com/transifex/cli#running-from-docker-beta

I'm having some promising results adding this command...

Resolving patch:
diff --git a/src/wiki/__about__.py b/src/wiki/__about__.py
--- a/src/wiki/__about__.py
+++ b/src/wiki/__about__.py
@@ -1 +1 @@
-__version__ = "0.10b1"
+__version__ = "0.10"


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
prefixes that are prefixed by other prefixes don't work
!set prefix ! "! " 
! flip
^ no output
!flip
^ output

!set prefix ! !!
etc



Discussion:
@tekulvw proposed we sort prefixes by length before saving them. (or bother discord.py to do the same)


Resolving patch:
diff --git a/red.py b/red.py
--- a/red.py
+++ b/red.py
@@ -202,8 +202,8 @@ async def prefix(*prefixes):
     if prefixes == ():
         await bot.say("Example: setprefix [ ! ^ .")
         return
-    bot.command_prefix = list(prefixes)
-    settings.prefixes = list(prefixes)
+    bot.command_prefix = sorted(prefixes, reverse=True)
+    settings.prefixes = sorted(prefixes, reverse=True)
     if len(prefixes) > 1:
         await bot.say("Prefixes set")
     else:
@@ -366,7 +366,7 @@ def check_configs():
             if new_prefix.lower() != "exit" and new_prefix != "":
                 prefixes.append(new_prefix)
                 #Remember we're using property's here, oh well...
-        settings.prefixes = prefixes
+        settings.prefixes = sorted(prefixes, reverse=True)
 
         print("\nIf you know what an User ID is, input *your own* now and press enter.")
         print("Otherwise you can just set yourself as owner later with '[prefix]set owner'. Leave empty and press enter in this case.")


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Denial of Service through bots triggering each other
Self-explanatory. Solution is to disallow commands if `author.bot` is `True`.



Discussion:
[Thanks for that.](http://i.imgur.com/qCC3GVi.png)


Resolving patch:
diff --git a/red.py b/red.py
--- a/red.py
+++ b/red.py
@@ -114,6 +114,9 @@ def user_allowed(message):
 
     mod = bot.get_cog('Mod')
 
+    if author.bot:
+        return False
+
     if mod is not None:
         if settings.owner == author.id:
             return True


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Red won't show servers when they reach a limit
After the Discord chat messages limit, Red can no longer display servers, http://prnt.sc/cr14d3 
Possibility to make it send 2 messages every 100 servers?



Discussion:

Resolving patch:
diff --git a/cogs/owner.py b/cogs/owner.py
--- a/cogs/owner.py
+++ b/cogs/owner.py
@@ -3,6 +3,7 @@
 from cogs.utils import checks
 from __main__ import set_cog, send_cmd_help, settings
 from .utils.dataIO import fileIO
+from .utils.chat_formatting import pagify
 
 import importlib
 import traceback
@@ -528,7 +529,8 @@ async def servers(self, ctx):
             server_list[str(i)] = servers[i]
             msg += "{}: {}\n".format(str(i), servers[i].name)
         msg += "\nTo leave a server just type its number."
-        await self.bot.say(msg)
+        for page in pagify(msg, ['\n']):
+            await self.bot.say(page)
         while msg != None:
             msg = await self.bot.wait_for_message(author=owner, timeout=15)
             if msg != None:


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Local playlists don't play in order
I have a local playlist consisting of an audio drama. Each file is named with a leading zero-prefixed number: `01, 02, ..., 10, 11, etc`. However, playing a local playlist did not start with `01` as I would have expected.



Discussion:

Resolving patch:
diff --git a/cogs/audio.py b/cogs/audio.py
--- a/cogs/audio.py
+++ b/cogs/audio.py
@@ -630,12 +630,13 @@ def _load_playlist(self, server, name, local=True):
 
     def _local_playlist_songlist(self, name):
         dirpath = os.path.join(self.local_playlist_path, name)
-        return os.listdir(dirpath)
+        return sorted(os.listdir(dirpath))
 
     def _make_local_song(self, filename):
         # filename should be playlist_folder/file_name
         folder, song = os.path.split(filename)
-        return Song(name=song, id=filename, title=song, url=filename)
+        return Song(name=song, id=filename, title=song, url=filename,
+                    webpage_url=filename)
 
     def _make_playlist(self, author, url, songlist):
         try:


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Audio] Server owner can't stop music using [p]stop
This appears to be a bug resulting from the fact that server owner isn't even checked for in `def can_instaskip` (line 1740 of audio.py). Propose adding a check for server owner in there


Discussion:

Resolving patch:
diff --git a/cogs/audio.py b/cogs/audio.py
--- a/cogs/audio.py
+++ b/cogs/audio.py
@@ -1747,6 +1747,7 @@ def can_instaskip(self, member):
         mod_role = settings.get_server_mod(server)
 
         is_owner = member.id == settings.owner
+        is_server_owner = member == server.owner
         is_admin = discord.utils.get(member.roles, name=admin_role) is not None
         is_mod = discord.utils.get(member.roles, name=mod_role) is not None
 
@@ -1754,7 +1755,7 @@ def can_instaskip(self, member):
         nonbots = sum(not m.bot for m in member.voice_channel.voice_members)
         alone = nonbots <= 1
 
-        return is_owner or is_admin or is_mod or alone
+        return is_owner or is_server_owner or is_admin or is_mod or alone
 
     @commands.command(pass_context=True, no_pm=True)
     async def sing(self, ctx):


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[p]version command won't embed if repo has a non-HTTPS remote address
I narrowed down a problem I was getting on the [p]version command for both regular and selfbots, where it would say "I need the `Embed links` permission to send this."
As it turns out, Discord doesn't allow non-HTTP protocols in the `url` field of embeds.


Discussion:
Caleb, I love you.
Funnily enough, markdown links with other protocols work just fine.

Resolving patch:
diff --git a/cogs/owner.py b/cogs/owner.py
--- a/cogs/owner.py
+++ b/cogs/owner.py
@@ -859,6 +859,9 @@ def _get_version(self):
         url, ncommits, branch, commits = result.split("\n", 3)
         if url.endswith(".git"):
             url = url[:-4]
+        if url.startswith("git@"):
+            domain, _, resource = url[4:].partition(':')
+            url = 'https://{}/{}'.format(domain, resource)
         repo_name = url.split("/")[-1]
 
         embed = discord.Embed(title="Updates of " + repo_name,


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Config V3] Config objects get() function is not returning the correct default value
It's currently returning `None` instead of the given default. Not sure if this happens across all levels but is definitely happening on at least guild.


Discussion:

Resolving patch:
diff --git a/core/config.py b/core/config.py
--- a/core/config.py
+++ b/core/config.py
@@ -443,10 +443,10 @@ def get(self, key, default=None):
         :return: 
         """
 
-        try:
-            return getattr(self, key)(default=default)
-        except AttributeError:
-            return
+        if default is not None:
+            return self._get_value_from_key(key)(default)
+        else:
+            return self._get_value_from_key(key)()
 
     async def set(self, key, value):
         # Notice to future developers:


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -18,7 +18,7 @@ def json_driver(tmpdir_factory):
     return driver
 
 
-@pytest.fixture(scope="module")
+@pytest.fixture()
 def config(json_driver):
     return Config(
         cog_name="PyTest",
@@ -26,7 +26,7 @@ def config(json_driver):
         driver_spawn=json_driver)
 
 
-@pytest.fixture(scope="module")
+@pytest.fixture()
 def config_fr(json_driver):
     """
     Mocked config object with force_register enabled.
diff --git a/tests/core/test_config.py b/tests/core/test_config.py
--- a/tests/core/test_config.py
+++ b/tests/core/test_config.py
@@ -145,3 +145,18 @@ async def test_set_channel_no_register(config, empty_channel):
     await config.channel(empty_channel).set("no_register", True)
     assert config.channel(empty_channel).no_register() is True
 #endregion
+
+
+# region Getting Values
+def test_get_func_w_reg(config):
+    config.register_global(
+        thing=True
+    )
+    assert config.get("thing") is True
+    assert config.get("thing", False) is False
+
+
+def test_get_func_wo_reg(config):
+    assert config.get("thing") is None
+    assert config.get("thing", True) is True
+# endregion
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Config V3] User all returning wrong level
All is currently returning USER_ID -> data instead of just data


Discussion:

Resolving patch:
diff --git a/core/config.py b/core/config.py
--- a/core/config.py
+++ b/core/config.py
@@ -118,17 +118,29 @@ def is_value(self, item: str) -> bool:
 
         return not isinstance(default, dict)
 
-    def get_attr(self, item: str, default=None):
+    def get_attr(self, item: str, default=None, resolve=True):
         """
         You should avoid this function whenever possible.
         :param item:
         :param default:
+        :param resolve:
+            If this is True, actual data will be returned, if false a Group/Value will be returned.
         :return:
         """
         value = getattr(self, item)
-        return value(default=default)
+        if resolve:
+            return value(default=default)
+        else:
+            return value
 
     def all(self) -> dict:
+        """
+        Gets all data from current User/Member/Guild etc.
+        :return:
+        """
+        return self()
+
+    def all_from_kind(self) -> dict:
         """
         Gets all entries of the given kind. If this kind is member
             then this method returns all members from the same


Test patch:
diff --git a/tests/core/test_config.py b/tests/core/test_config.py
--- a/tests/core/test_config.py
+++ b/tests/core/test_config.py
@@ -278,12 +278,20 @@ async def test_member_clear_all(config, member_factory):
 
 # Get All testing
 @pytest.mark.asyncio
-async def test_user_get_all(config, user_factory):
+async def test_user_get_all_from_kind(config, user_factory):
     for _ in range(5):
         user = user_factory.get()
         await config.user(user).foo.set(True)
 
     user = user_factory.get()
-    all_data = config.user(user).all()
+    all_data = config.user(user).all_from_kind()
 
     assert len(all_data) == 5
+
+
+@pytest.mark.asyncio
+async def test_user_getalldata(config, user_factory):
+    user = user_factory.get()
+    await config.user(user).foo.set(False)
+
+    assert "foo" in config.user(user).all()
Repository: Cog-Creators/Red-DiscordBot

Issue:
Music player error
Hi, I'm getting this error sometimes, and when it happens it'll skip the song it is currently playing.

[tls @ 00000228e2ef6d40] Error in the pull function.
[aac @ 00000228e2f8a740] Input buffer exhausted before END element found
Error while decoding stream #0:0: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000228e2f0ae80] stream 0, offset 0x5740ea: partial file
"google video link" Invalid data found when processing input

another one: 

[tls @ 000001619ee46f60] Error in the pull function.
[aac @ 000001619f455700] Input buffer exhausted before END element found
Error while decoding stream #0:0: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001619ee5ae80] stream 0, offset 0x388076: partial file
"google video link" Invalid data found when processing input



Discussion:
I get this problem as well sometimes. I'll try to look into it.

Seems like an issue with youtube_dl, a lot of people are getting it. The new download mode is default now and it works much better than streaming videos.

I haven't had this problem since switching to the download mode.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,7 @@ def get_package_list():
 def get_requirements():
     with open('requirements.txt') as f:
         requirements = f.read().splitlines()
+    requirements.append('discord.py>=1.0.0a0')  # Because RTD
     return requirements
 
 


Test patch: