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

Issue:
Line breaks in location field of ICS file needs to be converted
### Problem and impact

When I insert an address with multiple lines in the event location field, the linebreak `\n` in the downloaded ICS file gets ignored by the calendar apps and the address is written without any space.
In most apps the location field is only one line.

If I insert the following address in the event location:
```
Party Location
Partystreet 4
12345 Party
```
the address in Outlook or Thunderbird looks like this:
```
Party LocationPartystreet 412345 Party
```
So the apps can't find this address in a navigation app.

E.g. Google replaces `\n` with `\, ` in their ICS files.

### Expected behaviour

I insert the following address in the event location:
```
Party Location
Partystreet 4
12345 Party
```
so I expect the address in Outlook or Thunderbird of the ICS file looks like this:
```
Party Location, Partystreet 4, 12345 Party
```

### Steps to reproduce

1. Insert event location with multiple lines
2. Download ICS file of event
3. Open ICS file in calendar app (e.g. Outlook or Thunderbird)

### Screenshots

_No response_

### Link

_No response_

### Browser (software, desktop or mobile?) and version

_No response_

### Operating system, dependency versions

_No response_

### Version

4.15.0


Discussion:

Resolving patch:
diff --git a/src/pretix/presale/ical.py b/src/pretix/presale/ical.py
--- a/src/pretix/presale/ical.py
+++ b/src/pretix/presale/ical.py
@@ -57,7 +57,7 @@ def get_public_ical(events):
         vevent.add('summary').value = str(ev.name)
         vevent.add('dtstamp').value = creation_time
         if ev.location:
-            vevent.add('location').value = str(ev.location)
+            vevent.add('location').value = ", ".join(l.strip() for l in str(ev.location).splitlines() if l.strip())
         vevent.add('uid').value = 'pretix-{}-{}-{}@{}'.format(
             event.organizer.slug, event.slug,
             ev.pk if not isinstance(ev, Event) else '0',


Test patch:
Repository: pretix/pretix

Issue:
Exporting order data returns an invalid URL on download
### Problem and impact

When exporting anything from an event like orders etc pretix returns an invalid url that looks like a serialized python dict. 

It looks like this:
```https://example.com/download/%7B'__type__':%20'uuid',%20'__value__':%20%7B'hex':%20'ae58d52aaa2146a7be27e06e7bef9bcf'%7D%7D/```

The file can bin downloaded, by editing the URL and replacing the part after the /download with the uuid hex value. In this example: 
```https://example.com/download/ae58d52aaa2146a7be27e06e7bef9bcf ```

works. 

### Operating system, dependency versions

Docker

### Version

pretix/standalone:latest (4ddc35881844)


Discussion:

Resolving patch:
diff --git a/src/pretix/base/services/export.py b/src/pretix/base/services/export.py
--- a/src/pretix/base/services/export.py
+++ b/src/pretix/base/services/export.py
@@ -88,7 +88,7 @@ def set_progress(val):
                 file.filename, file.type, data = d
                 f = ContentFile(data)
                 file.file.save(cachedfile_name(file, file.filename), f)
-    return file.pk
+    return str(file.pk)
 
 
 @app.task(base=ProfiledOrganizerUserTask, throws=(ExportError,), bind=True)
@@ -156,7 +156,7 @@ def set_progress(val):
                 file.filename, file.type, data = d
                 f = ContentFile(data)
                 file.file.save(cachedfile_name(file, file.filename), f)
-    return file.pk
+    return str(file.pk)
 
 
 def _run_scheduled_export(schedule, context: Union[Event, Organizer], exporter, config_url, retry_func, has_permission):


Test patch:
Repository: pretix/pretix

Issue:
cookie_domain breaks cookie based settings on custom domains
### Problem and impact

Cookie Domain is always set to config's `cookie_domain`, even if custom domains for organizers or events are used.

Workaround is to not set `cookie_domain` in the pretix.cfg, i can not tell if this has security implications.

### Expected behaviour

Cookie domain should either respect the custom domain setting of an organizer or event, or should not be set.

### Steps to reproduce

1. A pretix store is setup as `foo.example.net`
2. The `cookie_domain` is set to `foo.example.net`
3. An event has custom store domain of `bar.example.com`
4. If the language switcher on the store is used, the cookie's domain setting is set to `foo.example.net`
5. Language switcher does not work

### Screenshots

_No response_

### Link

_No response_

### Browser (software, desktop or mobile?) and version

Every browser

### Operating system, dependency versions

_No response_

### Version

_No response_


Discussion:
Uh, that does sound like a bug! We actually do not use cookie_domain in production and I'm not sure many others do, but it should probably be ignored when on a custom domain.

Resolving patch:
diff --git a/src/pretix/presale/views/__init__.py b/src/pretix/presale/views/__init__.py
--- a/src/pretix/presale/views/__init__.py
+++ b/src/pretix/presale/views/__init__.py
@@ -54,6 +54,7 @@
 from pretix.base.services.cart import get_fees
 from pretix.base.templatetags.money import money_filter
 from pretix.helpers.cookies import set_cookie_without_samesite
+from pretix.multidomain.middlewares import get_cookie_domain
 from pretix.multidomain.urlreverse import eventreverse
 from pretix.presale.signals import question_form_fields
 
@@ -468,7 +469,7 @@ def wrapped_view(request, *args, **kwargs):
                 locale,
                 max_age=max_age,
                 expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime('%a, %d-%b-%Y %H:%M:%S GMT'),
-                domain=settings.SESSION_COOKIE_DOMAIN
+                domain=get_cookie_domain(request)
             )
             return resp
 
