replace _sre fake module literals with undefined types.

This commit is contained in:
Dave Halter
2014-06-20 11:18:54 +02:00
parent be3ac0b1c0
commit ea271c8047

View File

@@ -1,48 +1,48 @@
def compile(): def compile():
class SRE_Match(): class SRE_Match():
endpos = 1 endpos = int()
lastgroup = 0 lastgroup = int()
lastindex = 1 lastindex = int()
pos = 0 pos = int()
string = 'a' string = str()
regs = ((0, 1),) regs = ((int(), int()),)
def __init__(self, pattern): def __init__(self, pattern):
self.re = pattern self.re = pattern
def start(self): def start(self):
return 0 return int()
def end(self): def end(self):
return 1 return int()
def span(self): def span(self):
return 0, 1 return int(), int()
def expand(self): def expand(self):
return '' return str()
def group(self, nr): def group(self, nr):
return '' return str()
def groupdict(self): def groupdict(self):
return {'a', 'a'} return {str(): str()}
def groups(self): def groups(self):
return ('a',) return (str(),)
class SRE_Pattern(): class SRE_Pattern():
flags = 0 flags = int()
groupindex = {} groupindex = {}
groups = 0 groups = int()
pattern = 'a' pattern = str()
def findall(self, string, pos=None, endpos=None): def findall(self, string, pos=None, endpos=None):
""" """
findall(string[, pos[, endpos]]) --> list. findall(string[, pos[, endpos]]) --> list.
Return a list of all non-overlapping matches of pattern in string. Return a list of all non-overlapping matches of pattern in string.
""" """
return ['a'] return [str()]
def finditer(self, string, pos=None, endpos=None): def finditer(self, string, pos=None, endpos=None):
""" """
@@ -77,7 +77,7 @@ def compile():
split(string[, maxsplit = 0]) --> list. split(string[, maxsplit = 0]) --> list.
Split string by the occurrences of pattern. Split string by the occurrences of pattern.
""" """
return ['a'] return [str()]
def sub(self, repl, string, count=0): def sub(self, repl, string, count=0):
""" """
@@ -85,7 +85,7 @@ def compile():
Return the string obtained by replacing the leftmost non-overlapping Return the string obtained by replacing the leftmost non-overlapping
occurrences of pattern in string by the replacement repl. occurrences of pattern in string by the replacement repl.
""" """
return '' return str()
def subn(self, repl, string, count=0): def subn(self, repl, string, count=0):
""" """
@@ -94,6 +94,6 @@ def compile():
the leftmost non-overlapping occurrences of pattern with the the leftmost non-overlapping occurrences of pattern with the
replacement repl. replacement repl.
""" """
return ('', 1) return (str(), int())
return SRE_Pattern() return SRE_Pattern()