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

Issue:
[BUG] Impossible to edit a document after a migration from paperless-ng, `remove_inbox_tags` is null
### Description

I just upgraded from paperless-ng to paperless-ngx, following the guide and changing the image in docker-compose.yml.

Everything works fine, my users, documents and tags are all here.
I can edit/add tags from the document page, however, when I try to edit/add tags, or just "save" any change from that page, I get the following error:
```
{"headers":{"normalizedNames":{},"lazyUpdate":null},"status":400,"statusText":"Bad Request","url":"http://localhost:37007/api/documents/91/","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://localhost:37007/api/documents/91/: 400 Bad Request","error":{"remove_inbox_tags":["Ce champ ne peut être nul."]}}
```
(where `"Ce champ ne peut être nul."` can be translated to `This field cannot be null`)

What is this `remove_inbox_tags` field?### 

### Steps to reproduce

1. Click "Documents"
2. Edit any field
3. Click "Save"
-> The error is shown, and the document changes are not saved

### Webserver logs

```bash
I'm not sure where I can access those log from the docker `paperless_webserver_1` webserver
```


### Browser logs

```bash
The `paperless.log` file does not show anything related to the error I get, the last line it shows at the time I generated the error was:

[2024-03-01 08:29:54,003] [DEBUG] [paperless.matching] DocumentType Facture matched on document 2023-11-14 Relance sur échéancier because it contains this word: Facture
```
```


### Paperless-ngx version

2.5.4

### Host OS

Debian trixie

### Installation method

Docker - official image

### Browser

Firefox 124.0b5 (64 bits)

### Configuration changes

_No response_

### Other

_No response_

### Please confirm the following

- [X] I believe this issue is a bug that affects all users of Paperless-ngx, not something specific to my installation.
- [X] I have already searched for relevant existing issues and discussions before opening this report.
- [X] I have updated the title field above with a concise description.


Discussion:
Can you try emptying your browser cache and closing any open documents and try again?
I opened an private tab, logged in and tried.
The same error is shown.
Ah. Try saving the settings and then try again please.
What do you mean by 'saving the settings'? Is that done from within the webapp?
Go to settings and save (you would have to change something and then can change it back of course)

Resolving patch:
diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py
--- a/src/documents/serialisers.py
+++ b/src/documents/serialisers.py
@@ -665,6 +665,8 @@ class DocumentSerializer(
     remove_inbox_tags = serializers.BooleanField(
         default=False,
         write_only=True,
+        allow_null=True,
+        required=False,
     )
 
     def get_original_file_name(self, obj):


Test patch:
Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] Custom field of type currency does not allow negative values
### Description

I have ran into a problem with the changes to the custom fields of type currency. A little while ago it was basically only a number field (i.e. without the currency included into the value) , then got changed to a "real" currency.
Previously it was possible to enter a negative number (e.g. to differenciate between inbound and outgoing payments).

In the current version 2.7.2 it is no longer possible to enter a negative value into a currency amount field.
I would assume that the change of behavior was also introduced when the currency field was changed to the new currency logic, but I have just stumbled across this in the current release, so I am not sure about that.

I would consider this an error, as it used to work previously, but not anymore.

### Steps to reproduce

1. Create a custom field of type "currency"
2. Assign the field to a document
3. Try to enter a negative value into the currency field

### Webserver logs

```bash
na
```


### Browser logs

_No response_

### Paperless-ngx version

2.7.2

### Host OS

Ubuntu 22.04.4 LTS

### Installation method

Docker - official image

### Browser

Firefox

### Configuration changes

_No response_

### Other

_No response_

### Please confirm the following

- [X] I believe this issue is a bug that affects all users of Paperless-ngx, not something specific to my installation.
- [X] I have already searched for relevant existing issues and discussions before opening this report.
- [X] I have updated the title field above with a concise description.


Discussion:

Resolving patch:
diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py
--- a/src/documents/serialisers.py
+++ b/src/documents/serialisers.py
@@ -546,7 +546,7 @@ def validate(self, data):
                 except Exception:
                     # If that fails, try to validate as a monetary string
                     RegexValidator(
-                        regex=r"^[A-Z][A-Z][A-Z]\d+(\.\d{2,2})$",
+                        regex=r"^[A-Z]{3}-?\d+(\.\d{2,2})$",
                         message="Must be a two-decimal number with optional currency code e.g. GBP123.45",
                     )(data["value"])
             elif field.data_type == CustomField.FieldDataType.STRING:


Test patch:
Repository: lmfit/lmfit-py

Issue:
Assigning Model names
I'm thinking about giving names to models. Currently, the string representation for composite models is:

```
 <lmfit.model.Model at 0x26130f98>