diff --git a/src/pretix/presale/views/locale.py b/src/pretix/presale/views/locale.py
--- a/src/pretix/presale/views/locale.py
+++ b/src/pretix/presale/views/locale.py
@@ -40,6 +40,7 @@
 from django.views.generic import View
 
 from pretix.helpers.cookies import set_cookie_without_samesite
+from pretix.multidomain.middlewares import get_cookie_domain
 
 from .robots import NoSearchIndexViewMixin
 
@@ -62,7 +63,7 @@ def get(self, request, *args, **kwargs):
                 max_age=max_age,
                 expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime(
                     '%a, %d-%b-%Y %H:%M:%S GMT'),
-                domain=settings.SESSION_COOKIE_DOMAIN
+                domain=get_cookie_domain(request)
             )
 
         return resp


Test patch:
Repository: pretix/pretix

Issue:
Breaking issue on credit card payment with Stripe
### Problem and impact

Since 02.01.2024, credit card payments via Stripe do not work. The following error occurs:

```The statement_descriptor parameter is not supported for the payment_method_type `card`. To continue supporting payment_method_type `card`, please pass in `statement_descriptor_suffix` or remove the `statement_descriptor` parameter altogether. Please see https://support.stripe.com/questions/use-of-the-statement-descriptor-parameter-on-paymentintents-for-card-charges for additional details.```



### Expected behaviour

The bank transfer works

### Steps to reproduce

1. Set up Stripe
2. Pay by credit card
3. Error

### Screenshots

<img width="977" alt="Bildschirmfoto 2024-01-14 um 10 12 29" src="https://github.com/pretix/pretix/assets/47644344/3935a987-6c45-4e4d-9987-e33f0b389c80">


### Link

_No response_

### Browser (software, desktop or mobile?) and version

All browsers

### Operating system, dependency versions

All operating systems

### Version

2023.10.0


Discussion:
Also seeing this in a self-hosted version (tickets.devopsdays.org) and unable to accept payments

Looks like the details from Stripe are found at https://support.stripe.com/questions/use-of-the-statement-descriptor-parameter-on-paymentintents-for-card-charges



Resolving patch:
diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py
--- a/src/pretix/plugins/stripe/payment.py
+++ b/src/pretix/plugins/stripe/payment.py
@@ -842,6 +842,11 @@ def _handle_payment_intent(self, request, payment, intent=None):
                         }
                     })
 
