build: refactor configure.py
- Explicitly specify the encoding when opening files.
- Use f-strings to format strings.
- Use
isinstance()
for type checks instead oftype()
. - Use the
with
keyword for resource-allocating operations. - Avoid using multiple statements in a single line.
- Remove unnecessary
else
clauses afterreturn
. - Iterate with the
items()
method of dictionaries when both the key and value are used. - Remove unnecessary parentheses.
- Rename unused unpacked variables to
_
,_1
, etc etc. - Rename the
list
variable to avoid conflict with the globallist()
function.
Refs: https://github.com/nodejs/node/pull/47581#issuecomment-1518512779