bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def __init__(self, name=None, mode="r", fileobj=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for readin...
def __init__(self, name=None, mode="r", fileobj=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for readin...
13,700
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
13,701
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
13,702
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
13,703
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
13,704
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
13,705
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
13,706
def add(self, name, arcname=None, recursive=True): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `re...
def add(self, name, arcname=None, recursive=True): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `re...
13,707
def tag_add(self, tagName, index1, index2=None): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2)
def tag_add(self, tagName, index1, *args): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2)
13,708
def tag_add(self, tagName, index1, index2=None): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2)
def tag_add(self, tagName, index1, index2=None): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2)
13,709
def __init__(self, url, data=None, headers={}): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self.data = data self.headers = {} for key, value in headers.iteritems(): se...
def __init__(self, url, data=None, headers={}): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self.data = data self.headers = {} for key, value in headers.items(): self.a...
13,710
def check_cache(self): # first check for old ones t = time.time() if self.soonest <= t: for k, v in self.timeout.iteritems(): if v < t: self.cache[k].close() del self.cache[k] del self.timeout[k] self.soonest = min(self.timeout.values())
def check_cache(self): # first check for old ones t = time.time() if self.soonest <= t: for k, v in self.timeout.items(): if v < t: self.cache[k].close() del self.cache[k] del self.timeout[k] self.soonest = min(self.timeout.values())
13,711
def read(self): # Note: no size argument -- read until EOF only! return self.readlines().join('')
def read(self): # Note: no size argument -- read until EOF only! return self.readlines().join('')
13,712
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl(open(url2pathname(file), 'r...
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl(open(url2pathname(file), 'r')...
13,713
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), self.openedurl) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl(open(url2pathname(file), 'r...
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'r'), noheaders(), 'file:'+file) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl(open(url2pathname(file), 'r')...
13,714
def process_rawq(self): """Transfer from raw queue to cooked queue.
def process_rawq(self): """Transfer from raw queue to cooked queue.
13,715
def process_rawq(self): """Transfer from raw queue to cooked queue.
def process_rawq(self): """Transfer from raw queue to cooked queue.
13,716
def process_rawq(self): """Transfer from raw queue to cooked queue.
def process_rawq(self): """Transfer from raw queue to cooked queue.
13,717
def process_rawq(self): """Transfer from raw queue to cooked queue.
def process_rawq(self): """Transfer from raw queue to cooked queue.
13,718
def process_rawq(self): """Transfer from raw queue to cooked queue.
def process_rawq(self): """Transfer from raw queue to cooked queue.
13,719
def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() self.ted.WEInsert(stuff, None, None) selstart, selend = self.getselection() self._inputstart = selstart self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() if self._parentwindow.wid.GetWindowPort...
def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() try: self.ted.WEInsert(stuff, None, None) finally: self._buf = "" selstart, selend = self.getselection() self._inputstart = selstart self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() if self._p...
13,720
def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() self.ted.WEInsert(stuff, None, None) selstart, selend = self.getselection() self._inputstart = selstart self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() if self._parentwindow.wid.GetWindowPort...
def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() self.ted.WEInsert(stuff, None, None) selstart, selend = self.getselection() self._inputstart = selstart self.ted.WEClearUndo() self.updatescrollbars() if self._parentwindow.wid.GetWindowPort().QDIsPortBuff...
13,721
def flush(self): self.show() stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') end = self.w.outputtext.ted.WEGetTextLength() self.w.outputtext.setselection(end, end) self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 0) self.w.outputtext.ted.WEInsert(stuff, None, None) self._buf = "" self....
def flush(self): self.show() stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') end = self.w.outputtext.ted.WEGetTextLength() self.w.outputtext.setselection(end, end) self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 0) try: self.w.outputtext.ted.WEInsert(stuff, None, None) finally: self._...
13,722
def ckmsg(src, msg): try: compile(src, '<fragment>', 'exec') except SyntaxError, e: print e.msg if e.msg == msg: print "ok" else: print "expected:", msg else: print "failed to get expected SyntaxError"
def ckmsg(src, msg): try: compile(src, '<fragment>', 'exec') except SyntaxError, e: print e.msg if e.msg == msg: print "ok" else: print "expected:", msg else: print "failed to get expected SyntaxError"
13,723
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
13,724
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t...
def command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() commit(self, command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() entry): command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() file command = interpolate(SH_LOCK, file=f...
13,725
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t...
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t...
13,726
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t...
deflog("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") commit(self,log("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") entry):log("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") filelog...
13,727
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,728
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,729
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,730
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,731
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,732
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,733
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,734
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple.
13,735
def run (self):
def run (self):
13,736
def run (self):
def run (self):
13,737
def run (self):
def run (self):
13,738
def com_call_function(self, primaryNode, nodelist): if nodelist[0] == token.RPAR: return CallFunc(primaryNode, [], lineno=extractLineNo(nodelist)) args = [] kw = 0 len_nodelist = len(nodelist) for i in range(1, len_nodelist, 2): node = nodelist[i] if node[0] == token.STAR or node[0] == token.DOUBLESTAR: break kw, resul...
def com_call_function(self, primaryNode, nodelist): if nodelist[0] == token.RPAR: return CallFunc(primaryNode, [], lineno=extractLineNo(nodelist)) args = [] kw = 0 len_nodelist = len(nodelist) for i in range(1, len_nodelist, 2): node = nodelist[i] if node[0] == token.STAR or node[0] == token.DOUBLESTAR: break kw, resul...
13,739
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
13,740
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
13,741
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), tim...
13,742
def print_log(self): self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log)) i, n = self._cmd_log_idx, self._cmd_log_len while n: try: apply(self._mesg, self._cmd_log[i]) except: pass i += 1 if i >= self._cmd_log_len: i = 0 n -= 1
def print_log(self): self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log)) i, n = self._cmd_log_idx, self._cmd_log_len while n: try: apply(self._mesg, self._cmd_log[i]) except: pass i += 1 if i >= self._cmd_log_len: i = 0 n -= 1
13,743
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
13,744
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
13,745
def test_1229380(): import sys for endian in ('', '>', '<'): for cls in (int, long): for fmt in ('B', 'H', 'I', 'L'): deprecated_err(struct.pack, endian + fmt, cls(-1)) deprecated_err(struct.pack, endian + 'B', cls(300)) deprecated_err(struct.pack, endian + 'H', cls(70000)) deprecated_err(struct.pack, endian + 'I', s...
def test_1229380(): import sys for endian in ('', '>', '<'): for cls in (int, long): for fmt in ('B', 'H', 'I', 'L'): deprecated_err(struct.pack, endian + fmt, cls(-1)) deprecated_err(struct.pack, endian + 'B', cls(300)) deprecated_err(struct.pack, endian + 'H', cls(70000)) deprecated_err(struct.pack, endian + 'I', s...
13,746
def remove_stderr_debug_decorations(stderr): if __debug__: stderr = re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) return stderr
def remove_stderr_debug_decorations(stderr): return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr)
13,747
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
13,748
def __neg__(self, context=None): """Returns a copy with the sign switched.
def __neg__(self, context=None): """Returns a copy with the sign switched.
13,749
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.
13,750
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
13,751
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
13,752
def __add__(self, other, context=None): """Returns self + other.
def __add__(self, other, context=None): """Returns self + other.
13,753
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
13,754
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
13,755
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
13,756
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
13,757
def __mul__(self, other, context=None): """Return self * other.
def __mul__(self, other, context=None): """Return self * other.
13,758
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.
13,759
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.
13,760
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.
13,761
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)
13,762
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)
13,763
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.
13,764
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.
13,765
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.
13,766
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.
13,767
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...
13,768
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)
13,769
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"""
13,770
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.
13,771
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.
13,772
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.
13,773
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.
13,774
def to_integral(self, rounding = None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if self._is_special: ans = self._check_nans(context=context) if ans: return ans if self._exp >= 0: return self if context is None: context = getcontext() flags = context._ignore_flags(Rounded, In...
def to_integral(self, rounding=None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if self._is_special: ans = self._check_nans(context=context) if ans: return ans if self._exp >= 0: return self if context is None: context = getcontext() flags = context._ignore_flags(Rounded, Inex...
13,775
def sqrt(self, context=None): """Return the square root of self.
def sqrt(self, context=None): """Return the square root of self.
13,776
def sqrt(self, context=None): """Return the square root of self.
def sqrt(self, context=None): """Return the square root of self.
13,777
def max(self, other, context=None): """Returns the larger value.
def max(self, other, context=None): """Returns the larger value.
13,778
def min(self, other, context=None): """Returns the smaller value.
def min(self, other, context=None): """Returns the smaller value.
13,779
def create_decimal(self, num='0'): """Creates a new Decimal instance but using self as context.""" d = Decimal(num, context=self) return d._fix(context=self)
def create_decimal(self, num='0'): """Creates a new Decimal instance but using self as context.""" d = Decimal(num, context=self) return d._fix(context=self)
13,780
def _apply(self, a): return str(a._fix(context=self))
def _apply(self, a): return str(a._fix(context=self))
13,781
def reset(self): self.__buf = ''
def reset(self): self.__buf = ''
13,782
def get_buffer(self): return self.__buf
def get_buffer(self): return self.__buf
13,783
def pack_uint(self, x): self.__buf = self.__buf + struct.pack('>L', x)
def pack_uint(self, x): self.__buf = self.__buf + struct.pack('>L', x)
13,784
def pack_bool(self, x): if x: self.__buf = self.__buf + '\0\0\0\1' else: self.__buf = self.__buf + '\0\0\0\0'
def pack_bool(self, x): if x: self.__buf = self.__buf + '\0\0\0\1' else: self.__buf = self.__buf + '\0\0\0\0'
13,785
def pack_float(self, x): try: self.__buf = self.__buf + struct.pack('>f', x) except struct.error, msg: raise ConversionError, msg
def pack_float(self, x): try: self.__buf.write(struct.pack('>f', x)) except struct.error, msg: raise ConversionError, msg
13,786
def pack_double(self, x): try: self.__buf = self.__buf + struct.pack('>d', x) except struct.error, msg: raise ConversionError, msg
def pack_double(self, x): try: self.__buf.write(struct.pack('>d', x)) except struct.error, msg: raise ConversionError, msg
13,787
def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' n = ((n+3)/4)*4 data = s[:n] data = data + (n - len(data)) * '\0' self.__buf = self.__buf + data
def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' n = ((n+3)/4)*4 data = s[:n] data = data + (n - len(data)) * '\0' self.__buf = self.__buf + data
13,788
def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() self._rev = self.__class__("".join(L)) return self._rev
defverify(str(s).__class__ is str) rev(self):verify(str(s).__class__ is str) ifverify(str(s).__class__ is str) self._revverify(str(s).__class__ is str) isverify(str(s).__class__ is str) notverify(str(s).__class__ is str) None:verify(str(s).__class__ is str) returnverify(str(s).__class__ is str) self._revverify(str(s)._...
13,789
def __init__(self, flist=None, filename=None, key=None, root=None): if EditorWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.isdir('...
def __init__(self, flist=None, filename=None, key=None, root=None): if EditorWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.isdir('...
13,790
def run(self): # Copies all .py files, then also copies the txt and gif files build_py.run(self) assert self.packages == [idlelib] for name in txt_files: outfile = self.get_plain_outfile(self.build_lib, [idlelib], name) dir = os.path.dirname(outfile) self.mkpath(dir) self.copy_file(name, outfile, preserve_mode = 0) for...
def run(self): # Copies all .py files, then also copies the txt and gif files build_py.run(self) assert self.packages == [idlelib] for name in txt_files: outfile = self.get_plain_outfile(self.build_lib, [idlelib], name) dir = os.path.dirname(outfile) self.mkpath(dir) self.copy_file(os.path.join(package_dir, name), outf...
13,791
def get_source_files(self): # returns the .py files, the .txt files, and the icons icons = [os.path.join("Icons",name) for name in Icons] return build_py.get_source_files(self)+txt_files+icons
def get_source_files(self): # returns the .py files, the .txt files, and the icons icons = [os.path.join(package_dir, "Icons",name) for name in Icons] txts = [os.path.join(package_dir, name) for name in txt_files] return build_py.get_source_files(self)+txt_files+icons
13,792
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
13,793
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
13,794
def tearDown(self): del self.db
def tearDown(self): del self.db
13,795
def __getitem__(self, i): return self.seq[i]
def __getitem__(self, i): return self.seq[i]
13,796
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
13,797
def setUp(self): TestMailbox.setUp(self) if os.name in ('nt', 'os2'): self._box.colon = '!'
def setUp(self): TestMailbox.setUp(self) if os.name in ('nt', 'os2') or sys.platform == 'cygwin': self._box.colon = '!'
13,798
def test_lock_conflict(self): # Fork off a subprocess that will lock the file for 2 seconds, # unlock it, and then exit. if not hasattr(os, 'fork'): return pid = os.fork() if pid == 0: # In the child, lock the mailbox. self._box.lock() time.sleep(2) self._box.unlock() os._exit(0)
def test_lock_conflict(self): # Fork off a subprocess that will lock the file for 2 seconds, # unlock it, and then exit. if not hasattr(os, 'fork'): return pid = os.fork() if pid == 0: # In the child, lock the mailbox. self._box.lock() time.sleep(2) self._box.unlock() os._exit(0)
13,799