summaryrefslogtreecommitdiffstats
path: root/Lib/pipes.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-12-12 23:20:45 (GMT)
committerFred Drake <fdrake@acm.org>2000-12-12 23:20:45 (GMT)
commit8152d32375c40bba9ccbe43b780ebe96d9617781 (patch)
treef10aba5ba6f1e3064b26d2edfd6fffb45378245d /Lib/pipes.py
parentc140131995c67b1cd001b5c27e0095c53b1204b4 (diff)
downloadcpython-8152d32375c40bba9ccbe43b780ebe96d9617781.zip
cpython-8152d32375c40bba9ccbe43b780ebe96d9617781.tar.gz
cpython-8152d32375c40bba9ccbe43b780ebe96d9617781.tar.bz2
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
Diffstat (limited to 'Lib/pipes.py')
-rw-r--r--Lib/pipes.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/pipes.py b/Lib/pipes.py
index 4057fac..3aa1bf1 100644
--- a/Lib/pipes.py
+++ b/Lib/pipes.py
@@ -110,7 +110,7 @@ class Template:
def append(self, cmd, kind):
"""t.append(cmd, kind) adds a new step at the end."""
- if type(cmd) <> type(''):
+ if type(cmd) is not type(''):
raise TypeError, \
'Template.append: cmd must be a string'
if kind not in stepkinds:
@@ -119,7 +119,7 @@ class Template:
if kind == SOURCE:
raise ValueError, \
'Template.append: SOURCE can only be prepended'
- if self.steps <> [] and self.steps[-1][1] == SINK:
+ if self.steps and self.steps[-1][1] == SINK:
raise ValueError, \
'Template.append: already ends with SINK'
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
@@ -132,7 +132,7 @@ class Template:
def prepend(self, cmd, kind):
"""t.prepend(cmd, kind) adds a new step at the front."""
- if type(cmd) <> type(''):
+ if type(cmd) is not type(''):
raise TypeError, \
'Template.prepend: cmd must be a string'
if kind not in stepkinds:
@@ -141,7 +141,7 @@ class Template:
if kind == SINK:
raise ValueError, \
'Template.prepend: SINK can only be appended'
- if self.steps <> [] and self.steps[0][1] == SOURCE:
+ if self.steps and self.steps[0][1] == SOURCE:
raise ValueError, \
'Template.prepend: already begins with SOURCE'
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
@@ -165,7 +165,7 @@ class Template:
def open_r(self, file):
"""t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively."""
- if self.steps == []:
+ if not self.steps:
return open(file, 'r')
if self.steps[-1][1] == SINK:
raise ValueError, \
@@ -174,7 +174,7 @@ class Template:
return os.popen(cmd, 'r')
def open_w(self, file):
- if self.steps == []:
+ if not self.steps:
return open(file, 'w')
if self.steps[0][1] == SOURCE:
raise ValueError, \
@@ -203,7 +203,7 @@ def makepipeline(infile, steps, outfile):
#
# Make sure there is at least one step
#
- if list == []:
+ if not list:
list.append(['', 'cat', '--', ''])
#
# Take care of the input and output ends