```

which does not give any information on which model it contains.

I find useful, when dealing with many models, to assign a `name` attribute to the model object. In this way I can easily track which model has been used.

Adding an "official" way to set a name in `Model` constructor would standardize the way names are managed (all models would have a `name` attribute). A base `Model` could set the name by default to the name of the generating function. A composite model name could be set the name to `model_name1 + model_name2` by default. The user can always assign a more useful name to a composite model if desired.



Discussion:
Good idea.   I would suggest using `model.func.__name__` as the default name. For a composite model, this would then be 'composite_func', and the individual components (in model.components) would then have meaningful representations too.  Perhaps:

```
def __init__(self, ....., name=None):
    ...
    if name is None: 
         name = self.func.__name__
    self.__name___ = name

def __repr__(self):
    return  "<lmfit.Model: %s>" % (self.__name__)
```

But feel free to expand / improve upon that and make a PR when you're happy with the result.

+1

Any reason you want to make it a private attribute (`self.__name__`)?

I was thinking about `self.name` so it's directly exposed to the user. 

I have no preference.


Resolving patch:
diff --git a/lmfit/model.py b/lmfit/model.py
--- a/lmfit/model.py
+++ b/lmfit/model.py
@@ -42,6 +42,9 @@ class Model(object):
             numpy.isnan is used.
         'raise': Raise a (more helpful) exception when data contains null
             or missing values.
+    name: None or string
+        name for the model. When `None` (default) the name is the same as
+        the model function (`func`).
 
     Note
     ----
@@ -61,7 +64,7 @@ class Model(object):
     _invalid_par   = "Invalid parameter name ('%s') for function %s"
     _invalid_missing = "missing must be None, 'none', 'drop', or 'raise'."
     def __init__(self, func, independent_vars=None, param_names=None,
-                 missing='none', prefix='', components=None, **kws):
+                 missing='none', prefix='', components=None, name=None, **kws):
         self.func = func
         self.prefix = prefix
         self.param_names = param_names
@@ -80,6 +83,12 @@ def __init__(self, func, independent_vars=None, param_names=None,
         self._residual = self._build_residual()
         if self.independent_vars is None:
             self.independent_vars = []
+        if name is None:
+            name = self.func.__name__
+        self.name = name
+
+    def __repr__(self):
+        return  "<lmfit.Model: %s>" % (self.name)
 
     def _parse_params(self):
         "build params from function arguments"


Test patch:
Repository: lmfit/lmfit-py

Issue:
Cannot deploy to pypi repo dues to tuples in the `setup.py` attributes
Due to a python-bug (http://bugs.python.org/issue19610) i cannot install and deploy lmfit with `python setup install`

I discovered this issue while trying to fix #149 



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -30,11 +30,11 @@
       author_email = 'matt.newville@gmail.com',
       url          = 'http://lmfit.github.io/lmfit-py/',
       download_url = 'http://lmfit.github.io//lmfit-py/',
-      requires = ('numpy', 'scipy'),
+      requires = ['numpy', 'scipy'],
       license = 'BSD',
       description = "Least-Squares Minimization with Bounds and Constraints",
       long_description = long_desc,
-      platforms = ('Windows', 'Linux', 'Mac OS X'),
+      platforms = ['Windows', 'Linux', 'Mac OS X'],
       classifiers=['Intended Audience :: Science/Research',
                    'Operating System :: OS Independent',
                    'Programming Language :: Python',


Test patch:
Repository: lmfit/lmfit-py

Issue:
Can't set 0 as upper boundary for parameters
Fitting a parameter with a negative value as lower boundary and 0 as the upper boundary fails because of the check if lower and upper boundaries are equal:

/usr/local/lib/python3.4/site-packages/lmfit/parameter.py in _getval(self)
    369         if self.max < self.min:
    370             self.max, self.min = self.min, self.max
--> 371         if abs((1.0*self.max - self.min)/max(self.max, self.min)) < 1.e-13:
    372             raise ValueError("Parameter '%s' has min == max" % self.name)
    373 

ZeroDivisionError: float division by zero



Discussion:
@carstenblt -- ah sorry about that.  Should be an easy fix.


Resolving patch:
diff --git a/lmfit/parameter.py b/lmfit/parameter.py
--- a/lmfit/parameter.py
+++ b/lmfit/parameter.py
@@ -377,9 +377,9 @@ def _getval(self):
             self.max =  inf
         if self.max < self.min:
             self.max, self.min = self.min, self.max
-        if abs((1.0*self.max - self.min)/max(self.max, self.min)) < 1.e-13:
+        if (abs((1.0*self.max - self.min)/
+                max(abs(self.max), abs(self.min), 1.e-13)) < 1.e-13):
             raise ValueError("Parameter '%s' has min == max" % self.name)
-
         try:
             if self.min > -inf:
                 self._val = max(self.min, self._val)


Test patch:
Repository: lmfit/lmfit-py

Issue:
compatibility issue with Ipython4
hi,

I get this error experementing with Ipython4:

```
D:\WinPythonQt5\basedir34\build\winpython-3.4.3.amd64_build0\python-3.4.3.amd64\lib\site-packages\IPython\html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
```

``` python3
python-3.4.3.amd64\lib\site-packages\lmfit\ui\ipy_fitter.py in <module>()
     21 else:
     22     # as of IPython 3.x:
