You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix various niggly typing and checker complaints.
Environment.py:
* To avoid modifying a dict-like thing while iterating over it, we did
.copy(), making an awkward chained construct that checkers don't like.
Simpler (and the more common idion) is to make a list out of the .keys()
view, that way you're iterating over that new list and not the dict
(and save creating a dict copy).
* Another use of copy() was in detecting a CPPDEFINES deque, where we
want to keep a copy of it and not modify the original - use the deque
constructor for this instead of calling copy() method.
* Align the names of vars in overridden dunder methods in BuilderDict with
parent UserDict for more consistency.
* arg2nodes node_factory argument *could* be passed a None, indicate
that in the signature.
* Multiple uses of CacheDir (it was both an import from CacheDir for type
checking, and the name of a function in Environment.py). This was confusing
to at least one type checker, so just use the qualified name.
* The environment Base class _update and _update_onlynew methods
were annotated to take an EnvironmentBase argument, but in fact they're
designed to update the internal dict from a passed dict. Adjusted the
annotation.
* Used the global Environment hook directly by name rather than fully
qualified, as SCons.Environment doesn't have an import of itself. That's
namespace niggling, because it worked as written.
* The Repository method (public API level) was written to take kwargs and
pass those on to the FS layer's Repository - which doesn't take kwargs.
Repository() was never documented as accepting any keyword arguments
(and no tests ever poked at that usage), so just removed to align the two.
* In VariantDir, make a small readability change and also avoid
reassigning the function parameters: the index-zero access occurs on the
call to self.fs.VariantDir, not on the end of the call to arg2nodes.
Node/FS.py: Glob and glob annotation adjusted to show the exclude argument
could also be a single string, as that could be passed down from the public
API level, as documented: "The optional exclude argument may be set to a
pattern or a list of patterns describing files or directories to filter out of
the match list."
Tool/FortranCommon.py: fix an error where returns were Tuple, which is
not imported; changed to tuple.
Signed-off-by: Mats Wichmann <mats@linux.com>
0 commit comments