diff options
author | Skip Montanaro <skip@pobox.com> | 2007-08-06 21:07:53 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2007-08-06 21:07:53 (GMT) |
commit | 1e8ce58f5d0db22714d65ff440045a7526ed394d (patch) | |
tree | f705fb923334cffa32492a5bddfcca46ecc27f0a /Demo/pdist/cvslib.py | |
parent | 28a181cbe82bc79df3b881b79b19e12b2e39911b (diff) | |
download | cpython-1e8ce58f5d0db22714d65ff440045a7526ed394d.zip cpython-1e8ce58f5d0db22714d65ff440045a7526ed394d.tar.gz cpython-1e8ce58f5d0db22714d65ff440045a7526ed394d.tar.bz2 |
remove most uses of list(somedict.keys()) in Demo scripts
Diffstat (limited to 'Demo/pdist/cvslib.py')
-rwxr-xr-x | Demo/pdist/cvslib.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Demo/pdist/cvslib.py b/Demo/pdist/cvslib.py index 8ccb616..78e4fbb 100755 --- a/Demo/pdist/cvslib.py +++ b/Demo/pdist/cvslib.py @@ -223,15 +223,12 @@ class CVS: f.close() def getlocalfiles(self): - list = list(self.entries.keys()) + entries_keys = set(self.entries.keys()) addlist = os.listdir(os.curdir) for name in addlist: - if name in list: - continue if not self.ignored(name): - list.append(name) - list.sort() - for file in list: + entries_keys.add(name) + for file in sorted(entries_keys): try: e = self.entries[file] except KeyError: @@ -257,19 +254,17 @@ class CVS: print('-'*50) def keys(self): - keys = list(self.entries.keys()) - keys.sort() - return keys + return sorted(self.entries.keys()) def values(self): def value(key, self=self): return self.entries[key] - return list(map(value, list(self.keys()))) + return [value(k) for k in self.keys()] def items(self): def item(key, self=self): return (key, self.entries[key]) - return list(map(item, list(self.keys()))) + return [item(k) for k in self.keys()] def cvsexists(self, file): file = os.path.join("CVS", file) |