---> 23     from IPython.html.widgets import Dropdown
     24     from IPython.html.widgets import Button
     25     from IPython.html.widgets import Box

ImportError: No module named 'widgets'
```



Discussion:
Yep! Widgets were moved to a separate package, ipywidgets. Will try to get around to fix this soon, but a PR would be welcome.

in process, I forgot to install this package too.


Resolving patch:
diff --git a/lmfit/ui/ipy_fitter.py b/lmfit/ui/ipy_fitter.py
--- a/lmfit/ui/ipy_fitter.py
+++ b/lmfit/ui/ipy_fitter.py
@@ -13,6 +13,7 @@
 # Widgets were only experimental in IPython 2.x, but this does work there.
 # Handle the change in naming from 2.x to 3.x.
 IPY2 = IPython.release.version_info[0] == 2
+IPY3 = IPython.release.version_info[0] == 3
 if IPY2:
     from IPython.html.widgets import DropdownWidget as Dropdown
     from IPython.html.widgets import ButtonWidget as Button
@@ -23,13 +24,20 @@ class HBox(Box):
         def __init__(*args, **kwargs):
             self.add_class('hbox')
             super(self, HBox).__init__(*args, **kwargs)
-else:
+elif IPY3:
     # as of IPython 3.x:
     from IPython.html.widgets import Dropdown
     from IPython.html.widgets import Button
     from IPython.html.widgets import HBox
     from IPython.html.widgets import FloatText
     from IPython.html.widgets import Checkbox
+else:
+    # as of IPython 4.x+:
+    from ipywidgets import Dropdown
+    from ipywidgets import Button
+    from ipywidgets import Box
+    from ipywidgets import FloatText
+    from ipywidgets import Checkbox
 
 
 class ParameterWidgetGroup(object):


Test patch:
Repository: lmfit/lmfit-py

Issue:
copy(Parameters) is broken
OK, a simple copy of `Parameters` is broken:

```python
>>> from  lmfit import Parameters
>>> p = Parameters()
>>> p.add('x', 1)
>>> import copy 
>>> copy.copy(p)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Newville/anaconda3/lib/python3.6/copy.py", line 88, in copy
    return copier(x)
