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

Issue:
PyPy base object class has methods not slot wrappers, causing reflect failures
|[<img alt="dansut's avatar" src="https://avatars.githubusercontent.com/u/100365?s=50" width="50" height="50">](https://github.com/dansut)| @dansut reported|
|-|-|
|Trac ID|trac#9225|
|Type|enhancement|
|Created|2017-07-21 12:49:40Z|

The implementation of the `object` (and other) builtin classes is different on PyPy which has the side effect of making `twisted.python.reflect.accumulateMethods` pick up object methods from all new-style classes - such as `__setattr__`, etc.

This is causing the FAIL of these tests in the PyPy build:
```
  test_reflect
    AccumulateMethodTests
      test_baseClass
      test_ownClass
    PrefixedMethodsTests
      test_onlyObject
```

suggestion: if `accumulateMethods` ignored the `object` base class (did not descend further) then the existing tests work and behavior in these cases should match CPython - without altering results on CPython. Other PyPy cases where the implementation of a builtin class is different on PyPy could still obviously produce different results when classes are derived from these, eg. `dict`.

<details><summary>Searchable metadata</summary>

```
trac-id__9225 9225
type__enhancement enhancement
reporter__dansut dansut
priority__normal normal
milestone__PyPy_support PyPy-support
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1500641380601505 1500641380601505
changetime__1500829714202089 1500829714202089
version__None None
owner__Craig_Rodrigues__rodrigc_____ Craig Rodrigues <rodrigc@...>

```
</details>



Discussion:

Resolving patch:
diff --git a/src/twisted/python/reflect.py b/src/twisted/python/reflect.py
--- a/src/twisted/python/reflect.py
+++ b/src/twisted/python/reflect.py
@@ -134,7 +134,14 @@ def accumulateMethods(obj, dict, prefix='', curClass=None):
     if not curClass:
         curClass = obj.__class__
     for base in curClass.__bases__:
-        accumulateMethods(obj, dict, prefix, base)
+        # The implementation of the object class is different on PyPy vs.
+        # CPython.  This has the side effect of making accumulateMethods()
+        # pick up object methods from all new-style classes -
+        # such as __getattribute__, etc.
+        # If we ignore 'object' when accumulating methods, we can get
+        # consistent behavior on Pypy and CPython.
+        if base is not object:
+            accumulateMethods(obj, dict, prefix, base)
 
     for name, method in curClass.__dict__.items():
         optName = name[len(prefix):]


Test patch:
Repository: twisted/twisted

Issue:
Update docs for "twisted web" command line
|[<img alt="moshez's avatar" src="https://avatars.githubusercontent.com/u/422703?s=50" width="50" height="50">](https://github.com/moshez)| @moshez reported|
|-|-|
|Trac ID|trac#9434|
|Type|defect|
|Created|2018-04-24 13:18:44Z|

See [#6670](https://github.com/twisted/twisted/issues/6670) [#9402](https://github.com/twisted/twisted/issues/9402) for details

<details><summary>Searchable metadata</summary>

```
trac-id__9434 9434
type__defect defect
reporter__moshez moshez
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__documentation__review documentation, review
time__1524575924346110 1524575924346110
changetime__1524999288440818 1524999288440818
version__None None
owner__Amber_Brown__hawkowl_____ Amber Brown <hawkowl@...>

```
</details>



Discussion:

Resolving patch:
diff --git a/src/twisted/web/tap.py b/src/twisted/web/tap.py
--- a/src/twisted/web/tap.py
+++ b/src/twisted/web/tap.py
@@ -30,10 +30,10 @@ class Options(usage.Options):
     optParameters = [["logfile", "l", None,
                       "Path to web CLF (Combined Log Format) log file."],
                      ["certificate", "c", "server.pem",
-                      "(DEPRECATED: use --http) "
+                      "(DEPRECATED: use --listen) "
                       "SSL certificate to use for HTTPS. "],
                      ["privkey", "k", "server.pem",
-                      "(DEPRECATED: use --http) "
+                      "(DEPRECATED: use --listen) "
                       "SSL certificate to use for HTTPS."],
                      ]
 
@@ -47,8 +47,8 @@ class Options(usage.Options):
         "personal", "",
         "Instead of generating a webserver, generate a "
         "ResourcePublisher which listens on  the port given by "
-        "--http, or ~/%s " % (distrib.UserDirectory.userSocketName,) +
-        "if --http is not specified."])
+        "--listen, or ~/%s " % (distrib.UserDirectory.userSocketName,) +
+        "if --listen is not specified."])
 
     compData = usage.Completions(
                    optActions={"logfile" : usage.CompleteFiles("*.log"),
@@ -71,7 +71,7 @@ def __init__(self):
 
     def opt_port(self, port):
         """
-        (DEPRECATED: use --http)
+        (DEPRECATED: use --listen)
         Strports description of port to start the server on
         """
         msg = deprecate.getDeprecationWarningString(
@@ -83,7 +83,7 @@ def opt_port(self, port):
 
     def opt_https(self, port):
         """
-        (DEPRECATED: use --http)
+        (DEPRECATED: use --listen)
         Port to listen on for Secure HTTP.
         """
         msg = deprecate.getDeprecationWarningString(


Test patch:
Repository: twisted/twisted

Issue:
Release 22.1.0
|[<img alt="adiroiban's avatar" src="https://avatars.githubusercontent.com/u/204609?s=50" width="50" height="50">](https://github.com/adiroiban)| @adiroiban reported|
|-|-|
|Trac ID|trac#10296|
|Type|enhancement|
|Created|2022-01-26 23:00:40Z|



<details><summary>Searchable metadata</summary>

```
trac-id__10296 10296
type__enhancement enhancement
reporter__adiroiban adiroiban
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__None None
time__1643238040096069 1643238040096069
changetime__1643238699617231 1643238699617231
version__None None
owner__None None

```
</details>



Discussion:

Resolving patch:
diff --git a/src/twisted/_version.py b/src/twisted/_version.py
--- a/src/twisted/_version.py
+++ b/src/twisted/_version.py
@@ -7,5 +7,5 @@
 
 from incremental import Version
 
-__version__ = Version("Twisted", 21, 7, 0, post=0)
+__version__ = Version("Twisted", 22, 1, 0, post=0)
 __all__ = ["__version__"]
diff --git a/src/twisted/copyright.py b/src/twisted/copyright.py
--- a/src/twisted/copyright.py
+++ b/src/twisted/copyright.py
@@ -13,7 +13,7 @@
 longversion = str(_longversion)
 
 copyright = """\
-Copyright (c) 2001-2021 Twisted Matrix Laboratories.
+Copyright (c) 2001-2022 Twisted Matrix Laboratories.
 See LICENSE for details."""
 
 disclaimer = """
diff --git a/src/twisted/python/threadpool.py b/src/twisted/python/threadpool.py
--- a/src/twisted/python/threadpool.py
+++ b/src/twisted/python/threadpool.py
@@ -47,7 +47,7 @@ class ThreadPool:
     threadFactory = Thread
     currentThread = staticmethod(
         deprecated(
-            version=Version("Twisted", "NEXT", 0, 0),
+            version=Version("Twisted", 22, 1, 0),
             replacement="threading.current_thread",
         )(current_thread)
     )


Test patch:
diff --git a/src/twisted/internet/test/test_threads.py b/src/twisted/internet/test/test_threads.py
--- a/src/twisted/internet/test/test_threads.py
+++ b/src/twisted/internet/test/test_threads.py
@@ -224,7 +224,7 @@ def check():
     def test_threadPoolCurrentThreadDeprecated(self):
         self.callDeprecated(
             version=(
-                Version("Twisted", "NEXT", 0, 0),
+                Version("Twisted", 22, 1, 0),
                 "threading.current_thread",
             ),
             f=ThreadPool.currentThread,
Repository: twisted/twisted

Issue:
Release 22.2.0
|[<img alt="adiroiban's avatar" src="https://avatars.githubusercontent.com/u/204609?s=50" width="50" height="50">](https://github.com/adiroiban)| @adiroiban reported|
|-|-|
|Trac ID|trac#10306|
|Type|enhancement|
|Created|2022-02-08 14:05:11Z|



<details><summary>Searchable metadata</summary>

```
trac-id__10306 10306
type__enhancement enhancement
reporter__adiroiban adiroiban
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1644329111193403 1644329111193403
changetime__1646513115841857 1646513115841857
version__None None
owner__None None

```
</details>



Discussion:

Resolving patch:
diff --git a/src/twisted/_version.py b/src/twisted/_version.py
--- a/src/twisted/_version.py
+++ b/src/twisted/_version.py
@@ -7,5 +7,5 @@
 
 from incremental import Version
 
-__version__ = Version("Twisted", 22, 1, 0, post=0)
+__version__ = Version("Twisted", 22, 2, 0, post=0)
 __all__ = ["__version__"]


Test patch:
Repository: twisted/twisted

Issue:
Move development docs into the tree root
I think that having dev docs inside /core/development and /core/development/policy is complicated.

We should have them inside /development


Discussion:

Resolving patch:
diff --git a/docs/core/development/listings/new_module_template.py b/docs/development/listings/new_module_template.py
similarity index 100%
rename from docs/core/development/listings/new_module_template.py
rename to docs/development/listings/new_module_template.py


Test patch:
Repository: twisted/twisted

Issue:
Type hint for twisted.internet.task.react is incorrect?
|[<img alt="euresti's avatar" src="https://avatars.githubusercontent.com/u/1081858?s=50" width="50" height="50">](https://github.com/euresti)| @euresti reported|
|-|-|
|Trac ID|trac#10289|
|Type|enhancement|
|Created|2022-01-08 00:04:15Z|

It's currently typed as:
```
def react(
    main: Callable[
        ...,
        Union[Deferred[_T], Coroutine["Deferred[_T]", object, _T]],
    ],
    argv: Iterable[_T] = (),
    _reactor: Optional[IReactorCore] = None,
) -> NoReturn:
```
But I'm not sure argv should be `_T` since its not related to the return value of the callable.
 

(I'm not sure if there's a way to express in types that main should be take a reactor + whatever is in argv)

<details><summary>Searchable metadata</summary>

```
trac-id__10289 10289
type__enhancement enhancement
reporter__euresti euresti
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__None None
time__1641600255996109 1641600255996109
changetime__1641600255996109 1641600255996109
version__None None
owner__None None

```
</details>



Discussion:

Resolving patch:
diff --git a/.github/scripts/check-pr-text.py b/.github/scripts/check-pr-text.py
--- a/.github/scripts/check-pr-text.py
+++ b/.github/scripts/check-pr-text.py
@@ -43,7 +43,9 @@ def fail(message):
 
 title_search = re.search(r"^(#\d+) .+", pr_title)
 if not title_search:
-    fail("Title of PR has no issue ID reference.")
+    fail(
+        "Title of PR has no issue ID reference. It must look like “#1234 Foo bar baz”."
+    )
 else:
     print(f"PR title is complaint for {title_search[1]}. Good job.")
 
diff --git a/src/twisted/internet/task.py b/src/twisted/internet/task.py
--- a/src/twisted/internet/task.py
+++ b/src/twisted/internet/task.py
@@ -879,7 +879,7 @@ def react(
         ...,
         Union[Deferred[_T], Coroutine["Deferred[_T]", object, _T]],
     ],
-    argv: Iterable[_T] = (),
+    argv: Iterable[object] = (),
     _reactor: Optional[IReactorCore] = None,
 ) -> NoReturn:
     """
@@ -900,10 +900,11 @@ def react(
 
     The following demonstrates the signature of a C{main} function which can be
     used with L{react}::
-          async def main(reactor, username, password):
-              return "ok"
 
-          task.react(main, ("alice", "secret"))
+      async def main(reactor, username, password):
+          return "ok"
+
+      task.react(main, ("alice", "secret"))
 
     @param main: A callable which returns a L{Deferred} or
         coroutine. It should take the reactor as its first


Test patch:
Repository: twisted/twisted

Issue:
Annotate twisted.python.failure.Failure.raiseException to show it never returns
`raiseException` always raises an exception.  This means that a pattern like:

```
if isinstance(failureOrSomething, Failure):
    failureOrSomething.raiseException()
use(failureOrSomething)
```

is safe.  However, mypy thinks it is unsafe because it doesn't know `raiseException` can't return.



Discussion:

Resolving patch:
diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py
--- a/src/twisted/python/failure.py
+++ b/src/twisted/python/failure.py
@@ -20,6 +20,7 @@
 import sys
 from inspect import getmro
 from io import StringIO
+from typing import NoReturn
 
 import opcode
 
@@ -495,7 +496,7 @@ def check(self, *errorTypes):
                 return error
         return None
 
-    def raiseException(self):
+    def raiseException(self) -> NoReturn:
         """
         raise the original exception, preserving traceback
         information if available.


Test patch:
Repository: twisted/twisted

Issue:
Release 22.8.0
This is the ticket to track the release of 22.8.0


Discussion:

Resolving patch:
diff --git a/src/twisted/_version.py b/src/twisted/_version.py
--- a/src/twisted/_version.py
+++ b/src/twisted/_version.py
@@ -7,5 +7,5 @@
 
 from incremental import Version
 
-__version__ = Version("Twisted", 22, 4, 0, post=0)
+__version__ = Version("Twisted", 22, 8, 0, post=0)
 __all__ = ["__version__"]


Test patch:
Repository: twisted/twisted

Issue:
Give execute and maybeDeferred correct type annotations
Currently `maybeDeferred` is annotated:

```
def maybeDeferred(
    f: Callable[..., _T], *args: object, **kwargs: object
) -> "Deferred[_T]":
```

The handling of the parameters of `f` and of `args` and `kwargs` is overly general.  The handling of `_T` is incomplete and incorrect with respect to `Deferred` and `coroutine`.

`execute` is in roughly the same situation.



Discussion:

Resolving patch:
diff --git a/src/twisted/internet/defer.py b/src/twisted/internet/defer.py
--- a/src/twisted/internet/defer.py
+++ b/src/twisted/internet/defer.py
@@ -39,7 +39,7 @@
 
 import attr
 from incremental import Version
-from typing_extensions import Literal, Protocol
+from typing_extensions import Literal, ParamSpec, Protocol
 
 from twisted.internet.interfaces import IDelayedCall, IReactorTime
 from twisted.logger import Logger
@@ -78,6 +78,7 @@ def _copy_context() -> Type[_NoContext]:
 
 
 _T = TypeVar("_T")
+_P = ParamSpec("_P")
 
 
 class AlreadyCalledError(Exception):
@@ -156,7 +157,7 @@ def fail(result: Optional[Union[Failure, BaseException]] = None) -> "Deferred[An
 
 
 def execute(
-    callable: Callable[..., _T], *args: object, **kwargs: object
+    callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs
 ) -> "Deferred[_T]":
     """
     Create a L{Deferred} from a callable and arguments.
@@ -174,7 +175,7 @@ def execute(
 
 
 def maybeDeferred(
-    f: Callable[..., _T], *args: object, **kwargs: object
+    f: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs
 ) -> "Deferred[_T]":
     """
     Invoke a function that may or may not return a L{Deferred} or coroutine.


Test patch:
diff --git a/src/twisted/test/test_defer.py b/src/twisted/test/test_defer.py
--- a/src/twisted/test/test_defer.py
+++ b/src/twisted/test/test_defer.py
@@ -22,6 +22,7 @@
     Generator,
     List,
     Mapping,
+    NoReturn,
     Optional,
     Tuple,
     Type,
@@ -790,21 +791,18 @@ def test_maybeDeferredSyncException(self) -> None:
         L{defer.maybeDeferred} should catch an exception raised by a synchronous
         function and errback its resulting L{Deferred} with it.
         """
-        try:
-            "10" + 5  # type: ignore[operator]
-        except TypeError as e:
-            expected = str(e)
+        expected = ValueError("that value is unacceptable")
 
-        def plusFive(x: int) -> int:
-            return x + 5
+        def raisesException() -> NoReturn:
+            raise expected
 
         results: List[int] = []
         errors: List[Failure] = []
-        d = defer.maybeDeferred(plusFive, "10")
+        d = defer.maybeDeferred(raisesException)
         d.addCallbacks(results.append, errors.append)
         self.assertEqual(results, [])
         self.assertEqual(len(errors), 1)
-        self.assertEqual(str(errors[0].value), expected)
+        self.assertEqual(str(errors[0].value), str(expected))
 
     def test_maybeDeferredSyncFailure(self) -> None:
         """
Repository: twisted/twisted

Issue:
t.p.deprecate docs should show indeterminate versions
The [deprecation docs](https://docs.twisted.org/en/latest/api/twisted.python.deprecate.html) use concrete version numbers, as in this example:

    @deprecated(Version("Twisted", 8, 0, 0))
    def badAPI(self, first, second):
        '''
        Docstring for badAPI.
        '''
        ...

They should use [indeterminate versions](https://github.com/twisted/incremental#updating) instead, since that's what authors should actually write:


    @deprecated(Version("Twisted", "NEXT", 0, 0))
    def badAPI(self, first, second):
        '''
        Docstring for badAPI.
        '''
        ...
t.p.deprecate docs should show indeterminate versions
The [deprecation docs](https://docs.twisted.org/en/latest/api/twisted.python.deprecate.html) use concrete version numbers, as in this example:

    @deprecated(Version("Twisted", 8, 0, 0))
    def badAPI(self, first, second):
        '''
        Docstring for badAPI.
        '''
        ...

They should use [indeterminate versions](https://github.com/twisted/incremental#updating) instead, since that's what authors should actually write:


    @deprecated(Version("Twisted", "NEXT", 0, 0))
    def badAPI(self, first, second):
        '''
        Docstring for badAPI.
        '''
        ...


Discussion:

Resolving patch:
diff --git a/src/twisted/python/deprecate.py b/src/twisted/python/deprecate.py
--- a/src/twisted/python/deprecate.py
+++ b/src/twisted/python/deprecate.py
@@ -10,14 +10,14 @@
     from incremental import Version
     from twisted.python.deprecate import deprecated
 
-    @deprecated(Version("Twisted", 8, 0, 0))
+    @deprecated(Version("Twisted", "NEXT", 0, 0))
     def badAPI(self, first, second):
         '''
         Docstring for badAPI.
         '''
         ...
 
-    @deprecated(Version("Twisted", 16, 0, 0))
+    @deprecated(Version("Twisted", "NEXT", 0, 0))
     class BadClass:
         '''
         Docstring for BadClass.
@@ -34,7 +34,7 @@ class BadClass:
 
     class OtherwiseUndeprecatedClass:
 
-        @deprecatedProperty(Version('Twisted', 16, 0, 0))
+        @deprecatedProperty(Version("Twisted", "NEXT", 0, 0))
         def badProperty(self):
             '''
             Docstring for badProperty.
@@ -54,7 +54,7 @@ def badProperty(self, value):
     ...
 
     deprecatedModuleAttribute(
-        Version("Twisted", 8, 0, 0),
+        Version("Twisted", "NEXT", 0, 0),
         "Use goodAttribute instead.",
         "your.full.module.name",
         "badAttribute")
@@ -68,7 +68,7 @@ def badProperty(self, value):
 To mark an optional, keyword parameter of a function or method as deprecated
 without deprecating the function itself, you can use::
 
-    @deprecatedKeywordParameter(Version("Twisted", 19, 2, 0), 'baz')
+    @deprecatedKeywordParameter(Version("Twisted", "NEXT", 0, 0), "baz")
     def someFunction(foo, bar=0, baz=None):
         ...
 


Test patch:
Repository: twisted/twisted

Issue:
.hypothesis should be in .gitignore
**Describe the incorrect behavior you saw**

`git diff` shows me an untracked `.hypothesis` directory.

**Describe how to cause this behavior**

I ran the tests.

**Describe the correct behavior you'd like to see**

`.hypothesis` [shouldn't be checked in](https://hypothesis.readthedocs.io/en/latest/database.html#the-hypothesis-example-database), so it should be ignored by `git`.


Discussion:

Resolving patch:
diff --git a/.github/scripts/check-pr-text.py b/.github/scripts/check-pr-text.py
--- a/.github/scripts/check-pr-text.py
+++ b/.github/scripts/check-pr-text.py
@@ -41,7 +41,7 @@ def fail(message):
 if not pr_body:
     fail("Body for the PR not found. " "Maybe missing PR_BODY env var.")
 
-title_search = re.search(r"^(#\d+) .+", pr_title)
+title_search = re.search(r"^(#\d+):? .+", pr_title)
 if not title_search:
     fail(
         "Title of PR has no issue ID reference. It must look like “#1234 Foo bar baz”."


Test patch:
Repository: twisted/twisted

Issue:
Remove check for PR links to issue IDs
        > If this is a pain there are 2 options:

It does just seem to be the most common type of misconfiguration, which I bump into on almost every code review or submission.

I'm not sure it's providing enough value to be worth the hassle, so perhaps disabling would be best for now.  The "fixes:" line does most of the work.

_Originally posted by @glyph in https://github.com/twisted/twisted/issues/11747#issuecomment-1304901054_
      


Discussion:

Resolving patch:
diff --git a/.github/scripts/check-pr-text.py b/.github/scripts/check-pr-text.py
deleted file mode 100644
--- a/.github/scripts/check-pr-text.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# This script is designed to be called by the GHA workflow.
-#
-# It is designed to check that the PR text complies to our dev standards.
-#
-# The input is received via the environmet variables:
-# * PR_TITLE - title of the PR
-# * PR_BODY - the description of the PR
-#
-# To test it run
-#
-# $ export PR_TITLE='#1234 Test Title'
-# $ export PR_BODY='some lines
-# > Fixes #12345
-# > more lines'
-# $ python3 .github/scripts/check-pr-text.py
-#
-import os
-import re
-import sys
-
-pr_title = os.environ.get("PR_TITLE", "")
-pr_body = os.environ.get("PR_BODY", "")
-
-print("--- DEBUG ---")
-print(f"Title: {pr_title}")
-print(f"Body:\n {pr_body}")
-print("-------------")
-
-
-def fail(message):
-    print(message)
-    print("Fix the title and then trigger a new push.")
-    print("A re-run for this job will not work.")
-    sys.exit(1)
-
-
-if not pr_title:
-    fail("Title for the PR not found. " "Maybe missing PR_TITLE env var.")
-
-if not pr_body:
-    fail("Body for the PR not found. " "Maybe missing PR_BODY env var.")
-
-title_search = re.search(r"^(#\d+):? .+", pr_title)
-if not title_search:
-    fail(
-        "Title of PR has no issue ID reference. It must look like “#1234 Foo bar baz”."
-    )
-else:
-    print(f"PR title is complaint for {title_search[1]}. Good job.")
-
-
-body_search = re.search(r".*Fixes (#\d+).+", pr_body)
-if not body_search:
-    fail('Body of PR has no "Fixes #12345" issue ID reference.')
-else:
-    print(f"PR description is complaint for {body_search[1]}. Good job.")
-
-
-if title_search[1] != body_search[1]:
-    fail("PR title and description have different IDs.")
-
-# All good.
-sys.exit(0)


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -297,15 +297,6 @@ jobs:
       run: |
         tox -q -e newsfragment
 
-    # This is called only on code changes.
-    # If you forgot to define the right PR title you should re-run the job.
-    - name: Check PR title format
-      if: github.event_name == 'pull_request'
-      env:
-        PR_TITLE: ${{ github.event.pull_request.title }}
-        PR_BODY: ${{ github.event.pull_request.body }}
-      run: python .github/scripts/check-pr-text.py
-
 
   # Used to validate the narrative and API docs.
   # Checks for invalid syntax or broken links.