• Home
  • Raw
  • Download

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().
72 STDIN_FILEOUT = '-f' # Must write a real file
73 FILEIN_STDOUT = 'f-' # Must read a real file
74 STDIN_STDOUT = '--' # Normal pipeline element
75 SOURCE = '.-' # Must be first, writes stdout variable
76 SINK = '-.' # Must be last, reads stdin
79 SOURCE, SINK]
116 if kind == SOURCE:
117 raise ValueError('Template.append: SOURCE can only be prepended')
118 if self.steps and self.steps[-1][1] == SINK:
134 if self.steps and self.steps[0][1] == SOURCE:
135 raise ValueError('Template.prepend: already begins with SOURCE')
142 def open(self, file, rw): member in Template
143 """t.open(file, rw) returns a pipe or file object open for
149 raise ValueError('Template.open: rw must be \'r\' or \'w\', not %r'
154 t.open(file, 'r') and t.open(file, 'w') respectively."""
156 return open(file, 'r')
157 if self.steps[-1][1] == SINK:
164 return open(file, 'w')
165 if self.steps[0][1] == SOURCE:
166 raise ValueError('Template.open_w: pipeline begins with SOURCE')
177 cmd = 'set -x; ' + cmd
192 list.append(['', 'cat', '--', ''])
198 list.insert(0, ['', 'cat', '--', ''])
201 [cmd, kind] = list[-1][1:3]
203 list.append(['', 'cat', '--', ''])
204 list[-1][-1] = outfile
210 lkind = list[i-1][2]
216 list[i-1][-1] = list[i][0] = temp
224 if kind[0] == '-' and inf:
226 if kind[1] == '-' and outf:
241 rmcmd = 'rm -f'