We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
expand mypy .* module overrides
**Is your feature request related to a problem? Please describe.**
we'd like to be able to delete a module from the pyproject.toml to mark it as fully type annotated, however having .* overrides with weaker type hinting prevents this

**Describe the solution you'd like**
expand mypy .* module overrides


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/twisted/words/protocols/jabber/jid.py`
Content:
```
1 # -*- test-case-name: twisted.words.test.test_jabberjid -*-
2 #
3 # Copyright (c) Twisted Matrix Laboratories.
4 # See LICENSE for details.
5 
6 """
7 Jabber Identifier support.
8 
9 This module provides an object to represent Jabber Identifiers (JIDs) and
10 parse string representations into them with proper checking for illegal
11 characters, case folding and canonicalisation through
12 L{stringprep<twisted.words.protocols.jabber.xmpp_stringprep>}.
13 """
14 
15 from typing import Dict, Tuple, Union
16 
17 from twisted.words.protocols.jabber.xmpp_stringprep import (
18     nameprep,
19     nodeprep,
20     resourceprep,
21 )
22 
23 
24 class InvalidFormat(Exception):
25     """
26     The given string could not be parsed into a valid Jabber Identifier (JID).
27     """
28 
29 
30 def parse(jidstring: str) -> Tuple[Union[str, None], str, Union[str, None]]:
31     """
32     Parse given JID string into its respective parts and apply stringprep.
33 
34     @param jidstring: string representation of a JID.
35     @type jidstring: L{str}
36     @return: tuple of (user, host, resource), each of type L{str} as
37              the parsed and stringprep'd parts of the given JID. If the
38              given string did not have a user or resource part, the respective
39              field in the tuple will hold L{None}.
40     @rtype: L{tuple}
41     """
42     user = None
43     host = None
44     resource = None
45 
46     # Search for delimiters
47     user_sep = jidstring.find("@")
48     res_sep = jidstring.find("/")
49 
50     if user_sep == -1:
51         if res_sep == -1:
52             # host
53             host = jidstring
54         else:
55             # host/resource
56             host = jidstring[0:res_sep]
57             resource = jidstring[res_sep + 1 :] or None
58     else:
59         if res_sep == -1:
60             # user@host
61             user = jidstring[0:user_sep] or None
62             host = jidstring[user_sep + 1 :]
63         else:
64             if user_sep < res_sep:
65                 # user@host/resource
66                 user = jidstring[0:user_sep] or None
67                 host = jidstring[user_sep + 1 : user_sep + (res_sep - user_sep)]
68                 resource = jidstring[res_sep + 1 :] or None
69             else:
70                 # host/resource (with an @ in resource)
71                 host = jidstring[0:res_sep]
72                 resource = jidstring[res_sep + 1 :] or None
73 
74     return prep(user, host, resource)
75 
76 
77 def prep(
78     user: Union[str, None], host: str, resource: Union[str, None]
79 ) -> Tuple[Union[str, None], str, Union[str, None]]:
80     """
81     Perform stringprep on all JID fragments.
82 
83     @param user: The user part of the JID.
84     @type user: L{str}
85     @param host: The host part of the JID.
86     @type host: L{str}
87     @param resource: The resource part of the JID.
88     @type resource: L{str}
89     @return: The given parts with stringprep applied.
90     @rtype: L{tuple}
91     """
92 
93     if user:
94         try:
95             user = nodeprep.prepare(str(user))
96         except UnicodeError:
97             raise InvalidFormat("Invalid character in username")
98     else:
99         user = None
100 
101     if not host:
102         raise InvalidFormat("Server address required.")
103     else:
104         try:
105             host = nameprep.prepare(str(host))
106         except UnicodeError:
107             raise InvalidFormat("Invalid character in hostname")
108 
109     if resource:
110         try:
111             resource = resourceprep.prepare(str(resource))
112         except UnicodeError:
113             raise InvalidFormat("Invalid character in resource")
114     else:
115         resource = None
116 
117     return (user, host, resource)
118 
119 
120 __internJIDs: Dict[str, "JID"] = {}
121 
122 
123 def internJID(jidstring):
124     """
125     Return interned JID.
126 
127     @rtype: L{JID}
128     """
129 
130     if jidstring in __internJIDs:
131         return __internJIDs[jidstring]
132     else:
133         j = JID(jidstring)
134         __internJIDs[jidstring] = j
135         return j
136 
137 
138 class JID:
139     """
140     Represents a stringprep'd Jabber ID.
141 
142     JID objects are hashable so they can be used in sets and as keys in
143     dictionaries.
144     """
145 
146     def __init__(
147         self,
148         str: Union[str, None] = None,
149         tuple: Union[Tuple[str, str, str], None] = None,
150     ):
151         if str:
152             user, host, res = parse(str)
153         elif tuple:
154             user, host, res = prep(*tuple)
155         else:
156             raise RuntimeError(
157                 "You must provide a value for either 'str' or 'tuple' arguments."
158             )
159 
160         self.user = user
161         self.host = host
162         self.resource = res
163 
164     def userhost(self):
165         """
166         Extract the bare JID as a unicode string.
167 
168         A bare JID does not have a resource part, so this returns either
169         C{user@host} or just C{host}.
170 
171         @rtype: L{str}
172         """
173         if self.user:
174             return f"{self.user}@{self.host}"
175         else:
176             return self.host
177 
178     def userhostJID(self):
179         """
180         Extract the bare JID.
181 
182         A bare JID does not have a resource part, so this returns a
183         L{JID} object representing either C{user@host} or just C{host}.
184 
185         If the object this method is called upon doesn't have a resource
186         set, it will return itself. Otherwise, the bare JID object will
187         be created, interned using L{internJID}.
188 
189         @rtype: L{JID}
190         """
191         if self.resource:
192             return internJID(self.userhost())
193         else:
194             return self
195 
196     def full(self):
197         """
198         Return the string representation of this JID.
199 
200         @rtype: L{str}
201         """
202         if self.user:
203             if self.resource:
204                 return f"{self.user}@{self.host}/{self.resource}"
205             else:
206                 return f"{self.user}@{self.host}"
207         else:
208             if self.resource:
209                 return f"{self.host}/{self.resource}"
210             else:
211                 return self.host
212 
213     def __eq__(self, other: object) -> bool:
214         """
215         Equality comparison.
216 
217         L{JID}s compare equal if their user, host and resource parts all
218         compare equal.  When comparing against instances of other types, it
219         uses the default comparison.
220         """
221         if isinstance(other, JID):
222             return (
223                 self.user == other.user
224                 and self.host == other.host
225                 and self.resource == other.resource
226             )
227         else:
228             return NotImplemented
229 
230     def __hash__(self):
231         """
232         Calculate hash.
233 
234         L{JID}s with identical constituent user, host and resource parts have
235         equal hash values.  In combination with the comparison defined on JIDs,
236         this allows for using L{JID}s in sets and as dictionary keys.
237         """
238         return hash((self.user, self.host, self.resource))
239 
240     def __unicode__(self):
241         """
242         Get unicode representation.
243 
244         Return the string representation of this JID as a unicode string.
245         @see: L{full}
246         """
247 
248         return self.full()
249 
250     __str__ = __unicode__
251 
252     def __repr__(self) -> str:
253         """
254         Get object representation.
255 
256         Returns a string that would create a new JID object that compares equal
257         to this one.
258         """
259         return "JID(%r)" % self.full()
260
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/twisted/words/protocols/jabber/jid.py b/src/twisted/words/protocols/jabber/jid.py
--- a/src/twisted/words/protocols/jabber/jid.py
+++ b/src/twisted/words/protocols/jabber/jid.py
@@ -146,7 +146,7 @@
     def __init__(
         self,
         str: Union[str, None] = None,
-        tuple: Union[Tuple[str, str, str], None] = None,
+        tuple: Union[Tuple[Union[str, None], str, Union[str, None]], None] = None,
     ):
         if str:
             user, host, res = parse(str)

