Lines Matching +full:open +full:- +full:source
4 ------------
12 from a disk file or from an open file, and similar for its output.
27 -----------
34 where kind is a string of two characters: the first is '-' if the
50 To open a file for reading or writing through a conversion pipeline:
51 fp = t.open(file, mode)
52 where mode is 'r' to read the file, or 'w' to write it -- just like
53 for the built-in function open() or for os.popen().
75 STDIN_FILEOUT = '-f' # Must write a real file
76 FILEIN_STDOUT = 'f-' # Must read a real file
77 STDIN_STDOUT = '--' # Normal pipeline element
78 SOURCE = '.-' # Must be first, writes stdout variable
79 SINK = '-.' # Must be last, reads stdin
82 SOURCE, SINK]
119 if kind == SOURCE:
120 raise ValueError('Template.append: SOURCE can only be prepended')
121 if self.steps and self.steps[-1][1] == SINK:
137 if self.steps and self.steps[0][1] == SOURCE:
138 raise ValueError('Template.prepend: already begins with SOURCE')
145 def open(self, file, rw): member in Template
146 """t.open(file, rw) returns a pipe or file object open for
152 raise ValueError('Template.open: rw must be \'r\' or \'w\', not %r'
157 t.open(file, 'r') and t.open(file, 'w') respectively."""
159 return open(file, 'r')
160 if self.steps[-1][1] == SINK:
167 return open(file, 'w')
168 if self.steps[0][1] == SOURCE:
169 raise ValueError('Template.open_w: pipeline begins with SOURCE')
180 cmd = 'set -x; ' + cmd
195 list.append(['', 'cat', '--', ''])
201 list.insert(0, ['', 'cat', '--', ''])
204 [cmd, kind] = list[-1][1:3]
206 list.append(['', 'cat', '--', ''])
207 list[-1][-1] = outfile
213 lkind = list[i-1][2]
219 list[i-1][-1] = list[i][0] = temp
227 if kind[0] == '-' and inf:
229 if kind[1] == '-' and outf:
244 rmcmd = 'rm -f'