bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = r... | def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = r... | 21,900 |
def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = r... | def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = r... | 21,901 |
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 if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cfg_target != cur_target: my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_targ... | 21,902 |
def _write_headers(self, msg): for h, v in msg.items(): # We only write the MIME-Version: header for the outermost # container message. Unfortunately, we can't use same technique # as for the Unix-From above because we don't know when # MIME-Version: will occur. if h.lower() == 'mime-version' and not self.__first: con... | def _write_headers(self, msg): for h, v in msg.items(): # We only write the MIME-Version: header for the outermost # container message. Unfortunately, we can't use same technique # as for the Unix-From above because we don't know when # MIME-Version: will occur. if h.lower() == 'mime-version' and not self.__first: con... | 21,903 |
def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split(... | def _split_header(self, name, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.... | 21,904 |
def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split(... | def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.splitl... | 21,905 |
def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split(... | def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split(... | 21,906 |
def QueueTaskDoneTest(q) try: q.task_done() except ValueError: pass else: raise TestFailed("Did not detect task count going negative") | def QueueTaskDoneTest(q): try: q.task_done() except ValueError: pass else: raise TestFailed("Did not detect task count going negative") | 21,907 |
def test_folding_of_tuples_of_constants(self): for line, elem in ( ('a = 1,2,3', '((1, 2, 3))',), ('("a","b","c")', "(('a', 'b', 'c'))",), ('a,b,c = 1,2,3', '((1, 2, 3))',), ): asm = dis_single(line) self.assert_(elem in asm) self.assert_('BUILD_TUPLE' not in asm) | def test_folding_of_tuples_of_constants(self): for line, elem in ( ('a = 1,2,3', '((1, 2, 3))'), ('("a","b","c")', "(('a', 'b', 'c'))"), ('a,b,c = 1,2,3', '((1, 2, 3))'), ('(None, 1, None)', '((None, 1, None))'), ('((1, 2), 3, 4)', '(((1, 2), 3, 4))'), ): asm = dis_single(line) self.assert_(elem in asm) self.assert_('B... | 21,908 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 21,909 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 21,910 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 21,911 |
def set_break(self, filename, lineno, temporary=0, cond = None): filename = self.canonic(filename) import linecache # Import as late as possible line = linecache.getline(filename, lineno) if not line: return 'Line %s:%d does not exist' % (filename, lineno) if not self.breaks.has_key(filename): self.breaks[filename] = [... | def set_break(self, filename, lineno, temporary=0, cond = None): filename = self.canonic(filename) import linecache # Import as late as possible line = linecache.getline(filename, lineno) if not line: return 'Line %s:%d does not exist' % (filename, lineno) if not self.breaks.has_key(filename): self.breaks[filename] = [... | 21,912 |
def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = lin... | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: return self.default(line) elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = lin... | 21,913 |
def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = lin... | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: return self.emptyline() self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = lin... | 21,914 |
def do_event(self, (dev, val)): if dev == DEVICE.REDRAW: if self.vin: self.vin.redraw(val) if self.vout: self.vout.redraw(val) | def do_event(self, dev, val): if dev == DEVICE.REDRAW: if self.vin: self.vin.redraw(val) if self.vout: self.vout.redraw(val) | 21,915 |
def cb_in_new(self, args): self.msg('') hd, tl = os.path.split(self.ifile) filename = fl.file_selector('Input video file', hd, '', tl) if not filename: return self.open_input(filename) | def cb_in_new(self, *args): self.msg('') hd, tl = os.path.split(self.ifile) filename = fl.file_selector('Input video file', hd, '', tl) if not filename: return self.open_input(filename) | 21,916 |
def cb_in_close(self, args): self.msg('') self.close_input() | def cb_in_close(self, *args): self.msg('') self.close_input() | 21,917 |
def cb_in_skip(self, args): if not self.icheck(): return if not self.vin.get(): self.err('End of input file') self.ishow() | def cb_in_skip(self, *args): if not self.icheck(): return if not self.vin.get(): self.err('End of input file') self.ishow() | 21,918 |
def cb_in_back(self, args): if not self.icheck(): return if not self.vin.backup(): self.err('Input buffer exhausted') self.ishow() | def cb_in_back(self, *args): if not self.icheck(): return if not self.vin.backup(): self.err('Input buffer exhausted') self.ishow() | 21,919 |
def cb_in_rewind(self, args): if not self.icheck(): return self.vin.rewind() self.ishow() | def cb_in_rewind(self, *args): if not self.icheck(): return self.vin.rewind() self.ishow() | 21,920 |
def cb_copy(self, args): if not self.iocheck(): return data = self.vin.get() if not data: self.err('End of input file') self.ishow() return if self.vout.getinfo() <> self.vin.getinfo(): print 'Copying info...' self.vout.setinfo(self.vin.getinfo()) self.vout.put(data) self.oshow() self.ishow() | def cb_copy(self, *args): if not self.iocheck(): return data = self.vin.get() if not data: self.err('End of input file') self.ishow() return if self.vout.getinfo() <> self.vin.getinfo(): print 'Copying info...' self.vout.setinfo(self.vin.getinfo()) self.vout.put(data) self.oshow() self.ishow() | 21,921 |
def cb_uncopy(self, args): if not self.iocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') return self.oshow() if not self.vin.backup(): self.err('Input buffer exhausted') return self.ishow() | def cb_uncopy(self, *args): if not self.iocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') return self.oshow() if not self.vin.backup(): self.err('Input buffer exhausted') return self.ishow() | 21,922 |
def cb_out_new(self, args): self.msg('') hd, tl = os.path.split(self.ofile) filename = fl.file_selector('Output video file', hd, '', tl) if not filename: return self.open_output(filename) | def cb_out_new(self, *args): self.msg('') hd, tl = os.path.split(self.ofile) filename = fl.file_selector('Output video file', hd, '', tl) if not filename: return self.open_output(filename) | 21,923 |
def cb_out_close(self, args): self.msg('') self.close_output() | def cb_out_close(self, *args): self.msg('') self.close_output() | 21,924 |
def cb_out_skip(self, arg): if not self.ocheck(): return if not self.vout.forward(): self.err('Output buffer exhausted') self.oshow() | def cb_out_skip(self, *args): if not self.ocheck(): return if not self.vout.forward(): self.err('Output buffer exhausted') self.oshow() | 21,925 |
def cb_out_back(self, args): if not self.ocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') self.oshow() | def cb_out_back(self, *args): if not self.ocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') self.oshow() | 21,926 |
def cb_out_rewind(self, args): if not self.ocheck(): return self.vout.rewind() self.oshow() | def cb_out_rewind(self, *args): if not self.ocheck(): return self.vout.rewind() self.oshow() | 21,927 |
def cb_quit(self, args): self.close_input() self.close_output() sys.exit(0) | def cb_quit(self, *args): self.close_input() self.close_output() sys.exit(0) | 21,928 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,929 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,930 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,931 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,932 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,933 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 21,934 |
def output(self, attrs=None, header="Set-Cookie:", sep="\n"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) | def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) | 21,935 |
def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | 21,936 |
def test_autoseed(self): self.gen.seed() state1 = self.gen.getstate() time.sleep(1) self.gen.seed() # diffent seeds at different times state2 = self.gen.getstate() self.assertNotEqual(state1, state2) | def test_autoseed(self): self.gen.seed() state1 = self.gen.getstate() time.sleep(1.1) self.gen.seed() # diffent seeds at different times state2 = self.gen.getstate() self.assertNotEqual(state1, state2) | 21,937 |
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_pass... | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_pass... | 21,938 |
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) | 21,939 |
def stopped(): print 'pydoc server stopped' | def stopped(): print 'pydoc server stopped' | 21,940 |
def stopped(): print 'pydoc server stopped' | def stopped(): print 'pydoc server stopped' | 21,941 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,942 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,943 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,944 |
def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") | def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") | 21,945 |
def update(self): self.w.browser.update() | def update(self): self.w.browser.update() | 21,946 |
def unpack_sequence(seq, indent = 0): items = map(None, range(len(seq)), seq) items = map(lambda (k, v), type = type, simp = SIMPLE_TYPES, indent = indent: (k, v, not type(v) in simp, indent), items) return items | def unpack_sequence(seq, indent = 0): return [(i, v, not isinstance(v, SIMPLE_TYPES), indent) for i, v in enumerate(seq)] | 21,947 |
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) | 21,948 |
def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | def __init__(self, filenames=(), strict=True): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | 21,949 |
def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = ({}, {}) self.types_map_inv = ({}, {}) for (ext, type) in types_map.items(): self.add_type(type, ext, True) for (ext, type) in common_types.items(): self.add_type(type, ... | 21,950 |
def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | 21,951 |
def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 21,952 |
def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 21,953 |
def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 21,954 |
def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. | def guess_all_extensions(self, type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would b... | 21,955 |
def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. | def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. | 21,956 |
def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.' + ... | def readfp(self, fp, strict=True): """ Read a single mime.types-format file. If strict is true, information will be added to list of standard types, else to the list of non-standard types. """ while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del w... | 21,957 |
def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.' + ... | def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.' + ... | 21,958 |
def guess_extension(type, strict=1): """Guess the extension for a file based on its MIME type. Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type `type' by ... | def guess_all_extensions(type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapp... | 21,959 |
def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | def init(files=None): global guess_all_extensions, guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffi... | 21,960 |
def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global add_type, inited inited = True db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = d... | 21,961 |
def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | 21,962 |
def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map ... | 21,963 |
def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date... | def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date... | 21,964 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 21,965 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 21,966 |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | defself.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) detect_tkinter(self,self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) inc_dirs,self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) lib_dirs):self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) #self.announce... | 21,967 |
def __init__(self, host = '', port = 0): """Initialize a new instance. | def __init__(self, host = '', port = 0): """Initialize a new instance. | 21,968 |
def __init__(self, host = '', port = 0): """Initialize a new instance. | def __init__(self, host = '', port = 0): """Initialize a new instance. | 21,969 |
def connect(self, host='localhost', port = 0): """Connect to a host on a given port. | def connect(self, host='localhost', port = 0): """Connect to a host on a given port. | 21,970 |
def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 21,971 |
def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 21,972 |
def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 21,973 |
def docmd(self, cmd, args=""): """Send a command, and return its response code.""" self.putcmd(cmd,args) (code,msg)=self.getreply() return code | def docmd(self, cmd, args=""): """Send a command, and return its response code.""" self.putcmd(cmd,args) (code,msg)=self.getreply() return code | 21,974 |
def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("helo",name) (code,msg)=self.getreply() self.helo_resp=msg return code | def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("helo",name) (code,msg)=self.getreply() self.helo_resp=msg return code | 21,975 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MT... | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MT... | 21,976 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MT... | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MT... | 21,977 |
def help(self, args=''): """SMTP 'help' command. Returns help text from server.""" self.putcmd("help", args) (code,msg)=self.getreply() return msg | def help(self, args=''): """SMTP 'help' command. Returns help text from server.""" self.putcmd("help", args) (code,msg)=self.getreply() return msg | 21,978 |
def rset(self): """SMTP 'rset' command -- resets session.""" code=self.docmd("rset") return code | def rset(self): """SMTP 'rset' command -- resets session.""" code=self.docmd("rset") return code | 21,979 |
def noop(self): """SMTP 'noop' command -- doesn't do anything :>""" code=self.docmd("noop") return code | def noop(self): """SMTP 'noop' command -- doesn't do anything :>""" code=self.docmd("noop") return code | 21,980 |
def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % ... | def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: raise SMTPDataError(code,repl) else: self.send(quotedata(msg))... | 21,981 |
def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % ... | def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % ... | 21,982 |
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 21,983 |
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 21,984 |
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 21,985 |
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 21,986 |
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 21,987 |
def _ipaddress(str): if type(str) == type(1): return str # Already numeric ptr = macdnr.StrToAddr(str) ptr.wait() return ptr.ip0 | def _ipaddress(str): if type(str) == type(1): return str # Already numeric ptr = macdnr.StrToAddr(str) ptr.wait() return ptr.ip0 | 21,988 |
def gethostbyname(str): id = _ipaddress(str) return macdnr.AddrToStr(id) | def gethostbyname(str): id = _ipaddress(str) return macdnr.AddrToStr(id) | 21,989 |
def _gethostaddress(): global _myaddrstr if _myaddrstr == None: id = _myipaddress() _myaddrstr = macdnr.AddrToStr(id) return _myaddrstr | def _gethostaddress(): global _myaddrstr if _myaddrstr == None: id = _myipaddress() _myaddrstr = macdnr.AddrToStr(id) return _myaddrstr | 21,990 |
def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family %d not supported' % type if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | 21,991 |
def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | 21,992 |
def fromfd(*args): raise my_error, 'Operation not supported on a mac' | def fromfd(*args): raise my_error, 'Operation not supported on a mac' | 21,993 |
def accept(self, *args): raise my_error, 'Operation not supported on this socket' | def unsupported(self, *args): raise my_error, 'Operation not supported on this socket' | 21,994 |
def accept(self, *args): raise my_error, 'Operation not supported on this socket' | def accept(self, *args): raise my_error, 'Operation not supported on this socket' | 21,995 |
def accept(self): if not self.listening: raise my_error, 'Not listening' self.listening = 0 self.stream.wait() self.accepted = 1 return self, self.getsockname() | def accept(self): if not self.listening: raise my_error, 'Not listening' self.listening = 0 self.stream.wait() self.accepted = 1 return self, self.getsockname() | 21,996 |
def close(self): if self.accepted: self.accepted = 0 return self.stream.Abort() | def close(self): if self.accepted: self.accepted = 0 return self.stream.Abort() | 21,997 |
def makefile(self, rw): return _socketfile(self) | def makefile(self, rw = 'r'): return _socketfile(self, rw) | 21,998 |
def bytes_writeable(self): st = self.stream.Status() return st.sendWindow - st.sendUnacked; | def bytes_writeable(self): st = self.stream.Status() return st.sendWindow - st.sendUnacked; | 21,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.