diff options
author | Mats Wichmann <mats@linux.com> | 2021-03-10 17:14:16 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-03-11 21:03:07 (GMT) |
commit | ab0507d7d7baccef0960cd1d60d837e39f3161e3 (patch) | |
tree | da8e9634f22ef162febc2c2f2283c449be3cb551 /SCons/Util.py | |
parent | d10c8b15aa2ca3b6024fa6d9c99656d11205e266 (diff) | |
download | SCons-ab0507d7d7baccef0960cd1d60d837e39f3161e3.zip SCons-ab0507d7d7baccef0960cd1d60d837e39f3161e3.tar.gz SCons-ab0507d7d7baccef0960cd1d60d837e39f3161e3.tar.bz2 |
Drop dictionary has_key references: Py2-ism.
In some cases, added a __contains__ method instead,
not because it necessarily was needed, but for completeness.
Also one completely unrelated change because it happened to
be sitting modified in the tree when I committed modified files:
be a little more cautious about building CHECK_METHODS in
our subclassing of the optparse Option class... current
cpython starts it at None, then fills it in, so it shouldn't
be None when we subclass.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Util.py')
-rw-r--r-- | SCons/Util.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/SCons/Util.py b/SCons/Util.py index 4dd70f7..5a89704 100644 --- a/SCons/Util.py +++ b/SCons/Util.py @@ -1216,14 +1216,13 @@ def uniquer(seq, idfun=None): idfun = default_idfun seen = {} result = [] + result_append = result.append for item in seq: marker = idfun(item) - # in old Python versions: - # if seen.has_key(marker) - # but in new ones: - if marker in seen: continue + if marker in seen: + continue seen[marker] = 1 - result.append(item) + result_append(item) return result # A more efficient implementation of Alex's uniquer(), this avoids the @@ -1233,11 +1232,11 @@ def uniquer(seq, idfun=None): def uniquer_hashables(seq): seen = {} result = [] + result_append = result.append for item in seq: - #if not item in seen: if item not in seen: seen[item] = 1 - result.append(item) + result_append(item) return result |