mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
- restored 1.5.2 compatibility (sorry, eric)
- removed __all__ cruft from internal modules (sorry, skip) - don't assume ASCII for string escapes (sorry, per)
This commit is contained in:
parent
ae7636753e
commit
f2989b22ff
5 changed files with 39 additions and 31 deletions
14
Lib/sre.py
14
Lib/sre.py
|
@ -17,9 +17,14 @@
|
|||
import sre_compile
|
||||
import sre_parse
|
||||
|
||||
__all__ = ["match","search","sub","subn","split","findall","compile",
|
||||
"purge","template","escape","I","L","M","S","X","U","IGNORECASE",
|
||||
"LOCALE","MULTILINE","DOTALL","VERBOSE","UNICODE","error"]
|
||||
# public symbols
|
||||
__all__ = [ "match", "search", "sub", "subn", "split", "findall",
|
||||
"compile", "purge", "template", "escape", "I", "L", "M", "S", "X",
|
||||
"U", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",
|
||||
"UNICODE", "error" ]
|
||||
|
||||
# this module works under 1.5.2 and later. don't use string methods
|
||||
import string
|
||||
|
||||
# flags
|
||||
I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
|
||||
|
@ -88,7 +93,6 @@ def purge():
|
|||
|
||||
def template(pattern, flags=0):
|
||||
"Compile a template pattern, returning a pattern object"
|
||||
|
||||
return _compile(pattern, flags|T)
|
||||
|
||||
def escape(pattern):
|
||||
|
@ -111,7 +115,7 @@ _MAXCACHE = 100
|
|||
|
||||
def _join(seq, sep):
|
||||
# internal: join into string having the same type as sep
|
||||
return sep[:0].join(seq)
|
||||
return string.join(seq, sep[:0])
|
||||
|
||||
def _compile(*key):
|
||||
# internal: compile pattern
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue