mirror of
https://github.com/zulip/zulip.git
synced 2025-10-26 09:34:02 +00:00
python: Convert assignment type annotations to Python 3.6 style.
This commit was split by tabbott; this piece covers the vast majority
of files in Zulip, but excludes scripts/, tools/, and puppet/ to help
ensure we at least show the right error messages for Xenial systems.
We can likely further refine the remaining pieces with some testing.
Generated by com2ann, with whitespace fixes and various manual fixes
for runtime issues:
- invoiced_through: Optional[LicenseLedger] = models.ForeignKey(
+ invoiced_through: Optional["LicenseLedger"] = models.ForeignKey(
-_apns_client: Optional[APNsClient] = None
+_apns_client: Optional["APNsClient"] = None
- notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- signup_notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ signup_notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- author: Optional[UserProfile] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
+ author: Optional["UserProfile"] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
- bot_owner: Optional[UserProfile] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
+ bot_owner: Optional["UserProfile"] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
- default_sending_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
- default_events_register_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_sending_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_events_register_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
-descriptors_by_handler_id: Dict[int, ClientDescriptor] = {}
+descriptors_by_handler_id: Dict[int, "ClientDescriptor"] = {}
-worker_classes: Dict[str, Type[QueueProcessingWorker]] = {}
-queues: Dict[str, Dict[str, Type[QueueProcessingWorker]]] = {}
+worker_classes: Dict[str, Type["QueueProcessingWorker"]] = {}
+queues: Dict[str, Dict[str, Type["QueueProcessingWorker"]]] = {}
-AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional[LDAPSearch] = None
+AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional["LDAPSearch"] = None
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
af1aef9b39
commit
fead14951c
@@ -80,7 +80,7 @@ def get_test_method(test: TestCase) -> Callable[[], None]:
|
||||
return getattr(test, test._testMethodName)
|
||||
|
||||
# Each tuple is delay, test_name, slowness_reason
|
||||
TEST_TIMINGS = [] # type: List[Tuple[float, str, str]]
|
||||
TEST_TIMINGS: List[Tuple[float, str, str]] = []
|
||||
|
||||
|
||||
def report_slow_tests() -> None:
|
||||
@@ -154,7 +154,7 @@ class TextTestResult(runner.TextTestResult):
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.failed_tests = [] # type: List[str]
|
||||
self.failed_tests: List[str] = []
|
||||
|
||||
def addInfo(self, test: TestCase, msg: str) -> None:
|
||||
self.stream.write(msg) # type: ignore[attr-defined] # https://github.com/python/typeshed/issues/3139
|
||||
@@ -416,10 +416,10 @@ class Runner(DiscoverRunner):
|
||||
|
||||
# `templates_rendered` holds templates which were rendered
|
||||
# in proper logical tests.
|
||||
self.templates_rendered = set() # type: Set[str]
|
||||
self.templates_rendered: Set[str] = set()
|
||||
# `shallow_tested_templates` holds templates which were rendered
|
||||
# in `zerver.tests.test_templates`.
|
||||
self.shallow_tested_templates = set() # type: Set[str]
|
||||
self.shallow_tested_templates: Set[str] = set()
|
||||
template_rendered.connect(self.on_template_rendered)
|
||||
|
||||
def get_resultclass(self) -> Type[TestResult]:
|
||||
|
||||
Reference in New Issue
Block a user