(n_args: int)
| 148 | |
| 149 | @lru_cache(10) |
| 150 | def make_msg(n_args: int): |
| 151 | used = [name for idx, name in deprecate_positions if idx < n_args] |
| 152 | |
| 153 | if len(used) == 1: |
| 154 | args_txt = f"`{used[0]}`" |
| 155 | plr = "" |
| 156 | isare = "is" |
| 157 | else: |
| 158 | plr = "s" |
| 159 | isare = "are" |
| 160 | if len(used) == 2: |
| 161 | args_txt = " and ".join(f"`{u}`" for u in used) |
| 162 | else: |
| 163 | args_txt = ", ".join(f"`{u}`" for u in used[:-1]) |
| 164 | args_txt += f", and `{used[-1]}`" |
| 165 | |
| 166 | return ( |
| 167 | f"positional argument{plr} {args_txt} for `{func.__name__}` " |
| 168 | f"{isare} deprecated. Please use keyword argument{plr} instead." |
| 169 | ) |
| 170 | |
| 171 | @wraps(func) |
| 172 | def wrapper(*args, **kwargs): |
no outgoing calls
no test coverage detected
searching dependent graphs…