Add ability to mutate a target's `extra_files` list through the
rewriter.
The logic is copied from sources add/rm, but changes the `extra_files`
kwarg instead of the sources positional argument.
Has additional logic to handle creating the `extra_files` list if it
doesn't exist.
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.
this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.
Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
This also fixes that the keys in ArgumentNode.kwargs are
all of the type BaseNode now. Before this commit, it was
possible that both strings and Nodes where used as keys.
Currently default_options uses "" for the kwarks id, however this
is incorect and it must be "/". Additionally, this error won't be
ignored in the future with "--skip" (this is why the tests were
passing and this wasn't detected earlier).
This uses an iterator instead of walking a list, which is roughly twice
as fast. This also does away with the pre-check on whether the list is
valid for converting to a dict, and instead handles the case of an
uneven number by catching another exception. This is preferable since
it's a fatal error anyway, so avoiding it in the non-fatal case is
preferable.