nebius/SWE-bench-extra huggingface dataset:
Repository: matthewwardrop/formulaic

Issue:
`model_spec.transform_state` bugged when formula is not correctly written
In case the given formula is not correctly written i.e., with extra or forgotten spaces then the `transform_state` dictionary keys does not match and the dictionary results in `{}`. Here is an example:

`import numpy as np
import pandas as pd
from formulaic import Formula

df = pd.DataFrame({
    'y': np.linspace(1,5,10),
    'x': np.linspace(0,1,10),
})

\# Formula well written
y, X = Formula('y ~ bs(x, df=4) ').get_model_matrix(df)
print(X.model_spec.__dict__["transform_state"])
`

results in `{'bs(x, df=4)': {'lower_bound': 0.0, 'upper_bound': 1.0, 'knots': [0.0, 0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0, 1.0]}}` while

`\# Formula not well written (note the whitespaces)

y, X = Formula('y ~ bs( x, df = 4) ').get_model_matrix(df)
print(X.model_spec.__dict__["transform_state"])
`

results in `{}`

I am using Formulaic version 0.6.6

Comments:

Patch:
diff --git a/formulaic/materializers/base.py b/formulaic/materializers/base.py
index 9a097eb..6393769 100644
--- a/formulaic/materializers/base.py
+++ b/formulaic/materializers/base.py
@@ -186,14 +186,7 @@ class FormulaMaterializer(metaclass=FormulaMaterializerMeta):
         # the shared transform state pool.
         model_specs._map(
             lambda ms: ms.transform_state.update(
-                {
-                    factor.expr: factor_evaluation_model_spec.transform_state[
-                        factor.expr
-                    ]
-                    for term in ms.formula
-                    for factor in term.factors
-                    if factor.expr in factor_evaluation_model_spec.transform_state
-                }
+                factor_evaluation_model_spec.transform_state
             )
         )
 


Test patch:
diff --git a/tests/materializers/test_pandas.py b/tests/materializers/test_pandas.py
index 889616e..b85cda4 100644
--- a/tests/materializers/test_pandas.py
+++ b/tests/materializers/test_pandas.py
@@ -472,3 +472,12 @@ class TestPandasMaterializer:
             ),
         ):
             PandasMaterializer(data).get_model_matrix("I(a)")
+
+    def test_transform_state_with_inconsistent_formatting(self, data):
+        ms1 = PandasMaterializer(data).get_model_matrix("bs(a, df=4)").model_spec
+        ms2 = PandasMaterializer(data).get_model_matrix("bs( `a`, df = 4) ").model_spec
+        assert ms1.transform_state == ms2.transform_state
+
+    def test_nested_transform_state(self, data):
+        ms = PandasMaterializer(data).get_model_matrix("bs(bs(a))").model_spec
+        assert {"bs(a)", "bs(bs(a))"}.issubset(ms.transform_state)
Repository: matthewwithanm/python-markdownify

Issue:
Exclude comments
Currently markdownify allows to parse comments, might not very common to see comments (`<!--` & `-->`) in HTML however when you're working with someones HTML code anything can happen.

### Did write a test to check that:
```python
def test_comments():
    text = md("<!-- This is a comment -->")
    assert text == ""
``` 

The test above should pass, however, the response is ` This is a comment ` and it shouldn't be.

### Possible solutions:
- Do not parse at all the comments
- Enable to blacklist or exclude the comments on `strip` parameters or wtv

Awesome work BTW 

Comments:

Patch:
diff --git a/markdownify/__init__.py b/markdownify/__init__.py
index 6d93e47..5c008d3 100644
--- a/markdownify/__init__.py
+++ b/markdownify/__init__.py
@@ -1,4 +1,4 @@
-from bs4 import BeautifulSoup, NavigableString
+from bs4 import BeautifulSoup, NavigableString, Comment
 import re
 import six
 
@@ -75,7 +75,9 @@ class MarkdownConverter(object):
 
         # Convert the children first
         for el in node.children:
-            if isinstance(el, NavigableString):
+            if isinstance(el, Comment):
+                continue
+            elif isinstance(el, NavigableString):
                 text += self.process_text(six.text_type(el))
             else:
                 text += self.process_tag(el, convert_children_as_inline)


