mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
Convert all remaining *simple* cases of regex usage to re usage.
This commit is contained in:
parent
426916e50e
commit
9694fcab53
23 changed files with 134 additions and 144 deletions
10
Lib/pipes.py
10
Lib/pipes.py
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
import sys
|
||||
import regex
|
||||
import re
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
|
|
@ -124,10 +124,10 @@ class Template:
|
|||
if self.steps <> [] and self.steps[-1][1] == SINK:
|
||||
raise ValueError, \
|
||||
'Template.append: already ends with SINK'
|
||||
if kind[0] == 'f' and regex.search('\$IN', cmd) < 0:
|
||||
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
|
||||
raise ValueError, \
|
||||
'Template.append: missing $IN in cmd'
|
||||
if kind[1] == 'f' and regex.search('\$OUT', cmd) < 0:
|
||||
if kind[1] == 'f' and not re.search('\$OUT\b', cmd):
|
||||
raise ValueError, \
|
||||
'Template.append: missing $OUT in cmd'
|
||||
self.steps.append((cmd, kind))
|
||||
|
|
@ -146,10 +146,10 @@ class Template:
|
|||
if self.steps <> [] and self.steps[0][1] == SOURCE:
|
||||
raise ValueError, \
|
||||
'Template.prepend: already begins with SOURCE'
|
||||
if kind[0] == 'f' and regex.search('\$IN\>', cmd) < 0:
|
||||
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
|
||||
raise ValueError, \
|
||||
'Template.prepend: missing $IN in cmd'
|
||||
if kind[1] == 'f' and regex.search('\$OUT\>', cmd) < 0:
|
||||
if kind[1] == 'f' and not re.search('\$OUT\b', cmd):
|
||||
raise ValueError, \
|
||||
'Template.prepend: missing $OUT in cmd'
|
||||
self.steps.insert(0, (cmd, kind))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue