[PATCH] gdb: add type annotations to ada-unicode.py

Simon Marchi simark@simark.ca
Thu Apr 25 18:37:41 GMT 2024


On 4/25/24 2:25 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
> 
> Simon> Add type annotations to ada-unicode.py, just enough to make pyright
> Simon> happy:
> 
> Ok.
> Approved-By: Tom Tromey <tom@tromey.com>

Thanks, will push.

> Simon> +        print(
> Simon> +            f"   {{{r.range_start}, {r.range_end}, {r.upper_delta}, {r.lower_delta}}},",
> Simon> +            file=f,
> Simon> +        )
> 
> This trailing comma seems weird.

When it decides to put the arguments one per like, black adds that
trailing comma.  I guess it avoids having a diff on this line should you
add another argument after that.

You can also add the trailing comma yourself to force black to put
things one per line:

foo = (1, 2, 3)
bar = (
    1,
    2,
    3,
)

print("foo")
print(
    "foo",
)

It sometimes makes things more readable (not in the dummy examples
above, but in real life code).

Simon


More information about the Gdb-patches mailing list