TypeError: __copy__() missing 1 required positional argument: 'memo'
```



Discussion:

Resolving patch:
diff --git a/lmfit/parameter.py b/lmfit/parameter.py
--- a/lmfit/parameter.py
+++ b/lmfit/parameter.py
@@ -97,9 +97,9 @@ def copy(self):
         """Parameters.copy() should always be a deepcopy."""
         return self.__deepcopy__(None)
 
-    def __copy__(self, memo):
+    def __copy__(self):
         """Parameters.copy() should always be a deepcopy."""
-        self.__deepcopy__(memo)
+        return self.__deepcopy__(None)
 
     def __deepcopy__(self, memo):
         """Parameters.deepcopy() needs to make sure that asteval is available


Test patch:
diff --git a/tests/test_parameters.py b/tests/test_parameters.py
--- a/tests/test_parameters.py
+++ b/tests/test_parameters.py
@@ -3,7 +3,7 @@
 from lmfit.parameter import isclose
 from numpy.testing import assert_, assert_almost_equal, assert_equal
 import unittest
-from copy import deepcopy
+from copy import deepcopy, copy
 import numpy as np
 import pickle
 
@@ -41,6 +41,35 @@ def test_copy(self):
         assert(p2._asteval.symtable is not None)
         assert((p2['y'].value > 20) and (p2['y'].value < 21))
 
+    def test_copy_function(self):
+        # check copy(Parameters) does not fail
+        p1 = Parameters()
+        p1.add('t', 2.0, min=0.0, max=5.0)
+        p1.add('x', 10.0)
+        p1.add('y', expr='x*t + sqrt(t)/3.0')
+
+        p2 = copy(p1)
+        assert(isinstance(p2, Parameters))
+
+        # change the 'x' value in the original
+        p1['x'].value = 4.0
+
+        assert(p2['x'].value > 9.8)
+        assert(p2['x'].value < 10.2)
+        assert(np.isinf(p2['x'].max) and p2['x'].max > 0)
+
+        assert('t' in p2)
+        assert('y' in p2)
+        assert(p2['t'].max < 6.0)
+
+        assert(np.isinf(p2['x'].min) and p2['x'].min < 0)
+        assert('sqrt(t)' in p2['y'].expr )
+        assert(p2._asteval is not None)
+        assert(p2._asteval.symtable is not None)
+        assert((p2['y'].value > 20) and (p2['y'].value < 21))
+
+        assert(p1['y'].value < 10)
+
 
     def test_deepcopy(self):
         # check that a simple copy works
Repository: lmfit/lmfit-py

Issue:
hint is wrong for lognormal model
#### Description
Lognormal model in lmfit use this formula for fitting:
```latex
f(x; A, \mu, \sigma) = \frac{A}{\sigma\sqrt{2\pi}}\frac{e^{-(\ln(x) - \mu)^2/ 2\sigma^2}}{x}
```
I use this model to fit my data but i failed several times to use this model. 

I found that \mu is limited to be positive but \mu should not be limited in math. I think some one is confused with another representation of lognormal function:
```latex
f(x; A, \mu, \sigma) = \frac{A}{\sigma\sqrt{2\pi}}\frac{e^{-(\ln(x) - \ln(\mu))^2/ 2\sigma^2}}{x}
```
where a \ln is applied to \mu and \mu should be limited to be greater than 0.

I set the limit of \mu manually and it works.

I prefer to changing the model to \ln one to fix the bug.

###### Version information
Python: 3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00) 
[GCC 7.3.0]

lmfit: 1.0.1, scipy: 1.3.3, numpy: 1.17.4, asteval: 0.9.18, uncertainties: 3.0.3




Discussion:
@YoshieraHuang Thanks - I think you are correct that `center` should not be limited to positive values here.

I don't have a strong preference for `\ln(x) - \mu` vs `\ln(x) - \ln(\mu)` but I think going with the Wikipedia form is defensible as "consistent with other models" and that changing the hint instead of the functional form would be less disruptive to any existing scripts.

A PR to remove the hint would be welcome. If you are not up for that, let us know and we'll try to get to it soon.






Resolving patch:
diff --git a/lmfit/models.py b/lmfit/models.py
--- a/lmfit/models.py
+++ b/lmfit/models.py
@@ -803,7 +803,6 @@ def __init__(self, independent_vars=['x'], prefix='', nan_policy='raise',
         self._set_paramhints_prefix()
 
     def _set_paramhints_prefix(self):
-        self.set_param_hint('center', min=1.e-19)
         self.set_param_hint('sigma', min=0)
 
         fmt = ("{prefix:s}amplitude/max({0}, ({prefix:s}sigma*sqrt(2*pi)))"


Test patch:
Repository: lmfit/lmfit-py

Issue:
`ConstantModel` returns wrong shape
I am guessing people very rarely use the built-in `ConstantModel` without combining it with another model, which is probably why this hasn't cropped up before (when combined broadcasting rules would sort this out, I suspect), but `ConstantModel` returns only a single element rather than matching the shape of the input data. This causes the following to fail:

```python
import numpy as np
import matplotlib.pyplot as plt
from lmfit.models import ConstantModel

