diff mercurial/chgserver.py @ 51288:8b2ea2246a5f

pytype: convert type comment for inline variable too Same logic as for the previous changeset, but for "type comment" annotating variables, not function/method. As for the previous changeset, we had to adjust for of the types to actually match what was happening.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 20 Dec 2023 11:23:09 +0100
parents 18c8c18993f0
children 39e2b2d062c1
line wrap: on
line diff
--- a/mercurial/chgserver.py	Tue Dec 19 21:29:34 2023 +0100
+++ b/mercurial/chgserver.py	Wed Dec 20 11:23:09 2023 +0100
@@ -48,6 +48,10 @@
 import struct
 import time
 
+from typing import (
+    Optional,
+)
+
 from .i18n import _
 from .node import hex
 
@@ -628,14 +632,16 @@
 
     pollinterval = 1  # [sec]
 
+    _hashstate: Optional[hashstate]
+    _baseaddress: Optional[bytes]
+    _realaddress: Optional[bytes]
+
     def __init__(self, ui):
         self.ui = ui
 
-        # TODO: use PEP 526 syntax (`_hashstate: hashstate` at the class level)
-        #  when 3.5 support is dropped.
-        self._hashstate = None  # type: hashstate
-        self._baseaddress = None  # type: bytes
-        self._realaddress = None  # type: bytes
+        self._hashstate = None
+        self._baseaddress = None
+        self._realaddress = None
 
         self._idletimeout = ui.configint(b'chgserver', b'idletimeout')
         self._lastactive = time.time()