bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None): | def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None): | 4,100 |
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None): | def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None): | 4,101 |
def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return | def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return | 4,102 |
def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return | def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return | 4,103 |
def tutorialShowLesson(self, id, REQUEST): """ Navigate management frame to a given lesson's screen. """ url=self.lessonURL(id, REQUEST) if not url: return """\ | def tutorialShowLesson(self, id, REQUEST): """ Navigate management frame to a given lesson's screen. """ url=self.lessonURL(id, REQUEST) if not url or not self.checkInstallation(REQUEST): REQUEST.set('hide_next', 0) return """\ | 4,104 |
def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | 4,105 |
def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | 4,106 |
def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex | 4,107 |
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 4,108 |
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 4,109 |
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 4,110 |
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 4,111 |
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 4,112 |
def _get_id(ob, id): try: ob=ob.aq_base except: pass n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 while (hasattr(ob, id)): id='copy%s_of_%s' % (n and n+1 or '', id) n=n+1 return id | def _get_id(ob, id): try: ob=ob.aq_base except: pass n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 while (hasattr(ob, id)): id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1 return id | 4,113 |
def pt_render(self, source=0, extra_context={}): """Render this Page Template""" if self._v_errors: raise RuntimeError, 'Page Template %s has errors.' % self.id output = StringIO() c = self.pt_getContext() c.update(extra_context) if __debug__: __traceback_info__ = pprint.pformat(c) | def pt_render(self, source=0, extra_context={}): """Render this Page Template""" if self._v_errors: raise RuntimeError, 'Page Template %s has errors.' % self.id output = StringIO() c = self.pt_getContext() c.update(extra_context) if Z_DEBUG_MODE: __traceback_info__ = pprint.pformat(c) | 4,114 |
def manage_move_objects_up(self, REQUEST, ids=None, delta=None): """ Move specified sub-objects up by delta in container. """ if ids: try: attempt = self.moveObjectsUp(ids, delta) message = '%d item%s moved up.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (errmsg) el... | def manage_move_objects_up(self, REQUEST, ids=None, delta=1): """ Move specified sub-objects up by delta in container. """ if ids: try: attempt = self.moveObjectsUp(ids, delta) message = '%d item%s moved up.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (errmsg) else:... | 4,115 |
def manage_move_objects_down(self, REQUEST, ids=None, delta=None): """ Move specified sub-objects down by delta in container. """ if ids: try: attempt = self.moveObjectsDown(ids, delta) message = '%d item%s moved down.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (er... | def manage_move_objects_down(self, REQUEST, ids=None, delta=1): """ Move specified sub-objects down by delta in container. """ if ids: try: attempt = self.moveObjectsDown(ids, delta) message = '%d item%s moved down.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (errms... | 4,116 |
def publish(request, module_name, after_list, debug=0, # Optimize: call_object=call_object, missing_name=missing_name, dont_publish_class=dont_publish_class, mapply=mapply, ): (bobo_before, bobo_after, object, realm, debug_mode, err_hook, validated_hook, transactions_manager)= get_module_info(module_name) parents=Non... | def publish(request, module_name, after_list, debug=0, # Optimize: call_object=call_object, missing_name=missing_name, dont_publish_class=dont_publish_class, mapply=mapply, ): (bobo_before, bobo_after, object, realm, debug_mode, err_hook, validated_hook, transactions_manager)= get_module_info(module_name) parents=Non... | 4,117 |
def __iadd__(self, other): return self.__class__(self.value + other) | def __iadd__(self, other): return self.__class__(self.value + other) | 4,118 |
def __iadd__(self, other): return self.__class__(self.value + other) | def __iadd__(self, other): return self.__class__(self.value + other) | 4,119 |
def emitDefines(self, defines, position): for part in splitParts(defines): m = re.match( r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) if not m: raise TALError("invalid define syntax: " + `part`, position) scope, name, expr = m.group(1, 2, 3) scope = scope or "local" cexpr = self.compileExpression(expr) if s... | def emitDefines(self, defines, position): for part in splitParts(defines): m = re.match( r"(?s)\s*(?:(global|local)\s+)?(%s)\s+(.*)\Z" % NAME_RE, part) if not m: raise TALError("invalid define syntax: " + `part`, position) scope, name, expr = m.group(1, 2, 3) scope = scope or "local" cexpr = self.compileExpression(expr... | 4,120 |
def emitRepeat(self, arg): m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `repeat`) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program) | def emitRepeat(self, arg): m = re.match("(?s)\s*(%s)\s+(.*)\Z" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `repeat`) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program) | 4,121 |
def _error_html(self,title,body): # XXX could this try to use standard_error_message somehow? return ("""\ | def _error_html(self,title,body): # XXX could this try to use standard_error_message somehow? return ("""\ | 4,122 |
def getPhysicalPath(self): '''Returns a path (an immutable sequence of strings) that can be used to access this object again later, for example in a copy/paste operation. getPhysicalRoot() and getPhysicalPath() are designed to operate together. ''' path = (self.getId(),) p = aq_parent(aq_inner(self) if p is not None:... | def getPhysicalPath(self): '''Returns a path (an immutable sequence of strings) that can be used to access this object again later, for example in a copy/paste operation. getPhysicalRoot() and getPhysicalPath() are designed to operate together. ''' path = (self.getId(),) p = aq_parent(aq_inner(self)) if p is not None... | 4,123 |
def testSetupServersWithConflict(self): conf = self.load_config_text(""" <http-server> address 18092 </http-server> <ftp-server> address 18092 # conflict </ftp-server>""") starter = ZopeStarter(conf) # do the job the 'handler' would have done (call prepare) for server in conf.servers: server.prepare('', None, 'Zope', {... | def testSetupServersWithConflict(self): conf = self.load_config_text(""" <http-server> address 18092 </http-server> <ftp-server> address 18092 # conflict </ftp-server>""") starter = ZopeStarter(conf) # do the job the 'handler' would have done (call prepare) for server in conf.servers: server.prepare('', None, 'Zope',... | 4,124 |
def _cook_check(self): if self._v_last_read and not DevelopmentMode: return __traceback_info__ = self.filename try: mtime=os.stat(self.filename)[8] except: mtime=0 if hasattr(self, '_v_program') and mtime == self._v_last_read: return self.pt_edit(open(self.filename), None) self._cook() if self._v_errors: LOG('PageTe... | def _cook_check(self): if self._v_last_read and not DevelopmentMode: return __traceback_info__ = self.filename try: mtime = os.path.getmtime(self.filename) except OSError: mtime = 0 if self._v_program is not None and mtime == self._v_last_read: return self.pt_edit(open(self.filename), None) self._cook() if self._v_erro... | 4,125 |
def __bobo_traverse__(self, REQUEST, name): if name[-9:]=='__draft__': return getattr(self, name) | def __bobo_traverse__(self, REQUEST, name): if name[-9:]=='__draft__': return getattr(self, name) | 4,126 |
def nonempty(self): try: db=self._jar.db() except: # BoboPOS 2 return Globals.VersionBase[self._version].nonempty() else: # ZODB 3 return not db.versionEmpty(self._version) | def nonempty(self): try: db=self._p_jar.db() except: # BoboPOS 2 return Globals.VersionBase[self._version].nonempty() else: # ZODB 3 return not db.versionEmpty(self._version) | 4,127 |
def manage_Save__draft__(self, remark, REQUEST=None): """Make version changes permanent""" try: db=self._jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].commit(remark) else: # ZODB 3 s=self._version d=self._p_jar.getVersion() if d==s: d='' db.commitVersion(s, d) if REQUEST: REQUEST['RESPONSE'].redirect... | def manage_Save__draft__(self, remark, REQUEST=None): """Make version changes permanent""" try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].commit(remark) else: # ZODB 3 s=self._version d=self._p_jar.getVersion() if d==s: d='' db.commitVersion(s, d) if REQUEST: REQUEST['RESPONSE'].redire... | 4,128 |
def manage_Discard__draft__(self, REQUEST=None): 'Discard changes made during the version' try: db=self._jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].abort() else: # ZODB 3 db.abortVersion(self._version) | def manage_Discard__draft__(self, REQUEST=None): 'Discard changes made during the version' try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].abort() else: # ZODB 3 db.abortVersion(self._version) | 4,129 |
def authorize(self, user, accessed, container, name, value, roles): user = getattr(user, 'aq_base', user).__of__(self) newSecurityManager(None, user) security = getSecurityManager() try: try: if security.validate(accessed, container, name, value, roles): return 1 except: noSecurityManager() raise except Unauthorized: p... | def authorize(self, user, accessed, container, name, value, roles): user = getattr(user, 'aq_base', user).__of__(self) newSecurityManager(None, user) security = getSecurityManager() try: try: if roles is _noroles: if security.validate(accessed, container, name, value): return 1 else: if security.validate(accessed, ... | 4,130 |
def __init__(self,*args): """Return a new date-time object | def __init__(self,*args): """Return a new date-time object | 4,131 |
def forkit(attempts = FORK_ATTEMPTS): while attempts: # if at first you don't succeed... attempts = attempts + 1 try: pid = os.fork() except os.error: pstamp('Houston, the fork failed') time.sleep(2) else: pstamp('Houston, we have forked') return pid | def forkit(attempts = FORK_ATTEMPTS): while attempts: # if at first you don't succeed... attempts = attempts - 1 try: pid = os.fork() except os.error: pstamp('Houston, the fork failed') time.sleep(2) else: pstamp('Houston, we have forked') return pid | 4,132 |
def get(self, key, default): """Get a variable value | def get(self, key, default=None): """Get a variable value | 4,133 |
def main(args=None): # This is exactly like zdctl.main(), but uses ZopeCtlOptions and # ZopeCmd instead of ZDCtlOptions and ZDCmd, so the default values # are handled properly for Zope. options = ZopeCtlOptions() options.realize(args) c = ZopeCmd(options) if options.args: c.onecmd(" ".join(options.args)) else: options.... | def main(args=None): # This is exactly like zdctl.main(), but uses ZopeCtlOptions and # ZopeCmd instead of ZDCtlOptions and ZDCmd, so the default values # are handled properly for Zope. options = ZopeCtlOptions() options.realize(args) c = ZopeCmd(options) if options.args: c.onecmd(" ".join(options.args)) else: options.... | 4,134 |
def get_source(func): """Less silly interface to find_source""" # Sheesh return find_source(func.func_globals['__file__'], func.func_code)[1] | def get_source(func): """Less silly interface to find_source""" # Sheesh return find_source(func.func_globals['__file__'], func.func_code)[1] | 4,135 |
def checkBeforeAndAfter(self): from RestrictedPython.RCompile import RModule | deffrom RestrictedPython.tests import before_and_after checkBeforeAndAfter(self):from RestrictedPython.tests import before_and_after fromfrom RestrictedPython.tests import before_and_after RestrictedPython.RCompilefrom RestrictedPython.tests import before_and_after importfrom RestrictedPython.tests import before_and_af... | 4,136 |
def getiter(seq): calls.append(seq) return list(seq) | def getiter(seq): calls.append(seq) return list(seq) | 4,137 |
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0): | def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0): | 4,138 |
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the ... | def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the ... | 4,139 |
def _finish(self, tid, user, desc, ext): """Called from BaseStorage.tpc_finish(), this commits the underlying BSDDB transaction. | def _finish(self, tid, user, desc, ext): """Called from BaseStorage.tpc_finish(), this commits the underlying BSDDB transaction. | 4,140 |
def _abort(self, tid, user, desc, ext): """Called from BaseStorage.tpc_abort(), this aborts the underlying BSDDB transaction. tid is the transaction id user is the transaction user desc is the transaction description ext is the transaction extension | def _abort(self, tid, user, desc, ext): """Called from BaseStorage.tpc_abort(), this aborts the underlying BSDDB transaction. tid is the transaction id user is the transaction user desc is the transaction description ext is the transaction extension | 4,141 |
def _validTime(self,h,m,s): return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59 | def _validTime(self,h,m,s): return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59 | 4,142 |
def unrestrictedTraverse(self, path, default=_marker, restricted=0): | def unrestrictedTraverse(self, path, default=_marker, restricted=0): | 4,143 |
def next_object(self): # Get the next object pickle data. Return the oid and the pickle # string. Raise a LogCorruptedError if there's an incomplete marshal # record. rec = self._next() if rec is None: return None try: key, (oid, pickle) = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key <> ... | def next_object(self): # Get the next object pickle data. Return the oid and the pickle # string. Raise a LogCorruptedError if there's an incomplete marshal # record. rec = self._next() if rec is None: return None try: key, (oid, pickle) = rec except ValueError: raise LogCorruptedError, 'incomplete record' if... | 4,144 |
def write_object(self, oid, pickle): self._append('o', (oid, pickle)) | def write_object(self, oid, pickle): self._append('o', (oid, pickle)) | 4,145 |
def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return NOne try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key re... | def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return None try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key re... | 4,146 |
def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return NOne try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key re... | def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return NOne try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key re... | 4,147 |
def manage_exportObject(self, id='', download=None, toxml=None, RESPONSE=None,REQUEST=None): """Exports an object to a file and returns that file.""" if not id: # can't use getId() here (breaks on "old" exported objects) id=self.id if hasattr(id, 'im_func'): id=id() ob=self else: ob=self._getOb(id) | def manage_exportObject(self, id='', download=None, toxml=None, RESPONSE=None,REQUEST=None): """Exports an object to a file and returns that file.""" if not id: # can't use getId() here (breaks on "old" exported objects) id=self.id if hasattr(id, 'im_func'): id=id() ob=self else: ob=self._getOb(id) | 4,148 |
def manage_importObject(self, file, REQUEST=None, set_owner=1): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise BadRequestException, 'Invalid file name %s' % escape(file) | def manage_importObject(self, file, REQUEST=None, set_owner=1): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise BadRequestException, 'Invalid file name %s' % escape(file) | 4,149 |
def _cookie_list(self): | def _cookie_list(self): | 4,150 |
def formatTracebackInfo(self, tbi): return self.formatSupplementLine('__traceback_info__: %s' % tbi) | def formatTracebackInfo(self, tbi): return self.formatSupplementLine('__traceback_info__: %s' % tbi) | 4,151 |
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level). | def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level). | 4,152 |
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level). | def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level). | 4,153 |
def doc_inner_link(self, s, expr1 = re.compile(r"\.\.\s*").search, expr2 = re.compile(r"\[[%s%s]+\]" % (letters, digits) ).search): # make sure we dont grab a named link if expr2(s) and expr1(s): start1,end1 = expr1(s).span() start2,end2 = expr2(s).span() if end1 == start2: # uh-oh, looks like a named link return None... | def doc_inner_link(self, s, expr1 = re.compile(r"\.\.\s*").search, expr2 = re.compile(r"\[[%s%s]+\]" % (letters, digits) ).search): # make sure we dont grab a named link if expr2(s) and expr1(s): start1,end1 = expr1(s).span() start2,end2 = expr2(s).span() if end1 == start2: # uh-oh, looks like a named link return None... | 4,154 |
def __getattr__(self, name): | def __getattr__(self, name): | 4,155 |
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ try: obj = self.aq_parent.restrictedTraverse(self.getpath(rid)) if not obj: if REQUEST is None: REQUEST=self.REQUEST obj = self.sq_parent.resolve_url(self.getpath(rid), REQUEST) return obj except: pass | def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ try: obj = self.aq_parent.restrictedTraverse(self.getpath(rid)) if not obj: if REQUEST is None: REQUEST=self.REQUEST obj = self.aq_parent.resolve_url(self.getpath(rid), REQUEST) return obj except: pass | 4,156 |
def _unauthorized(self): realm=self.realm if realm: self['WWW-authenticate']='basic realm="%s"' % realm | def _unauthorized(self): realm=self.realm if realm: self['WWW-authenticate']='basic realm="%s"' % realm | 4,157 |
def __init__(self, id, text=None, content_type=None, encoding='utf-8', strict=True): self.id = id self.expand = 0 self.ZBindings_edit(self._default_bindings) self.output_encoding = 'utf-8' | def __init__(self, id, text=None, content_type=None, encoding='utf-8', strict=True): self.id = id self.expand = 0 self.ZBindings_edit(self._default_bindings) self.output_encoding = 'utf-8' | 4,158 |
def pt_edit(self, text, content_type, keep_output_encoding=False): | def pt_edit(self, text, content_type, keep_output_encoding=False): | 4,159 |
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ... | def initialize(app): # Initialize the application # Initialize the cache:# The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the introduction of certain system objects ... | 4,160 |
def apply(self, classobj): """Apply security information to the given class object.""" dict = classobj.__dict__ | def apply(self, classobj): """Apply security information to the given class object.""" dict = classobj.__dict__ | 4,161 |
def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(lambda s: d[s], S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' enc... | def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(reprs.get, S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' encoding... | 4,162 |
def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(lambda s: d[s], S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' enc... | def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(lambda s: d[s], S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' enc... | 4,163 |
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v | def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32-h v=h*t32+v return v | 4,164 |
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v | def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32+h v=h*t32+v return v | 4,165 |
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v | def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v | 4,166 |
def end_none(self,tag,data): return None | def end_none(self,tag,data): return None | 4,167 |
def end_dictionary(self, tag, data): D={} a=data[1] for k, v in data[2:]: D[k]=v if a.has_key('id'): self._pickleids[a['id']]=D return D | def end_dictionary(self, tag, data): D={} a=data[1] for k, v in data[2:]: D[k]=v if a.has_key('id'): self._pickleids[a['id']]=D return D | 4,168 |
def end_item(self, tag, data): v=data[2:] return v | def end_item(self, tag, data): v=data[2:] return v | 4,169 |
def end_item(self, tag, data): v=data[2:] return v | def end_item(self, tag, data): v=data[2:] return v | 4,170 |
def end_item(self, tag, data): v=data[2:] return v | def end_item(self, tag, data): v=data[2:] return v | 4,171 |
def save_string(self, tag, data): binary=self.binary v='' a=data[1] if len(data)>2: for x in data[2:]: v=v+x encoding=a['encoding'] if encoding is not '': v=unconvert(encoding,v) put='p' if binary: l=len(v) s=mdumps(l)[1:] if (l<256): v='U'+s[0]+v else: v='T'+s+v put='q' else: v="S'"+v+"'\012" if a.has_key('id'): id=a[... | def save_string(self, tag, data): binary=self.binary v='' a=data[1] if len(data)>2: for x in data[2:]: v=v+x encoding=a['encoding'] if encoding is not '': v=unconvert(encoding,v) put='p' if binary: l=len(v) s=mdumps(l)[1:] if (l<256): v='U'+s[0]+v else: v='T'+s+v put='q' else: v="S'"+v+"'\012" return save_put(self, v, ... | 4,172 |
def save_tuple(self, tag, data): binary=self.binary T=data[2:] a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s pu... | def save_tuple(self, tag, data): T=data[2:] a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id el... | 4,173 |
def save_tuple(self, tag, data): binary=self.binary T=data[2:] a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s pu... | def save_tuple(self, tag, data): binary=self.binary T=data[2:] if not T: return ')' return save_put(self, '('+string.join(T,'')+'t', data[1]) | 4,174 |
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not ''... | def save_list(self, tag, data): L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not '': v=']'+put+id+'('+... | 4,175 |
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not ''... | def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] if self.binary: v=save_put(self, ']', a) if L: v=v+'('+string.join(L,'')+'e' else: while x<len(L): v=v+L[x]+'a' x=x+1 if id: v='(lp'+id+'\012'+v if v=='': v=']' return v | 4,176 |
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not ''... | def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not ''... | 4,177 |
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>... | def save_dict(self, tag, data): D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>0: v=v+'u' else: v=... | 4,178 |
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>... | def save_dict(self, tag, data): binary=self.binary D=data[2:] if self.binary: v=save_put(self, '}', data[1]) if D: v=v+'('+string.join(D,'')+'u' else: v='(dp'+id+'\012' x=0 while x<len(D): v=v+D[x]+'s' x=x+1 return v | 4,179 |
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>... | def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>... | 4,180 |
def save_reference(self, tag, data): binary=self.binary a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] get='g' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] get='h' else: id=s get='j' v=get+id else: v=get+id+'\012' return v | def save_reference(self, tag, data): binary=self.binary a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] get='g' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] get='h' else: id=s get='j' v=get+id else: v=get+id+'\012' return v | 4,181 |
def save_object(self, tag, data): binary=self.binary a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind... | def save_object(self, tag, data): v='('+data[2] x=data[3][1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=save_put(self, v+x+'o', data[1]) v=v+data[4]+'b' return v def save_global(self, tag, data): a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=str... | 4,182 |
def save_object(self, tag, data): binary=self.binary a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind... | def save_object(self, tag, data): binary=self.binary a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind... | 4,183 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | def save_persis(self, tag, data): v=data[2] if binary: v=v+'Q' else: v='P'+v return v | 4,184 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | def save_persis(self, tag, data): binary=self.binary v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v | 4,185 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | defsave_persis(self,tag,data):binary=self.binaryv=data[2]ifbinary:v=v+'Q'else:v='P'+vreturnv | 4,186 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | 4,187 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | 4,188 |
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v | 4,189 |
def write_access(home, user='', group=''): import whrandom pw_choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz" \ "0123456789!" ac_path=os.path.join(home, 'access') if not os.path.exists(ac_path): print 'creating default access file' acfile=open(ac_path, 'w') pw = '' for i in range(8): pw = pw + wh... | def write_access(home, user='', group=''): import whrandom pw_choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz" \ "0123456789!" ac_path=os.path.join(home, 'access') if not os.path.exists(ac_path): print 'creating default access file' acfile=open(ac_path, 'w') pw = '' for i in range(8): pw = pw + wh... | 4,190 |
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | 4,191 |
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | 4,192 |
def publish(self, module_name, after_list, published='web_objects', | def publish(self, module_name, after_list, published='web_objects', | 4,193 |
def publish(self, module_name, after_list, published='web_objects', | def publish(self, module_name, after_list, published='web_objects', | 4,194 |
def publish(self, module_name, after_list, published='web_objects', | def publish(self, module_name, after_list, published='web_objects', | 4,195 |
def __call__(self, *args, **kw): self._a() try: return apply(self._f, args, kw) finally: self._r() | def __call__(self, *args, **kw): self._a() try: return apply(self._f, args, kw) finally: self._r() | 4,196 |
def __init__(self, *dicts): self._mm = apply(MultiMapping, dicts) | def __init__(self, *dicts): self._mm = apply(MultiMapping, dicts) | 4,197 |
def has_get(self, key): v = self._mm.get(key, self) if v is self: return 0, None else: return 1, v | def has_get(self, key): v = self.get(key, _marker) if v is _marker: return 0, None else: return 1, v | 4,198 |
def __init__(self,*args): """Return a new date-time object | def __init__(self,*args): """Return a new date-time object | 4,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.