internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: interactions-py/interactions.py

Issue:
[FEAT] Allow for changing bot banner for current bot
### Problem Description

Bots recently gained support for bots to have banners. Needless to say, you should be able to set a bot's banner through interactions.py.

### Proposed Solution

Add a `banner` attribute to `ClientUser.edit` and its respective functions. This should be relatively simple, since it's similar to `avatar`.

### Alternatives Considered

_No response_

### Additional Information

Discord docs technically don't reflect this, but it's in [discord.py](https://github.com/Rapptz/discord.py/commit/82d13e7b497ac8983a3567a715d5c528b2a895ba) already, and has been publicly announced in the DDevs server.

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:

Resolving patch:
diff --git a/interactions/models/discord/user.py b/interactions/models/discord/user.py
--- a/interactions/models/discord/user.py
+++ b/interactions/models/discord/user.py
@@ -239,12 +239,18 @@ def guilds(self) -> List["Guild"]:
         """The guilds the user is in."""
         return list(filter(None, (self._client.cache.get_guild(guild_id) for guild_id in self._guild_ids)))
 
-    async def edit(self, *, username: Absent[str] = MISSING, avatar: Absent[UPLOADABLE_TYPE] = MISSING) -> None:
+    async def edit(
+        self,
+        *,
+        username: Absent[str] = MISSING,
+        avatar: Absent[UPLOADABLE_TYPE] = MISSING,
+        banner: Absent[UPLOADABLE_TYPE] = MISSING,
+    ) -> None:
         """
         Edit the client's user.
 
-        You can either change the username, or avatar, or both at once.
-        `avatar` may be set to `None` to remove your bot's avatar
+        You can change the username, avatar, and banner, or any combination of the three.
+        `avatar` and `banner` may be set to `None` to remove your bot's avatar/banner
 
         ??? Hint "Example Usage:"
             ```python
@@ -258,6 +264,7 @@ async def edit(self, *, username: Absent[str] = MISSING, avatar: Absent[UPLOADAB
         Args:
             username: The username you want to use
             avatar: The avatar to use. Can be a image file, path, or `bytes` (see example)
+            banner: The banner to use. Can be a image file, path, or `bytes`
 
         Raises:
             TooManyChanges: If you change the profile too many times
@@ -270,6 +277,10 @@ async def edit(self, *, username: Absent[str] = MISSING, avatar: Absent[UPLOADAB
             payload["avatar"] = to_image_data(avatar)
         elif avatar is None:
             payload["avatar"] = None
+        if banner:
+            payload["banner"] = to_image_data(banner)
+        elif banner is None:
+            payload["banner"] = None
 
         try:
             resp = await self._client.http.modify_client_user(payload)


Test patch:
Repository: interactions-py/interactions.py

Issue:
[BUG] Recorder Memory Usage
### Library Version

5.11.0

### Describe the Bug

Leaving and rejoining a voice channel with a bot recording causes enormous RAM usage and the bot recorder to stop functioning properly or the bot to crash completely (from out-of-memory). This is because the calculation for how many silence frames to insert is wrong (multiplies by sample rate twice).

### Steps to Reproduce

Use whatever you prefer and start monitoring your system memory usage. Join a voice channel and have a bot join it to record. Talk and then disconnect from the voice channel. Wait 3-5 seconds and rejoin the voice channel. Memory usage will spike into the 10-20 GB range or the bot will crash.

The exact outcome and how long to wait between rejoining the voice channel  really depends on the amount of memory available on your system. If you wait too long and don't have enough memory, you likely will see "Error while recording: " in the logs because Python was smart enough to not let you try to allocate that much memory. I have 64 GB of RAM, of which 32 GB is available to the bot, and it will spike up to 25 GB consistently or just crash. When it crashes, you will see "Killed" in the terminal and the exit code will be 137, which is an out-of-memory exit code.

### Expected Results

The memory will not have a substantial spike and the bot will not crash.

### Minimal Reproducible Code

_No response_

### Traceback

_No response_

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

_No response_


Discussion:

Resolving patch:
diff --git a/interactions/api/voice/recorder.py b/interactions/api/voice/recorder.py
--- a/interactions/api/voice/recorder.py
+++ b/interactions/api/voice/recorder.py
@@ -217,10 +217,10 @@ def process_data(self, raw_audio: RawInputAudio) -> None:
 
         if raw_audio.ssrc not in self.user_timestamps:
             if last_timestamp := self.audio.last_timestamps.get(raw_audio.user_id, None):
-                diff = raw_audio.timestamp - last_timestamp
-                silence = int(diff * decoder.sample_rate)
+                silence = raw_audio.timestamp - last_timestamp
+                frames = int(silence * decoder.sample_rate)
                 log.debug(
-                    f"{self.state.channel.id}::{raw_audio.user_id} - User rejoined, adding {silence} silence frames ({diff} seconds)"
+                    f"{self.state.channel.id}::{raw_audio.user_id} - User rejoined, adding {frames} silence frames ({silence} seconds)"
                 )
             else:
                 silence = 0


Test patch:
Repository: interactions-py/interactions.py

Issue:
[BUG] Occasionally VoiceChannel is None 
### Library Version

5.11.0

### Describe the Bug

Occasionally, the built in cache receives None for VoiceChannel when trying to access `_voice_member_ids`. I believe this has to do with not having the `VOICE_STATE_UPDATE` intent.

### Steps to Reproduce

Run an interactions.py bot with Sentry enabled and inspect the error log occasionally.

### Expected Results

Ideally, the library isn't sending errors to Sentry :)

### Minimal Reproducible Code

_No response_

### Traceback

```py
AttributeError: 'NoneType' object has no attribute '_voice_member_ids'
  File "interactions/client/smart_cache.py", line 767, in place_voice_state_data
    if user_id in old_state.channel._voice_member_ids:
```

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

_No response_


Discussion:
Ah, I see what's happening here.  Shouldn't be too hard to fix.

Resolving patch:
diff --git a/interactions/client/smart_cache.py b/interactions/client/smart_cache.py
--- a/interactions/client/smart_cache.py
+++ b/interactions/client/smart_cache.py
@@ -794,7 +794,7 @@ async def place_voice_state_data(
 
         if old_state := self.get_voice_state(user_id):
             # noinspection PyProtectedMember
-            if user_id in old_state.channel._voice_member_ids:
+            if old_state.channel is not None and user_id in old_state.channel._voice_member_ids:
                 # noinspection PyProtectedMember
                 old_state.channel._voice_member_ids.remove(user_id)
 


Test patch:
Repository: interactions-py/interactions.py

Issue:
[BUG] AuditLogEventType 192 missing 
### Library Version

stable

### Describe the Bug

Seeing the following error in bot logs:
Class `AuditLogEventType` received an invalid and unexpected value `192`, a new enum item will be created to represent this value. Please update interactions.py or report this issue on GitHub - https://github.com/interactions-py/interactions.py/issues


### Steps to Reproduce

TBD, trying to determine which audit log event corresponds to ID 192 so that the enums can be updated.

### Expected Results

No AuditLogEventType event code errors shown in bot log output.

### Minimal Reproducible Code

_No response_

### Traceback

_No response_

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

Enum needs to be set, but need to first identify what event 192 is. Discord Docs don't have anything listed, either. 

https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions
https://github.com/interactions-py/interactions.py/blob/stable/interactions/models/discord/enums.py#L992


Discussion:
Opening this issue to track -- I'm trying to identify which event 192 corresponds to and will open a MR with the fix once identified. 
@ryandiamond23
192 = channel status added/changed
193 = channel status removed
![image](https://github.com/interactions-py/interactions.py/assets/51890392/acc48e84-f42d-4a66-8244-8bec59eac940)

here is what's from the canary dist that isn't covered by the enum if someone would like to contribute it. The names may change in the future like they have in the past (we don't match very accurately anymore)
```js
{
                VOICE_CHANNEL_STATUS_CREATE: 192,
                VOICE_CHANNEL_STATUS_DELETE: 193,
                CLYDE_AI_PROFILE_UPDATE: 194,
                GUILD_SCHEDULED_EVENT_EXCEPTION_CREATE: 200,
                GUILD_SCHEDULED_EVENT_EXCEPTION_UPDATE: 201,
                GUILD_SCHEDULED_EVENT_EXCEPTION_DELETE: 202
```

Resolving patch:
diff --git a/interactions/models/discord/enums.py b/interactions/models/discord/enums.py
--- a/interactions/models/discord/enums.py
+++ b/interactions/models/discord/enums.py
@@ -1017,6 +1017,12 @@ class AuditLogEventType(CursedIntEnum):
     BLOCKED_PHISHING_LINK = 180
     SERVER_GUIDE_CREATE = 190
     SERVER_GUIDE_UPDATE = 191
+    VOICE_CHANNEL_STATUS_CREATE = 192
+    VOICE_CHANNEL_STATUS_DELETE = 193
+    CLYDE_AI_PROFILE_UPDATE = 194
+    GUILD_SCHEDULED_EVENT_EXCEPTION_CREATE = 200
+    GUILD_SCHEDULED_EVENT_EXCEPTION_UPDATE = 201
+    GUILD_SCHEDULED_EVENT_EXCEPTION_DELETE = 202
 
 
 class AutoModTriggerType(CursedIntEnum):


Test patch:
Repository: celery/celery

Issue:
os.kill is not available in windows before python 2.7
As per the topic, the current celery implementation (>=2.3.0) crashes on windows using python 2.5 and 2.6, because it uses os.kill which is not available in windows before python 2.7



Discussion:
Thanks! What is the traceback?

Sorry I don't have it readily available, but I think it crashed on attempted import in concurrency. I'll try to get a traceback for ya

```
Traceback (most recent call last):
 File "run_celeryd.py", line 9, in <module>
   celery.bin.celeryd.main()
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\bin\celeryd.py", line 187, in main
   worker.execute_from_commandline()
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\bin\base.py", line 72, in execute_from_commandline
   return self.handle_argv(prog_name, argv[1:])
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\bin\base.py", line 100, in handle_argv
   return self.run(*args, **vars(options))
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\bin\celeryd.py", line 95, in run
   kwargs.get("pool") or self.app.conf.CELERYD_POOL)
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\concurrency\__init__.py", line 13, in get_implementation
   return get_cls_by_name(cls, ALIASES)
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\utils\__init__.py", line 313, in get_cls_by_name
   module = imp(module_name)
 File "c:\python25\lib\site-packages\importlib-1.0.2-py2.5.egg\importlib\__init__.py", line 37, in import_module
   __import__(name)
 File "c:\python25\lib\site-packages\celery-2.3.1-py2.5.egg\celery\concurrency\processes\__init__.py", line 9, in <module>
   from os import kill as _kill
ImportError: cannot import name kill
```


Resolving patch:
diff --git a/celery/concurrency/processes/__init__.py b/celery/concurrency/processes/__init__.py
--- a/celery/concurrency/processes/__init__.py
+++ b/celery/concurrency/processes/__init__.py
@@ -6,8 +6,6 @@
 import platform
 import signal as _signal
 
-from os import kill as _kill
-
 from celery.concurrency.base import BasePool
 from celery.concurrency.processes.pool import Pool, RUN
 
@@ -17,6 +15,8 @@
     # *and its children* (if any).
     from celery.concurrency.processes import _win
     _kill = _win.kill_processtree  # noqa
+else:
+    from os import kill as _kill
 
 
 class TaskPool(BasePool):


Test patch:
Repository: celery/celery

Issue:
Sending SIGHUP leaks file handles
When sending SIGHUP to the Celery master process, it leaks all of its previously open file handles when calling exec. This is a regression introduced in  3.1 by 118b300fcad4e6ffb0178fc00cf9fe26075101a5 (originally fixed in 803655b79ccb0403f47cfcd2cfa5a6ed66301cbc for #1270).

This additionally causes Celery to crash after enough HUPs (if the open file limit is larger than 1024):

```
ERROR celery.bootsteps Error on stopping Pool: ValueError('filedescriptor out of range in select()',)
Traceback (most recent call last):
  File "celery/bootsteps.py", line 155, in send_all
    fun(parent, *args)
  File "celery/bootsteps.py", line 377, in stop
    return self.obj.stop()
  File "celery/concurrency/base.py", line 119, in stop
    self.on_stop()
  File "celery/concurrency/prefork.py", line 140, in on_stop
    self._pool.join()
  File "billiard/pool.py", line 1523, in join
    stop_if_not_current(self._result_handler)
  File "billiard/pool.py", line 148, in stop_if_not_current
    thread.stop(timeout)
  File "billiard/pool.py", line 493, in stop
    self.on_stop_not_started()
  File "celery/concurrency/asynpool.py", line 301, in on_stop_not_started
    join_exited_workers(shutdown=True)
  File "billiard/pool.py", line 1109, in _join_exited_workers
    self.process_flush_queues(worker)
  File "celery/concurrency/asynpool.py", line 1082, in process_flush_queues
    readable, _, again = _select(fds, None, fds, timeout=0.01)
  File "celery/concurrency/asynpool.py", line 141, in _select
    r, w, e = select.select(readers, writers, err, timeout)
ValueError: filedescriptor out of range in select()
```



Discussion:

Resolving patch:
diff --git a/celery/apps/worker.py b/celery/apps/worker.py
--- a/celery/apps/worker.py
+++ b/celery/apps/worker.py
@@ -315,6 +315,9 @@ def on_SIGINT(worker):
 
 
 def _reload_current_worker():
+    platforms.close_open_fds([
+        sys.__stdin__, sys.__stdout__, sys.__stderr__,
+    ])
     os.execv(sys.executable, [sys.executable] + sys.argv)
 
 


Test patch:
Repository: celery/celery

Issue:
Task.throws cannot be a list, misleading documentation
The check at https://github.com/celery/celery/blob/b35569090c5cabfa784b00a68b55c7628fee813d/celery/worker/job.py#L456 throws this error when the `Task.throws` is a list:

``` shell
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
```

Documentation on `Task.throws` is misleading by mentioning that `throws` can be a `List/tuple`: 
https://github.com/celery/celery/blob/b35569090c5cabfa784b00a68b55c7628fee813d/celery/app/task.py#L316-L322



Discussion:

Resolving patch:
diff --git a/celery/app/task.py b/celery/app/task.py
--- a/celery/app/task.py
+++ b/celery/app/task.py
@@ -313,7 +313,7 @@ class Task(object):
     #: :setting:`CELERY_ACKS_LATE` setting.
     acks_late = None
 
-    #: List/tuple of expected exceptions.
+    #: Tuple of expected exceptions.
     #:
     #: These are errors that are expected in normal operation
     #: and that should not be regarded as a real error by the worker.


Test patch:
Repository: celery/celery

Issue:
Internal error when embedding app
Celery 3.1.13 and 3.1.16 (latest release as of this writing)

I'm wrapping the celery app inside a utility class, which constructs the app and the worker:

``` python
    self.celery = celery.Celery()
    self.worker = self.celery.WorkController(pool_cls='solo', queues=[self.queue_name])
    self.celery.task(self._receive_callback, name=self.callback_task_name)
```

The utility class has a start() method which starts the worker like this:

``` python
    t = threading.Thread(target=self.worker.start)
    # Starting the worker in a daemonic thread so that it doesn't keep the process
    # alive when the main thread exits
    t.setDaemon(True)
    t.start()
```

When the embedded app receives the task it crashes with the following traceback:

``` python
    CRITICAL:celery.worker.job:Task [my_task_name][cfe87fb7-373d-4082-a72c-0f44d265cc9f] INTERNAL ERROR: AttributeError("'NoneType' object has no attribute 'loader'",)
    Traceback (most recent call last):
      File "/virtualenvdir/lib/python2.7/site-packages/celery/app/trace.py", line 333, in trace_task
        task.__trace__ = build_tracer(task.name, task, **opts)
      File "/virtualenvdir/lib/python2.7/site-packages/celery/app/trace.py", line 160, in build_tracer
        loader = loader or app.loader
    AttributeError: 'NoneType' object has no attribute 'loader'
```

I printed the stack trace from the exception handler in celery.app.trace.trace_task right before report_internal error is called and the error seems to be triggered in _trace_task_ret: 

``` python
def _trace_task_ret(name, uuid, args, kwargs, request={}, app=None, **opts):
    return trace_task((app or current_app).tasks[name],
                      uuid, args, kwargs, request, app=app, **opts)
```



Discussion:

Resolving patch:
diff --git a/celery/app/trace.py b/celery/app/trace.py
--- a/celery/app/trace.py
+++ b/celery/app/trace.py
@@ -337,7 +337,8 @@ def trace_task(task, uuid, args, kwargs, request={}, **opts):
 
 
 def _trace_task_ret(name, uuid, args, kwargs, request={}, app=None, **opts):
-    return trace_task((app or current_app).tasks[name],
+    app = app or current_app
+    return trace_task(app.tasks[name],
                       uuid, args, kwargs, request, app=app, **opts)
 trace_task_ret = _trace_task_ret
 


Test patch:
Repository: celery/celery

Issue:
pymongo refuses backend/mongodb.py default settings
`self.options.setdefault('max_pool_size', self.max_pool_size)`
`self.options.setdefault('auto_start_request', False)`

These lines are refusing from `pymongo` and gives `ConfigurationError` exception. By the way pymongo version is 3.0 and for use mongodb as backend i have to remove that lines from mongodb.py. 



Discussion:

Resolving patch:
diff --git a/celery/backends/mongodb.py b/celery/backends/mongodb.py
--- a/celery/backends/mongodb.py
+++ b/celery/backends/mongodb.py
@@ -78,9 +78,14 @@ def __init__(self, app=None, url=None, **kwargs):
 
         self.url = url
 
-        # default options
-        self.options.setdefault('max_pool_size', self.max_pool_size)
-        self.options.setdefault('auto_start_request', False)
+
+        # default options according to pymongo version
+        if pymongo.version_tuple >= (3,):
+            self.options.setdefault('maxPoolSize', self.max_pool_size)
+        else:
+            self.options.setdefault('max_pool_size', self.max_pool_size)
+            self.options.setdefault('auto_start_request', False)
+
 
         # update conf with mongo uri data, only if uri was given
         if self.url:


Test patch:
Repository: celery/celery

Issue:
Celery can't send error email when task has non-ascii arguments
There is the issue with celery 3.1.18, python 3.4 and tasks with non-ascii string arguments.

When task raises exception and CELERY_SEND_TASK_ERROR_EMAILS set to True, celery couldn't send mail because email.mime.MimeText instance raises UnicodeDecodeError('ascii', ...). Exception is raised [here](https://github.com/celery/celery/blob/dffb61c4d99f1ce5817be267104e9810e88391ee/celery/utils/mail.py#L56). 
Looks like Message constructor has charset argument with 'us-ascii' as default value, and it can't be changed without editing celery source code. When charset changed to 'utf-8', bug disappears.

Example app:

``` python
from celery import Celery

app = Celery('app')

app.conf.CELERY_SEND_TASK_ERROR_EMAILS = True
app.conf.ADMINS = (
    ('Admin', 'test@example.com'),
)

@app.task
def test(arg):
    raise Exception()

test.delay('Щ')
```



Discussion:

Resolving patch:
diff --git a/celery/app/base.py b/celery/app/base.py
--- a/celery/app/base.py
+++ b/celery/app/base.py
@@ -465,6 +465,7 @@ def mail_admins(self, subject, body, fail_silently=False):
                 timeout=conf.EMAIL_TIMEOUT,
                 use_ssl=conf.EMAIL_USE_SSL,
                 use_tls=conf.EMAIL_USE_TLS,
+                charset=conf.EMAIL_CHARSET,
             )
 
     def select_queues(self, queues=None):
diff --git a/celery/app/defaults.py b/celery/app/defaults.py
--- a/celery/app/defaults.py
+++ b/celery/app/defaults.py
@@ -220,6 +220,7 @@ def __repr__(self):
         'TIMEOUT': Option(2, type='float'),
         'USE_SSL': Option(False, type='bool'),
         'USE_TLS': Option(False, type='bool'),
+        'CHARSET': Option('us-ascii'),
     },
     'SERVER_EMAIL': Option('celery@localhost'),
     'ADMINS': Option((), type='tuple'),
diff --git a/celery/loaders/base.py b/celery/loaders/base.py
--- a/celery/loaders/base.py
+++ b/celery/loaders/base.py
@@ -224,10 +224,11 @@ def getarg(arg):
     def mail_admins(self, subject, body, fail_silently=False,
                     sender=None, to=None, host=None, port=None,
                     user=None, password=None, timeout=None,
-                    use_ssl=False, use_tls=False):
+                    use_ssl=False, use_tls=False, charset='us-ascii'):
         message = self.mail.Message(sender=sender, to=to,
                                     subject=safe_str(subject),
-                                    body=safe_str(body))
+                                    body=safe_str(body),
+                                    charset=charset)
         mailer = self.mail.Mailer(host=host, port=port,
                                   user=user, password=password,
                                   timeout=timeout, use_ssl=use_ssl,


Test patch: