@@ -32,7 +32,7 @@ def __repr__(self) -> str:
3232 pass
3333
3434 @abstractmethod
35- def process_trace (self , reader , max_req = - 1 , max_sec = - 1 , start_time = - 1 , end_time = - 1 ):
35+ def process_trace (self , reader , max_req : int = - 1 , max_sec : int = - 1 , start_time : int = - 1 , end_time : int = - 1 ) -> float :
3636 """Process a trace with this cache and return miss ratio.
3737
3838 This method processes trace data entirely on the C++ side to avoid
@@ -63,7 +63,7 @@ def init_cache(self, cache_size: int, **kwargs) -> Cache:
6363 def get (self , req : Request ) -> bool :
6464 return self .cache .get (req )
6565
66- def process_trace (self , reader , max_req = - 1 , max_sec = - 1 , start_time = - 1 , end_time = - 1 ):
66+ def process_trace (self , reader , max_req : int = - 1 , max_sec : int = - 1 , start_time : int = - 1 , end_time : int = - 1 ) -> float :
6767 """Process a trace with this cache and return miss ratio.
6868
6969 This method processes trace data entirely on the C++ side to avoid
@@ -150,9 +150,9 @@ def init_cache(self, cache_size: int, **kwargs):
150150 return Clock_init (cache_size , n_bit_counter , init_freq )
151151
152152 def __repr__ (self ):
153- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
154- f"n_bit_counter={ self .n_bit_counter } , " \
155- f"init_freq={ self .init_freq } )"
153+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
154+ f"n_bit_counter={ self .n_bit_counter } , "
155+ f"init_freq={ self .init_freq } )" )
156156
157157
158158class TwoQ (EvictionPolicy ):
@@ -183,9 +183,9 @@ def init_cache(self, cache_size: int, **kwargs):
183183 return TwoQ_init (cache_size , ain_size_ratio , aout_size_ratio )
184184
185185 def __repr__ (self ):
186- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
187- f"ain_size_ratio={ self .ain_size_ratio } , " \
188- f"aout_size_ratio={ self .aout_size_ratio } )"
186+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
187+ f"ain_size_ratio={ self .ain_size_ratio } , "
188+ f"aout_size_ratio={ self .aout_size_ratio } )" )
189189
190190
191191class LRB (EvictionPolicy ):
@@ -214,8 +214,8 @@ def init_cache(self, cache_size: int, **kwargs) -> Cache:
214214 return LRB_init (cache_size , objective )
215215
216216 def __repr__ (self ):
217- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
218- f"objective={ self .objective } )"
217+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
218+ f"objective={ self .objective } )" )
219219
220220
221221class LRU (EvictionPolicy ):
@@ -286,10 +286,10 @@ def init_cache(self, cache_size: int, **kwargs):
286286 return S3FIFO_init (cache_size , fifo_size_ratio , ghost_size_ratio , move_to_main_threshold )
287287
288288 def __repr__ (self ):
289- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
290- f"fifo_size_ratio={ self .fifo_size_ratio } , " \
291- f"ghost_size_ratio={ self .ghost_size_ratio } , " \
292- f"move_to_main_threshold={ self .move_to_main_threshold } )"
289+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
290+ f"fifo_size_ratio={ self .fifo_size_ratio } , "
291+ f"ghost_size_ratio={ self .ghost_size_ratio } , "
292+ f"move_to_main_threshold={ self .move_to_main_threshold } )" )
293293
294294
295295class Sieve (EvictionPolicy ):
@@ -326,8 +326,8 @@ def init_cache(self, cache_size: int, **kwargs):
326326 return ThreeLCache_init (cache_size , objective )
327327
328328 def __repr__ (self ):
329- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
330- f"objective={ self .objective } )"
329+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
330+ f"objective={ self .objective } )" )
331331
332332
333333class TinyLFU (EvictionPolicy ):
@@ -355,9 +355,9 @@ def init_cache(self, cache_size: int, **kwargs):
355355 return TinyLFU_init (cache_size , main_cache , window_size )
356356
357357 def __repr__ (self ):
358- return f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , " \
359- f"main_cache={ self .main_cache } , " \
360- f"window_size={ self .window_size } )"
358+ return ( f"{ self .__class__ .__name__ } (cache_size={ self .cache .cache_size } , "
359+ f"main_cache={ self .main_cache } , "
360+ f"window_size={ self .window_size } )" )
361361
362362
363363
@@ -508,5 +508,5 @@ def cache_size(self):
508508 return self .cache .cache_size
509509
510510 def __repr__ (self ):
511- return f"{ self .__class__ .__name__ } (cache_size={ self ._cache_size } , " \
512- f"cache_name='{ self .cache_name } ', hooks_set={ self ._hooks_set } )"
511+ return ( f"{ self .__class__ .__name__ } (cache_size={ self ._cache_size } , "
512+ f"cache_name='{ self .cache_name } ', hooks_set={ self ._hooks_set } )" )
0 commit comments