A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/b09184bf05 below:

Remove function re.template() and flag re.TEMPLATE (GH-32300) · python/cpython@b09184b · GitHub

File tree Expand file treeCollapse file tree 8 files changed

+7

-18

lines changed

Filter options

Expand file treeCollapse file tree 8 files changed

+7

-18

lines changed Original file line number Diff line number Diff line change

@@ -129,7 +129,7 @@

129 129

# public symbols

130 130

__all__ = [

131 131

"match", "fullmatch", "search", "sub", "subn", "split",

132 -

"findall", "finditer", "compile", "purge", "template", "escape",

132 +

"findall", "finditer", "compile", "purge", "escape",

133 133

"error", "Pattern", "Match", "A", "I", "L", "M", "S", "X", "U",

134 134

"ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",

135 135

"UNICODE", "NOFLAG", "RegexFlag",

@@ -148,8 +148,6 @@ class RegexFlag:

148 148

MULTILINE = M = _compiler.SRE_FLAG_MULTILINE # make anchors look for newline

149 149

DOTALL = S = _compiler.SRE_FLAG_DOTALL # make dot match newline

150 150

VERBOSE = X = _compiler.SRE_FLAG_VERBOSE # ignore whitespace and comments

151 -

# sre extensions (experimental, don't rely on these)

152 -

TEMPLATE = T = _compiler.SRE_FLAG_TEMPLATE # disable backtracking

153 151

DEBUG = _compiler.SRE_FLAG_DEBUG # dump pattern after compilation

154 152

__str__ = object.__str__

155 153

_numeric_repr_ = hex

@@ -231,10 +229,6 @@ def purge():

231 229

_cache.clear()

232 230

_compile_repl.cache_clear()

233 231 234 -

def template(pattern, flags=0):

235 -

"Compile a template pattern, returning a Pattern object"

236 -

return _compile(pattern, flags|T)

237 - 238 232

# SPECIAL_CHARS

239 233

# closing ')', '}' and ']'

240 234

# '-' (a range in character set)

Original file line number Diff line number Diff line change

@@ -147,8 +147,6 @@ def _compile(data, pattern, flags):

147 147

else:

148 148

emit(ANY)

149 149

elif op in REPEATING_CODES:

150 -

if flags & SRE_FLAG_TEMPLATE:

151 -

raise error("internal: unsupported template operator %r" % (op,))

152 150

if _simple(av[2]):

153 151

emit(REPEATING_CODES[op][2])

154 152

skip = _len(code); emit(0)

Original file line number Diff line number Diff line change

@@ -202,7 +202,6 @@ def _makecodes(names):

202 202

}

203 203 204 204

# flags

205 -

SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)

206 205

SRE_FLAG_IGNORECASE = 2 # case insensitive

207 206

SRE_FLAG_LOCALE = 4 # honour system locale

208 207

SRE_FLAG_MULTILINE = 8 # treat target as multiline string

@@ -245,7 +244,6 @@ def dump(f, d, prefix):

245 244

dump(f, ATCODES, "SRE")

246 245

dump(f, CHCODES, "SRE")

247 246 248 -

f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)

249 247

f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)

250 248

f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)

251 249

f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)

Original file line number Diff line number Diff line change

@@ -61,12 +61,11 @@

61 61

"x": SRE_FLAG_VERBOSE,

62 62

# extensions

63 63

"a": SRE_FLAG_ASCII,

64 -

"t": SRE_FLAG_TEMPLATE,

65 64

"u": SRE_FLAG_UNICODE,

66 65

}

67 66 68 67

TYPE_FLAGS = SRE_FLAG_ASCII | SRE_FLAG_LOCALE | SRE_FLAG_UNICODE

69 -

GLOBAL_FLAGS = SRE_FLAG_DEBUG | SRE_FLAG_TEMPLATE

68 +

GLOBAL_FLAGS = SRE_FLAG_DEBUG

70 69 71 70

class Verbose(Exception):

72 71

pass

Original file line number Diff line number Diff line change

@@ -2432,11 +2432,11 @@ def test_flags_repr(self):

2432 2432

"re.IGNORECASE|re.DOTALL|re.VERBOSE|0x100000")

2433 2433

self.assertEqual(

2434 2434

repr(~re.I),

2435 -

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DOTALL|re.VERBOSE|re.TEMPLATE|re.DEBUG")

2435 +

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DOTALL|re.VERBOSE|re.DEBUG|0x1")

2436 2436

self.assertEqual(repr(~(re.I|re.S|re.X)),

2437 -

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG")

2437 +

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DEBUG|0x1")

2438 2438

self.assertEqual(repr(~(re.I|re.S|re.X|(1<<20))),

2439 -

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG|0xffe00")

2439 +

"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DEBUG|0xffe01")

2440 2440 2441 2441 2442 2442

class ImplementationTest(unittest.TestCase):

Original file line number Diff line number Diff line change

@@ -0,0 +1,2 @@

1 +

Remove undocumented and never working function ``re.template()`` and flag

2 +

``re.TEMPLATE``.

Original file line number Diff line number Diff line change

@@ -1323,7 +1323,6 @@ pattern_repr(PatternObject *obj)

1323 1323

const char *name;

1324 1324

int value;

1325 1325

} flag_names[] = {

1326 -

{"re.TEMPLATE", SRE_FLAG_TEMPLATE},

1327 1326

{"re.IGNORECASE", SRE_FLAG_IGNORECASE},

1328 1327

{"re.LOCALE", SRE_FLAG_LOCALE},

1329 1328

{"re.MULTILINE", SRE_FLAG_MULTILINE},

Original file line number Diff line number Diff line change

@@ -86,7 +86,6 @@

86 86

#define SRE_CATEGORY_UNI_NOT_WORD 15

87 87

#define SRE_CATEGORY_UNI_LINEBREAK 16

88 88

#define SRE_CATEGORY_UNI_NOT_LINEBREAK 17

89 -

#define SRE_FLAG_TEMPLATE 1

90 89

#define SRE_FLAG_IGNORECASE 2

91 90

#define SRE_FLAG_LOCALE 4

92 91

#define SRE_FLAG_MULTILINE 8

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4