bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | 10,600 |
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | 10,601 |
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not ... | 10,602 |
def session(self): call, host_port = self.sock.recvfrom(8192) reply = self.handle(call) if reply <> None: self.sock.sendto(reply, host_port) | def session(self): call, host_port = self.sock.recvfrom(8192) reply = self.handle(call) if reply != None: self.sock.sendto(reply, host_port) | 10,603 |
def _calcbounds(self): # calculate absolute bounds relative to the window origin from our # abstract _possize attribute, which is either a 4-tuple or a callable object oldbounds = self._bounds pl, pt, pr, pb = self._parent._bounds if callable(self._possize): # _possize is callable, let it figure it out by itself: it sh... | def _calcbounds(self): # calculate absolute bounds relative to the window origin from our # abstract _possize attribute, which is either a 4-tuple or a callable object oldbounds = self._bounds pl, pt, pr, pb = self._parent._bounds if callable(self._possize): # _possize is callable, let it figure it out by itself: it sh... | 10,604 |
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | 10,605 |
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | 10,606 |
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | 10,607 |
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutter... | 10,608 |
def initpatterns(self): Scanner.initpatterns(self) self.head_pat = "^EXTERN_API(_C)?" self.type_pat = "EXTERN_API(_C)?" + \ "[ \t\n]*\([ \t\n]*" + \ "(?P<type>[a-zA-Z0-9_* \t]*[a-zA-Z0-9_*])" + \ "[ \t\n]*\)[ \t\n]*" self.whole_pat = self.type_pat + self.name_pat + self.args_pat self.sym_pat = "^[ \t]*(?P<name>[a-zA-Z0... | def _8bit = re.compile(r"[\200-\377]") def escape8bit(s): if _8bit.search(s) is not None: out = [] for c in s: o = ord(c) if o >= 128: out.append("\\" + hex(o)[1:]) else: out.append(c) s = "".join(out) return s initpatterns(self): _8bit = re.compile(r"[\200-\377]") def escape8bit(s): if _8bit.search(s) is not None: ... | 10,609 |
def open_file(self, _object=None, **args): for alias in _object: fss = alias.Resolve()[0] pathname = fss.as_pathname() sys.argv.append(pathname) self._quit() | def open_file(self, _object=None, **args): for alias in _object: fsr = alias.FSResolveAlias(None)[0] pathname = fsr.as_pathname() sys.argv.append(pathname) self._quit() | 10,610 |
def has_section(self, section): """Indicate whether the named section is present in the configuration. | def has_section(self, section): """Indicate whether the named section is present in the configuration. | 10,611 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,612 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,613 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,614 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,615 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,616 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,617 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,618 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 10,619 |
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | def getboolean(self, section, option): v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | 10,620 |
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if v.lower() not in self._boolean_states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | 10,621 |
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()] | 10,622 |
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section] | def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == DEFAULTSECT: option = self.optionxform(option) return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in se... | 10,623 |
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section] | def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif section not in self.__sections: return 0 else: option = self.optionxform(option) return option in self.__sections[section] | 10,624 |
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section] | def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section] | 10,625 |
def set(self, section, option, value): """Set an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value | def set(self, section, option, value): """Set an option.""" if not section or section == DEFAULTSECT: sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value | 10,626 |
def set(self, section, option, value): """Set an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value | def set(self, section, option, value): """Set an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value | 10,627 |
def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.sections(): fp.write("[" + section + "]\n... | def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[%s]\n" % DEFAULTSECT) for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.sections(): fp.write("[" + secti... | 10,628 |
def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.sections(): fp.write("[" + section + "]\n... | def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.__sections: fp.write("[%s]\n" % section) ... | 10,629 |
def remove_option(self, section, option): """Remove an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) existed = option in sectdict if existed: del sectdict[optio... | def remove_option(self, section, option): """Remove an option.""" if not section or section == DEFAULTSECT: sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) existed = option in sectdict if existed: del sectdict[opt... | 10,630 |
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | def remove_section(self, section): """Remove a file section.""" existed = section in self.__sections if existed: del self.__sections[section] return True else: return False | 10,631 |
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | 10,632 |
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | 10,633 |
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False | 10,634 |
def __read(self, fp, fpname): """Parse a sectioned setup file. | def __read(self, fp, fpname): """Parse a sectioned setup file. | 10,635 |
def __read(self, fp, fpname): """Parse a sectioned setup file. | def __read(self, fp, fpname): """Parse a sectioned setup file. | 10,636 |
def __read(self, fp, fpname): """Parse a sectioned setup file. | def __read(self, fp, fpname): """Parse a sectioned setup file. | 10,637 |
def __read(self, fp, fpname): """Parse a sectioned setup file. | def __read(self, fp, fpname): """Parse a sectioned setup file. | 10,638 |
def __read(self, fp, fpname): """Parse a sectioned setup file. | def __read(self, fp, fpname): """Parse a sectioned setup file. | 10,639 |
def test_open_existing_hash(self): "verify we can open a file known to be a hash v2 file" db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") db.close() | def test_open_existing_hash(self): db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") db.close() | 10,640 |
def test_whichdb(self): "verify that whichdb correctly sniffs the known hash v2 file" self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") | def test_whichdb(self): self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") | 10,641 |
def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: ... | def test_anydbm_create(self): tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: os.rmdir(tmpdir) | 10,642 |
def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: ... | def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(os.path.splitext(dbfile)[0], "c").close() ftype = whichdb.whichdb(dbfile) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) ... | 10,643 |
def execvpe(file, args, env): """execv(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the current process. args may be a list or tuple of strings. """ _execvpe(file, args, env) | def execvpe(file, args, env): """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the current process. args may be a list or tuple of strings. """ _execvpe(file, args, env) | 10,644 |
def _execvpe(file, args, env=None): from errno import ENOENT, ENOTDIR if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath ... | def _execvpe(file, args, env=None): from errno import ENOENT, ENOTDIR if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath ... | 10,645 |
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr) | def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return getattr(self, attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr) | 10,646 |
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr) | def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr) | 10,647 |
def open(self, host, port): """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) self.file = self.sock.makefile('r') | def open(self, host, port): """Setup connection to remote server on "host:port". This connection will be used by the routines: read, readline, send, shutdown. """ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) self.file = self.sock.makefile('r') | 10,648 |
def response(self, code): """Return data for response 'code' if received, or None. | def response(self, code): """Return data for response 'code' if received, or None. | 10,649 |
def logout(self): """Shutdown connection to server. | def logout(self): """Shutdown connection to server. | 10,650 |
def search(self, charset, *criteria): """Search mailbox for matching messages. | def search(self, charset, *criteria): """Search mailbox for matching messages. | 10,651 |
def status(self, mailbox, names): """Request named status conditions for mailbox. | def status(self, mailbox, names): """Request named status conditions for mailbox. | 10,652 |
def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number. | def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number. | 10,653 |
def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response. | def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response. | 10,654 |
def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name) | def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name) | 10,655 |
def _command(self, name, *args): | def _command(self, name, *args): | 10,656 |
def _command(self, name, *args): | def _command(self, name, *args): | 10,657 |
def _get_response(self): | def _get_response(self): | 10,658 |
def _get_line(self): | def _get_line(self): | 10,659 |
def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | 10,660 |
def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat | def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(getattr(M, cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat | 10,661 |
def show_compilers (): from distutils.ccompiler import show_compilers show_compilers() | def show_compilers (): from distutils.ccompiler import show_compilers show_compilers() | 10,662 |
def check_extensions_list (self, extensions): """Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e. it is a list of Extension objects. We also support the old-style list of 2-tuples, where the tuples are (ext_name, build_info), which are converted to Extension inst... | def check_extensions_list (self, extensions): """Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e. it is a list of Extension objects. We also support the old-style list of 2-tuples, where the tuples are (ext_name, build_info), which are converted to Extension inst... | 10,663 |
def build_extensions (self): | def build_extensions (self): | 10,664 |
def build_extensions (self): | def build_extensions (self): | 10,665 |
def find_swig (self): """Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. """ | def find_swig (self): """Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. """ | 10,666 |
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, f... | def _lock_file(f, dotlock=True): """Lock file f using lockf and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOC... | 10,667 |
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, f... | def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_... | 10,668 |
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, f... | def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, f... | 10,669 |
def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | def _unlock_file(f): """Unlock file f using lockf and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | 10,670 |
def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | 10,671 |
def winfo_children(self): """Return a list of all widgets which are children of this widget.""" return map(self._nametowidget, self.tk.splitlist(self.tk.call( 'winfo', 'children', self._w))) | def winfo_children(self): """Return a list of all widgets which are children of this widget.""" return map(self._nametowidget, self.tk.splitlist(self.tk.call( 'winfo', 'children', self._w))) | 10,672 |
def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'http': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost... | def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'http': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost... | 10,673 |
def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object). | def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object). | 10,674 |
def waitchild(options): pid, sts = os.wait(G.busy, options) if pid == G.busy: G.busy = 0 G.stop.enable(0) | def waitchild(options): pid, sts = os.waitpid(G.busy, options) if pid == G.busy: G.busy = 0 G.stop.enable(0) | 10,675 |
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.... | def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() s... | 10,676 |
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.... | def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.... | 10,677 |
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.... | def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(dr, vr) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.... | 10,678 |
def getscrollbarvalues(self): dr = self.ted.destRect vr = self.ted.viewRect height = self.ted.nLines * self.ted.lineHeight vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2]) vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3]) print dr, vr, height, vx, vy return vx, vy | def getscrollbarvalues(self): dr = self.ted.destRect vr = self.ted.viewRect height = self.ted.nLines * self.ted.lineHeight vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2]) vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3]) print dr, vr, height, vx, vy return None, vy | 10,679 |
def scrollbar_callback(self, which, what, value): if which == 'y': if what == 'set': height = self.ted.nLines * self.ted.lineHeight cur = self.getscrollbarvalues()[1] delta = (cur-value)*height/32767 if what == '-': delta = self.ted.lineHeight elif what == '--': delta = (self.ted.viewRect[3]-self.ted.lineHeight) if del... | def scrollbar_callback(self, which, what, value): if which == 'y': if what == 'set': height = self.ted.nLines * self.ted.lineHeight cur = self.getscrollbarvalues()[1] delta = (cur-value)*height/32767 if what == '-': delta = self.ted.lineHeight elif what == '--': delta = (self.ted.viewRect[3]-self.ted.lineHeight) if del... | 10,680 |
def idle(self, *args): for l in self._windows.values(): l.do_idle() | def idle(self, *args): for l in self._windows.values(): l.do_idle() | 10,681 |
def spam(self): return 42 | defspam(self):return42 | 10,682 |
def __new__(metaclass, name, bases, dict): # XXX Should check that name isn't already a base class name dict["__dynamic__"] = 1 cls = super(autosuper, metaclass).__new__(metaclass, name, bases, dict) # Name mangling for __super removes leading underscores while name[:1] == "_": name = name[1:] if name: name = "_%s__sup... | def __new__(metaclass, name, bases, dict): # XXX Should check that name isn't already a base class nameassert dict.get("__dynamic__", 1) cls = super(autosuper, metaclass).__new__(metaclass, name, bases, dict) # Name mangling for __super removes leading underscores while name[:1] == "_": name = name[1:] if name: name = ... | 10,683 |
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | 10,684 |
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | 10,685 |
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value) | 10,686 |
def __getitem__(self, i): if 0 <= i < 10: return i raise IndexError | def __getitem__(self, i): if 0 <= i < 10: return i raise IndexError | 10,687 |
def __repr__(self): return "%.*g" % (self.prec, self) | def __repr__(self): return "%.*g" % (self.prec, self) | 10,688 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,689 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,690 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,691 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,692 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,693 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,694 |
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) | 10,695 |
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | 10,696 |
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | 10,697 |
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)""" | 10,698 |
def getresp(self): """Internal: get a response from the server. Raise various errors if the response indicates an error.""" resp = self.getline() if self.debugging: print '*resp*', `resp` c = resp[:1] if c == '4': raise error_temp, resp if c == '5': raise error_perm, resp if c not in '123': raise error_proto, resp retu... | def getresp(self): """Internal: get a response from the server. Raise various errors if the response indicates an error.""" resp = self.getline() if self.debugging: print '*resp*', `resp` c = resp[:1] if c == '4': raise NNTPTemporaryError(resp) if c == '5': raise error_perm, resp if c not in '123': raise error_proto, r... | 10,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.