Is there perhaps a way to tell black
to format the code consistently and not just when 119 char line is encountered?
Here is an example of how it reformats now:
parser.add_argument(
"--max_seq_length",
default=128,
type=int,
help="The maximum total input sequence length after tokenization. Sequences longer "
"than this will be truncated, sequences shorter will be padded.",
)
parser.add_argument("--do_train", action="store_true", help="Whether to run training.")
parser.add_argument("--do_eval", action="store_true", help="Whether to run eval on the dev set.")
parser.add_argument(
"--evaluate_during_training",
action="store_true",
help="Run evaluation during training at each logging step.",
)
This is not easy to read, since the format keeps on changing every few lines.
The following would be much easier to read:
parser.add_argument(
"--max_seq_length",
default=128,
type=int,
help="The maximum total input sequence length after tokenization. Sequences longer "
"than this will be truncated, sequences shorter will be padded.",
)
parser.add_argument(
"--do_train",
action="store_true",
help="Whether to run training."
)
parser.add_argument(
"--do_eval",
action="store_true",
help="Whether to run eval on the dev set."
)
parser.add_argument(
"--evaluate_during_training",
action="store_true",
help="Run evaluation during training at each logging step.",
)
but then the 2 middle lines of code are < 119 so they don’t get wrapped. I manually wrapped the code above.
I am not sure if the following is better, but it’s another version of being consistent:
parser.add_argument( "--max_seq_length", default=128, type=int,
help="The maximum total input sequence length after tokenization. Sequences longer"
"than this will be truncated, sequences shorter will be padded.",)
parser.add_argument("--do_train", action="store_true", help="Whether to run training.")
parser.add_argument("--do_eval", action="store_true", help="Whether to run eval on the dev set.")
parser.add_argument("--evaluate_during_training", action="store_true",
help="Run evaluation during training at each logging step.", )
I don’t like this last one - as it doesn’t improve readability.
Thanks.