+                if self.method == "card":
+                    params['statement_descriptor_suffix'] = self.statement_descriptor(payment)
+                else:
+                    params['statement_descriptor'] = self.statement_descriptor(payment)
+
                 intent = stripe.PaymentIntent.create(
                     amount=self._get_amount(payment),
                     currency=self.event.currency.lower(),
@@ -853,7 +858,6 @@ def _handle_payment_intent(self, request, payment, intent=None):
                         event=self.event.slug.upper(),
                         code=payment.order.code
                     ),
-                    statement_descriptor=self.statement_descriptor(payment),
                     metadata={
                         'order': str(payment.order.id),
                         'event': self.event.id,


Test patch:
Repository: pretix/pretix

Issue:
A item default price of None does not make sense



Discussion:
Setting the field to null=False currently causes problems when creating items


Resolving patch:
diff --git a/src/pretix/base/migrations/0257_item_default_price_not_null.py b/src/pretix/base/migrations/0257_item_default_price_not_null.py
new file mode 100644
--- /dev/null
+++ b/src/pretix/base/migrations/0257_item_default_price_not_null.py
@@ -0,0 +1,19 @@
+# Generated by Django 4.2.9 on 2024-01-30 11:11
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("pretixbase", "0256_itemvariation_unavail_modes"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="item",
+            name="default_price",
+            field=models.DecimalField(decimal_places=2, default=0, max_digits=13),
+            preserve_default=False,
+        ),
+    ]
diff --git a/src/pretix/base/models/items.py b/src/pretix/base/models/items.py
--- a/src/pretix/base/models/items.py
+++ b/src/pretix/base/models/items.py
@@ -430,7 +430,7 @@ class Item(LoggedModel):
         help_text=_("If this product has multiple variations, you can set different prices for each of the "
                     "variations. If a variation does not have a special price or if you do not have variations, "
                     "this price will be used."),
