internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: Zeroto521/my-data-toolkit

Issue:
DEP: Drop `inplace` option of `filter_in`
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [x] whatsnew entry

Refer other `filter` methods. There don't have `inplace` option.


Discussion:

Resolving patch:
diff --git a/dtoolkit/accessor/dataframe/filter_in.py b/dtoolkit/accessor/dataframe/filter_in.py
--- a/dtoolkit/accessor/dataframe/filter_in.py
+++ b/dtoolkit/accessor/dataframe/filter_in.py
@@ -8,6 +8,7 @@
 from dtoolkit.accessor._util import get_mask
 from dtoolkit.accessor._util import isin
 from dtoolkit.accessor.register import register_dataframe_method
+from dtoolkit.util._decorator import warning
 
 
 if TYPE_CHECKING:
@@ -17,6 +18,12 @@
 
 
 @register_dataframe_method
+@warning(
+    "The 'inplace' option of 'dtoolkit.accessor.dataframe.filter_in' is deprecated "
+    "and will be removed in 0.0.16. (Warning added DToolKit 0.0.15)",
+    DeprecationWarning,
+    stacklevel=3,
+)
 def filter_in(
     df: pd.DataFrame,
     condition: Iterable | pd.Series | pd.DataFrame | dict[str, list[str]],
@@ -30,6 +37,10 @@ def filter_in(
     Similar to :meth:`~pandas.DataFrame.isin`, but the return is value not
     bool.
 
+    .. warning::
+        The ``inplace`` option of ``dtoolkit.accessor.dataframe.filter_in`` is
+        deprecated and will be removed in 0.0.16. (Warning added DToolKit 0.0.15)
+
     Parameters
     ----------
     condition : iterable, Series, DataFrame or dict


Test patch:
Repository: Zeroto521/my-data-toolkit

Issue:
PERF: `to_set` speeds up especial for large data
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [x] whatsnew entry


| data                 | `set(s)`         | `set(s.unique())` |
| -------------------- | ---------------- | ----------------- |
| small, `list(range(10)`      | 1.83 µs ± 31.6 ns | 1.17 ms ± 144 µs |
| large, `list(range(10)*1000` | 9.67 µs ± 564 ns | 255 µs ± 14.9 µs |



Discussion:

Resolving patch:
diff --git a/dtoolkit/accessor/index/to_set.py b/dtoolkit/accessor/index/to_set.py
--- a/dtoolkit/accessor/index/to_set.py
+++ b/dtoolkit/accessor/index/to_set.py
@@ -33,4 +33,4 @@ def to_set(index: pd.Index) -> set:
     {1, 2}
     """
 
-    return set(index)
+    return set(index.unique())


Test patch:
Repository: Zeroto521/my-data-toolkit

Issue:
ENH: New geoaccessor to calculate two coordinates distance on earth
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [ ] whatsnew entry



Discussion:

Resolving patch:
diff --git a/dtoolkit/geoaccessor/geoseries/geodistance.py b/dtoolkit/geoaccessor/geoseries/geodistance.py
--- a/dtoolkit/geoaccessor/geoseries/geodistance.py
+++ b/dtoolkit/geoaccessor/geoseries/geodistance.py
@@ -20,7 +20,9 @@ def geodistance(
     radius: float = 6371008.7714150598,
 ) -> pd.Series:
     """
-    Returns a ``Series`` containing the great-circle distance to aligned other.
+    Returns a ``Series`` containing the `great-circle`__ distance to aligned other.
+
+    __ https://en.wikipedia.org/wiki/Great-circle_distance
 
     The algorithm uses the Vincenty formula which is more accurate than the Haversine
     formula.
diff --git a/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py b/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
--- a/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
+++ b/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
@@ -15,9 +15,11 @@ def geodistance_matrix(
     radius: float = 6371008.7714150598,
 ) -> pd.DataFrame:
     """
-    Returns a ``DataFrame`` containing the great-circle distances matrix between in
+    Returns a ``DataFrame`` containing the `great-circle`__ distances matrix between in
     ``s`` and ``other`` via haversine formula.
 
+    __ https://en.wikipedia.org/wiki/Great-circle_distance
+
     .. math::
 
         D(x, y) = 2 \\arcsin [


Test patch:
Repository: Zeroto521/my-data-toolkit

Issue:
BUG: CRS is missing
https://github.com/Zeroto521/my-data-toolkit/blob/93aaefa0193c1822af21c60d9edbbc9acff68815/dtoolkit/geoaccessor/series/to_geoframe.py#L86-L87

`np.asarray` will remove CRS information from GeoSeries.


Discussion:

Resolving patch:
diff --git a/dtoolkit/geoaccessor/series/to_geoframe.py b/dtoolkit/geoaccessor/series/to_geoframe.py
--- a/dtoolkit/geoaccessor/series/to_geoframe.py
+++ b/dtoolkit/geoaccessor/series/to_geoframe.py
@@ -3,7 +3,6 @@
 from typing import TYPE_CHECKING
 
 import geopandas as gpd
-import numpy as np
 import pandas as pd
 from geopandas.base import is_geometry_type
 
@@ -84,7 +83,7 @@ def to_geoframe(
     if geometry is not None:
         # FIXME: https://github.com/geopandas/geopandas/issues/2660
         if isinstance(geometry, gpd.GeoSeries):
-            geometry = np.asarray(geometry)
+            geometry = geometry.set_axis(s.index)
         return gpd.GeoDataFrame(s, geometry=geometry, crs=crs, **kwargs)
     elif is_geometry_type(s):
         return gpd.GeoDataFrame(geometry=s, crs=crs, **kwargs)


Test patch:
diff --git a/test/geoaccessor/series/test_to_geoframe.py b/test/geoaccessor/series/test_to_geoframe.py
--- a/test/geoaccessor/series/test_to_geoframe.py
+++ b/test/geoaccessor/series/test_to_geoframe.py
@@ -154,3 +154,19 @@ def test_index(s, geometry, expected):
     result = to_geoframe(s, geometry=geometry)
 
     assert_geodataframe_equal(result, expected)
+
+
+# https://github.com/Zeroto521/my-data-toolkit/issues/815
+def test_crs():
+    result = to_geoframe(
+        pd.Series([1, 2]),
+        geometry=gpd.GeoSeries(
+            [
+                Point(1, 1),
+                Point(2, 2),
+            ],
+            crs=4326,
+        ),
+    )
+
+    assert result.crs == 4326
Repository: Zeroto521/my-data-toolkit

Issue:
BUG: `DataFrame.to_geoframe` will ignore GeoDataFrame type
```python
>>> import dtoolkit.geoaccessor
>>> import geopandas as gpd
>>> from shapely import Point
>>> df = gpd.GeoDataFrame(
...     {
...         "label": ["a", "b"],
...         "geometry": [Point(100, 1), Point(122, 50)],
...     },
...     crs=4326,
... )
>>> df
  label                    geometry
0     a   POINT (100.00000 1.00000)
1     b  POINT (122.00000 50.00000)
>>> df.to_geoframe(gpd.GeoSeries([Point(0, 0), Point(1, 1)], crs=3857))
# geometry doesn't change at all
  label                    geometry
0     a   POINT (100.00000 1.00000)
1     b  POINT (122.00000 50.00000)
```


Discussion:

Resolving patch:
diff --git a/dtoolkit/geoaccessor/dataframe/to_geoframe.py b/dtoolkit/geoaccessor/dataframe/to_geoframe.py
--- a/dtoolkit/geoaccessor/dataframe/to_geoframe.py
+++ b/dtoolkit/geoaccessor/dataframe/to_geoframe.py
@@ -101,15 +101,6 @@ def to_geoframe(
     - Prime Meridian: Greenwich
     """
 
-    return (
-        gpd.GeoDataFrame(
-            # Avoid mutating the original DataFrame.
-            # https://github.com/geopandas/geopandas/issues/1179
-            df.copy(),
-            crs=crs,
-            geometry=geometry,
-            **kwargs,
-        )
-        if not isinstance(df, gpd.GeoDataFrame)
-        else df
-    )
+    # Use `.copy` to avoid mutating the original DataFrame.
+    # https://github.com/geopandas/geopandas/issues/1179
+    return gpd.GeoDataFrame(df.copy(), geometry=geometry, crs=crs, **kwargs)


Test patch:
diff --git a/test/geoaccessor/dataframe/test_to_geoframe.py b/test/geoaccessor/dataframe/test_to_geoframe.py
--- a/test/geoaccessor/dataframe/test_to_geoframe.py
+++ b/test/geoaccessor/dataframe/test_to_geoframe.py
@@ -1,5 +1,7 @@
+import geopandas as gpd
 import pandas as pd
 from pandas.testing import assert_frame_equal
+from shapely import Point
 
 from dtoolkit.geoaccessor.dataframe import to_geoframe  # noqa: F401
 
@@ -23,3 +25,23 @@ def test_original_dataframe_type():
     df.to_geoframe(geometry=df["geom"])
 
     assert_frame_equal(df, df_copy)
+
+
+# https://github.com/Zeroto521/my-data-toolkit/issues/820
+def test_replace_old_geoemtry():
+    df = gpd.GeoDataFrame(
+        {
+            "label": ["a", "b"],
+            "geometry": [Point(100, 1), Point(122, 50)],
+        },
+        crs=4326,
+    ).to_geoframe(
+        geometry=gpd.GeoSeries(
+            [Point(0, 0), Point(1, 1)],
+            crs=3857,
+        ),
+    )
+
+    assert df.geometry.x.tolist() == [0, 1]
+    assert df.geometry.y.tolist() == [0, 1]
+    assert df.crs == 3857
Repository: Zeroto521/my-data-toolkit

Issue:
BUG: `geocentroid` coordiantes should divide distance
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [x] closes #832
- [x] whatsnew entry

```latex
        \left\{\begin{matrix}
            d_i &=& D(P(\bar{x}_n, \bar{y}_n), P(x_i,y_i))  \\
            \bar{x}_0 &=& \frac{\sum w_i x_i}{\sum w_i} \\
            \bar{y}_0 &=& \frac{\sum w_i y_i}{\sum w_i} \\
            \bar{x}_{n+1} &=& \frac{\sum w_i x_i / d_i}{\sum w_i / d_i} \\
            \bar{y}_{n+1} &=& \frac{\sum w_i y_i / d_i}{\sum w_i / d_i} \\
        \end{matrix}\right.
```


Discussion:

Resolving patch:
diff --git a/dtoolkit/geoaccessor/geoseries/geocentroid.py b/dtoolkit/geoaccessor/geoseries/geocentroid.py
--- a/dtoolkit/geoaccessor/geoseries/geocentroid.py
+++ b/dtoolkit/geoaccessor/geoseries/geocentroid.py
@@ -75,14 +75,14 @@ def geocentroid(
     Set weights for each point.
 
     >>> df.geocentroid("weights")
-    <POINT (121.999 54.998)>
+    <POINT (121.999 54.999)>
     >>> df.geocentroid([1, 2, 3])
-    <POINT (121.999 54.998)>
+    <POINT (121.999 54.999)>
     """
 
     weights = np.asarray(weights) if weights is not None else 1
     coord = xy(s)
-    X = coord.mean()
+    X = coord.mul(weights, axis=0).mean()
     for _ in range(max_iter):
         dis = geodistance(s, Point(*X.tolist())).rdiv(1).mul(weights, axis=0)
         Xt = coord.mul(dis, axis=0).sum() / dis.sum()


Test patch:
Repository: chanzuckerberg/single-cell-curation

Issue:
Feat(curation notebooks): display the x-request-id in the error response
When an error occurs especially 500 errors, the only piece of debug information the user has is the x-request-id. Making this value visible to the users will help developer trouble shoot errors seen by the users in the future.


Discussion:

Resolving patch:
diff --git a/notebooks/curation_api/python/src/utils/logger.py b/notebooks/curation_api/python/src/utils/logger.py
--- a/notebooks/curation_api/python/src/utils/logger.py
+++ b/notebooks/curation_api/python/src/utils/logger.py
@@ -40,6 +40,8 @@ def failure(logger: logging.Logger, e, *messages):
     logger.error("\n\033[1m\033[38;5;9mFAILED\033[0m\n")  # 'FAILED' in bold red
     logger.error(e.response.reason + "\n")
     logger.error(e.response.text + "\n")
+    logger.error(f"x-request-id: {e.response.headers.get('x-request-id')}")
+
     if messages:
         [logger.error(m) for m in messages]
 


Test patch:
Repository: flask-admin/flask-admin

Issue:
model edit_view 'Save and Continue' doesn't work when app is not located at root url
The "Save and Continue" functionality for a model's edit_view only works if the app is at the root url.

As an example, here is a version of the flask-admin sqla example that has been modified so that the root of the admin is at '/dispatched/admin/': https://gist.github.com/wilsaj/7553854

"Save and Continue" will try to redirect to '/admin/...' instead of '/dispatched/admin/...'



Discussion:

Resolving patch:
diff --git a/flask_admin/model/base.py b/flask_admin/model/base.py
--- a/flask_admin/model/base.py
+++ b/flask_admin/model/base.py
@@ -1246,7 +1246,7 @@ def edit_view(self):
             if self.update_model(form, model):
                 if '_continue_editing' in request.form:
                     flash(gettext('Model was successfully saved.'))
-                    return redirect(request.full_path)
+                    return redirect(request.url)
                 else:
                     return redirect(return_url)
 


Test patch:
diff --git a/flask_admin/tests/test_model.py b/flask_admin/tests/test_model.py
--- a/flask_admin/tests/test_model.py
+++ b/flask_admin/tests/test_model.py
@@ -2,6 +2,9 @@
 
 from flask import Flask
 
+from werkzeug.wsgi import DispatcherMiddleware
+from werkzeug.test import Client
+
 from wtforms import fields
 
 from flask.ext.admin import Admin, form
@@ -175,6 +178,21 @@ def test_mockview():
     eq_(rv.status_code, 302)
     eq_(rv.headers['location'], 'http://localhost/admin/modelview/')
 
+    # Create a dispatched application to test that edit view's "save and
+    # continue" functionality works when app is not located at root
+    dummy_app = Flask('dummy_app')
+    dispatched_app = DispatcherMiddleware(dummy_app, {'/dispatched': app})
+    dispatched_client = Client(dispatched_app)
+
+    app_iter, status, headers = dispatched_client.post(
+        '/dispatched/admin/modelview/edit/?id=3',
+        data=dict(col1='another test!', col2='test@', col3='test#', _continue_editing='True'))
+
+    eq_(status, '302 FOUND')
+    eq_(headers['Location'], 'http://localhost/dispatched/admin/modelview/edit/?id=3')
+    model = view.updated_models.pop()
+    eq_(model.col1, 'another test!')
+
 
 def test_permissions():
     app, admin = setup()
Repository: flask-admin/flask-admin

Issue:
Peewee: InlineModelFormList initialises InlineModelFormField with 3 positional args, but only 2 are allowed
When adding a simple inline model to my Peewee modelview, flask-admin threw a "wrong-number-of-arguments" error at me.

I tracked the cause down: [peewee/forms.py, L35](https://github.com/mrjoes/flask-admin/blob/master/flask_admin/contrib/peewee/form.py#L35) initialises `form_field_type` (i.e. `InlineModelFormField`) with an extra positional argument `inline_view`.

InlineModelFormField takes only 2 positional arguments: [model/fields.py, L105](https://github.com/mrjoes/flask-admin/blob/master/flask_admin/model/fields.py#L105)

However, it does not cause an error at this point, because it is an UnboundField. The error occurs as soon as the field is bound slightly later.

Looking at the equivalent code for sqla [sqla/fields.py, L212](https://github.com/mrjoes/flask-admin/blob/master/flask_admin/contrib/sqla/fields.py#L212), I think the fix would be to simply remove the extra argument `inline_view`, though perhaps there's a good reason for it to be there?



Discussion:
No, there were recent developments and I forgot to update peewee backend.

Pull request is very welcome.


Resolving patch:
diff --git a/flask_admin/contrib/peewee/form.py b/flask_admin/contrib/peewee/form.py
--- a/flask_admin/contrib/peewee/form.py
+++ b/flask_admin/contrib/peewee/form.py
@@ -31,8 +31,7 @@ def __init__(self, form, model, prop, inline_view, **kwargs):
         self.inline_view = inline_view
 
         self._pk = get_primary_key(model)
-
-        super(InlineModelFormList, self).__init__(self.form_field_type(form, self._pk, inline_view), **kwargs)
+        super(InlineModelFormList, self).__init__(self.form_field_type(form, self._pk), **kwargs)
 
     def display_row_controls(self, field):
         return field.get_pk() is not None


Test patch:
Repository: flask-admin/flask-admin

Issue:
form_overrides does not work with Peewee model backend
I assume this is the same reason as the others -- that the Peewee backend's not quite as up-to-date?

Looking through the code, it appears that form_overrides is not even checked in the Peewee backend, so it shouldn't be too hard for me to fix this.

If you confirm that this is a bug and I'm not missing something, I can send through some code.



Discussion:
Unfortunately - not up to date. Yes, pull request would be great.


Resolving patch:
diff --git a/flask_admin/contrib/peewee/form.py b/flask_admin/contrib/peewee/form.py
--- a/flask_admin/contrib/peewee/form.py
+++ b/flask_admin/contrib/peewee/form.py
@@ -90,6 +90,8 @@ def __init__(self, view, additional=None):
         self.converters[DateField] = self.handle_date
         self.converters[TimeField] = self.handle_time
 
+        self.overrides = getattr(self.view, 'form_overrides', None) or {}
+
     def handle_foreign_key(self, model, field, **kwargs):
         loader = getattr(self.view, '_form_ajax_refs', {}).get(field.name)
 


Test patch:
Repository: flask-admin/flask-admin

Issue:
Type formatter is ignored when list_formatter exists
I added a formatter to my column and it ignored the `type_formatter`.

```
# this format do nothing but type formatter is not applied
list_formatters = dict(x=lambda v, c, m, p: m.x)
```

I expected to return a bool to be formatted as a bool in my view (with bootstrap icons).



Discussion:

Resolving patch:
diff --git a/flask_admin/model/base.py b/flask_admin/model/base.py
--- a/flask_admin/model/base.py
+++ b/flask_admin/model/base.py
@@ -1058,9 +1058,9 @@ def get_list_value(self, context, model, name):
         """
         column_fmt = self.column_formatters.get(name)
         if column_fmt is not None:
-            return column_fmt(self, context, model, name)
-
-        value = self._get_field_value(model, name)
+            value = column_fmt(self, context, model, name)
+        else:
+            value = self._get_field_value(model, name)
 
         choices_map = self._column_choices_map.get(name, {})
         if choices_map:


Test patch:
Repository: flask-admin/flask-admin

Issue:
Import of wtforms _unset_value needs to change to unset_value
Same problem as in #374 - the _unset_value function is no longer in wtforms.fields.core, but in wtforms.utils as unset_value.

Problem still exists in flask_admin/contrib/mongoengine/fields.py - needs basically the same fix that was applied earlier for flask_admin/form/upload.py.



Discussion:

Resolving patch:
diff --git a/flask_admin/contrib/mongoengine/fields.py b/flask_admin/contrib/mongoengine/fields.py
--- a/flask_admin/contrib/mongoengine/fields.py
+++ b/flask_admin/contrib/mongoengine/fields.py
@@ -1,7 +1,11 @@
 from werkzeug.datastructures import FileStorage
 
 from wtforms import fields
-from wtforms.fields.core import _unset_value
+
+try:
+    from wtforms.fields.core import _unset_value as unset_value
+except ImportError:
+    from wtforms.utils import unset_value
 
 from . import widgets
 from flask.ext.admin.model.fields import InlineFormField
@@ -47,7 +51,7 @@ def __init__(self, label=None, validators=None, **kwargs):
 
         self._should_delete = False
 
-    def process(self, formdata, data=_unset_value):
+    def process(self, formdata, data=unset_value):
         if formdata:
             marker = '_%s-delete' % self.name
             if marker in formdata:


Test patch:
Repository: flask-admin/flask-admin

Issue:
Add Documentation for Changing "data-date-format" On DateTime Field
I'm having a tough time figuring out how to change "data-date-format" on a datetime field by using form_args, form_widget_args, or form_overrides.

Is that even possible? If it is, can we add it to the examples or the documentation?



Discussion:

Resolving patch:
diff --git a/flask_admin/model/base.py b/flask_admin/model/base.py
--- a/flask_admin/model/base.py
+++ b/flask_admin/model/base.py
@@ -365,6 +365,15 @@ class MyModelView(BaseModelView):
                         'style': 'color: black'
                     }
                 }
+                
+        Note, changing the format of a DateTimeField will require changes to both form_widget_args and form_args:
+
+            form_args = dict(
+                start=dict(format='%Y-%m-%d %H:%M') # changes how the input is parsed by strptime
+            )
+            form_widget_args = dict(
+                start={'data-date-format': u'yyyy-mm-dd hh:ii'} # changes how the DateTimeField displays the time
+            )
     """
 
     form_extra_fields = None


Test patch: