rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.ted = TE.TENew(r2, r2) | self.ted = TE.TENew(dr, vr) | 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.... |
return vx, vy | return None, 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 vx, vy |
if what == 'set': return if what == '-': delta = self.ted.viewRect[2]/10 elif what == '--': delta = self.ted.viewRect[2]/2 elif what == '+': delta = +self.ted.viewRect[2]/10 elif what == '++': delta = +self.ted.viewRect[2]/2 self.ted.TEPinScroll(delta, 0) | pass | 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... |
for l in self._windows.values(): l.do_idle() | if self.active: self.active.do_idle() | def idle(self, *args): for l in self._windows.values(): l.do_idle() |
dict["__dynamic__"] = 1 | assert dict.get("__dynamic__", 1) | 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... |
verify(base.__class__ is complex) | veris(base.__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
verify(complex(a).__class__ is complex) | veris(complex(a).__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
verify((+a).__class__ is complex) verify((a + 0).__class__ is complex) | veris((+a).__class__, complex) veris((a + 0).__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
verify((a - 0).__class__ is complex) | veris((a - 0).__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
verify((a * 1).__class__ is complex) | veris((a * 1).__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
verify((a / 1).__class__ is complex) | veris((a / 1).__class__, complex) | def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) |
- port: port to connect to (default the standard NNTP port)""" | - port: port to connect to (default the standard NNTP port) - user: username to authenticate with - password: password to use with username - readermode: if true, send 'mode reader' command after connecting. readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to ca... | 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)""" |
raise error_reply, resp | raise NNTPReplyError(resp) | 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)""" |
raise error_perm, resp | raise NNTPPermanentError(resp) | 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)""" |
raise error_temp, resp | raise NNTPTemporaryError(resp) | 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... |
raise error_perm, resp | raise NNTPPermanentError(resp) | 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... |
raise error_proto, resp | raise NNTPProtocolError(resp) | 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... |
raise error_reply, resp | raise NNTPReplyError(resp) | 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... |
raise error_reply, resp | raise NNTPReplyError(resp) | 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""" |
raise error_reply, resp | raise NNTPReplyError(resp) | 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 |
raise error_data,line | raise NNTPDataError(line) | 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)""" |
raise error_reply, resp | raise NNTPReplyError(resp) | 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""" |
raise error_reply, resp | raise NNTPReplyError(resp) | 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.""" |
raise error_data, resp | raise NNTPDataError(resp) | 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.""" |
raise error_reply, resp | raise NNTPReplyError(resp) | def post(self, f): """Process a POST command. Arguments: - f: file containing the article Returns: - resp: server response if succesful""" |
raise error_reply, resp | raise NNTPReplyError(resp) | 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.""" |
s = NNTP('news') | s = NNTP('news', readermode='reader') | 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()... |
timestamp = regex.compile('\+OK.*\(<[^>]+>\)') | timestamp = re.compile(r'\+OK.*(<[^>]+>)') | def rpop(self, user): """Not sure what this does.""" return self._shortcmd('RPOP %s' % user) |
if self.timestamp.match(self.welcome) <= 0: | m = self.timestamp.match(self.welcome) if not m: | def apop(self, user, secret): """Authorisation |
digest = md5.new(self.timestamp.group(1)+secret).digest() | digest = md5.new(m.group(1)+secret).digest() | def apop(self, user, secret): """Authorisation |
elif type(signature) == StringType and len(signature) != 4: | elif type(signature) == StringType and len(signature) == 4: | 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 asList(nodes): | def asList(nodearg): | 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 |
for item in nodes: | for item in nodearg: | 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 |
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) | nodelist = [] nodelist.append(self.expr) if self.lower is not None: nodelist.append(self.lower) if self.upper is not None: nodelist.append(self.upper) return tuple(nodelist) | 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) |
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) | nodelist = [] if self.expr1 is not None: nodelist.append(self.expr1) if self.expr2 is not None: nodelist.append(self.expr2) if self.expr3 is not None: nodelist.append(self.expr3) return tuple(nodelist) | 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) |
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) | nodelist = [] nodelist.append(self.assign) nodelist.append(self.list) nodelist.append(self.body) if self.else_ is not None: nodelist.append(self.else_) return tuple(nodelist) | 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) |
nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.nodes)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) |
nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.items)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes) |
nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodelist.append(self.dest) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) |
nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes) | nodelist = [] nodelist.append(self.expr) nodelist.extend(flatten_nodes(self.subs)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes) |
nodes = [] nodes.append(self.body) nodes.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | nodelist = [] nodelist.append(self.body) nodelist.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodelist.append(self.else_) return tuple(nodelist) | 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) |
nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.defaults)) nodelist.append(self.code) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) |
nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes) | nodelist = [] nodelist.append(self.test) if self.fail is not None: nodelist.append(self.fail) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes) |
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) | nodelist = [] nodelist.append(self.expr) if self.locals is not None: nodelist.append(self.locals) if self.globals is not None: nodelist.append(self.globals) return tuple(nodelist) | 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) |
nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.bases)) nodelist.append(self.code) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes) |
nodes = [] nodes.append(self.test) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | nodelist = [] nodelist.append(self.test) nodelist.append(self.body) if self.else_ is not None: nodelist.append(self.else_) return tuple(nodelist) | 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) |
nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.nodes)) nodelist.append(self.expr) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes) |
nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes) | nodelist = [] nodelist.append(self.expr) nodelist.extend(flatten_nodes(self.ops)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes) |
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) | nodelist = [] nodelist.append(self.node) nodelist.extend(flatten_nodes(self.args)) if self.star_args is not None: nodelist.append(self.star_args) if self.dstar_args is not None: nodelist.append(self.dstar_args) return tuple(nodelist) | 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) |
nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | nodelist = [] nodelist.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodelist.append(self.else_) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) |
nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes) | nodelist = [] nodelist.append(self.expr) nodelist.extend(flatten_nodes(self.quals)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes) |
nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes) | nodelist = [] nodelist.append(self.assign) nodelist.append(self.list) nodelist.extend(flatten_nodes(self.ifs)) return tuple(nodelist) | def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes) |
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") | 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.... | |
return "" | 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. | |
return "" def calltip_cancel_event(self, event): self._remove_calltip_window() return "" | 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... | |
index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch not in wordchars: break if text.compare(indexspec, "<=", "1.0"): break word = text.get("insert-%dc" % (index-1,), "insert") if word: | chars = text.get("insert linestart", "insert") i = len(chars) while i and chars[i-1] in wordchars: i = i-1 word = chars[i:] if word: | 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 ... |
if not argText and hasattr(ob, "__doc__") and ob.__doc__: | if hasattr(ob, "__doc__") and ob.__doc__: | 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... |
argText = ob.__doc__[:pos] | if argText: argText = argText + "\n" argText = argText + ob.__doc__[:pos] | 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... |
if get_arg_text(t) != t.__doc__: | if get_arg_text(t) != t.__doc__ + "\n" + t.__doc__: | 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)) |
st = self.stream.Status() host = macdnr.AddrToStr(st.localHost) return host, st.localPort | host, port = self.stream.GetSockName() host = macdnr.AddrToStr(host) return host, port | def getsockname(self): st = self.stream.Status() host = macdnr.AddrToStr(st.localHost) return host, st.localPort |
if not self.databuf: print '** socket: no data!' print '** recv: got ', len(self.databuf) | 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... | |
print '** Readline:',self, `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:] print '** Readline:',self, `rv` return rv | |
try: base64.decodestring("") except binascii_error: pass else: self.fail("expected a binascii.Error on null decode request") | 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(... |
sf = self.static and "staticforward " | sf = self.static and "static " | def generate(self): # XXX This should use long strings and %(varname)s substitution! |
sf = self.static and "staticforward " | sf = self.static and "static " | 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... |
__version__ = '1.3' | __version__ = '1.4' | def _(s): return s |
if self.__options.docstrings: | if opts.docstrings and not opts.nodocstrings.get(self.__curfile): | 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... |
if ttype == tokenize.NAME and tstring in self.__options.keywords: | if ttype == tokenize.NAME and tstring in opts.keywords: | 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... |
'ad:DEhk:Kno:p:S:Vvw:x:', | 'ad:DEhk:Kno:p:S:Vvw:x:X:', | 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... |
'docstrings', | 'docstrings', 'no-docstrings', | 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... |
return "0L" | return "0" | 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... |
"".join(map(lambda i: "0123456789abcdef"[i], digits)) + "L" | "".join(map(lambda i: "0123456789abcdef"[i], digits)) | 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... |
expected = self.slow_format(x, 10)[:-1] | expected = self.slow_format(x, 10) | 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... |
reverse[tuple(keys)] = (k, v) | reverse.setdefault(tuple(keys), []).append((k, v)) | 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... |
k, v = reverse[rkey] if reduce(operator.__add__, v.values()): print >> fp, ' v = v.keys() v.sort() if not options.writelocations: pass elif options.locationstyle == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} print >>fp, _(' elif options.locationstyle == options.GNU: ... | rentries = reverse[rkey] rentries.sort() for k, v in rentries: if reduce(operator.__add__, v.values()): print >> fp, ' v = v.keys() v.sort() if not options.writelocations: pass elif options.locationstyle == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} print >>fp, _( ' ... | 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... |
locline = " if len(locline) > 2: print >> fp, locline print >> fp, 'msgid', normalize(k) print >> fp, 'msgstr ""\n' | print >> fp, 'msgid', normalize(k) print >> fp, 'msgstr ""\n' | 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... |
ScrolledList.__init__(self, master, width=80) | if macosxSupport.runningAsOSXApp(): ScrolledList.__init__(self, master) else: ScrolledList.__init__(self, master, width=80) | def __init__(self, master, flist, gui): ScrolledList.__init__(self, master, width=80) self.flist = flist self.gui = gui self.stack = [] |
cmd = "kfmclient %s >/dev/null 2>&1" % action | assert "'" not in action cmd = "kfmclient '%s' >/dev/null 2>&1" % action | 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 |
self._remote("openURL %s" % url) | 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) |
register("links", None, GenericBrowser("links %s")) | register("links", None, GenericBrowser("links '%s'")) | def open_new(self, url): self.open(url) |
register("lynx", None, GenericBrowser("lynx %s")) | register("lynx", None, GenericBrowser("lynx '%s'")) | def open_new(self, url): self.open(url) |
register("w3m", None, GenericBrowser("w3m %s")) | register("w3m", None, GenericBrowser("w3m '%s'")) | def open_new(self, url): self.open(url) |
if _iscommand("netscape") or _iscommand("mozilla"): if _iscommand("mozilla"): register("mozilla", None, Netscape("mozilla")) if _iscommand("netscape"): register("netscape", None, Netscape("netscape")) | if _iscommand("mozilla"): register("mozilla", None, Netscape("mozilla")) if _iscommand("netscape"): register("netscape", None, Netscape("netscape")) | def open_new(self, url): self.open(url) |
register("mosaic", None, GenericBrowser("mosaic %s >/dev/null &")) | register("mosaic", None, GenericBrowser( "mosaic '%s' >/dev/null &")) | def open_new(self, url): self.open(url) |
register(cmd.lower(), None, GenericBrowser("%s %%s" % cmd.lower())) | register(cmd.lower(), None, GenericBrowser( "%s '%%s'" % cmd.lower())) | def open_new(self, url): self.open(url) |
import _socket | if not sys.platform.startswith('java'): import _socket | 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... |
self.make_re() | 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 make_re(self): dst = self.add_module("re") src = self.r_import("pre") for name in dir(src): if name != "__name__": setattr(dst, name, getattr(src, name)) | 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 | |
self.literal = 0 | 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 ... | |
root.add_file("PC/py.ico") root.add_file("PC/pyc.ico") | 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... | |
r'[TARGETDIR]py.ico', "REGISTRY.def"), | r'[DLLs]py.ico', "REGISTRY.def"), | # File extensions, associated with the REGISTRY.def component |
r'[TARGETDIR]pyc.ico', "REGISTRY.def"), | r'[DLLs]pyc.ico', "REGISTRY.def"), | # File extensions, associated with the REGISTRY.def component |
return 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 | def wrap_info(info): if info is None: return None else: return None # XXX for now |
tb = None | if tbid is None: tb = None else: tb = tracebacktable[tbid] | 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... |
return msg | def clear_all_file_breaks(self, filename): msg = self.idb.clear_all_file_breaks(filename) | |
def interaction(self, message, fid, iid): | def interaction(self, message, fid, modified_info): | def interaction(self, message, fid, iid): ##print "interaction: (%s, %s, %s)" % (`message`,`fid`, `iid`) frame = FrameProxy(self.conn, fid) info = None # XXX for now self.gui.interaction(message, frame, info) |
info = None self.gui.interaction(message, frame, info) | self.gui.interaction(message, frame, modified_info) | def interaction(self, message, fid, iid): ##print "interaction: (%s, %s, %s)" % (`message`,`fid`, `iid`) frame = FrameProxy(self.conn, fid) info = None # XXX for now self.gui.interaction(message, frame, info) |
def get_stack(self, frame, tb): stack, i = self.call("get_stack", frame._fid, None) | def get_stack(self, frame, tbid): stack, i = self.call("get_stack", frame._fid, tbid) | def get_stack(self, frame, tb): stack, i = self.call("get_stack", frame._fid, None) stack = [(FrameProxy(self.conn, fid), k) for fid, k in stack] return stack, i |
return msg | def clear_all_file_breaks(self, filename): msg = self.call("clear_all_file_breaks", filename) | |
print 'Testing UTF-16 code point order comparisons...', assert u'\u0061' < u'\u20ac' assert u'\u0061' < u'\ud800\udc02' def test_lecmp(s, s2): assert s < s2 , "comparison failed on %s < %s" % (s, s2) def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc... | if 0: print 'Testing UTF-16 code point order comparisons...', assert u'\u0061' < u'\u20ac' assert u'\u0061' < u'\ud800\udc02' def test_lecmp(s, s2): assert s < s2 , "comparison failed on %s < %s" % (s, s2) def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\u... | test('capwords', u'abc\t def \nghi', u'Abc Def Ghi') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.