mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-26 04:51:06 -05:00
utils.str.perlReToReplacer: Return picklable function to String supports py3.14
This commit is contained in:
parent
bb01d53f2f
commit
9a8e7fd98c
@ -307,9 +307,9 @@ def perlReToReplacer(s):
|
|||||||
flags = ''.join(flags)
|
flags = ''.join(flags)
|
||||||
r = perlReToPythonRe(sep.join(('', regexp, flags)))
|
r = perlReToPythonRe(sep.join(('', regexp, flags)))
|
||||||
if g:
|
if g:
|
||||||
return lambda s: r.sub(replace, s)
|
return functools.partial(r.sub, replace)
|
||||||
else:
|
else:
|
||||||
return lambda s: r.sub(replace, s, 1)
|
return functools.partial(r.sub, replace, count=1)
|
||||||
|
|
||||||
_perlVarSubstituteRe = re.compile(r'\$\{([^}]+)\}|\$([a-zA-Z][a-zA-Z0-9]*)')
|
_perlVarSubstituteRe = re.compile(r'\$\{([^}]+)\}|\$([a-zA-Z][a-zA-Z0-9]*)')
|
||||||
def perlVariableSubstitute(vars, text):
|
def perlVariableSubstitute(vars, text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user