MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / prepend

Method prepend

tools/python-3.11.9-amd64/Lib/pipes.py:129–143  ·  view source on GitHub ↗

t.prepend(cmd, kind) adds a new step at the front.

(self, cmd, kind)

Source from the content-addressed store, hash-verified

127 self.steps.append((cmd, kind))
128
129 def prepend(self, cmd, kind):
130 """t.prepend(cmd, kind) adds a new step at the front."""
131 if not isinstance(cmd, str):
132 raise TypeError('Template.prepend: cmd must be a string')
133 if kind not in stepkinds:
134 raise ValueError('Template.prepend: bad kind %r' % (kind,))
135 if kind == SINK:
136 raise ValueError('Template.prepend: SINK can only be appended')
137 if self.steps and self.steps[0][1] == SOURCE:
138 raise ValueError('Template.prepend: already begins with SOURCE')
139 if kind[0] == 'f' and not re.search(r'\$IN\b', cmd):
140 raise ValueError('Template.prepend: missing $IN in cmd')
141 if kind[1] == 'f' and not re.search(r'\$OUT\b', cmd):
142 raise ValueError('Template.prepend: missing $OUT in cmd')
143 self.steps.insert(0, (cmd, kind))
144
145 def open(self, file, rw):
146 """t.open(file, rw) returns a pipe or file object open for

Callers

nothing calls this directly

Calls 2

searchMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected