def get_scanner(self, skey):
"""Find the appropriate scanner given a key (usually a file suffix).
- __cacheable__
"""
sm = self._gsm()
- if sm.has_key(skey):
- return sm[skey]
- return None
+ try: return sm[skey]
+ except (KeyError, TypeError): return None
def _smd(self):
"__reset_cache__"
suffixes = [".c", ".cc", ".cxx", ".m4", ".m5"]
+ env = Environment()
+ try: del env['SCANNERS']
+ except KeyError: pass
+ s = map(env.get_scanner, suffixes)
+ assert s == [None, None, None, None, None], s
+
env = Environment(SCANNERS = [])
s = map(env.get_scanner, suffixes)
assert s == [None, None, None, None, None], s