diff options
Diffstat (limited to 'Demo/pdist')
-rwxr-xr-x | Demo/pdist/cmdfw.py | 4 | ||||
-rwxr-xr-x | Demo/pdist/cmptree.py | 2 | ||||
-rwxr-xr-x | Demo/pdist/cvslib.py | 17 | ||||
-rwxr-xr-x | Demo/pdist/rrcs.py | 8 | ||||
-rwxr-xr-x | Demo/pdist/server.py | 4 |
5 files changed, 12 insertions, 23 deletions
diff --git a/Demo/pdist/cmdfw.py b/Demo/pdist/cmdfw.py index 7bcb461..ec854b1 100755 --- a/Demo/pdist/cmdfw.py +++ b/Demo/pdist/cmdfw.py @@ -104,9 +104,7 @@ class CommandFrameWork: c = c.__bases__[0] if docstrings: print("where subcommand can be:") - names = list(docstrings.keys()) - names.sort() - for name in names: + for name in sorted(docstrings.keys()): print(docstrings[name]) if self.PostUsageMessage: print(self.PostUsageMessage) diff --git a/Demo/pdist/cmptree.py b/Demo/pdist/cmptree.py index d6962e9..1e9f985e 100755 --- a/Demo/pdist/cmptree.py +++ b/Demo/pdist/cmptree.py @@ -89,7 +89,7 @@ def compare(local, remote, mode): else: print("same mtime but different sum?!?!", end=' ') print() - for name in list(lsumdict.keys()): + for name in lsumdict.keys(): if not list(rsumdict.keys()): print(repr(name), "only locally", end=' ') fl() 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) diff --git a/Demo/pdist/rrcs.py b/Demo/pdist/rrcs.py index 8d0ef03..647ecc5 100755 --- a/Demo/pdist/rrcs.py +++ b/Demo/pdist/rrcs.py @@ -71,11 +71,9 @@ def unlock(x, copts, fn): x.unlock(fn) def info(x, copts, fn): - dict = x.info(fn) - keys = list(dict.keys()) - keys.sort() - for key in keys: - print(key + ':', dict[key]) + info_dict = x.info(fn) + for key in sorted(info_dict.keys()): + print(key + ':', info_dict[key]) print('='*70) def head(x, copts, fn): diff --git a/Demo/pdist/server.py b/Demo/pdist/server.py index 98a4741..7e77971 100755 --- a/Demo/pdist/server.py +++ b/Demo/pdist/server.py @@ -101,9 +101,7 @@ class Server: def _listmethods(self, cl=None): if not cl: cl = self.__class__ - names = list(cl.__dict__.keys()) - names = [x for x in names if x[0] != '_'] - names.sort() + names = sorted([x for x in cl.__dict__.keys() if x[0] != '_']) for base in cl.__bases__: basenames = self._listmethods(base) basenames = list(filter(lambda x, names=names: x not in names, basenames)) |