mypy: Enable ignore-without-code error.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-26 13:43:42 -07:00
parent 95b33b83b5
commit 43654b9cf2
3 changed files with 5 additions and 4 deletions

View file

@ -39,6 +39,7 @@ enable_error_code = [
"redundant-expr",
"truthy-bool",
"truthy-iterable",
"ignore-without-code",
"unused-awaitable",
]

View file

@ -154,7 +154,7 @@ def add_default_arguments(
self.print_help(sys.stderr)
self.exit(2, f"{self.prog}: error: {message}\n")
parser.error = types.MethodType(custom_error_handling, parser) # type: ignore # patching function
parser.error = types.MethodType(custom_error_handling, parser) # type: ignore[method-assign] # patching function
if allow_provisioning:
parser.add_argument(
@ -1802,7 +1802,7 @@ if LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION == "3":
# This block is support for testing Zulip 3.x, which documents old
# interfaces for the following functions:
class LegacyInterfaceClient(Client):
def update_user_group_members(self, group_data: Dict[str, Any]) -> Dict[str, Any]: # type: ignore # Intentional override; see comments above.
def update_user_group_members(self, group_data: Dict[str, Any]) -> Dict[str, Any]: # type: ignore[override] # Intentional override; see comments above.
modern_group_data = group_data.copy()
group_id = group_data["group_id"]
del modern_group_data["group_id"]
@ -1821,4 +1821,4 @@ if LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION == "3":
method="GET",
)
Client = LegacyInterfaceClient # type: ignore # Intentional override; see comments above.
Client = LegacyInterfaceClient # type: ignore[misc] # Intentional override; see comments above.

View file

@ -30,7 +30,7 @@ def mock_http_conversation(http_data: Dict[str, Any]) -> Any:
mock_result.headers.update(http_headers)
mock_result.encoding = get_encoding_from_headers(mock_result.headers)
if is_raw_response:
mock_result._content = http_response.encode() # type: ignore # This modifies a "hidden" attribute.
mock_result._content = http_response.encode() # type: ignore[attr-defined] # This modifies a "hidden" attribute.
else:
mock_result._content = json.dumps(http_response).encode()
return mock_result