summaryrefslogtreecommitdiffstats
path: root/Demo/pdist/cvslib.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2007-08-06 21:07:53 (GMT)
committerSkip Montanaro <skip@pobox.com>2007-08-06 21:07:53 (GMT)
commit1e8ce58f5d0db22714d65ff440045a7526ed394d (patch)
treef705fb923334cffa32492a5bddfcca46ecc27f0a /Demo/pdist/cvslib.py
parent28a181cbe82bc79df3b881b79b19e12b2e39911b (diff)
downloadcpython-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-xDemo/pdist/cvslib.py17
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)