Build an error message when the the number of arguments provided is not within the expected range.
(range_min: int, range_max: float)
| 266 | |
| 267 | |
| 268 | def build_range_error(range_min: int, range_max: float) -> str: |
| 269 | """Build an error message when the the number of arguments provided is not within the expected range.""" |
| 270 | err_msg = "expected " |
| 271 | |
| 272 | if range_max == constants.INFINITY: |
| 273 | plural = "" if range_min == 1 else "s" |
| 274 | err_msg += f"at least {range_min}" |
| 275 | else: |
| 276 | plural = "" if range_max == 1 else "s" |
| 277 | if range_min == range_max: |
| 278 | err_msg += f"{range_min}" |
| 279 | else: |
| 280 | err_msg += f"{range_min} to {range_max}" |
| 281 | |
| 282 | err_msg += f" argument{plural}" |
| 283 | |
| 284 | return err_msg |
| 285 | |
| 286 | |
| 287 | ############################################################################################################ |
no outgoing calls
searching dependent graphs…