comparison mercurial/chgserver.py @ 51305: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
comparison
equal deleted inserted replaced
51304:f15cb5111a1e 51305:8b2ea2246a5f
45 import re 45 import re
46 import socket 46 import socket
47 import stat 47 import stat
48 import struct 48 import struct
49 import time 49 import time
50
51 from typing import (
52 Optional,
53 )
50 54
51 from .i18n import _ 55 from .i18n import _
52 from .node import hex 56 from .node import hex
53 57
54 from . import ( 58 from . import (
626 class chgunixservicehandler: 630 class chgunixservicehandler:
627 """Set of operations for chg services""" 631 """Set of operations for chg services"""
628 632
629 pollinterval = 1 # [sec] 633 pollinterval = 1 # [sec]
630 634
635 _hashstate: Optional[hashstate]
636 _baseaddress: Optional[bytes]
637 _realaddress: Optional[bytes]
638
631 def __init__(self, ui): 639 def __init__(self, ui):
632 self.ui = ui 640 self.ui = ui
633 641
634 # TODO: use PEP 526 syntax (`_hashstate: hashstate` at the class level) 642 self._hashstate = None
635 # when 3.5 support is dropped. 643 self._baseaddress = None
636 self._hashstate = None # type: hashstate 644 self._realaddress = None
637 self._baseaddress = None # type: bytes
638 self._realaddress = None # type: bytes
639 645
640 self._idletimeout = ui.configint(b'chgserver', b'idletimeout') 646 self._idletimeout = ui.configint(b'chgserver', b'idletimeout')
641 self._lastactive = time.time() 647 self._lastactive = time.time()
642 648
643 def bindsocket(self, sock, address): 649 def bindsocket(self, sock, address):