Mercurial > hg
comparison mercurial/lsprof.py @ 7622:4dd7b28003d2
use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 12 Jan 2009 09:16:03 +0100 |
parents | 8fee8ff13d37 |
children | 553aa0cbeab6 |
comparison
equal
deleted
inserted
replaced
7621:6d891df43a5f | 7622:4dd7b28003d2 |
---|---|
86 if isinstance(code, str): | 86 if isinstance(code, str): |
87 return code | 87 return code |
88 try: | 88 try: |
89 mname = _fn2mod[code.co_filename] | 89 mname = _fn2mod[code.co_filename] |
90 except KeyError: | 90 except KeyError: |
91 for k, v in sys.modules.items(): | 91 for k, v in sys.modules.iteritems(): |
92 if v is None: | 92 if v is None: |
93 continue | 93 continue |
94 if not hasattr(v, '__file__'): | 94 if not hasattr(v, '__file__'): |
95 continue | 95 continue |
96 if not isinstance(v.__file__, str): | 96 if not isinstance(v.__file__, str): |