{"golden_diff": "diff --git a/src/twisted/words/protocols/jabber/jid.py b/src/twisted/words/protocols/jabber/jid.py\n--- a/src/twisted/words/protocols/jabber/jid.py\n+++ b/src/twisted/words/protocols/jabber/jid.py\n@@ -146,7 +146,7 @@\n     def __init__(\n         self,\n         str: Union[str, None] = None,\n-        tuple: Union[Tuple[str, str, str], None] = None,\n+        tuple: Union[Tuple[Union[str, None], str, Union[str, None]], None] = None,\n     ):\n         if str:\n             user, host, res = parse(str)\n", "issue": "expand mypy .* module overrides\n**Is your feature request related to a problem? Please describe.**\r\nwe'd like to be able to delete a module from the pyproject.toml to mark it as fully type annotated, however having .* overrides with weaker type hinting prevents this\r\n\r\n**Describe the solution you'd like**\r\nexpand mypy .* module overrides\r\n\n", "before_files": [{"content": "# -*- test-case-name: twisted.words.test.test_jabberjid -*-\n#\n# Copyright (c) Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\"\"\"\nJabber Identifier support.\n\nThis module provides an object to represent Jabber Identifiers (JIDs) and\nparse string representations into them with proper checking for illegal\ncharacters, case folding and canonicalisation through\nL{stringprep<twisted.words.protocols.jabber.xmpp_stringprep>}.\n\"\"\"\n\nfrom typing import Dict, Tuple, Union\n\nfrom twisted.words.protocols.jabber.xmpp_stringprep import (\n    nameprep,\n    nodeprep,\n    resourceprep,\n)\n\n\nclass InvalidFormat(Exception):\n    \"\"\"\n    The given string could not be parsed into a valid Jabber Identifier (JID).\n    \"\"\"\n\n\ndef parse(jidstring: str) -> Tuple[Union[str, None], str, Union[str, None]]:\n    \"\"\"\n    Parse given JID string into its respective parts and apply stringprep.\n\n    @param jidstring: string representation of a JID.\n    @type jidstring: L{str}\n    @return: tuple of (user, host, resource), each of type L{str} as\n             the parsed and stringprep'd parts of the given JID. If the\n             given string did not have a user or resource part, the respective\n             field in the tuple will hold L{None}.\n    @rtype: L{tuple}\n    \"\"\"\n    user = None\n    host = None\n    resource = None\n\n    # Search for delimiters\n    user_sep = jidstring.find(\"@\")\n    res_sep = jidstring.find(\"/\")\n\n    if user_sep == -1:\n        if res_sep == -1:\n            # host\n            host = jidstring\n        else:\n            # host/resource\n            host = jidstring[0:res_sep]\n            resource = jidstring[res_sep + 1 :] or None\n    else:\n        if res_sep == -1:\n            # user@host\n            user = jidstring[0:user_sep] or None\n            host = jidstring[user_sep + 1 :]\n        else:\n            if user_sep < res_sep:\n                # user@host/resource\n                user = jidstring[0:user_sep] or None\n                host = jidstring[user_sep + 1 : user_sep + (res_sep - user_sep)]\n                resource = jidstring[res_sep + 1 :] or None\n            else:\n                # host/resource (with an @ in resource)\n                host = jidstring[0:res_sep]\n                resource = jidstring[res_sep + 1 :] or None\n\n    return prep(user, host, resource)\n\n\ndef prep(\n    user: Union[str, None], host: str, resource: Union[str, None]\n) -> Tuple[Union[str, None], str, Union[str, None]]:\n    \"\"\"\n    Perform stringprep on all JID fragments.\n\n    @param user: The user part of the JID.\n    @type user: L{str}\n    @param host: The host part of the JID.\n    @type host: L{str}\n    @param resource: The resource part of the JID.\n    @type resource: L{str}\n    @return: The given parts with stringprep applied.\n    @rtype: L{tuple}\n    \"\"\"\n\n    if user:\n        try:\n            user = nodeprep.prepare(str(user))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in username\")\n    else:\n        user = None\n\n    if not host:\n        raise InvalidFormat(\"Server address required.\")\n    else:\n        try:\n            host = nameprep.prepare(str(host))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in hostname\")\n\n    if resource:\n        try:\n            resource = resourceprep.prepare(str(resource))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in resource\")\n    else:\n        resource = None\n\n    return (user, host, resource)\n\n\n__internJIDs: Dict[str, \"JID\"] = {}\n\n\ndef internJID(jidstring):\n    \"\"\"\n    Return interned JID.\n\n    @rtype: L{JID}\n    \"\"\"\n\n    if jidstring in __internJIDs:\n        return __internJIDs[jidstring]\n    else:\n        j = JID(jidstring)\n        __internJIDs[jidstring] = j\n        return j\n\n\nclass JID:\n    \"\"\"\n    Represents a stringprep'd Jabber ID.\n\n    JID objects are hashable so they can be used in sets and as keys in\n    dictionaries.\n    \"\"\"\n\n    def __init__(\n        self,\n        str: Union[str, None] = None,\n        tuple: Union[Tuple[str, str, str], None] = None,\n    ):\n        if str:\n            user, host, res = parse(str)\n        elif tuple:\n            user, host, res = prep(*tuple)\n        else:\n            raise RuntimeError(\n                \"You must provide a value for either 'str' or 'tuple' arguments.\"\n            )\n\n        self.user = user\n        self.host = host\n        self.resource = res\n\n    def userhost(self):\n        \"\"\"\n        Extract the bare JID as a unicode string.\n\n        A bare JID does not have a resource part, so this returns either\n        C{user@host} or just C{host}.\n\n        @rtype: L{str}\n        \"\"\"\n        if self.user:\n            return f\"{self.user}@{self.host}\"\n        else:\n            return self.host\n\n    def userhostJID(self):\n        \"\"\"\n        Extract the bare JID.\n\n        A bare JID does not have a resource part, so this returns a\n        L{JID} object representing either C{user@host} or just C{host}.\n\n        If the object this method is called upon doesn't have a resource\n        set, it will return itself. Otherwise, the bare JID object will\n        be created, interned using L{internJID}.\n\n        @rtype: L{JID}\n        \"\"\"\n        if self.resource:\n            return internJID(self.userhost())\n        else:\n            return self\n\n    def full(self):\n        \"\"\"\n        Return the string representation of this JID.\n\n        @rtype: L{str}\n        \"\"\"\n        if self.user:\n            if self.resource:\n                return f\"{self.user}@{self.host}/{self.resource}\"\n            else:\n                return f\"{self.user}@{self.host}\"\n        else:\n            if self.resource:\n                return f\"{self.host}/{self.resource}\"\n            else:\n                return self.host\n\n    def __eq__(self, other: object) -> bool:\n        \"\"\"\n        Equality comparison.\n\n        L{JID}s compare equal if their user, host and resource parts all\n        compare equal.  When comparing against instances of other types, it\n        uses the default comparison.\n        \"\"\"\n        if isinstance(other, JID):\n            return (\n                self.user == other.user\n                and self.host == other.host\n                and self.resource == other.resource\n            )\n        else:\n            return NotImplemented\n\n    def __hash__(self):\n        \"\"\"\n        Calculate hash.\n\n        L{JID}s with identical constituent user, host and resource parts have\n        equal hash values.  In combination with the comparison defined on JIDs,\n        this allows for using L{JID}s in sets and as dictionary keys.\n        \"\"\"\n        return hash((self.user, self.host, self.resource))\n\n    def __unicode__(self):\n        \"\"\"\n        Get unicode representation.\n\n        Return the string representation of this JID as a unicode string.\n        @see: L{full}\n        \"\"\"\n\n        return self.full()\n\n    __str__ = __unicode__\n\n    def __repr__(self) -> str:\n        \"\"\"\n        Get object representation.\n\n        Returns a string that would create a new JID object that compares equal\n        to this one.\n        \"\"\"\n        return \"JID(%r)\" % self.full()\n", "path": "src/twisted/words/protocols/jabber/jid.py"}], "after_files": [{"content": "# -*- test-case-name: twisted.words.test.test_jabberjid -*-\n#\n# Copyright (c) Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\"\"\"\nJabber Identifier support.\n\nThis module provides an object to represent Jabber Identifiers (JIDs) and\nparse string representations into them with proper checking for illegal\ncharacters, case folding and canonicalisation through\nL{stringprep<twisted.words.protocols.jabber.xmpp_stringprep>}.\n\"\"\"\n\nfrom typing import Dict, Tuple, Union\n\nfrom twisted.words.protocols.jabber.xmpp_stringprep import (\n    nameprep,\n    nodeprep,\n    resourceprep,\n)\n\n\nclass InvalidFormat(Exception):\n    \"\"\"\n    The given string could not be parsed into a valid Jabber Identifier (JID).\n    \"\"\"\n\n\ndef parse(jidstring: str) -> Tuple[Union[str, None], str, Union[str, None]]:\n    \"\"\"\n    Parse given JID string into its respective parts and apply stringprep.\n\n    @param jidstring: string representation of a JID.\n    @type jidstring: L{str}\n    @return: tuple of (user, host, resource), each of type L{str} as\n             the parsed and stringprep'd parts of the given JID. If the\n             given string did not have a user or resource part, the respective\n             field in the tuple will hold L{None}.\n    @rtype: L{tuple}\n    \"\"\"\n    user = None\n    host = None\n    resource = None\n\n    # Search for delimiters\n    user_sep = jidstring.find(\"@\")\n    res_sep = jidstring.find(\"/\")\n\n    if user_sep == -1:\n        if res_sep == -1:\n            # host\n            host = jidstring\n        else:\n            # host/resource\n            host = jidstring[0:res_sep]\n            resource = jidstring[res_sep + 1 :] or None\n    else:\n        if res_sep == -1:\n            # user@host\n            user = jidstring[0:user_sep] or None\n            host = jidstring[user_sep + 1 :]\n        else:\n            if user_sep < res_sep:\n                # user@host/resource\n                user = jidstring[0:user_sep] or None\n                host = jidstring[user_sep + 1 : user_sep + (res_sep - user_sep)]\n                resource = jidstring[res_sep + 1 :] or None\n            else:\n                # host/resource (with an @ in resource)\n                host = jidstring[0:res_sep]\n                resource = jidstring[res_sep + 1 :] or None\n\n    return prep(user, host, resource)\n\n\ndef prep(\n    user: Union[str, None], host: str, resource: Union[str, None]\n) -> Tuple[Union[str, None], str, Union[str, None]]:\n    \"\"\"\n    Perform stringprep on all JID fragments.\n\n    @param user: The user part of the JID.\n    @type user: L{str}\n    @param host: The host part of the JID.\n    @type host: L{str}\n    @param resource: The resource part of the JID.\n    @type resource: L{str}\n    @return: The given parts with stringprep applied.\n    @rtype: L{tuple}\n    \"\"\"\n\n    if user:\n        try:\n            user = nodeprep.prepare(str(user))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in username\")\n    else:\n        user = None\n\n    if not host:\n        raise InvalidFormat(\"Server address required.\")\n    else:\n        try:\n            host = nameprep.prepare(str(host))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in hostname\")\n\n    if resource:\n        try:\n            resource = resourceprep.prepare(str(resource))\n        except UnicodeError:\n            raise InvalidFormat(\"Invalid character in resource\")\n    else:\n        resource = None\n\n    return (user, host, resource)\n\n\n__internJIDs: Dict[str, \"JID\"] = {}\n\n\ndef internJID(jidstring):\n    \"\"\"\n    Return interned JID.\n\n    @rtype: L{JID}\n    \"\"\"\n\n    if jidstring in __internJIDs:\n        return __internJIDs[jidstring]\n    else:\n        j = JID(jidstring)\n        __internJIDs[jidstring] = j\n        return j\n\n\nclass JID:\n    \"\"\"\n    Represents a stringprep'd Jabber ID.\n\n    JID objects are hashable so they can be used in sets and as keys in\n    dictionaries.\n    \"\"\"\n\n    def __init__(\n        self,\n        str: Union[str, None] = None,\n        tuple: Union[Tuple[Union[str, None], str, Union[str, None]], None] = None,\n    ):\n        if str:\n            user, host, res = parse(str)\n        elif tuple:\n            user, host, res = prep(*tuple)\n        else:\n            raise RuntimeError(\n                \"You must provide a value for either 'str' or 'tuple' arguments.\"\n            )\n\n        self.user = user\n        self.host = host\n        self.resource = res\n\n    def userhost(self):\n        \"\"\"\n        Extract the bare JID as a unicode string.\n\n        A bare JID does not have a resource part, so this returns either\n        C{user@host} or just C{host}.\n\n        @rtype: L{str}\n        \"\"\"\n        if self.user:\n            return f\"{self.user}@{self.host}\"\n        else:\n            return self.host\n\n    def userhostJID(self):\n        \"\"\"\n        Extract the bare JID.\n\n        A bare JID does not have a resource part, so this returns a\n        L{JID} object representing either C{user@host} or just C{host}.\n\n        If the object this method is called upon doesn't have a resource\n        set, it will return itself. Otherwise, the bare JID object will\n        be created, interned using L{internJID}.\n\n        @rtype: L{JID}\n        \"\"\"\n        if self.resource:\n            return internJID(self.userhost())\n        else:\n            return self\n\n    def full(self):\n        \"\"\"\n        Return the string representation of this JID.\n\n        @rtype: L{str}\n        \"\"\"\n        if self.user:\n            if self.resource:\n                return f\"{self.user}@{self.host}/{self.resource}\"\n            else:\n                return f\"{self.user}@{self.host}\"\n        else:\n            if self.resource:\n                return f\"{self.host}/{self.resource}\"\n            else:\n                return self.host\n\n    def __eq__(self, other: object) -> bool:\n        \"\"\"\n        Equality comparison.\n\n        L{JID}s compare equal if their user, host and resource parts all\n        compare equal.  When comparing against instances of other types, it\n        uses the default comparison.\n        \"\"\"\n        if isinstance(other, JID):\n            return (\n                self.user == other.user\n                and self.host == other.host\n                and self.resource == other.resource\n            )\n        else:\n            return NotImplemented\n\n    def __hash__(self):\n        \"\"\"\n        Calculate hash.\n\n        L{JID}s with identical constituent user, host and resource parts have\n        equal hash values.  In combination with the comparison defined on JIDs,\n        this allows for using L{JID}s in sets and as dictionary keys.\n        \"\"\"\n        return hash((self.user, self.host, self.resource))\n\n    def __unicode__(self):\n        \"\"\"\n        Get unicode representation.\n\n        Return the string representation of this JID as a unicode string.\n        @see: L{full}\n        \"\"\"\n\n        return self.full()\n\n    __str__ = __unicode__\n\n    def __repr__(self) -> str:\n        \"\"\"\n        Get object representation.\n\n        Returns a string that would create a new JID object that compares equal\n        to this one.\n        \"\"\"\n        return \"JID(%r)\" % self.full()\n", "path": "src/twisted/words/protocols/jabber/jid.py"}]}