Test patch:
diff --git a/tests/test_advanced.py b/tests/test_advanced.py
index 4c480d7..7ee61d2 100644
--- a/tests/test_advanced.py
+++ b/tests/test_advanced.py
@@ -4,3 +4,13 @@ from markdownify import markdownify as md
 def test_nested():
     text = md('<p>This is an <a href="http://example.com/">example link</a>.</p>')
     assert text == 'This is an [example link](http://example.com/).\n\n'
+
+
+def test_ignore_comments():
+    text = md("<!-- This is a comment -->")
+    assert text == ""
+
+
+def test_ignore_comments_with_other_tags():
+    text = md("<!-- This is a comment --><a href='http://example.com/'>example link</a>")
+    assert text == "[example link](http://example.com/)"
Repository: maxfischer2781/asyncstdlib

Issue:
islice consumes too many items
The ``stop`` condition of ``islice`` is evaluated by *peeking* at the next item, then discarding it:

https://github.com/maxfischer2781/asyncstdlib/blob/7d45d075877433a2effb0b3aa9ec949816b892ac/asyncstdlib/itertools.py#L213-L217

This results in two undesirable behaviours:
- if the next item is available, it is discarded. Consecutive use of ``islice`` drops items.
- if the next item is not available, ``isclice`` blocks indefinitely.

Comments:

Patch:
diff --git a/asyncstdlib/itertools.py b/asyncstdlib/itertools.py
index b299840..dfdfd7f 100644
--- a/asyncstdlib/itertools.py
+++ b/asyncstdlib/itertools.py
@@ -199,22 +199,26 @@ async def islice(iterable: AnyIterable[T], *args: Optional[int]) -> AsyncIterato
     s = slice(*args)
     start, stop, step = s.start or 0, s.stop, s.step or 1
     async with ScopedIter(iterable) as async_iter:
-        # always consume the first ``start - 1`` items, even if the slice is empty
+        # always consume the first ``start`` items, even if the slice is empty
         if start > 0:
             async for _count, element in aenumerate(_borrow(async_iter), start=1):
                 if _count == start:
                     break
         if stop is None:
             async for idx, element in aenumerate(async_iter, start=0):
-                if idx % step == 0:
+                if not idx % step:
                     yield element
+        elif stop <= start:
+            return
         else:
-            stop -= start
+            # We would actually check ``idx >= stop -1`` later on.
+            # Since we do that for every ``idx``, we subtract ``1`` once here.
+            stop -= start + 1
             async for idx, element in aenumerate(async_iter, start=0):
-                if idx >= stop:
-                    return
                 if not idx % step:
                     yield element
