Validates if the arguments passed are correct
(self)
| 311 | self.device = device |
| 312 | |
| 313 | def validate(self): |
| 314 | """Validates if the arguments passed are correct""" |
| 315 | |
| 316 | incorrect_arg_msg = ( |
| 317 | "Some of the keys in `cache_config` are defined incorrectly. `{key}` should be {correct_value}` " |
| 318 | "but found {found_value}" |
| 319 | ) |
| 320 | |
| 321 | if self.batch_size <= 0: |
| 322 | raise ValueError( |
| 323 | incorrect_arg_msg.format( |
| 324 | key="batch_size", |
| 325 | correct_value="> 0", |
| 326 | found_value=self.batch_size, |
| 327 | ), |
| 328 | ) |
| 329 | |
| 330 | if self.max_cache_len <= 0: |
| 331 | raise ValueError( |
| 332 | incorrect_arg_msg.format( |
| 333 | key="max_cache_len", |
| 334 | correct_value="> 0", |
| 335 | found_value=self.max_cache_len, |
| 336 | ), |
| 337 | ) |
| 338 | |
| 339 | |
| 340 | class DynamicCache(Cache): |
nothing calls this directly
no outgoing calls
no test coverage detected