binutils-gdb/gdb/testsuite/gdb.python
Simon Marchi 13123da89a gdb: re-format Python files using black 21.4b0
Re-format all Python files using black [1] version 21.4b0.  The goal is
that from now on, we keep all Python files formatted using black.  And
that we never have to discuss formatting during review (for these files
at least) ever again.

One change is needed in gdb.python/py-prettyprint.exp, because it
matches the string representation of an exception, which shows source
code.  So the change in formatting must be replicated in the expected
regexp.

To document our usage of black I plan on adding this to the "GDB Python
Coding Standards" wiki page [2]:

--8<--

All Python source files under the `gdb/` directory must be formatted
using black version 21.4b0.

This specific version can be installed using:

    $ pip3 install 'black == 21.4b0'

All you need to do to re-format files is run `black <file/directory>`,
and black will re-format any Python file it finds in there.  It runs
quite fast, so the simplest is to do:

    $ black gdb/

from the top-level.

If you notice that black produces changes unrelated to your patch, it's
probably because someone forgot to run it before you.  In this case,
don't include unrelated hunks in your patch.  Push an obvious patch
fixing the formatting and rebase your work on top of that.

-->8--

Once this is merged, I plan on setting a up an `ignoreRevsFile`
config so that git-blame ignores this commit, as described here:

  https://github.com/psf/black#migrating-your-code-style-without-ruining-git-blame

I also plan on working on a git commit hook (checked in the repo) to
automatically check the formatting of the Python files on commit.

[1] https://pypi.org/project/black/
[2] https://sourceware.org/gdb/wiki/Internals%20GDB-Python-Coding-Standards

gdb/ChangeLog:

	* Re-format all Python files using black.

gdb/testsuite/ChangeLog:

	* Re-format all Python files using black.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Adjust.