x = np.array([1.0, 2.0, 3.0])
y = np.array([1.0, 1.5, 0.5])
model = ConstantModel()
params = model.guess(y, x=x)
fit = model.fit(y, params, x=x)

plt.plot(x, y, "o")
plt.plot(x, fit.best_fit, "--")
```

This raises: `ValueError: x and y must have same first dimension, but have shapes (3,) and (1,)` since `fit.best_fit` has shape `(1,)`.


Discussion:

Resolving patch:
diff --git a/lmfit/models.py b/lmfit/models.py
--- a/lmfit/models.py
+++ b/lmfit/models.py
@@ -168,7 +168,7 @@ def __init__(self, independent_vars=['x'], prefix='', nan_policy='raise',
                        'independent_vars': independent_vars})
 
         def constant(x, c=0.0):
-            return c
+            return c * np.ones(np.shape(x))
         super().__init__(constant, **kwargs)
 
     def guess(self, data, x=None, **kwargs):
@@ -198,7 +198,7 @@ def __init__(self, independent_vars=['x'], prefix='', nan_policy='raise',
                        'independent_vars': independent_vars})
 
         def constant(x, re=0., im=0.):
-            return re + 1j*im
+            return (re + 1j*im) * np.ones(np.shape(x))
         super().__init__(constant, **kwargs)
 
     def guess(self, data, x=None, **kwargs):


Test patch:
Repository: lmfit/lmfit-py

Issue:
_buildmodel state dict (version 2) restore typo
#### First Time Issue Code
Yes, I read the instructions and I am sure this is a GitHub Issue.>

#### Description
There is a typo in the `_buildmodel` function introduced in #940
https://github.com/lmfit/lmfit-py/blob/3cfd09a127a1b40020538e1a3d9e71ac2661ee38/lmfit/model.py#L1391

###### A Minimal, Complete, and Verifiable example
n/a


###### Fit report:
n/a


###### Error message:
n/a

###### Version information
lmfit since #940 (1.3.0+)

###### Link(s)




Discussion:

Resolving patch:
diff --git a/lmfit/model.py b/lmfit/model.py
--- a/lmfit/model.py
+++ b/lmfit/model.py
@@ -1388,7 +1388,7 @@ def _buildmodel(state, funcdefs=None):
             func = left.get('funcdef', None)
             name = left.get('name', None)
             prefix = left.get('prefix', None)
-            ivars = left.get('indepedendent_vars', None)
+            ivars = left.get('independent_vars', None)
             pnames = left.get('param_root_names', None)
             phints = left.get('param_hints', None)
             nan_policy = left.get('nan_policy', None)


Test patch:
Repository: ros2/ros2_documentation

Issue:
Add "Edit on Github" links to the pages
Currently there's a link at the bottom to the RST in the generated site. It would be valuable to have the link to the github sources to facilitate opening a pull request. 

There are ways to add this to the theme or side bar. There may be plugins to add this too. 




Discussion:

Resolving patch:
diff --git a/conf.py b/conf.py
--- a/conf.py
+++ b/conf.py
@@ -69,7 +69,7 @@
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-extensions = ['sphinx.ext.intersphinx', 'sphinx_tabs.tabs', 'sphinx_multiversion']
+extensions = ['sphinx.ext.intersphinx', 'sphinx_tabs.tabs', 'sphinx_multiversion', 'sphinxcontrib.srclinks']
 
 # Intersphinx mapping
 
@@ -90,12 +90,16 @@
 #
 #html_theme = 'alabaster'
 
+srclink_project = 'https://github.com/ros2/ros2_documentation'
+srclink_src_path = 'source/'
+srclink_branch = 'rolling'
+
 templates_path = [
     "source/_templates",
 ]
 
 html_sidebars = {
-    '**': ['navigation.html', 'versioning.html'],
+    '**': ['navigation.html', 'srclinks.html', 'versioning.html'],
 }
 
 # smv_tag_whitelist = None
@@ -237,6 +241,11 @@ def smv_rewrite_baseurl(app, config):
     if app.config.smv_current_version != '':
         app.config.html_baseurl = app.config.html_baseurl + '/' + app.config.smv_current_version
 
+def srclink_rewrite_branch(app, config):
+    if app.config.smv_current_version != '':
+        app.config.srclink_branch = app.config.smv_current_version
+
 def setup(app):
     app.connect('config-inited', smv_rewrite_baseurl)
+    app.connect('config-inited', srclink_rewrite_branch)
     RedirectFrom.register(app)


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -15,8 +15,8 @@ jobs:
 
       - name: Install dependencies with pip
         run: |
-          pip install doc8 sphinx sphinx-multiversion
-          pip install git+https://github.com/osrf/sphinx-tabs
+          pip install --no-warn-script-location --user --upgrade -r requirements.txt
+          pip install doc8
 
       - run: make html
       - run: doc8 --ignore D001 --ignore-path build
Repository: ros2/ros2_documentation

Issue:
Add the ROS distro version above the fold
With #1150 we have the new versioning tabs which are moderately small and compact, but that makes it hard to tell what version you're looking at. Having a subtitle or other content at the top to know what version you're looking at at the top would be valuable. It could likely go in as a subtitle under ros2_documentation or elsewhere near the top of the left menu.



Discussion:

Resolving patch:
diff --git a/conf.py b/conf.py
--- a/conf.py
+++ b/conf.py
@@ -40,7 +40,7 @@
 suppress_warnings = ['image.nonlocal_uri']
 
 # General information about the project.
-project = 'ros2 documentation'
+project = 'ROS 2 documentation'
 author = 'Open Robotics'
 copyright = '{}, {}'.format(time.strftime('%Y'), author)
 
@@ -248,6 +248,7 @@ def smv_rewrite_baseurl(app, config):
     # to rewrite the html_baseurl with the current version.
     if app.config.smv_current_version != '':
         app.config.html_baseurl = app.config.html_baseurl + '/' + app.config.smv_current_version
+        app.config.project = 'ROS 2 Documentation: ' + app.config.smv_current_version.title()
 
 def github_link_rewrite_branch(app, pagename, templatename, context, doctree):
     if app.config.smv_current_version != '':


Test patch: