nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: python-attrs/attrs
Pull request #506 (2019-02-18 09:30:59)

added first doc stub

hynek: So the first steps would be:

1. update your branch to latest master (you can press the button above and pull)
2. make sure the CI passes. :) you can usually make that sure locally by running tox.

You may want to give another look to our [contributing help file](http://www.attrs.org/en/stable/contributing.html) since it has a bunch of valuable information that will save you a lot of time!
chobeat: @hynek now the test passes but it's trivial stuff so far. From the other thread on the issue we left open the discussion on how to proceed from here.
chobeat: I've added the newsfragment and I've addressed most of the points. When you answer in the open conversations I can proceed.
hynek: Sorry I dropped the ball on this, could you resolve the conflicts please?

Patch:
diff --git a/changelog.d/506.change.rst b/changelog.d/506.change.rst
new file mode 100644
index 0000000..038b78e
--- /dev/null
+++ b/changelog.d/506.change.rst
@@ -0,0 +1,1 @@
+The documentation of generated methods is now created automatically using the method name.
diff --git a/src/attr/_make.py b/src/attr/_make.py
index 5f79488..ef2f43f 100644
--- a/src/attr/_make.py
+++ b/src/attr/_make.py
@@ -732,6 +732,13 @@ class _ClassBuilder(object):
         except AttributeError:
             pass
 
+        try:
+            method.__doc__ = "Method generated by attrs for class {}.".format(
+                self._cls.__qualname__
+            )
+        except AttributeError:
+            pass
+
         return method
 
 


Test patch:
diff --git a/tests/test_make.py b/tests/test_make.py
index 1aa7335..b484207 100644
--- a/tests/test_make.py
+++ b/tests/test_make.py
@@ -1630,3 +1630,35 @@ class TestDetermineEqOrder(object):
             "2021-06-01.  Please use `eq` and `order` instead."
             == w.message.args[0]
         )
+
+
+class TestDocs:
+    @pytest.mark.parametrize(
+        "meth_name",
+        [
+            "__init__",
+            "__repr__",
+            "__eq__",
+            "__ne__",
+            "__lt__",
+            "__le__",
+            "__gt__",
+            "__ge__",
+        ],
+    )
+    def test_docs(self, meth_name):
+        """
+        Tests the presence and correctness of the documentation
+        for the generated methods
+        """
+
+        @attr.s
+        class A(object):
+            pass
+
+        if hasattr(A, "__qualname__"):
+            method = getattr(A, meth_name)
+            expected = "Method generated by attrs for class {}.".format(
+                A.__qualname__
+            )
+            assert expected == method.__doc__
Repository: python-attrs/attrs
Pull request #1263 (2024-03-16 15:44:11)

Deprecate attr.s's repr_ns
It's pointless in Python 3. define et al never had it.



Patch:
diff --git a/changelog.d/1263.deprecation.md b/changelog.d/1263.deprecation.md
new file mode 100644
index 0000000..2593951
--- /dev/null
+++ b/changelog.d/1263.deprecation.md
@@ -0,0 +1,2 @@
+The *repr_ns* argument to `attr.s` is now deprecated.
+It was a workaround for nested classes in Python 2 and is pointless in Python 3.
diff --git a/src/attr/_make.py b/src/attr/_make.py
index 8fadc64..710c617 100644
--- a/src/attr/_make.py
+++ b/src/attr/_make.py
@@ -1354,7 +1354,8 @@ def attrs(
 
     :param str repr_ns: When using nested classes, there was no way in Python 2
         to automatically detect that.  This argument allows to set a custom
-        name for a more meaningful ``repr`` output.
+        name for a more meaningful ``repr`` output.  This argument
+        is pointless in Python 3 and is therefore deprecated.
     :param bool auto_detect: Instead of setting the *init*, *repr*, *eq*,
         *order*, and *hash* arguments explicitly, assume they are set to
         ``True`` **unless any** of the involved methods for one of the
@@ -1597,7 +1598,18 @@ def attrs(
     .. versionadded:: 21.3.0 *match_args*
     .. versionadded:: 22.2.0
        *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
+    .. deprecated:: 24.1.0 *repr_ns*
     """
+    if repr_ns is not None:
+        import warnings
+
+        warnings.warn(
+            DeprecationWarning(
+                "The `repr_ns` argument is deprecated and will be removed in or after April 2025."
+            ),
+            stacklevel=2,
+        )
+
     eq_, order_ = _determine_attrs_eq_order(cmp, eq, order, None)
 
     # unsafe_hash takes precedence due to PEP 681.


Test patch:
diff --git a/tests/test_make.py b/tests/test_make.py
index 1760964..e0e0aa9 100644
--- a/tests/test_make.py
+++ b/tests/test_make.py
@@ -600,11 +600,13 @@ class TestAttributes:
         Setting repr_ns overrides a potentially guessed namespace.
         """
 
-        @attr.s(slots=slots_outer)
-        class C:
-            @attr.s(repr_ns="C", slots=slots_inner)
-            class D:
-                pass
+        with pytest.deprecated_call(match="The `repr_ns` argument"):
+
+            @attr.s(slots=slots_outer)
+            class C:
+                @attr.s(repr_ns="C", slots=slots_inner)
+                class D:
+                    pass
 
         assert "C.D()" == repr(C.D())