mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
lint: Prevent self: Any annotations.
We should omit these for mypy. For most class definitions, mypy doesn't need `Any`, and it provides no real useful info. For clever monkeypatches, you should provide a more specific type than `Any`.
This commit is contained in:
@@ -264,6 +264,10 @@ def build_custom_checkers(by_lang):
|
||||
'description': 'Missing space around "%"',
|
||||
'good_lines': ["'%s' % ('foo')", "'%s' % (foo)"],
|
||||
'bad_lines': ["'%s'%('foo')", "'%s'%(foo)"]},
|
||||
{'pattern': 'self: Any',
|
||||
'description': 'you can omit Any annotation for self',
|
||||
'good_lines': ['def foo (self):'],
|
||||
'bad_lines': ['def foo(self: Any):']},
|
||||
# This rule is constructed with + to avoid triggering on itself
|
||||
{'pattern': " =" + '[^ =>~"]',
|
||||
'description': 'Missing whitespace after "="',
|
||||
|
||||
@@ -23,7 +23,7 @@ class AttachmentsTests(ZulipTestCase):
|
||||
attachments = user_attachments(user_profile)
|
||||
self.assertEqual(result.json()['attachments'], attachments)
|
||||
|
||||
def test_remove_attachment_exception(self: Any) -> None:
|
||||
def test_remove_attachment_exception(self) -> None:
|
||||
user_profile = self.example_user('cordelia')
|
||||
self.login(user_profile.email)
|
||||
with mock.patch('zerver.lib.attachments.delete_message_image', side_effect=Exception()):
|
||||
|
||||
@@ -2269,7 +2269,7 @@ class UserSignUpTest(ZulipTestCase):
|
||||
self.assertEqual(result.status_code, 302)
|
||||
self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
|
||||
|
||||
def test_registration_of_active_mirror_dummy_user(self: Any) -> None:
|
||||
def test_registration_of_active_mirror_dummy_user(self) -> None:
|
||||
"""
|
||||
Trying to activate an already-active mirror dummy user should
|
||||
raise an AssertionError.
|
||||
|
||||
Reference in New Issue
Block a user