bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,100
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,101
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,102
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,103
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,104
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,105
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,106
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,107
def b(): 'my docstring' pass
def b(): 'my docstring' pass
25,108
def another(): pass
def another(): pass
25,109
def temp(): print 1
def temp(): print 1
25,110
def getMessage(self): """ Return the message for this LogRecord.
def getMessage(self): """ Return the message for this LogRecord.
25,111
def openfile(filename): path = os.path.join(os.path.dirname(test_email.__file__), 'data', filename) return open(path)
def openfile(filename): path = os.path.join(os.path.dirname(test_support_file), 'data', filename) return open(path)
25,112
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestMessageAPI)) suite.addTest(unittest.makeSuite(TestEncoders)) suite.addTest(unittest.makeSuite(TestLongHeaders)) suite.addTest(unittest.makeSuite(TestFromMangling)) suite.addTest(unittest.makeSuite(TestMIMEAudio)) suite.addTest(unittest.makeS...
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestMessageAPI)) suite.addTest(unittest.makeSuite(TestEncoders)) suite.addTest(unittest.makeSuite(TestLongHeaders)) suite.addTest(unittest.makeSuite(TestFromMangling)) suite.addTest(unittest.makeSuite(TestMIMEAudio)) suite.addTest(unittest.makeS...
25,113
def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to # self._handle_maintype_subtype(). If there's no handler for the full # MIME type, then dispatch to self._handle_maintype(). If that's # missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: ...
def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to # self._handle_maintype_subtype(). If there's no handler for the full # MIME type, then dispatch to self._handle_maintype(). If that's # missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: ...
25,114
def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to # self._handle_maintype_subtype(). If there's no handler for the full # MIME type, then dispatch to self._handle_maintype(). If that's # missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: ...
def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to # self._handle_maintype_subtype(). If there's no handler for the full # MIME type, then dispatch to self._handle_maintype(). If that's # missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: ...
25,115
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = msg.get_bound...
25,116
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
25,117
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
25,118
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
25,119
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has every been attached boundary = m...
25,120
def _handle_multipart_digest(self, msg): self._handle_multipart(msg, isdigest=1)
def _handle_multipart_digest(self, msg): self._handle_multipart(msg, isdigest=1)
25,121
def _handle_message_delivery_status(self, msg): # We can't just write the headers directly to self's file object # because this will leave an extra newline between the last header # block and the boundary. Sigh. blocks = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__...
def _handle_message_delivery_status(self, msg): # We can't just write the headers directly to self's file object # because this will leave an extra newline between the last header # block and the boundary. Sigh. blocks = [] for part in msg.get_payload(): s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=0) tex...
25,122
def _handle_message(self, msg): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart.Extract that object, stringify it, and write #...
def _handle_message(self, msg): s = StringIO() g = self.clone(s) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart.Extract that object, stringify it, and write # that out. g.flatten(msg.get_payload(0), unix...
25,123
def _handle_message(self, msg): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart.Extract that object, stringify it, and write #...
def _handle_message(self, msg): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart.Extract that object, stringify it, and write #...
25,124
def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread.""" self.finish_request(request, client_address) self.close_request(request)
def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread.""" self.finish_request(request, client_address) self.close_request(request)
25,125
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag ...
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag ...
25,126
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
25,127
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
25,128
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
25,129
def visit(pattern, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname n = len(pattern) for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if linkto[:n] == pattern: print name, '->', linkto except os.error: pass
def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') if len(args) < 2: raise getopt.error, 'not enough arguments' except getopt.error, msg: sys.stdout = sys.stderr print msg print 'usage: findlinksto pattern directory ...' sys.exit(2) pat, dirs = args[0], args[1:] prog = regex.compile(pat) for dirname in dirs:...
25,130
def visit(pattern, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname n = len(pattern) for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if linkto[:n] == pattern: print name, '->', linkto except os.error: pass
def visit(pattern, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if linkto[:n] == pattern: print name, '->', linkto except os.error: pass
25,131
def visit(pattern, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname n = len(pattern) for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if linkto[:n] == pattern: print name, '->', linkto except os.error: pass
def visit(pattern, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname n = len(pattern) for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if prog.search(linkto) >= 0: print name, '->', linkto except os.error: pa...
25,132
def _compile(code, pattern, flags): # internal: compile a (sub)pattern emit = code.append for op, av in pattern: if op in (LITERAL, NOT_LITERAL): if flags & SRE_FLAG_IGNORECASE: emit(OPCODES[OP_IGNORE[op]]) emit(_sre.getlower(av, flags)) else: emit(OPCODES[op]) emit(av) elif op is IN: if flags & SRE_FLAG_IGNORECASE: em...
def _compile(code, pattern, flags): # internal: compile a (sub)pattern emit = code.append for op, av in pattern: if op in LITERAL_CODES: if flags & SRE_FLAG_IGNORECASE: emit(OPCODES[OP_IGNORE[op]]) emit(_sre.getlower(av, flags)) else: emit(OPCODES[op]) emit(av) elif op is IN: if flags & SRE_FLAG_IGNORECASE: emit(OPCODE...
25,133
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,134
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,135
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,136
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,137
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,138
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,139
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,140
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,141
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,142
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,143
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,144
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,145
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,146
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,147
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,148
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,149
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,150
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,151
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
25,152
def _compile_charset(charset, flags, code, fixup=None): # compile charset subprogram emit = code.append if fixup is None: fixup = lambda x: x for op, av in _optimize_charset(charset, fixup): emit(OPCODES[op]) if op is NEGATE: pass elif op is LITERAL: emit(fixup(av)) elif op is RANGE: emit(fixup(av[0])) emit(fixup(av[1]...
def _compile_charset(charset, flags, code, fixup=None): # compile charset subprogram emit = code.append if fixup is None: fixup = _identityfunction for op, av in _optimize_charset(charset, fixup): emit(OPCODES[op]) if op is NEGATE: pass elif op is LITERAL: emit(fixup(av)) elif op is RANGE: emit(fixup(av[0])) emit(fixup...
25,153
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: outappend((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: #...
25,154
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
25,155
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
25,156
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
25,157
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
def _optimize_charset(charset, fixup): # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: ...
25,158
def _mk_bitmap(bits): data = [] if _sre.CODESIZE == 2: start = (1, 0) else: start = (1L, 0L) m, v = start for c in bits: if c: v = v + m m = m << 1 if m > MAXCODE: data.append(v) m, v = start return data
def _mk_bitmap(bits): data = [] if _sre.CODESIZE == 2: start = (1, 0) else: start = (1L, 0L) m, v = start for c in bits: if c: v = v + m m = m + m if m > MAXCODE: data.append(v) m, v = start return data
25,159
def _mk_bitmap(bits): data = [] if _sre.CODESIZE == 2: start = (1, 0) else: start = (1L, 0L) m, v = start for c in bits: if c: v = v + m m = m << 1 if m > MAXCODE: data.append(v) m, v = start return data
def _mk_bitmap(bits): data = [] if _sre.CODESIZE == 2: start = (1, 0) else: start = (1L, 0L) m, v = start for c in bits: if c: v = v + m m = m << 1 if m > MAXCODE: dataappend(v) m, v = start return data
25,160
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op i...
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in xrange(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op ...
25,161
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op i...
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op i...
25,162
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op i...
def _optimize_unicode(charset, fixup): try: import array except ImportError: return charset charmap = [False]*65536 negate = 0 try: for op, av in charset: if op is NEGATE: negate = 1 elif op is LITERAL: charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op i...
25,163
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,164
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,165
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,166
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,167
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,168
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
def _compile_info(code, pattern, flags): # internal: compile an info block. in the current version, # this contains min/max pattern width, and an optional literal # prefix or a character map lo, hi = pattern.getwidth() if lo == 0: return # not worth it # look for a literal prefix prefix = [] prefix_skip = 0 charset = ...
25,169
def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def').""" # XXX Can speed this up an order of magnitude safe = always_safe + safe res = list(s) for i in range(len(res)): c = res[i] if c not in safe: res[i] = '%%%02x' % ord(c) return string.joinfields(res, '')
def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def'.""" # XXX Can speed this up an order of magnitude safe = always_safe + safe res = list(s) for i in range(len(res)): c = res[i] if c not in safe: res[i] = '%%%02x' % ord(c) return string.joinfields(res, '')
25,170
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
25,171
def _command(self, name, *args):
def _command(self, name, *args):
25,172
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() _local.__decimal_context__ = context
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() _local.__decimal_context__ = context
25,173
def __neg__(self, context=None): """Returns a copy with the sign switched.
def __neg__(self, context=None): """Returns a copy with the sign switched.
25,174
def __pos__(self, context=None): """Returns a copy, unless it is a sNaN.
def __pos__(self, context=None): """Returns a copy, unless it is a sNaN.
25,175
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
25,176
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
25,177
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
25,178
def _increment(self, round=1, context=None): """Special case of add, adding 1eExponent
def _increment(self, round=1, context=None): """Special case of add, adding 1eExponent
25,179
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
25,180
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
25,181
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
25,182
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
25,183
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
25,184
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
25,185
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
def _divide(self, other, divmod = 0, context=None): """Return a / b, to context.prec precision.
25,186
def remainder_near(self, other, context=None): """ Remainder nearest to 0- abs(remainder-near) <= other/2 """ other = _convert_other(other)
def remainder_near(self, other, context=None): """ Remainder nearest to 0- abs(remainder-near) <= other/2 """ other = _convert_other(other)
25,187
def remainder_near(self, other, context=None): """ Remainder nearest to 0- abs(remainder-near) <= other/2 """ other = _convert_other(other)
def remainder_near(self, other, context=None): """ Remainder nearest to 0- abs(remainder-near) <= other/2 """ other = _convert_other(other)
25,188
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
def _fix(self, context): """Round if it is necessary to keep self within prec precision.
25,189
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
25,190
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
25,191
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision.
25,192
def _fixexponents(self, prec=None, rounding=None, folddown=None, context=None): """Fix the exponents and return a copy with the exponent in bounds.""" if self._is_special: return self if context is None: context = getcontext() if prec is None: prec = context.prec if folddown is None: folddown = context._clamp Emin = co...
def _fixexponents(self, prec, context): """Fix the exponents and return a copy with the exponent in bounds. Only call if known to not be a special value. """ folddown = context._clamp Emin = context.Emin ans = Decimal(self) ans_adjusted = ans.adjusted() if ans_adjusted < Emin: Etiny = context.Etiny() if ans._exp < Etin...
25,193
def __pow__(self, n, modulo = None, context=None): """Return self ** n (mod modulo)
def __pow__(self, n, modulo = None, context=None): """Return self ** n (mod modulo)
25,194
def normalize(self, context=None): """Normalize- strip trailing 0s, change anything equal to 0 to 0e0"""
def normalize(self, context=None): """Normalize- strip trailing 0s, change anything equal to 0 to 0e0"""
25,195
def quantize(self, exp, rounding = None, context=None, watchexp = 1): """Quantize self so its exponent is the same as that of exp.
def quantize(self, exp, rounding=None, context=None, watchexp=1): """Quantize self so its exponent is the same as that of exp.
25,196
def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp.
def _rescale(self, exp, rounding=None, context=None, watchexp=1): """Rescales so that the exponent is exp.
25,197
def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp.
def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp.
25,198
def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp.
def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp.
25,199