-        max_digits=13, decimal_places=2, null=True
+        max_digits=13, decimal_places=2,
     )
     free_price = models.BooleanField(
         default=False,


Test patch:
diff --git a/src/tests/api/test_cart.py b/src/tests/api/test_cart.py
--- a/src/tests/api/test_cart.py
+++ b/src/tests/api/test_cart.py
@@ -934,7 +934,7 @@ def test_cartpos_create_with_voucher_unknown(token_client, organizer, event, ite
 @pytest.mark.django_db
 def test_cartpos_create_with_voucher_invalid_item(token_client, organizer, event, item, quota):
     with scopes_disabled():
-        item2 = event.items.create(name="item2")
+        item2 = event.items.create(name="item2", default_price=0)
         voucher = event.vouchers.create(code="FOOBAR", item=item2)
     res = copy.deepcopy(CARTPOS_CREATE_PAYLOAD)
     res['item'] = item.pk
Repository: pretix/pretix

Issue:
Customer's phoner number is not available in API
### Problem and impact

Unable to pull customer's phone number from API

### Expected behaviour

`GET /api/v1/organizers/(organizer)/customers/` returns phone

### Steps to reproduce

1. Get customer with phone in system
2. Validate that phone is visible in UI
3. Make API call `GET /api/v1/organizers/(organizer)/customers/` and check that all fields except phone are exposed

### Screenshots

_No response_

### Link

_No response_

### Browser (software, desktop or mobile?) and version

_No response_

### Operating system, dependency versions

_No response_

### Version

_No response_


Discussion:

Resolving patch:
diff --git a/src/pretix/api/serializers/organizer.py b/src/pretix/api/serializers/organizer.py
--- a/src/pretix/api/serializers/organizer.py
+++ b/src/pretix/api/serializers/organizer.py
@@ -79,8 +79,8 @@ class CustomerSerializer(I18nAwareModelSerializer):
 
     class Meta:
         model = Customer
-        fields = ('identifier', 'external_identifier', 'email', 'name', 'name_parts', 'is_active', 'is_verified', 'last_login', 'date_joined',
-                  'locale', 'last_modified', 'notes')
+        fields = ('identifier', 'external_identifier', 'email', 'phone', 'name', 'name_parts', 'is_active',
+                  'is_verified', 'last_login', 'date_joined', 'locale', 'last_modified', 'notes')
 
     def update(self, instance, validated_data):
         if instance and instance.provider_id:


Test patch:
diff --git a/src/tests/api/test_customers.py b/src/tests/api/test_customers.py
--- a/src/tests/api/test_customers.py
+++ b/src/tests/api/test_customers.py
@@ -29,6 +29,7 @@ def customer(organizer, event):
     return organizer.customers.create(
         identifier="8WSAJCJ",
         email="foo@example.org",
+        phone="+493012345678",
         name_parts={"_legacy": "Foo"},
         name_cached="Foo",
         is_verified=False,
@@ -39,6 +40,7 @@ def customer(organizer, event):
     "identifier": "8WSAJCJ",
     "external_identifier": None,
     "email": "foo@example.org",
+    "phone": "+493012345678",
     "name": "Foo",
     "name_parts": {
         "_legacy": "Foo",
diff --git a/src/tests/api/test_reusable_media.py b/src/tests/api/test_reusable_media.py
--- a/src/tests/api/test_reusable_media.py
+++ b/src/tests/api/test_reusable_media.py
@@ -155,6 +155,7 @@ def test_medium_detail(token_client, organizer, event, medium, giftcard, custome
             "identifier": customer.identifier,
             "external_identifier": None,
             "email": "foo@example.org",
+            "phone": None,
             "name": "Foo",
             "name_parts": {"_legacy": "Foo"},
             "is_active": True,
Repository: pretix/pretix

Issue:
Allow setting DISABLE_SERVER_SIDE_CURSORS for PostgreSQL configurations
### Problem and impact

We use Pretix with a PostgreSQL server and a PGBouncer in-between. We observe for example exports (in this case an Excel export) breaking on db cursor errors.

We are currently testing if passing [`DISABLE_SERVER_SIDE_CURSORS`](https://docs.djangoproject.com/en/3.0/ref/settings/#disable-server-side-cursors) solves the problem, it is however currently not possible to pass this to Pretix in the `pretix.cfg` file or (as far as we were able to determine) via an environment variable or equivalent.

Would adding an option for this be possible if the problem is solved with this db setting?

### Expected behaviour

All exports work even when using PGBouncer.

### Steps to reproduce

_No response_

### Screenshots

_No response_

### Link

_No response_

### Browser (software, desktop or mobile?) and version

_No response_

### Operating system, dependency versions

_No response_

### Version

_No response_


Discussion:
I'm hesitant – yes, not much of an effort and easily doable, on the other hand there's *so much more* that could break on pgBouncer and I'm not sure we want to go down that route :\
I'm guessing except if you explicitly use PostgreSQL features that wouldn't work with transaction mode (cursors, prepared statements mostly) it should work, and it seems for now at least that we didn't encounter any problems except in that instance where Django/psycopg2 transparently uses cursors for you.

We'd be fine with a requirement for session pooling though if that's the official stance. Too bad for the extra resources we'd have to permanently allocate to Pretix instead of having them be distributed with the other apps using the DB, but nothing we can't handle.
Yeah. Would you be willing to create PR with the config flag?

Resolving patch:
diff --git a/src/pretix/settings.py b/src/pretix/settings.py
--- a/src/pretix/settings.py
+++ b/src/pretix/settings.py
@@ -142,6 +142,8 @@
 
     db_options.update(tls_config)
 
+db_disable_server_side_cursors = db_backend == 'postgresql' and config.getboolean('database', 'disable_server_side_cursors', fallback=False)
+
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.' + db_backend,
@@ -152,6 +154,7 @@
         'PORT': config.get('database', 'port', fallback=''),
         'CONN_MAX_AGE': 0 if db_backend == 'sqlite3' else 120,
         'CONN_HEALTH_CHECKS': db_backend != 'sqlite3',  # Will only be used from Django 4.1 onwards
+        'DISABLE_SERVER_SIDE_CURSORS': db_disable_server_side_cursors,
         'OPTIONS': db_options,
         'TEST': {}
     }


Test patch:
Repository: PennyLaneAI/qml

Issue:
Provide a download link for sine.txt in the function fitting tutorial
The quantum function fitting tutorial is not executed by Sphinx-Gallery, as it takes too long to execute. Unfortunately, this caused an issue with loaded data to be overlooked; the referenced file [`data/sine.txt`](https://raw.githubusercontent.com/XanaduAI/pennylane/v0.3.0/examples/data/sine.txt) not only has no download links, but as far as I can tell, isn't even present in the repository.

A clear download link should be added to the tutorial.

Related issue: #60 


Discussion:

Resolving patch:
diff --git a/demonstrations/quantum_neural_net.py b/demonstrations/quantum_neural_net.py
--- a/demonstrations/quantum_neural_net.py
+++ b/demonstrations/quantum_neural_net.py
@@ -1,4 +1,7 @@
 """
+.. role:: html(raw)
+   :format: html
+
 .. _quantum_neural_net:
 
 Function fitting with a quantum neural network
@@ -108,14 +111,16 @@ def cost(var, features, labels):
 # Optimization
 # ~~~~~~~~~~~~
 #
-# We load noisy data samples of a sine function.
+# We load noisy data samples of a sine function from the external file ``sine.txt``
+# (:html:`<a href="https://raw.githubusercontent.com/XanaduAI/pennylane/v0.3.0/examples/data/sine.txt"
+# download="sine.txt" target="_blank">download the file here</a>`).
 
-data = np.loadtxt("data/sine.txt")
+data = np.loadtxt("sine.txt")
 X = data[:, 0]
 Y = data[:, 1]
 
 ##############################################################################
-# Before training a model, let’s examine the data.
+# Before training a model, let's examine the data.
 #
 # *Note: For the next cell to work you need the matplotlib library.*
 


Test patch:
Repository: PennyLaneAI/qml

Issue:
Provide a download link for parity.txt data in the variational classifier tutorial
See https://github.com/XanaduAI/pennylane/issues/536 for context. 

When a script requires a a file to be loaded (e.g., loading data), we should make it clear to the user where to acquire this file, where to put it locally, and how to modify the script to find this file. 

Currently, the variational classifier does not do a good job of this (causing execution to fail for downloaded scripts). On the other hand, the transfer learning and embeddings tutorials explicitly provide download links to necessary files.


Discussion:

Resolving patch:
diff --git a/demonstrations/tutorial_variational_classifier.py b/demonstrations/tutorial_variational_classifier.py
--- a/demonstrations/tutorial_variational_classifier.py
+++ b/demonstrations/tutorial_variational_classifier.py
@@ -1,4 +1,7 @@
 r"""
+.. role:: html(raw)
+   :format: html
+
 .. _variational_classifier:
 
 Variational classifier
@@ -182,6 +185,13 @@ def cost(var, X, Y):
 # ~~~~~~~~~~~~
 #
 # Let’s now load and preprocess some data.
+#
+# .. note::
+#
+#     The parity dataset can be downloaded
+#     :html:`<a href="https://raw.githubusercontent.com/XanaduAI/qml/master/demonstrations/variational_classifier/data/parity.txt"
+#     download=parity.txt target="_blank">here</a>` and
+#     should be placed in the subfolder ``variational_classifer/data``.
 
 data = np.loadtxt("variational_classifier/data/parity.txt")
 X = data[:, :-1]
@@ -362,6 +372,13 @@ def cost(weights, features, labels):
 # order to encode the inputs into the amplitudes of a quantum state. In
 # the last preprocessing step, we translate the inputs x to rotation
 # angles using the ``get_angles`` function we defined above.
+#
+# .. note::
+#
+#     The Iris dataset can be downloaded
+#     :html:`<a href="https://raw.githubusercontent.com/XanaduAI/qml/master/demonstrations/variational_classifier/data/iris_classes1and2_scaled.txt"
+#     download=parity.txt target="_blank">here</a>` and should be placed
+#     in the subfolder ``variational_classifer/data``.
 
 data = np.loadtxt("variational_classifier/data/iris_classes1and2_scaled.txt")
 X = data[:, 0:2]


Test patch:
Repository: PennyLaneAI/qml

Issue:
[BUG] Backprop tutorial has an incorrect gradient result compared to other built-in methods
Reported here: https://discuss.pennylane.ai/t/possible-discrepancy-in-the-quantum-gradients-with-backpropagation-tutorial/4236
Demo: https://pennylane.ai/qml/demos/tutorial_backprop/

The gradient calculated manually via the below doesn't match what `jax.grad` or `qml.gradients.param_shift` gives 🤔.

```
def parameter_shift_term(qnode, params, i):
    shifted = params.copy()
    shifted = shifted.at[i].add(np.pi/2)
    forward = qnode(shifted)  # forward evaluation

    shifted = shifted.at[i].add(-np.pi/2)
    backward = qnode(shifted) # backward evaluation

    return 0.5 * (forward - backward)
```


Discussion:

Resolving patch:
diff --git a/demonstrations/tutorial_backprop.py b/demonstrations/tutorial_backprop.py
--- a/demonstrations/tutorial_backprop.py
+++ b/demonstrations/tutorial_backprop.py
@@ -112,7 +112,7 @@ def parameter_shift_term(qnode, params, i):
     shifted = shifted.at[i].add(np.pi/2)
     forward = qnode(shifted)  # forward evaluation
 
-    shifted = shifted.at[i].add(-np.pi/2)
+    shifted = shifted.at[i].add(-np.pi)
     backward = qnode(shifted) # backward evaluation
 
     return 0.5 * (forward - backward)
@@ -147,7 +147,7 @@ def parameter_shift(qnode, params):
 # Alternatively, we can directly compute quantum gradients of QNodes using
 # PennyLane's built in :mod:`qml.gradients <pennylane.gradients>` module:
 
-print(qml.gradients.param_shift(circuit)(params))
+print(np.stack(qml.gradients.param_shift(circuit)(params)))
 
 ##############################################################################
 # If you count the number of quantum evaluations, you will notice that we had to evaluate the circuit


Test patch:
Repository: secondmind-labs/trieste

Issue:
Ensure type information is packaged with installable
**Describe the feature you'd like**
As a user, I want to be able to type check my code that calls into trieste. It's not clear at the moment if this is currently possible, given there is no py.typed file.

See the python PEP for more info https://www.python.org/dev/peps/pep-0561/


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -27,6 +27,9 @@
     long_description_content_type="text/markdown",
     url="https://github.com/secondmind-labs/trieste",
     packages=find_packages(include=("trieste*",)),
+    package_data={
+        "trieste": ["py.typed"],
+    },
     classifiers=[
         "Programming Language :: Python :: 3.7",
         "License :: OSI Approved :: Apache Software License",


Test patch:
Repository: dmlc/gluon-nlp

Issue:
API doc examples are currently not easy to copy/paste
users may want to use a snippet from example directly, so making the notebooks copy-friendly is important

currently the code blocks have python shell prefix ">>>" in them. see http://gluon-nlp.mxnet.io/api/notes/data_api.html


Discussion:
I suggest we follow https://devguide.python.org/documenting/#showing-code-examples (note the toggle in the upper right corner of the code example)

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -216,6 +216,7 @@ def setup(app):
             }, True)
     app.add_transform(AutoStructify)
     app.add_javascript('google_analytics.js')
+    app.add_javascript('copybutton.js')
 
 
 sphinx_gallery_conf = {


Test patch: