bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __call__(self, *args): return self.__send(self.__name, args) | def __call__(self, *args): return self.__send(self.__name, args) | 3,700 |
def parse_response(self, f): # read response from input file, and parse it | def parse_response(self, f): # read response from input file, and parse it | 3,701 |
def parse_response(self, f): # read response from input file, and parse it | def parse_response(self, f): # read response from input file, and parse it | 3,702 |
def send_host(self, connection, host): if isinstance(host, TupleType): host, x509 = host connection.putheader("Host", host) | def send_host(self, connection, host): if isinstance(host, TupleType): host, x509 = host connection.putheader("Host", host) | 3,703 |
def __repr__(self): return ( "<Server proxy for %s%s>" % (self.__host, self.__handler) ) | def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) ) | 3,704 |
def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | 3,705 |
def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | 3,706 |
def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | 3,707 |
def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n... | 3,708 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | defstore(self,oid,serial,data,version,transaction):iftransactionisnotself._transaction:raisePOSException.StorageTransactionError(self,transaction) | 3,709 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | 3,710 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,711 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,712 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,713 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,714 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,715 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,716 |
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... | 3,717 |
def _takeOutGarbage(self, oid, txn): # take out the garbage. referenceCount=self._referenceCount referenceCount.delete(oid, txn) self._opickle.delete(oid, txn) self._current.delete(oid, txn) | def _takeOutGarbage(self, oid, txn): # take out the garbage. referenceCount=self._referenceCount referenceCount.delete(oid, txn) self._opickle.delete(oid, txn) self._current.delete(oid, txn) | 3,718 |
def _takeOutGarbage(self, oid, txn): # take out the garbage. referenceCount=self._referenceCount referenceCount.delete(oid, txn) self._opickle.delete(oid, txn) self._current.delete(oid, txn) | def_takeOutGarbage(self,oid,txn):#takeoutthegarbage.referenceCount=self._referenceCountreferenceCount.delete(oid,txn)self._opickle.delete(oid,txn)self._current.delete(oid,txn) | 3,719 |
def pack(self, t, referencesf): self._lock_acquire() try: pass # TBD finally: self._lock_release() | defpack(self,t,referencesf):self._lock_acquire()try:pass#TBDfinally:self._lock_release() | 3,720 |
def pack(self, t, referencesf): self._lock_acquire() try: pass # TBD finally: self._lock_release() | def pack(self, t, referencesf): self._lock_acquire() try: pass # TBD finally: self._lock_release() | 3,721 |
def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There... | def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There... | 3,722 |
def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There... | def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There... | 3,723 |
def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | 3,724 |
def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | 3,725 |
def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | 3,726 |
def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | 3,727 |
def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | 3,728 |
def pret(ast, level=0): if ISTERMINAL(ast[0]): print ' '*level, ast[1] else: print ' '*level, sym_name[ast[0]] for a in ast[1:]: pret(a,level+1) | def pret(ast, level=0): if ISTERMINAL(ast[0]): print ' '*level, ast[1] else: print ' '*level, sym_name[ast[0]], '(%s)' % ast[0] for a in ast[1:]: pret(a,level+1) | 3,729 |
def munge(ast): if ISTERMINAL(ast[0]): return else: if ast[0]==term and len(ast) > 2: ast[1:]=[multi_munge(ast[1:])] elif ast[0]==power: keep_going=1 while keep_going: keep_going=0 start=2 for i in range(start,len(ast)): a=ast[i] if a[0]==trailer: if a[1][0]==DOT: ast[:i+1]=dot_munge(ast,i) keep_going=1 start=3 break i... | def munge(ast): if ISTERMINAL(ast[0]): return else: if ast[0]==term and len(ast) > 2: keep_going=1 while keep_going: keep_going=0 start=2 for i in range(start,len(ast)-1): if ast[i][0]==STAR: ast[i-1:i+2]=[multi_munge(ast[i-1:i+2])] keep_going=1 break for a in ast[1:]: munge(a) elif ast[0]==power: keep_going=1 while ... | 3,730 |
def multi_munge(ast): # Munge a multiplication into a function call: __very_safe_multiply__ args=[arglist] append=args.append a=(factor, (power, (atom, (NAME, '_vars')))) a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, a))))))))))) append(a) append([... | def multi_munge(ast): # Munge a multiplication into a function call: __very_safe_multiply__ args=[arglist] append=args.append a=(factor, (power, (atom, (NAME, '_vars')))) a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, a))))))))))) append(a) append([... | 3,731 |
def spam(): # Regression test import traceback ok=1 for expr1, expr2 in ( ("a*b", "__guarded_mul__(_vars, a, b)"), ("a*b*c", "__guarded_mul__(_vars, a, b, c)"), ("a.b", "__guarded_getattr__(_vars, a, 'b')"), ("a[b]", "__guarded_getitem__(_vars, a, b)"), ("a[b,c]", "__guarded_getitem__(_vars, a, b, c)"), ("a[b:c]",... | def spam(): # Regression test import traceback ok=1 for expr1, expr2 in ( ("a*b", "__guarded_mul__(_vars, a, b)"), ("a*b*c", "__guarded_mul__(_vars, __guarded_mul__(_vars, a, b), c)" ), ("a.b", "__guarded_getattr__(_vars, a, 'b')"), ("a[b]", "__guarded_getitem__(_vars, a, b)"), ("a[b,c]", "__guarded_getitem__(_vars... | 3,732 |
def __init__(self, stdin, environ, response, clean=0): self._orig_env=environ # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. if not clean: environ=sane_environment(environ) | def __init__(self, stdin, environ, response, clean=0): self._orig_env=environ # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. if not clean: environ=sane_environment(environ) | 3,733 |
def __init__(self, stdin, environ, response, clean=0): self._orig_env=environ # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. if not clean: environ=sane_environment(environ) | def __init__(self, stdin, environ, response, clean=0): self._orig_env=environ # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. if not clean: environ=sane_environment(environ) | 3,734 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,735 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,736 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,737 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,738 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,739 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,740 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,741 |
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, ): """Process request input... | 3,742 |
def keys(self): keys = {} keys.update(self.common) keys.update(self._lazies) | def keys(self): keys = {} keys.update(self.common) keys.update(self._lazies) | 3,743 |
def manage_clone(self, ob, id, REQUEST=None): """Clone an object, creating a new object with the given id.""" if not ob.cb_isCopyable(): raise CopyError, eNotSupported % absattr(ob.id) try: self._checkId(id) except: raise CopyError, MessageDialog( title='Invalid Id', message=sys.exc_value, action ='manage_main') self._... | defob=ob.__of__(self) manage_clone(self,ob=ob.__of__(self) ob,ob=ob.__of__(self) id,ob=ob.__of__(self) REQUEST=None):ob=ob.__of__(self) """Cloneob=ob.__of__(self) anob=ob.__of__(self) object,ob=ob.__of__(self) creatingob=ob.__of__(self) aob=ob.__of__(self) newob=ob.__of__(self) objectob=ob.__of__(self) withob=ob.__of__... | 3,744 |
def manage_edit(self, title, base, path, REQUEST=None): '''Set the title, base, and path''' self.__init__(title, base, path) if REQUEST: return MessageDialog(title='SiteRoot changed.', message='The title is now "%s"<br>' 'The base is now "%s"<br>' 'The path is now "%s"<br>' % map(escape, (title, base, path)), action='%... | def manage_edit(self, title, base, path, REQUEST=None): '''Set the title, base, and path''' self.__init__(title, base, path) if REQUEST: return MessageDialog(title='SiteRoot changed.', message='SiteRoot changed.', action='%s/manage_main' % REQUEST['URL1']) | 3,745 |
def dav__init(self, request, response): # By the spec, we are not supposed to accept /foo for a # collection, we are supposed to redirect to /foo/. if request['PATH_INFO'][-1] != '/': raise 'Moved Permanently', request['URL1']+'/' response.setHeader('Connection', 'close', 1) response.setHeader('Date', rfc1123_date(), 1... | def dav__init(self, request, response): # By the spec, we are not supposed to accept /foo for a # collection, we are supposed to redirect to /foo/. pathinfo=request.get('PATH_INFO','') if pathinfo and pathinfo[-1] != '/': raise 'Moved Permanently', request['URL1']+'/' response.setHeader('Connection', 'close', 1) respon... | 3,746 |
def manage_addFile(self,id,file='',title='',precondition='', content_type='', REQUEST=None): """Add a new File object. Creates a new File object 'id' with the contents of 'file'""" id=str(id) title=str(title) content_type=str(content_type) precondition=str(precondition) id, title = cookId(id, title, file) self=self... | def manage_addFile(self,id,file='',title='',precondition='', content_type='', REQUEST=None): """Add a new File object. Creates a new File object 'id' with the contents of 'file'""" id=str(id) title=str(title) content_type=str(content_type) precondition=str(precondition) id, title = cookId(id, title, file) self=self... | 3,747 |
def manage_addImage(self, id, file, title='', precondition='', content_type='', REQUEST=None): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """ id=str(id) title=str(title) content_type=str(content_type) precondition=str(precondition) id, title = cookId(id, title, file) se... | def manage_addImage(self, id, file, title='', precondition='', content_type='', REQUEST=None): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """ id=str(id) title=str(title) content_type=str(content_type) precondition=str(precondition) id, title = cookId(id, title, file) se... | 3,748 |
def pw_validate(reference, attempt): """Validate the provided password string, which uses LDAP-style encoding notation. Reference is the correct password, attempt is clear text password attempt.""" result = 0 if upper(reference[:5]) == '{SHA}': attempt = binascii.b2a_base64(sha.new(attempt).digest())[:-1] result = re... | def pw_validate(reference, attempt): """Validate the provided password string, which uses LDAP-style encoding notation. Reference is the correct password, attempt is clear text password attempt.""" result = 0 if upper(reference[:5]) == '{SHA}': attempt = binascii.b2a_base64(sha.new(attempt).digest())[:-1] result = re... | 3,749 |
def manage_test(self, REQUEST): | def manage_test(self, REQUEST): | 3,750 |
def _init_headers(self, request, response): # Attempt to handle If-Modified-Since headers. ms=request.get_header('If-Modified-Since', None) if ms is not None: ms=split(ms, ';')[0] ms=DateTime(ms).timeTime() if self.lmt > ms: RESPONSE.setStatus(304) return RESPONSE response.setHeader('Content-Type', self.content_type) r... | def _init_headers(self, request, response): # Attempt to handle If-Modified-Since headers. ms=request.get_header('If-Modified-Since', None) if ms is not None: ms=split(ms, ';')[0] ms=DateTime(ms).timeTime() if self.lmt > ms: response.setStatus(304) return response response.setHeader('Content-Type', self.content_type) r... | 3,751 |
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 | 3,752 |
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 | 3,753 |
def validate(self,groups,realm=None): | def validate(self,groups,realm=None): | 3,754 |
def validate(self,groups,realm=None): | def validate(self,groups,realm=None): | 3,755 |
def open_bobobase(): # Open the application database Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName) product_dir=os.path.join(SOFTWARE_HOME,'lib/python/Products') __traceback_info__=sys.path try: app=Bobobase['Application'] except KeyError: app=Application() app._init() Bobobase['Applicatio... | def open_bobobase(): # Open the application database Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName) product_dir=os.path.join(SOFTWARE_HOME,'lib/python/Products') __traceback_info__=sys.path try: app=B... | 3,756 |
def catalog_object(self, obj, uid=None, idxs=[]): """ wrapper around catalog """ | def catalog_object(self, obj, uid=None, idxs=[]): """ wrapper around catalog """ | 3,757 |
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_permission=None, obj_roles=None, search_sub=0, REQUEST=None, result=None, pre='', apply_func=None, apply_path=''): """Zope Find interface and apply | def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_permission=None, obj_roles=None, search_sub=0, REQUEST=None, result=None, pre='', apply_func=None, apply_path=''): """Zope Find interface and apply | 3,758 |
def resolve_url(self, path, REQUEST): """ Attempt to resolve a url into an object in the Zope namespace. The url may be absolute or a catalog path style url. If no object is found, None is returned. No exceptions are raised. """ script=REQUEST.script if string.find(path, script) != 0: path='%s/%s' % (script, path) try:... | def resolve_url(self, path, REQUEST): """ Attempt to resolve a url into an object in the Zope namespace. The url may be absolute or a catalog path style url. If no object is found, None is returned. No exceptions are raised. """ script=REQUEST.script if path.find(script) != 0: path='%s/%s' % (script, path) try: return ... | 3,759 |
def manage_normalize_paths(self, REQUEST): """Ensure that all catalog paths are full physical paths | def manage_normalize_paths(self, REQUEST): """Ensure that all catalog paths are full physical paths | 3,760 |
def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | def loadmail(dest, name, mbox, printstat=0, max=-1): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i > max... | 3,761 |
def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if m... | 3,762 |
def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | 3,763 |
def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | def loadmail(dest, name, mbox, printstat=0, max=99999999): try: import Products.BTreeFolder.BTreeFolder except: dest.manage_addFolder(name) else: Products.BTreeFolder.BTreeFolder.manage_addBTreeFolder(dest, name) dest=getattr(dest, name) f=open(mbox) mb=mailbox.UnixMailbox(f) i=0 message=mb.next() while message: if i... | 3,764 |
def base(): try: os.unlink('../../var/Data.fs') except: pass import Zope app=Zope.app() max=atoi(sys.argv[3]) print do(Zope.DB, loadmail, (app, 'mail', sys.argv[2], 1, max)) Zope.DB.close() | def base(): try: os.unlink('../../var/Data.fs') except: pass import Zope app=Zope.app() if len(sys.argv) > 3: max = atoi(sys.argv[3]) else: max = -1 print do(Zope.DB, loadmail, (app, 'mail', sys.argv[2], 1, max)) Zope.DB.close() | 3,765 |
def name_param(params,tag='',expr=0, attr='name', default_unnamed=1): used=params.has_key __traceback_info__=params, tag, expr, attr #if expr and used('expr') and used('') and not used(params['']): # # Fix up something like: <!--#in expr="whatever" mapping--> # params[params['']]=default_unnamed # del params['']... | def name_param(params,tag='',expr=0, attr='name', default_unnamed=1): used=params.has_key __traceback_info__=params, tag, expr, attr #if expr and used('expr') and used('') and not used(params['']): # # Fix up something like: <!--#in expr="whatever" mapping--> # params[params['']]=default_unnamed # del params['']... | 3,766 |
def __init__(self): self.Products=ProductFolder() | def __init__(self): self.Products=ProductFolder() | 3,767 |
def __str__(self): return """The implementation of %(method)s violates it's contract because %(mess)s. """ % self.__dict__ | def __str__(self): return """The implementation of %(method)s violates its contract because %(mess)s. """ % self.__dict__ | 3,768 |
def earliestTime(self): """Return a new DateTime object that represents the earliest possible time (in whole seconds) that still falls within the current object\'s day, in the object\'s timezone context""" return self.__class__(self._year,self._month,self._day,0,0,1,self._tz) | def earliestTime(self): """Return a new DateTime object that represents the earliest possible time (in whole seconds) that still falls within the current object\'s day, in the object\'s timezone context""" return self.__class__(self._year,self._month,self._day,0,0,1,self._tz) | 3,769 |
def manage_test(self, REQUEST): | def manage_test(self, REQUEST): | 3,770 |
def manage_test(self, REQUEST): | def manage_test(self, REQUEST): | 3,771 |
def manage_test(self, REQUEST): | def manage_test(self, REQUEST): | 3,772 |
def name_param(params,tag='',expr=0): used=params.has_key if used(''): if used('name'): raise ParseError, _tm('Two names were given', tag) if expr: if used('expr'): raise ParseError, _tm('name and expr given', tag) return params[''],None return params[''] elif used('name'): if expr: if used('expr'): raise ParseError, _... | def name_param(params,tag='',expr=0): used=params.has_key if used(''): if used('name'): raise ParseError, _tm('Two names were given', tag) if expr: if used('expr'): raise ParseError, _tm('name and expr given', tag) return params[''],None return params[''] elif used('name'): if expr: if used('expr'): raise ParseError, _... | 3,773 |
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor... | def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor... | 3,774 |
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor... | def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor... | 3,775 |
def _calcIndependentSecondEtc(tz, x, ms): # Derive the timezone-independent second from the timezone # dependent second. fsetAtEpoch = _tzoffset(tz, 0.0) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms # nearTime is now within an hour of being correct. # Recalculate t according to DST. fset = long(_tzoffset(tz, ... | def _calcIndependentSecondEtc(tz, x, ms): # Derive the timezone-independent second from the timezone # dependent second. fsetAtEpoch = _tzoffset(tz, 0.0) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms # nearTime is now within an hour of being correct. # Recalculate t according to DST. fset = long(_tzoffset(tz, ... | 3,776 |
def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: try: # For the seconds, print two digits # before the decimal point. subsec = ('%g' % s).split('.')[1] return '%4.4d/%2.2d/%2.2d %2... | def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: try: # For the seconds, print two digits # before the decimal point. subsec = ('%g' % s).split('.')[1] return '%4.4d/%2.2d/%2.2d %2... | 3,777 |
def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: try: # For the seconds, print two digits # before the decimal point. subsec = ('%g' % s).split('.')[1] return '%4.4d/%2.2d/%2.2d %2... | def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: try: # For the seconds, print two digits # before the decimal point. subsec = ('%g' % s).split('.')[1] return '%4.4d/%2.2d/%2.2d %2... | 3,778 |
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" | def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" | 3,779 |
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" | def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" | 3,780 |
def recordMetaData(self, object, request, # Optimize global var lookups: hasattr=hasattr, getattr=getattr, logger=ac_logger, ): request_get = request.get if hasattr(object, 'getPhysicalPath'): path = '/'.join(object.getPhysicalPath()) else: # Try hard to get the physical path of the object, # but there are many circums... | def recordMetaData(self, object, request, # Optimize global var lookups: hasattr=hasattr, getattr=getattr, logger=ac_logger, ): request_get = request.get if hasattr(object, 'getPhysicalPath'): path = '/'.join(object.getPhysicalPath()) else: # Try hard to get the physical path of the object, # but there are many circums... | 3,781 |
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 | 3,782 |
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 | 3,783 |
def env(key,d=environ): try: return d[key] except: if string.upper(key) == 'HTTP_AUTHORIZATION': try: return d['HTTP_CGI_AUTHORIZATION'] except: return '' return '' | def env(key,d=environ): try: return d[key] except: if string.upper(key) == 'HTTP_AUTHORIZATION': try: return d['HTTP_CGI_AUTHORIZATION'] except: return '' return '' | 3,784 |
def __getitem__(self, key): '''\ Get the ResultList objects for the inverted key, key. The key may be a regular expression, in which case a regular expression match is done. The key may be a string, in which case an case-insensitive match is done. ''' index = self._index_object synstop = self.synstop List = self.lis... | def __getitem__(self, key): '''\ Get the ResultList objects for the inverted key, key. The key may be a regular expression, in which case a regular expression match is done. The key may be a string, in which case an case-insensitive match is done. ''' index = self._index_object synstop = self.synstop List = self.lis... | 3,785 |
def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions.sort() positions.reverse() | def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions.sort() positions.reverse() | 3,786 |
def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions.sort() positions.reverse() | def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions.sort() positions.reverse() | 3,787 |
def _checkApply( self, req, expectedValues ): result, used = self._index._apply_index( req ) assert used == ( 'foo', ) try: length = len(result) except: result = result.keys() length = len(result) assert length == len( expectedValues ), \ '%s | %s' % ( map( None, result ), map(lambda x: x[0], expectedValues )) for k, v... | def _checkApply( self, req, expectedValues ): result, used = self._index._apply_index( req ) assert used == ( 'foo', ) assert len(result) == len( expectedValues ), \ '%s | %s' % ( map( None, result ), map(lambda x: x[0], expectedValues )) for k, v in expectedValues: assert k in result | 3,788 |
def test_suite(): return unittest.makeSuite( TestCase ) | def test_suite(): return unittest.makeSuite( TestCase ) | 3,789 |
def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % product... | def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % product... | 3,790 |
def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10) | def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10) | 3,791 |
def testAllowed(self): """hasRole is an alias for allowed, which should be unaffected.""" try: self.userObject.allowed(None) except DeprecationWarning: self.fail('Expected DeprecationWarning, none given') else: pass | def testAllowed(self): """hasRole is an alias for allowed, which should be unaffected.""" try: self.userObject.allowed(None) except DeprecationWarning: self.fail('Unexpected DeprecationWarning, ' 'no warnings expected here') else: pass | 3,792 |
def filtered_meta_types(self, user): "Those meta types for which a user has adequite permissions." meta_types=[] all=callable(self.all_meta_types) and self.all_meta_types() or \ self.all_meta_types for meta_type in all: if meta_type.has_key('permission'): if user.has_permission(meta_type['permission'],self): meta_types... | def filtered_meta_types(self, user): "Those meta types for which a user has adequite permissions." meta_types=[] if callable(self.all_meta_types): all=self.all_meta_types() else: all=self.all_meta_types for meta_type in all: if meta_type.has_key('permission'): if user.has_permission(meta_type['permission'],self): meta... | 3,793 |
def __getitem__(self, index): """ returns instances of self._v_brains, or whatever is passed into self.useBrains. """ self.useBrains(self._v_brains) r=self._v_result_class(self.data[index]).__of__(self.aq_parent) r.data_record_id_ = index return r | def __getitem__(self, index): """ returns instances of self._v_brains, or whatever is passed into self.useBrains. """ r=self._v_result_class(self.data[index]).__of__(self.aq_parent) r.data_record_id_ = index return r | 3,794 |
def has_key(self, key): return self.__record_schema__.has_key(key) | def has_key(self, key): return self.__record_schema__.has_key(key) | 3,795 |
def has_key(self, key): return self.__record_schema__.has_key(key) | def has_key(self, key): return self.__record_schema__.has_key(key) | 3,796 |
def instantiate(self, record): self.useBrains(self._v_brains) | def instantiate(self, record): self.useBrains(self._v_brains) | 3,797 |
def searchResults(self, REQUEST=None, used=None, query_map={ type(regex.compile('')): Query.Regex, type([]): orify, type(''): Query.String, }, **kw): | def searchResults(self, REQUEST=None, used=None, query_map={ type(regex.compile('')): Query.Regex, type([]): orify, type(''): Query.String, }, **kw): | 3,798 |
def manage_test(self, REQUEST): | def manage_test(self, REQUEST): | 3,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.