+                if idx >= stop:
+                    return
 
 
 async def starmap(


Test patch:
diff --git a/unittests/test_itertools.py b/unittests/test_itertools.py
index 21b1e8f..7585524 100644
--- a/unittests/test_itertools.py
+++ b/unittests/test_itertools.py
@@ -150,6 +150,28 @@ async def test_islice(iterable, slicing):
     assert await a.list(a.islice(asyncify(iterable), *slicing)) == expected
 
 
+async def ayield_exactly(count: int):
+    for item in range(count):
+        yield item
+    assert False, "Too many `anext` items requested"
+
+
+@sync
+@pytest.mark.parametrize(
+    "slicing", ((0,), (5,), (0, 20, 3), (5, 0, 1), (3, 50, 4)),
+)
+async def test_islice_exact(slicing):
+    """`isclice` consumes exactly as many items as needed"""
+    boundary = slice(*slicing) if len(slicing) > 1 else slice(0, slicing[0])
+    expected = list(range(boundary.stop)[boundary])
+    assert (
+        await a.list(
+            a.islice(ayield_exactly(max(boundary.start, boundary.stop)), *slicing)
+        )
+        == expected
+    )
+
+
 starmap_cases = [
     (lambda x, y: x + y, [(1, 2), (3, 4)]),
     (lambda *args: sum(args), [range(i) for i in range(1, 10)]),
Repository: maxfischer2781/asyncstdlib

Issue:
Check functools.cached_property return value nesting
The handling of the return value in `functools.cached_property` appears to be too deeply/shallowly nested with awaitables. Wrapping of the original method means:

- `__wrapped__` is of type `(Self) -> await T`
- `value = await self.__wrapped__(instance)` is of type `T`
- `attributes[self._name] = AwaitableValue(value)` is of type `await T`

Now here comes the problem: The helper method has two `return` paths, one for `return value` (``... -> T``) and one for `return attributes[self._name]` (``... -> await T``)! It cannot be correct for both paths.

I assume the latter path is dead in the unit-tests, and I'm somewhat sure it cannot ever be reached. Either way, this should be tested and if necessary fixed or cleaned up.

Comments:

Patch:
diff --git a/asyncstdlib/functools.py b/asyncstdlib/functools.py
index 5bd874c..1e33091 100644
--- a/asyncstdlib/functools.py
+++ b/asyncstdlib/functools.py
@@ -116,14 +116,9 @@ class CachedProperty:
         return self._get_attribute(instance)
 
     async def _get_attribute(self, instance) -> T:
-        attributes = instance.__dict__
-        try:
-            return attributes[self._name]
-        except KeyError:
-            value = await self.__wrapped__(instance)
-            if self._name not in attributes:
-                attributes[self._name] = AwaitableValue(value)
-            return value
+        value = await self.__wrapped__(instance)
+        instance.__dict__[self._name] = AwaitableValue(value)
+        return value
 
 
 cached_property = CachedProperty


Test patch:
diff --git a/unittests/test_functools.py b/unittests/test_functools.py
index d8257f5..9d13530 100644
--- a/unittests/test_functools.py
+++ b/unittests/test_functools.py
@@ -35,12 +35,11 @@ async def test_cache_property_nodict():
             __slots__ = "a", "b"
 
             def __init__(self, a, b):
-                self.a = a
-                self.b = b
+                pass  # pragma: no cover
 
             @a.cached_property
             async def total(self):
-                return self.a + self.b
+                pass  # pragma: no cover
 
 
 @multi_sync
@@ -62,7 +61,7 @@ async def test_cache_property_order():
     val = Value(0)
     await Schedule(check_increment(5), check_increment(12), check_increment(1337))
     assert (await val.cached) != 0
-    assert (await val.cached) == 5  # first value fetched
+    assert (await val.cached) == 1337  # last value fetched
 
 
 @sync
Repository: mbillow/python-redpocket

Issue:
Retrieve quicker updating data
I found that when retrieving data from the `/get-details` endpoint, it appeared to update quicker when `type=api` was included. Without it, the data retrieved appeared to be cached.  There was an increase in response time as a side effect, but I took this as a good sign.

Call: ```https://www.redpocket.com/account/get-details?id=AAA1BBB2&type=api```
Instead of: ```https://www.redpocket.com/account/get-details?id=AAA1BBB2```

Comments:

Patch:
diff --git a/redpocket/api.py b/redpocket/api.py
index a69964e..f20da88 100644
--- a/redpocket/api.py
+++ b/redpocket/api.py
@@ -204,12 +204,15 @@ class RedPocket:
         self,
         method: str = "get",
         url: str = "",
+        params: dict = None,
         data: dict = None,
         _is_retry: bool = False,
     ) -> requests.Response:
         self._logger.debug("API Request: [%s] URL: %s", method.upper(), url)
 
-        request = self._session.request(method=method, url=url, data=data)
+        request = self._session.request(
+            method=method, url=url, params=params, data=data
+        )
         if request.status_code != requests.codes.ok:
             raise RedPocketAPIError("API Returned Non-200 Response!")
 
@@ -241,8 +244,13 @@ class RedPocket:
         ]
 
     def get_line_details(self, account_hash: str) -> RedPocketLineDetails:
