bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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 error_temp, resp if c == '5': raise NNTPPermanentError(resp) if c not in '123': raise error_proto, r...
10,700
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 error_temp, resp if c == '5': raise error_perm, resp if c not in '123': raise NNTPProtocolError(resp...
10,701
def getlongresp(self): """Internal: get a response plus following text from the server. Raise various errors if the response indicates an error.""" resp = self.getresp() if resp[:3] not in LONGRESP: raise error_reply, resp list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1...
def getlongresp(self): """Internal: get a response plus following text from the server. Raise various errors if the response indicates an error.""" resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = lin...
10,702
def group(self, name): """Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if succesful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: the group name"""
def group(self, name): """Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if succesful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: the group name"""
10,703
def statparse(self, resp): """Internal: parse the response of a STAT, NEXT or LAST command.""" if resp[:2] <> '22': raise error_reply, resp words = string.split(resp) nr = 0 id = '' n = len(words) if n > 1: nr = words[1] if n > 2: id = words[2] return resp, nr, id
def statparse(self, resp): """Internal: parse the response of a STAT, NEXT or LAST command.""" if resp[:2] <> '22': raise NNTPReplyError(resp) words = string.split(resp) nr = 0 id = '' n = len(words) if n > 1: nr = words[1] if n > 2: id = words[2] return resp, nr, id
10,704
def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if succesful - list: list of (art-nr, subject, poster, date, id, references, size, lines)"""
def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if succesful - list: list of (art-nr, subject, poster, date, id, references, size, lines)"""
10,705
def xpath(self,id): """Process an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if succesful path: directory path to article"""
def xpath(self,id): """Process an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if succesful path: directory path to article"""
10,706
def xpath(self,id): """Process an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if succesful path: directory path to article"""
def xpath(self,id): """Process an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if succesful path: directory path to article"""
10,707
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
10,708
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
10,709
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if succesful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc."""
10,710
def post(self, f): """Process a POST command. Arguments: - f: file containing the article Returns: - resp: server response if succesful"""
def post(self, f): """Process a POST command. Arguments: - f: file containing the article Returns: - resp: server response if succesful"""
10,711
def ihave(self, id, f): """Process an IHAVE command. Arguments: - id: message-id of the article - f: file containing the article Returns: - resp: server response if succesful Note that if the server refuses the article an exception is raised."""
def ihave(self, id, f): """Process an IHAVE command. Arguments: - id: message-id of the article - f: file containing the article Returns: - resp: server response if succesful Note that if the server refuses the article an exception is raised."""
10,712
def _test(): """Minimal test function.""" s = NNTP('news') resp, count, first, last, name = s.group('comp.lang.python') print resp print 'Group', name, 'has', count, 'articles, range', first, 'to', last resp, subs = s.xhdr('subject', first + '-' + last) print resp for item in subs: print "%7s %s" % item resp = s.quit()...
def _test(): """Minimal test function.""" s = NNTP('news', readermode='reader') resp, count, first, last, name = s.group('comp.lang.python') print resp print 'Group', name, 'has', count, 'articles, range', first, 'to', last resp, subs = s.xhdr('subject', first + '-' + last) print resp for item in subs: print "%7s %s" %...
10,713
def rpop(self, user): """Not sure what this does.""" return self._shortcmd('RPOP %s' % user)
def rpop(self, user): """Not sure what this does.""" return self._shortcmd('RPOP %s' % user)
10,714
def apop(self, user, secret): """Authorisation
def apop(self, user, secret): """Authorisation
10,715
def apop(self, user, secret): """Authorisation
def apop(self, user, secret): """Authorisation
10,716
def __init__(self, signature): """Create a communication channel with a particular application. Addressing the application is done by specifying either a 4-byte signature, an AEDesc or an object that will __aepack__ to an AEDesc. """ if type(signature) == AEDescType: self.target = signature elif type(signature) == Ins...
def __init__(self, signature): """Create a communication channel with a particular application. Addressing the application is done by specifying either a 4-byte signature, an AEDesc or an object that will __aepack__ to an AEDesc. """ if type(signature) == AEDescType: self.target = signature elif type(signature) == Ins...
10,717
def asList(nodes): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l
def asList(nodearg): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l
10,718
def asList(nodes): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l
def asList(nodes): l = [] for item in nodearg: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l
10,719
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.lower is not None: nodes.append(self.lower) if self.upper is not None: nodes.append(self.upper) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.lower is not None: nodes.append(self.lower) if self.upper is not None: nodes.append(self.upper) return tuple(nodes)
10,720
def getChildNodes(self): nodes = [] if self.expr1 is not None: nodes.append(self.expr1) if self.expr2 is not None: nodes.append(self.expr2) if self.expr3 is not None: nodes.append(self.expr3) return tuple(nodes)
def getChildNodes(self): nodes = [] if self.expr1 is not None: nodes.append(self.expr1) if self.expr2 is not None: nodes.append(self.expr2) if self.expr3 is not None: nodes.append(self.expr3) return tuple(nodes)
10,721
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
10,722
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,723
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,724
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes)
10,725
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes)
10,726
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes)
10,727
def getChildNodes(self): nodes = [] nodes.append(self.body) nodes.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.body) nodes.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
10,728
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,729
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes)
10,730
def getChildNodes(self): nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes)
10,731
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.locals is not None: nodes.append(self.locals) if self.globals is not None: nodes.append(self.globals) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.locals is not None: nodes.append(self.locals) if self.globals is not None: nodes.append(self.globals) return tuple(nodes)
10,732
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,733
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,734
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,735
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes)
10,736
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes)
10,737
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,738
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,739
def getChildNodes(self): nodes = [] nodes.append(self.test) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.test) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
10,740
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes)
10,741
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes)
10,742
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,743
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes)
10,744
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,745
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes)
10,746
def getChildNodes(self): nodes = [] nodes.append(self.node) nodes.extend(flatten_nodes(self.args)) if self.star_args is not None: nodes.append(self.star_args) if self.dstar_args is not None: nodes.append(self.dstar_args) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.node) nodes.extend(flatten_nodes(self.args)) if self.star_args is not None: nodes.append(self.star_args) if self.dstar_args is not None: nodes.append(self.dstar_args) return tuple(nodes)
10,747
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes)
10,748
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes)
10,749
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes)
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes)
10,750
def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct strftime_output = time.strftime("%c", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, self.time_tuple), "LC_date_time incorrect") strftime_output = time.strftime("%x", self.time_tuple) self....
def test_date_time(self): # Check that LC_date_time, LC_date, and LC_time are correct strftime_output = time.strftime("%x", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, self.time_tuple), "LC_date incorrect") strftime_output = time.strftime("%X", self.time_tuple) self.failUnle...
10,751
def paren_open_event(self, event): self._remove_calltip_window() arg_text = get_arg_text(self.get_object_at_cursor()) if arg_text: self.calltip_start = self.text.index("insert") self.calltip = self._make_calltip_window() self.calltip.showtip(arg_text) # dont return "break" so the key is inserted.
defreturn "" paren_open_event(self,return "" event):return "" self._remove_calltip_window()return "" arg_textreturn "" =return "" get_arg_text(self.get_object_at_cursor())return "" ifreturn "" arg_text:return "" self.calltip_startreturn "" =return "" self.text.index("insert")return "" self.calltipreturn "" =return "" s...
10,752
def paren_close_event(self, event): # Now just hides, but later we should check if other # paren'd expressions remain open. # dont return "break" so the key is inserted. self._remove_calltip_window()
defparen_close_event(self,event):#Nowjusthides,butlaterweshouldcheckifother#paren'dexpressionsremainopen.#dontreturn"break"sothekeyisinserted.self._remove_calltip_window()
10,753
def check_calltip_cancel_event(self, event): # This doesnt quite work correctly as it is processed # _before_ the key is handled. Thus, when the "Up" key # is pressed, this test happens before the cursor is moved. # This will do for now. if self.calltip: # If we have moved before the start of the calltip, # or off the...
def check_calltip_cancel_event(self, event): # This doesnt quite work correctly as it is processed # _before_ the key is handled. Thus, when the "Up" key # is pressed, this test happens before the cursor is moved. # This will do for now. if self.calltip: # If we have moved before the start of the calltip, # or off the...
10,754
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch ...
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch ...
10,755
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch ...
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch ...
10,756
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined func...
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined func...
10,757
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined func...
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined func...
10,758
def t6(self, a, b=None, *args, **kw): "(a, b=None, ...)"
deft6(self,a,b=None,*args,**kw):"(a,b=None,...)"
10,759
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__ + "\n" + t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
10,760
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
10,761
def getsockname(self): st = self.stream.Status() host = macdnr.AddrToStr(st.localHost) return host, st.localPort
def getsockname(self): host, port = self.stream.GetSockName() host = macdnr.AddrToStr(host) return host, port
10,762
def recv(self, bufsize, flags=0): if flags: raise my_error, 'recv flags not yet supported on mac' if not self.databuf: try: self.databuf, urg, mark = self.stream.Rcv(0) if not self.databuf: print '** socket: no data!' print '** recv: got ', len(self.databuf) except mactcp.error, arg: if arg[0] != MACTCP.connectionClosi...
def recv(self, bufsize, flags=0): if flags: raise my_error, 'recv flags not yet supported on mac' if not self.databuf: try: self.databuf, urg, mark = self.stream.Rcv(0) except mactcp.error, arg: if arg[0] != MACTCP.connectionClosing: raise mactcp.error, arg rv = self.databuf[:bufsize] self.databuf = self.databuf[bufsiz...
10,763
def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] print '** Readline:',self, `rv` return rv
def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] return rv
10,764
def test_decode_string(self): """Testing decode string""" test_support.verify(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n") == "www.python.org", reason="www.python.org decodestring failed") test_support.verify(base64.decodestring("YQ==\n") == "a", reason="a decodestring failed") test_support.verify(base64.decodestring(...
def test_decode_string(self): """Testing decode string""" test_support.verify(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n") == "www.python.org", reason="www.python.org decodestring failed") test_support.verify(base64.decodestring("YQ==\n") == "a", reason="a decodestring failed") test_support.verify(base64.decodestring(...
10,765
def generate(self): # XXX This should use long strings and %(varname)s substitution!
def generate(self): # XXX This should use long strings and %(varname)s substitution!
10,766
def outputTypeObject(self): sf = self.static and "staticforward " Output() Output("%sPyTypeObject %s = {", sf, self.typename) IndentLevel() Output("PyObject_HEAD_INIT(NULL)") Output("0, /*ob_size*/") if self.modulename: Output("\"%s.%s\", /*tp_name*/", self.modulename, self.name) else: Output("\"%s\", /*tp_name*/", sel...
def outputTypeObject(self): sf = self.static and "static " Output() Output("%sPyTypeObject %s = {", sf, self.typename) IndentLevel() Output("PyObject_HEAD_INIT(NULL)") Output("0, /*ob_size*/") if self.modulename: Output("\"%s.%s\", /*tp_name*/", self.modulename, self.name) else: Output("\"%s\", /*tp_name*/", self.name)...
10,767
def _(s): return s
def _(s): return s
10,768
def _(s): return s
def _(s): return s
10,769
def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if self.__options.docstrings: # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): s...
def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if opts.docstrings and not opts.nodocstrings.get(self.__curfile): # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not i...
10,770
def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if self.__options.docstrings: # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): s...
def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if self.__options.docstrings: # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): s...
10,771
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstr...
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:X:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docs...
10,772
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstr...
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstr...
10,773
def slow_format(self, x, base): if (x, base) == (0, 8): # this is an oddball! return "0L" digits = [] sign = 0 if x < 0: sign, x = 1, -x while x: x, r = divmod(x, base) digits.append(int(r)) digits.reverse() digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ "".join(map(lambda i: "0123456...
def slow_format(self, x, base): if (x, base) == (0, 8): # this is an oddball! return "0" digits = [] sign = 0 if x < 0: sign, x = 1, -x while x: x, r = divmod(x, base) digits.append(int(r)) digits.reverse() digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ "".join(map(lambda i: "01234567...
10,774
def slow_format(self, x, base): if (x, base) == (0, 8): # this is an oddball! return "0L" digits = [] sign = 0 if x < 0: sign, x = 1, -x while x: x, r = divmod(x, base) digits.append(int(r)) digits.reverse() digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ "".join(map(lambda i: "0123456...
def slow_format(self, x, base): if (x, base) == (0, 8): # this is an oddball! return "0L" digits = [] sign = 0 if x < 0: sign, x = 1, -x while x: x, r = divmod(x, base) digits.append(int(r)) digits.reverse() digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ "".join(map(lambda i: "0123456...
10,775
def check_format_1(self, x): for base, mapper in (8, oct), (10, repr), (16, hex): got = mapper(x) expected = self.slow_format(x, base) msg = Frm("%s returned %r but expected %r for %r", mapper.__name__, got, expected, x) self.assertEqual(got, expected, msg) self.assertEqual(long(got, 0), x, Frm('long("%s", 0) != %r', g...
def check_format_1(self, x): for base, mapper in (8, oct), (10, repr), (16, hex): got = mapper(x) expected = self.slow_format(x, base) msg = Frm("%s returned %r but expected %r for %r", mapper.__name__, got, expected, x) self.assertEqual(got, expected, msg) self.assertEqual(long(got, 0), x, Frm('long("%s", 0) != %r', g...
10,776
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
10,777
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
10,778
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # The time stamp in the header doesn't have the same format as that # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} # Sort the entries. First sort each particular entry's keys, then # sort...
10,779
def __init__(self, master, flist, gui): ScrolledList.__init__(self, master, width=80) self.flist = flist self.gui = gui self.stack = []
def __init__(self, master, flist, gui): if macosxSupport.runningAsOSXApp(): ScrolledList.__init__(self, master) else: ScrolledList.__init__(self, master, width=80) self.flist = flist self.gui = gui self.stack = []
10,780
def _remote(self, action): cmd = "kfmclient %s >/dev/null 2>&1" % action rc = os.system(cmd) if rc: import time if self.basename == "konqueror": os.system(self.name + " --silent &") else: os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) return not rc
def _remote(self, action): assert "'" not in action cmd = "kfmclient '%s' >/dev/null 2>&1" % action rc = os.system(cmd) if rc: import time if self.basename == "konqueror": os.system(self.name + " --silent &") else: os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) return not rc
10,781
def open(self, url, new=1, autoraise=1): # XXX Currently I know no way to prevent KFM from # opening a new win. self._remote("openURL %s" % url)
def open(self, url, new=1, autoraise=1): # XXX Currently I know no way to prevent KFM from # opening a new win. self._remote("openURL %s" % url)
10,782
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,783
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,784
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,785
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,786
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,787
def open_new(self, url): self.open(url)
def open_new(self, url): self.open(url)
10,788
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # Silent fail here seems the best route since some modules # may not be available in all environments. # Since an ImportError may leave a partial module object in # sys.modules, get rid of that first. Here's what happens if...
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # Silent fail here seems the best route since some modules # may not be available in all environments. # Since an ImportError may leave a partial module object in # sys.modules, get rid of that first. Here's what happens if...
10,789
def __init__(self, hooks = None, verbose = 0): ihooks._Verbose.__init__(self, verbose) # XXX There's a circular reference here: self.hooks = hooks or RHooks(verbose) self.hooks.set_rexec(self) self.modules = {} self.ok_dynamic_modules = self.ok_builtin_modules list = [] for mname in self.ok_builtin_modules: if mname in...
def __init__(self, hooks = None, verbose = 0): ihooks._Verbose.__init__(self, verbose) # XXX There's a circular reference here: self.hooks = hooks or RHooks(verbose) self.hooks.set_rexec(self) self.modules = {} self.ok_dynamic_modules = self.ok_builtin_modules list = [] for mname in self.ok_builtin_modules: if mname in...
10,790
def make_osname(self): osname = os.name src = __import__(osname) dst = self.copy_only(src, self.ok_posix_names) dst.environ = e = {} for key, value in os.environ.items(): e[key] = value
def make_osname(self): osname = os.name src = __import__(osname) dst = self.copy_only(src, self.ok_posix_names) dst.environ = e = {} for key, value in os.environ.items(): e[key] = value
10,791
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag ...
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag ...
10,792
def add_files(db): cab = CAB("python") tmpfiles = [] # Add all executables, icons, text files into the TARGETDIR component root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") default_feature.set_current() if not msilib.Win64: root.add_file("PCBuild/w9xpopen.exe") root.add_file("PC/py.ico") root.add_file...
def add_files(db): cab = CAB("python") tmpfiles = [] # Add all executables, icons, text files into the TARGETDIR component root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") default_feature.set_current() if not msilib.Win64: root.add_file("PCBuild/w9xpopen.exe") root.add_file("README.txt", src="README"...
10,793
# File extensions, associated with the REGISTRY.def component
# File extensions, associated with the REGISTRY.def component
10,794
# File extensions, associated with the REGISTRY.def component
# File extensions, associated with the REGISTRY.def component
10,795
# File extensions, associated with the REGISTRY.def component
# File extensions, associated with the REGISTRY.def component
10,796
def wrap_info(info): if info is None: return None else: return None # XXX for now
def wrap_info(info): if info is None: traceback = info[2] assert isinstance(traceback, types.TracebackType) traceback_id = id(traceback) tracebacktable[traceback_id] = traceback modified_info = (info[0], info[1], traceback_id) return modified_info else: traceback = info[2] assert isinstance(traceback, types.TracebackTy...
10,797
def get_stack(self, fid, tbid): ##print >>sys.__stderr__, "get_stack(%s, %s)" % (`fid`, `tbid`) frame = frametable[fid] tb = None # XXX for now stack, i = self.idb.get_stack(frame, tb) ##print >>sys.__stderr__, "get_stack() ->", stack stack = [(wrap_frame(frame), k) for frame, k in stack] ##print >>sys.__stderr__, "get...
def get_stack(self, fid, tbid): ##print >>sys.__stderr__, "get_stack(%s, %s)" % (`fid`, `tbid`) frame = frametable[fid] if tbid is None: tb = None else: tb = tracebacktable[tbid] # XXX for now stack, i = self.idb.get_stack(frame, tb) ##print >>sys.__stderr__, "get_stack() ->", stack stack = [(wrap_frame(frame), k) for ...
10,798
def clear_all_file_breaks(self, filename): msg = self.idb.clear_all_file_breaks(filename)
defreturn msg clear_all_file_breaks(self,return msg filename):return msg msgreturn msg =return msg self.idb.clear_all_file_breaks(filename)
10,799