##// END OF EJS Templates
pytype: convert type comment for inline variable too...
marmoute -
r52181:8b2ea224 default
parent child Browse files
Show More
@@ -48,6 +48,10 b' import stat'
48 import struct
48 import struct
49 import time
49 import time
50
50
51 from typing import (
52 Optional,
53 )
54
51 from .i18n import _
55 from .i18n import _
52 from .node import hex
56 from .node import hex
53
57
@@ -628,14 +632,16 b' class chgunixservicehandler:'
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()
@@ -57,7 +57,7 b' class Hint:'
57 """
57 """
58
58
59 def __init__(self, *args, **kw):
59 def __init__(self, *args, **kw):
60 self.hint = kw.pop('hint', None) # type: Optional[bytes]
60 self.hint: Optional[bytes] = kw.pop('hint', None)
61 super(Hint, self).__init__(*args, **kw)
61 super(Hint, self).__init__(*args, **kw)
62
62
63
63
@@ -89,7 +89,7 b' def gettext(message: bytes) -> bytes:'
89 if message not in cache:
89 if message not in cache:
90 if type(message) is str:
90 if type(message) is str:
91 # goofy unicode docstrings in test
91 # goofy unicode docstrings in test
92 paragraphs = message.split(u'\n\n') # type: List[str]
92 paragraphs: List[str] = message.split(u'\n\n')
93 else:
93 else:
94 # should be ascii, but we have unicode docstrings in test, which
94 # should be ascii, but we have unicode docstrings in test, which
95 # are converted to utf-8 bytes on Python 3.
95 # are converted to utf-8 bytes on Python 3.
@@ -392,4 +392,4 b' if rustdirs is not None:'
392 # rather not let our internals know that we're thinking in posix terms
392 # rather not let our internals know that we're thinking in posix terms
393 # - instead we'll let them be oblivious.
393 # - instead we'll let them be oblivious.
394 join = posixpath.join
394 join = posixpath.join
395 dirname = posixpath.dirname # type: Callable[[bytes], bytes]
395 dirname: Callable[[bytes], bytes] = posixpath.dirname
@@ -163,7 +163,9 b' if typing.TYPE_CHECKING:'
163 _fphasesentry = struct.Struct(b'>i20s')
163 _fphasesentry = struct.Struct(b'>i20s')
164
164
165 # record phase index
165 # record phase index
166 public, draft, secret = range(3) # type: int
166 public: int = 0
167 draft: int = 1
168 secret: int = 2
167 archived = 32 # non-continuous for compatibility
169 archived = 32 # non-continuous for compatibility
168 internal = 96 # non-continuous for compatibility
170 internal = 96 # non-continuous for compatibility
169 allphases = (public, draft, secret, archived, internal)
171 allphases = (public, draft, secret, archived, internal)
@@ -108,7 +108,7 b' class improvement:'
108 compatible_with_share = False
108 compatible_with_share = False
109
109
110
110
111 allformatvariant = [] # type: List[Type['formatvariant']]
111 allformatvariant: List[Type['formatvariant']] = []
112
112
113
113
114 def registerformatvariant(cls):
114 def registerformatvariant(cls):
General Comments 0
You need to be logged in to leave comments. Login now