+        params = {
+            "id": account_hash,
+            "type": "api",
+        }
         details = self.request(
-            url=f"https://www.redpocket.com/account/get-details?id={account_hash}"
+            url="https://www.redpocket.com/account/get-details",
+            params=params,
         )
         details_json = details.json()
         return RedPocketLineDetails.from_api(


Test patch:
diff --git a/tests/test_api.py b/tests/test_api.py
index caf6de1..3cce41d 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -134,7 +134,7 @@ def test_get_line_details(
     )
     responses.add(
         responses.GET,
-        "https://www.redpocket.com/account/get-details?id=MTIzNDU2",
+        "https://www.redpocket.com/account/get-details?id=MTIzNDU2&type=api",
         status=200,
         json={"return_code": 1, "return_data": mock_line_details},
     )
@@ -157,7 +157,7 @@ def test_get_all_line_details(
     )
     responses.add(
         responses.GET,
-        "https://www.redpocket.com/account/get-details?id=MTIzNDU2",
+        "https://www.redpocket.com/account/get-details?id=MTIzNDU2&type=api",
         status=200,
         json={"return_code": 1, "return_data": mock_line_details},
     )
Repository: mc706/changelog-cli

Issue:
The --yes flag on release results in a release type flag being ignored
It seems that using the `--yes` flag with release causes the recommended release type to be used rather than one specified by the command. See examples below.

It looks like a simple fix - will hopefully raise a PR as soon as I can get my head around how the tests work!

```
$ changelog suggest
0.7.1

$ changelog release --patch
Planning on releasing version 0.7.1. Proceed? [y/N]: N

$ changelog release --minor
Planning on releasing version 0.8.0. Proceed? [y/N]: N

$ changelog release --major
Planning on releasing version 1.0.0. Proceed? [y/N]: N

$ changelog release --major --yes

$ changelog current
0.7.1
```


Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4a3db0..eec5d1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
   * Existing CHANGELOGs will start using these headers after the new run of `changelog release`
 
 ### Fixed
+* Fix changelog release --<release type> --yes
 * Format release lines in the same format that keepachangelog.com does
 * Fix Description for pypi
 
diff --git a/src/changelog/commands.py b/src/changelog/commands.py
index d038747..7b29803 100644
--- a/src/changelog/commands.py
+++ b/src/changelog/commands.py
@@ -60,7 +60,7 @@ def release(release_type: str, auto_confirm: bool) -> None:
     try:
         new_version = CL.get_new_release_version(release_type)
         if auto_confirm:
-            CL.cut_release()
+            CL.cut_release(release_type)
         else:
             if click.confirm(f"Planning on releasing version {new_version}. Proceed?"):
                 CL.cut_release(release_type)


Test patch:
diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py
index 9c3e472..9de770d 100644
--- a/tests/integration/test_cli.py
+++ b/tests/integration/test_cli.py
@@ -128,6 +128,15 @@ class CliIntegrationTestCase(unittest.TestCase):
             suggest = self.runner.invoke(cli, ['current'])
             self.assertEqual(suggest.output.strip(), '0.1.0')
 
+    def test_cli_release_y_specify_type(self):
+        with self.runner.isolated_filesystem():
+            self.runner.invoke(cli, ['init'])
+            self.runner.invoke(cli, ['added', 'Adding a new feature'])
+            result = self.runner.invoke(cli, ['release', '--major', '--yes'])
+            self.assertTrue(result)
+            suggest = self.runner.invoke(cli, ['current'])
+            self.assertEqual(suggest.output.strip(), '1.0.0')
+
     def test_cli_release_missing(self):
         with self.runner.isolated_filesystem():
             result = self.runner.invoke(cli, ['release'])
Repository: mdowds/python-mock-firestore

Issue:
DocumentSnapshot.get() missing
The DocumentSnapshot has a get function, which seems to be missing here. Large sections of our source code uses the get function. It would be great if this could be added.

Comments:

Patch:
diff --git a/mockfirestore/document.py b/mockfirestore/document.py
index 24c8a68..ccd3ba7 100644
--- a/mockfirestore/document.py
+++ b/mockfirestore/document.py
@@ -27,9 +27,15 @@ class DocumentSnapshot:
         timestamp = Timestamp.from_now()
         return timestamp
 
+    def get(self, field_path: str) -> Any:
+        if not self.exists:
+            return None
+        else:
+            return reduce(operator.getitem, field_path.split('.'), self._doc)
+
     def _get_by_field_path(self, field_path: str) -> Any:
         try:
-            return reduce(operator.getitem, field_path.split('.'), self._doc)
+            return self.get(field_path)
         except KeyError:
             return None
 


Test patch:
diff --git a/tests/test_document_snapshot.py b/tests/test_document_snapshot.py
index 19cce06..7d60e4b 100644
--- a/tests/test_document_snapshot.py
+++ b/tests/test_document_snapshot.py
@@ -46,3 +46,45 @@ class TestDocumentSnapshot(TestCase):
         doc_snapshot = doc_ref.get()
         self.assertIs(doc_ref, doc_snapshot.reference)
 
+    def test_documentSnapshot_get_by_existing_field_path(self):
+        fs = MockFirestore()
+        fs._data = {'foo': {
+            'first': {'id': 1, 'contact': {
+                'email': 'email@test.com'
+            }}
+        }}
+        doc = fs.collection('foo').document('first').get()
+        self.assertEqual(doc.get('contact.email'), 'email@test.com')
+
+    def test_documentSnapshot_get_by_non_existing_field_path(self):
+        fs = MockFirestore()
+        fs._data = {'foo': {
+            'first': {'id': 1, 'contact': {
+                'email': 'email@test.com'
+            }}
+        }}
+        doc = fs.collection('foo').document('first').get()
+        with self.assertRaises(KeyError):
+            doc.get('contact.phone')
+
+    def test_documentSnapshot_get_in_an_non_existing_document(self):
+        fs = MockFirestore()
+        fs._data = {'foo': {
+            'first': {'id': 1, 'contact': {
+                'email': 'email@test.com'
+            }}
+        }}
+        doc = fs.collection('foo').document('second').get()
+        self.assertIsNone(doc.get('contact.email'))
+
+    def test_documentSnapshot_get_returns_a_copy_of_the_data_stored(self):
+        fs = MockFirestore()
+        fs._data = {'foo': {
+            'first': {'id': 1, 'contact': {
+                'email': 'email@test.com'
+            }}
+        }}
+        doc = fs.collection('foo').document('first').get()
+        self.assertIsNot(
+            doc.get('contact'),fs._data['foo']['first']['contact']
+        )
Repository: mdowds/python-mock-firestore

Issue:
Query._apply_cursor is not working for similar objects
Following test will fail:
```
    def test_collection_start_after_similar_objects(self):
        fs = MockFirestore()
        fs._data = {'foo': {
            'first': {'id': 1, 'value': 1},
            'second': {'id': 2, 'value': 2},
            'third': {'id': 3, 'value': 2},
            'fourth': {'id': 4, 'value': 3}
        }}
        docs = list(fs.collection('foo').order_by('id').start_after({'id': 3, 'value': 2}).stream())
        self.assertEqual({'id': 4, 'value': 3}, docs[0].to_dict())
        self.assertEqual(1, len(docs))
```

Only last key in `document_fields` decides if index is set or not because of missing `brake` in search-compare loop inside `Query._apply_cursor`:

```
        for idx, doc in enumerate(doc_snapshot):
            index = None
            for k, v in document_fields.items():
                if doc.to_dict().get(k, None) == v:
                    index = idx
                else:
                    index = None
                    # missing break
            if index:
                ...
    
``` 



Comments:

Patch:
diff --git a/mockfirestore/query.py b/mockfirestore/query.py
index 354df4b..2e94f07 100644
--- a/mockfirestore/query.py
+++ b/mockfirestore/query.py
@@ -103,6 +103,7 @@ class Query:
                     index = idx
                 else:
                     index = None
+                    break
             if index is not None:
                 if before and start:
                     return islice(docs, index, None, None)


Test patch:
diff --git a/tests/test_collection_reference.py b/tests/test_collection_reference.py
index 5507811..361e3e0 100644
--- a/tests/test_collection_reference.py
+++ b/tests/test_collection_reference.py
@@ -255,6 +255,18 @@ class TestCollectionReference(TestCase):
         self.assertEqual({'id': 2}, docs[0].to_dict())
         self.assertEqual(2, len(docs))
 
+    def test_collection_start_after_similar_objects(self):
+        fs = MockFirestore()
+        fs._data = {'foo': {
+            'first': {'id': 1, 'value': 1},
+            'second': {'id': 2, 'value': 2},
+            'third': {'id': 3, 'value': 2},
+            'fourth': {'id': 4, 'value': 3}
+        }}
+        docs = list(fs.collection('foo').order_by('id').start_after({'id': 3, 'value': 2}).stream())
+        self.assertEqual({'id': 4, 'value': 3}, docs[0].to_dict())
+        self.assertEqual(1, len(docs))
+
     def test_collection_start_after_order_by(self):
         fs = MockFirestore()
         fs._data = {'foo': {