comparison mercurial/statprof.py @ 51811:460e80488cf0

typing: lock in correct changes from pytype 2023.04.11 -> 2023.06.16 There were a handful of other changes to the pyi files generated when updating pytype locally (and jumping from python 3.8.0 to python 3.10.11), but they were not as clear (e.g. the embedded type in a list changing from `nothing` to `Any` or similar). These looked obviously correct, and agreed with PyCharm's thoughts on the signatures. Oddly, even though pytype starting inferring `obsutil._getfilteredreason()` as returning bytes, it (correctly) complained about the None path when it was typed that way. Instead, raise a ProgrammingError if an unhandled fate is calculated. (Currently, all possibilities are handled, so this isn't reachable unless another fate is added in the future.)
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 20 Aug 2024 18:30:47 -0400
parents 933551630b0d
children 454feddab720
comparison
equal deleted inserted replaced
51810:f1ef512e14ab 51811:460e80488cf0
111 import signal 111 import signal
112 import sys 112 import sys
113 import threading 113 import threading
114 import time 114 import time
115 115
116 from typing import (
117 List,
118 )
119
116 from .pycompat import open 120 from .pycompat import open
117 from . import ( 121 from . import (
118 encoding, 122 encoding,
119 pycompat, 123 pycompat,
120 ) 124 )
153 ########################################################################### 157 ###########################################################################
154 ## Collection data structures 158 ## Collection data structures
155 159
156 160
157 class ProfileState: 161 class ProfileState:
162 samples: List["Sample"]
163
158 def __init__(self, frequency=None): 164 def __init__(self, frequency=None):
159 self.reset(frequency) 165 self.reset(frequency)
160 self.track = b'cpu' 166 self.track = b'cpu'
161 167
162 def reset(self, frequency=None): 168 def reset(self, frequency=None):