Change-Id: I28588a22c2406afd6bc2703774ddfff47cd61919
2021-05-07 10:56:20 -04:00
..
amd64-py-framefilter-invalidarg.S
compare-enum-type-a.c
compare-enum-type-b.c
compare-enum-type.exp
compare-enum-type.h
flexible-array-member.c gdb: fix getting range of flexible array member in Python 2021-04-22 15:01:28 -04:00
flexible-array-member.exp gdb/testsuite: adjust gdb.python/flexible-array-member.exp expected pattern 2021-05-04 11:20:19 -04:00
lib-types.cc
lib-types.exp gdb/testsuite: check the correct Python variable in test 2021-03-12 12:18:33 +00:00
libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-arch-reg-groups.exp
py-arch-reg-names.exp
py-arch.c
py-arch.exp
py-as-string.c
py-as-string.exp
py-auto-load-chaining-f1.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining-f1.o-gdb.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-auto-load-chaining-f2.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining-f2.o-gdb.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-auto-load-chaining.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining.exp gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-autoloaded-pretty-printers-in-newobjfile-event-lib.h gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-autoloaded-pretty-printers-in-newobjfile-event-main.cc gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-autoloaded-pretty-printers-in-newobjfile-event.exp gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-autoloaded-pretty-printers-in-newobjfile-event.py gdb: do autoload before notifying Python side in new_objfile event 2021-04-27 11:22:32 -04:00
py-bad-printers.c
py-bad-printers.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-bad-printers.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-block.c
py-block.exp gdb/testsuite: make test names unique in gdb.python/py-block.exp 2021-03-12 12:18:33 +00:00
py-breakpoint-create-fail.c
py-breakpoint-create-fail.exp
py-breakpoint-create-fail.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-breakpoint.c
py-breakpoint.exp
py-caller-is.c
py-caller-is.exp
py-cmd.c
py-cmd.exp
py-completion.exp
py-completion.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-error.exp
py-error.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-events-shlib.c
py-events.c
py-events.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-events.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-evsignal.exp
py-evthreads.c
py-evthreads.exp
py-explore-cc.exp gdb/testsuite: make test names unique in gdb.python/py-explore-cc.exp 2021-03-12 12:18:33 +00:00
py-explore.c
py-explore.cc
py-explore.exp gdb/testsuite: make test names unique in gdb.python/py-explore.exp 2021-03-12 12:18:33 +00:00
py-finish-breakpoint2.cc
py-finish-breakpoint2.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-finish-breakpoint2.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-finish-breakpoint.c
py-finish-breakpoint.exp gdb/testsuite: make test names unique in gdb.python/py-finish-breakpoint.exp 2021-03-12 12:18:33 +00:00
py-finish-breakpoint.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-format-string.c
py-format-string.exp
py-format-string.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-frame-args.c
py-frame-args.exp
py-frame-args.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-frame-inline.c
py-frame-inline.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-frame.c
py-frame.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-framefilter-addr.c gdb/python: fix FrameDecorator regression on Python 2 2021-03-16 09:31:56 +00:00
py-framefilter-addr.exp gdb/python: fix FrameDecorator regression on Python 2 2021-03-16 09:31:56 +00:00
py-framefilter-addr.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-framefilter-gdb.py.in
py-framefilter-invalidarg-gdb.py.in
py-framefilter-invalidarg.exp
py-framefilter-invalidarg.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-framefilter-mi.c
py-framefilter-mi.exp
py-framefilter.c
py-framefilter.exp
py-framefilter.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-function.exp
py-inferior.c
py-inferior.exp
py-infthread.c
py-infthread.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-lazy-string.c
py-lazy-string.exp
py-linetable.c
py-linetable.exp
py-linetable.S
py-lookup-type.exp gdb/testsuite: remove a duplicate test 2021-03-12 12:18:33 +00:00
py-mi-events-gdb.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-mi-events.c
py-mi-events.exp
py-mi-objfile-gdb.py
py-mi-objfile.c
py-mi-objfile.exp
py-mi-var-info-path-expression.c
py-mi-var-info-path-expression.exp
py-mi-var-info-path-expression.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-mi.exp
py-nested-maps.c
py-nested-maps.exp
py-nested-maps.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-objfile-script-gdb.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-objfile-script.c
py-objfile-script.exp
py-objfile.c
py-objfile.exp
py-parameter.exp gdb/testsuite: don't include paths in test names 2021-04-15 21:33:58 +01:00
py-pp-integral.c
py-pp-integral.exp
py-pp-integral.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-pp-maint.c
py-pp-maint.exp gdb/testsuite: make test names unique in gdb.python/py-pp-maint.exp 2021-03-12 12:18:33 +00:00
py-pp-maint.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-pp-re-notag.c
py-pp-re-notag.exp
py-pp-re-notag.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-pp-registration.c
py-pp-registration.exp
py-pp-registration.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-prettyprint.c gdb/testsuite: more testing of pretty printer 'array' display_hint 2021-03-26 17:43:14 +00:00
py-prettyprint.exp gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-prettyprint.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-progspace.c
py-progspace.exp
py-prompt.c
py-prompt.exp gdb/testsuite: make test names unique in gdb.python/py-prompt.exp 2021-03-12 12:18:33 +00:00
py-rbreak-func2.c
py-rbreak.c
py-rbreak.exp
py-record-btrace-threads.c
py-record-btrace-threads.exp
py-record-btrace.c
py-record-btrace.exp
py-record-full.c
py-record-full.exp
py-recurse-unwind.c
py-recurse-unwind.exp
py-recurse-unwind.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-rvalue-ref-value-cc.cc
py-rvalue-ref-value-cc.exp
py-section-script.c
py-section-script.exp
py-section-script.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-shared-sl.c
py-shared.c
py-shared.exp
py-startup-opt.exp gdb/testsuite: update expected results in gdb.python/py-startup-opt.exp 2021-05-03 12:21:00 +01:00
py-strfns.c
py-strfns.exp gdb/testsuite: make test names unique in gdb.python/py-strfns.exp 2021-03-12 12:18:33 +00:00
py-symbol-2.c
py-symbol.c
py-symbol.exp
py-symtab.exp gdb/testsuite: make test names unique in gdb.python/py-symtab.exp 2021-03-12 12:18:33 +00:00
py-sync-interp.c
py-sync-interp.exp
py-template.cc
py-template.exp
py-thrhandle.c
py-thrhandle.exp
py-type.c
py-type.exp gdb: update Type.fields doc based on actual GDB behavior 2021-05-04 22:19:05 -04:00
py-typeprint.cc
py-typeprint.exp
py-typeprint.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-unwind-inline.c
py-unwind-inline.exp
py-unwind-inline.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-unwind-maint.c
py-unwind-maint.exp
py-unwind-maint.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-unwind.c
py-unwind.exp
py-unwind.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
py-value-cc.cc
py-value-cc.exp gdb/testsuite: remove duplicate test from gdb.python/py-value-cc.exp 2021-03-12 12:18:34 +00:00
py-value.c
py-value.exp
py-xmethods.cc
py-xmethods.exp
py-xmethods.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
python-1.c
python.c
python.exp
source1
source2.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
tui-window-disabled.c
tui-window-disabled.exp
tui-window-disabled.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00
tui-window.exp
tui-window.py gdb: re-format Python files using black 21.4b0 2021-05-07 10:56:20 -04:00