bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def testUnderlinesWithoutWithspaces(self): """ underscores in literals shouldn't do unterlining """
def testUnderlinesWithoutWithspaces(self): """ underscores in literals shouldn't do unterlining """
2,600
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[...
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[...
2,601
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[...
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[...
2,602
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
2,603
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
2,604
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
2,605
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
2,606
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
2,607
def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self...
def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self...
2,608
def read_file(name): f = open(os.path.join(here, name), 'rb') res = f.read() f.close() return res
def read_file(name): f = open(os.path.join(here, name), 'r') res = f.read() f.close() return res
2,609
def d(**kw): return kw
defd(**kw):returnkw
2,610
def __init__(self,key,**kw): for k in kw.keys(): self.__dict__[k]=kw[k]
def __init__(self,key,**kw): for k in kw.keys(): self.__dict__[k]=kw[k]
2,611
def modified_in_session(self):
def modified_in_session(self):
2,612
def manage_addImage(id, file, title='', precondition='', content_type=''): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """
def manage_addImage(id, file, title='', precondition='', content_type=''): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """
2,613
def __call__(self): return 'dummy'
def __call__(self): return 'dummy'
2,614
def setUp(self): self.e = e = Expressions.getEngine() self.ec = e.getContext( one = 1, d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'}, blank = '', dummy = Dummy() )
def setUp(self): self.e = e = Expressions.getEngine() self.ec = e.getContext( one = 1, d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'}, blank = '', dummy = Dummy() )
2,615
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
2,616
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
2,617
def get_module_info(self, server_name, module_name, module):
def get_module_info(self, server_name, module_name, module):
2,618
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,619
def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match TH...
def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match TH...
2,620
def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match TH...
def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match TH...
2,621
def dav__init(self, request, response): # Init expected HTTP 1.1 / WebDAV headers which are not # currently set by the response object automagically. # Note we set an borg-specific header for ie5 :( response.setHeader('Date', rfc1123_date(), 1) response.setHeader('MS-Author-Via', 'DAV')
def dav__init(self, request, response): # Init expected HTTP 1.1 / WebDAV headers which are not # currently set by the response object automagically. # Note we set an borg-specific header for ie5 :( response.setHeader('Date', rfc1123_date(), 1) response.setHeader('MS-Author-Via', 'DAV')
2,622
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj)
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj)
2,623
def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST)
def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST)
2,624
def getUser(self, name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None.
def getUser(name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None.
2,625
def getUser(self, name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None.
defgetUser(self,name):"""Returnstheuserobjectspecifiedbyname.Ifthereisnousernamed'name'intheuserfolder,returnNone.
2,626
def getUsers(self): """ Returns a sequence of all user objects which reside in the user folder.
def getUsers(): """ Returns a sequence of all user objects which reside in the user folder.
2,627
def getUsers(self): """ Returns a sequence of all user objects which reside in the user folder.
defgetUsers(self):"""Returnsasequenceofalluserobjectswhichresideintheuserfolder.
2,628
def getUserNames(self): """ Returns a sequence of names of the users which reside in the user folder.
def getUserNames(): """ Returns a sequence of names of the users which reside in the user folder.
2,629
def getUserNames(self): """ Returns a sequence of names of the users which reside in the user folder.
defgetUserNames(self):"""Returnsasequenceofnamesoftheuserswhichresideintheuserfolder.
2,630
def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method.
def manage_addUser(name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method.
2,631
def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method.
defmanage_addUser(self,name,password,roles,domains):"""APImethodforcreatinganewuserobject.Notethatnotalluserfolderimplementationssupportdynamiccreationofuserobjects.Implementationsthatdonotsupportdynamiccreationofuserobjectswillraiseanerrorforthismethod.
2,632
def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method.
def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method.
2,633
def manage_editUser(self, name, password, roles, domains): """ API method for changing user object attributes. Note that not all user folder implementations support changing of user object attributes. Implementations that do not support changing of user object attributes will raise an error for this method.
defmanage_editUser(self,name,password,roles,domains):"""APImethodforchanginguserobjectattributes.Notethatnotalluserfolderimplementationssupportchangingofuserobjectattributes.Implementationsthatdonotsupportchangingofuserobjectattributeswillraiseanerrorforthismethod.
2,634
def manage_editUser(self, name, password, roles, domains): """ API method for changing user object attributes. Note that not all user folder implementations support changing of user object attributes. Implementations that do not support changing of user object attributes will raise an error for this method.
def manage_editUser(self, name, password, roles, domains): """ API method for changing user object attributes. Note that not all user folder implementations support changing of user object attributes. Implementations that do not support changing of user object attributes will raise an error for this method.
2,635
def manage_delUsers(self, names): """ API method for deleting one or more user objects. Note that not all user folder implementations support deletion of user objects. Implementations that do not support deletion of user objects will raise an error for this method.
defmanage_delUsers(self,names):"""APImethodfordeletingoneormoreuserobjects.Notethatnotalluserfolderimplementationssupportdeletionofuserobjects.Implementationsthatdonotsupportdeletionofuserobjectswillraiseanerrorforthismethod.
2,636
def get_signal_name(n): """Return the symbolic name for signal n. Returns 'unknown' if there is no SIG name bound to n in the signal module. """ global _signals if _signals is None: _signals = {} for k, v in signal.__dict__.items(): startswith = getattr(k, 'startswith', None) if startswith is None: continue if startsw...
def get_signal_name(n): """Return the symbolic name for signal n. Returns 'unknown' if there is no SIG name bound to n in the signal module. """ global _signals if _signals is None: _signals = {} for k, v in signal.__dict__.items(): startswith = getattr(k, 'startswith', None) if startswith is None: continue if startsw...
2,637
def tpId(self): return self.id
def tpId(self): return self.id
2,638
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
2,639
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self,REQUEST)
2,640
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self, REQUEST) def VocabularyIDs(self): """ returns a list of acquireable vocabularies. Stole this from ZSQLMethods """ ids={} have_id=ids.has_k...
2,641
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST)
2,642
def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog()
def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog()
2,643
def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog()
def self._catalog.addColumn('absolute_url') self._catalog.addIndex('absolute_url', 'FieldIndex') def getVocabulary(self): """ more ack! """ return getattr(self, self.vocab_id) __init__(self,id,title=''): self._catalog.addColumn('absolute_url') self._catalog.addIndex('absolute_url', 'FieldIndex') def getVocabulary(...
2,644
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold))
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold))
2,645
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
2,646
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__
2,647
def validate(self,request,auth='',roles=None):
def validate(self,request,auth='',roles=None):
2,648
def encode_seq(state): "Convert a sequence to an encoded string" state=compress(str(state)) l=len(state) if l > 57: states=[] for i in range(0,l,57): states.append(b2a_base64(state[i:i+57])[:-1]) state=join(states,'') else: state=b2a_base64(state)[:-1] l=find(state,'=') if l >= 0: state=state[:l] return state
def state=translate(state, tplus) encode_seq(state): state=translate(state, tplus) "Convert state=translate(state, tplus) a state=translate(state, tplus) sequence state=translate(state, tplus) to state=translate(state, tplus) an state=translate(state, tplus) encoded state=translate(state, tplus) string" state=translate...
2,649
def decode_seq(state): "Convert an encoded string to a sequence" l=len(state) if l > 76: states=[] j=0 for i in range(l/76): k=j+76 states.append(a2b_base64(state[j:k])) j=k if j < l: state=state[j:] l=len(state) k=l%4 if k: state=state+'='*(4-k) states.append(a2b_base64(state)) state=join(states,'') else: l=len(sta...
defstate=translate(state, tminus) decode_seq(state):state=translate(state, tminus) "Convertstate=translate(state, tminus) anstate=translate(state, tminus) encodedstate=translate(state, tminus) stringstate=translate(state, tminus) tostate=translate(state, tminus) astate=translate(state, tminus) sequence"state=translate(...
2,650
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) elif hasattr(self, b): bases.append(getattr(self, b)) else: # If self is the "methods" pr...
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: # If self is the "methods" propertysheet # of a ZClass, get the class from the # pr...
2,651
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) elif hasattr(self, b): bases.append(getattr(self, b)) else: # If self is the "methods" pr...
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) elif hasattr(self, b): bases.append(getattr(self, b)) else: # If self is the "methods" pr...
2,652
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
2,653
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
2,654
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
2,655
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
2,656
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch...
2,657
def getdate(val): try: val = string.strip(val) year, month, day = int(val[:4]), int(val[5:7]), int(val[8:10]) hour,minute,second=int(val[11:13]),int(val[14:16]),int(val[17:19]) t = time.mktime((year, month, day, hour, minute, second, 0, 0, -1)) return t except: raise ProfileException, "bad date %s" % val
def getdate(val): try: val = string.strip(val) year, month, day = int(val[:4]), int(val[5:7]), int(val[8:10]) hour,minute,second=int(val[11:13]),int(val[14:16]),int(val[17:19]) t = time.mktime((year, month, day, hour, minute, second, 0, 0, -1)) return t except: raise ProfileException, "bad date %s" % val
2,658
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range...
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start), tick2str(end), resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in ran...
2,659
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range...
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" d = {} for r in requests: t = r.start slice = getTimeslice(resolution,t) if d.ha...
2,660
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range...
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range...
2,661
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range...
def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %sprint " Avg: %6d %4.2lf" % \ (avg_requests,avg_requests*1.0/resolution) print "Total: %6d n/a " % (hits) End: %sprint " Avg: %6d %4.2lf" % \ (avg_requests,avg_requ...
2,662
def tick2str(t): return time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(t))
def tick2str(t): return time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(t))
2,663
def usage(basic=1): usage = ( """
defusage(basic=1):usage=("""
2,664
def usage(basic=1): usage = ( """
def usage(basic=1): usage = ( """
2,665
def value(self): return str(self._v)[:-1]
def value(self): return str(self._v)[:-1]
2,666
def testStrftimeUnicode(self): dt = DateTime('2002-05-02T08:00:00+00:00') self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), u'Le 02/05/2002 \xe0 10h00')
def testStrftimeUnicode(self): dt = DateTime('2002-05-02T08:00:00+00:00') self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), u'Le 02/05/2002 \xe0 10h00')
2,667
def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range)
def time(function,*args,**kwargs): repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range)
2,668
def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range)
def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) t=time.clock() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range)
2,669
def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range)
def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) t=(time.clock()-t)/1000.0 return float(t)/len(repeat_range)
2,670
def restrictedTraverse(self, path, securityManager, get=getattr, has=hasattr, N=None, M=[], TupleType=type(()) ): REQUEST = {'path': path} REQUEST['TraversalRequestNameStack'] = path = path[:] # Copy! if not path[0]: # If the path starts with an empty string, go to the root first. self = self.getPhysicalRoot() if not ...
def restrictedTraverse(self, path, securityManager, get=getattr, has=hasattr, N=None, M=[], TupleType=type(()) ): REQUEST = {'path': path} REQUEST['TraversalRequestNameStack'] = path = path[:] # Copy! if not path[0]: # If the path starts with an empty string, go to the root first. self = self.getPhysicalRoot() if not ...
2,671
def manage_product_zclass_info(self): r=[] Z=self._zclass Z=getattr(Z, 'aq_self', Z) for d in self.aq_acquire('_getProductRegistryData')('zclasses'): z=d['meta_class'] if hasattr(z._zclass_,'_p_deactivate'): # Eek, persistent continue x={} x.update(d) x['selected'] = (z is Z) and 'selected' or '' del x['meta_class'] r....
def manage_product_zclass_info(self): r=[] Z=self._zclass Z=getattr(Z, 'aq_self', Z) for d in self.aq_acquire('_getProductRegistryData')('zclasses'): z=d['meta_class'] if hasattr(z._zclass_,'_p_deactivate'): # Eek, persistent continue x={} x.update(d) x['selected'] = (z is Z) and 'selected' or '' del x['meta_class'] r....
2,672
def setColorizableTexts(self, v): pass
def setColorizableTexts(self, v): pass
2,673
def doc_numbered( self, paragraph, expr = re.compile(r'(\s*[%s]+\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match): # This is the old expression. It had a nasty habit # of grabbing paragraphs that began with a single # letter word even if there was no following period. #expr = re.compile('\s*' # '(...
def doc_numbered( self, paragraph, expr = re.compile(r'(\s*[%s]\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match): # This is the old expression. It had a nasty habit # of grabbing paragraphs that began with a single # letter word even if there was no following period. #expr = re.compile('\s*' # '((...
2,674
def doc_header(self, paragraph, expr=re.compile(r'[ %s0-9.:/,-_*<>\?\'\"]+' % letters).match): subs=paragraph.getSubparagraphs() if not subs: return None top=paragraph.getColorizableTexts()[0] if not strip(top): return None if top[-2:]=='::': subs=StructuredTextExample(subs) if strip(top)=='::': return subs # copy attr...
def doc_header(self, paragraph): subs=paragraph.getSubparagraphs() if not subs: return None top=paragraph.getColorizableTexts()[0] if not strip(top): return None if top[-2:]=='::': subs=StructuredTextExample(subs) if strip(top)=='::': return subs # copy attrs when returning a paragraph kw = {} atts = getattr(paragraph,...
2,675
def doc_literal( self, s, expr=re.compile( r"(?:\s|^)'" # open r"([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" # contents r"'(?:\s|[,.;:!?]|$)" # close ).search): r=expr(s) if r: start, end = r.span(1) return (Structured...
def doc_literal( self, s, expr=re.compile( r"(?:\s|^)'" # open r"([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" # contents r"'(?:\s|[,.;:!?]|$)" # close ).search): r=expr(s) if r: start, end = r.span(1) return (Structured...
2,676
def doc_emphasize( self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
def doc_emphasize( self, s, expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search ):
2,677
def doc_inner_link(self, s, expr1 = re.compile(r"\.\.\s*").search, expr2 = re.compile(r"\[[%s0-9]+\]" % letters ).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 else: # ...
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...
2,678
def doc_underline(self, s, expr=re.compile(r"\_([%s0-9\s\.,\?]+)\_" % letters).search): result = expr(s) if result: start,end = result.span(1) st,e = result.span() return (StructuredTextUnderline(s[start:end]),st,e) else: return None
def doc_underline(self, s, expr=re.compile(r'_([%s%s%s\s]+)_' % (letters, digits, under_punc)).search): result = expr(s) if result: start,end = result.span(1) st,e = result.span() return (StructuredTextUnderline(s[start:end]),st,e) else: return None
2,679
def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
def doc_strong(self, s, expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search ):
2,680
def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
2,681
def doc_xref(self, s, expr = re.compile('\[([%s0-9\-.:/;,\n\~]+)\]' % letters).search ): r = expr(s) if r: start, end = r.span(1) return (StructuredTextXref(s[start:end]), start-1, end+1) else: return None
def doc_xref(self, s, expr = re.compile('\[([%s0-9\-.:/;,\n\r\~]+)\]' % letters).search ): r = expr(s) if r: start, end = r.span(1) return (StructuredTextXref(s[start:end]), start-1, end+1) else: return None
2,682
def render(self, md):
def render(self, md):
2,683
def manage_addZCatalog(self, id, title, vocab_id='', REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
2,684
def __init__(self, id, title='', vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
def __init__(self, id, title='', vocab_id=None, container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
2,685
def evaluateBoolean(self, expr): return not not self.evaluate(expr)
def evaluateBoolean(self, expr): return not not self.evaluate(expr)
2,686
def evaluateText(self, expr): text = self.evaluate(expr) if text is not None: text = str(text) return text
def evaluateText(self, expr): text = self.evaluate(expr) if text not in (None, Undefined): text = str(text) return text
2,687
def __init__(self, attrs): distutils.core.Distribution.__init__(self, attrs) self.cmdclass["install"] = ZopeInstall self.cmdclass["install_data"] = ZopeInstallData
def __init__(self, attrs): distutils.core.Distribution.__init__(self, attrs) self.cmdclass["install"] = ZopeInstall self.cmdclass["install_data"] = ZopeInstallData
2,688
def all_meta_types(self): return self.meta_types
def all_meta_types(self): return self.meta_types
2,689
def guarded_getitem(object, index): v = object[index] if getSecurityManager().validate(object, object, index, v): return v raise Unauthorized, 'unauthorized access to element %s' % `i`
def guarded_getitem(object, index): v = object[index] if getSecurityManager().validate(object, object, index, v): return v raise Unauthorized, 'unauthorized access to element %s' % `i`
2,690
def simple_marshal(v): if isinstance(v, StringType): return '' if BooleanType and isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
def simple_marshal(v): if isinstance(v, StringType): return '' if isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
2,691
def indention(str,front = re.compile("^\s+").match): """ Convert all tabs to the appropriate number of spaces. Find the number of leading spaces. If none, return 0 """ if front(str): start,end = front(str).span() return end-start-1 else: return 0 # no leading spaces
def indention(str,front = re.compile("^\s+").match): """ Convert all tabs to the appropriate number of spaces. Find the number of leading spaces. If none, return 0 """ result = front(str) if result is not None: start, end = result.span() return end-start else: return 0 # no leading spaces
2,692
def ZCache_set(self, ob, data, view_name, keywords, mtime_func): # Note the blatant ignorance of view_name, keywords, and # mtime_func. Standard HTTP accelerators are not able to make # use of this data. REQUEST = ob.REQUEST RESPONSE = REQUEST.RESPONSE anon = 1 u = REQUEST.get('AUTHENTICATED_USER', None) if u is not N...
def ZCache_set(self, ob, data, view_name, keywords, mtime_func): # Note the blatant ignorance of view_name, keywords, and # mtime_func. Standard HTTP accelerators are not able to make # use of this data. REQUEST = ob.REQUEST RESPONSE = REQUEST.RESPONSE anon = 1 u = REQUEST.get('AUTHENTICATED_USER', None) if u is not N...
2,693
def logmsg(self, event): # log a service event using servicemanager.LogMsg try: servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_)) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full...
def logmsg(self, event): # log a service event using servicemanager.LogMsg try: servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_)) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full...
2,694
def _dolog(self, func, msg): try: fullmsg = "%s (%s): %s" % \ (self._svc_name_, self._svc_display_name_, msg) func(fullmsg) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full. We don't want this to kill us print "FAILED to write event log entry:", detail...
def _dolog(self, func, msg): try: fullmsg = "%s (%s): %s" % \ (self._svc_name_, self._svc_display_name_, msg) func(fullmsg) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full. We don't want this to kill us print "FAILED to write event log entry:", detail...
2,695
def do_start(self, arg): self.get_status() if not self.zd_up: args = [ self.options.python, self.options.zdrun, ] args += self._get_override("-S", "schemafile") args += self._get_override("-C", "configfile") args += self._get_override("-b", "backofflimit") args += self._get_override("-d", "daemon", flag=1) args += self...
def do_start(self, arg): self.get_status() if not self.zd_up: args = [ self.options.python, self.options.zdrun, ] args += self._get_override("-S", "schemafile") args += self._get_override("-C", "configfile") args += self._get_override("-b", "backofflimit") args += self._get_override("-d", "daemon", flag=1) args += self...
2,696
def import_products(): # Try to import each product, checking for and catching errors. done={} products = get_products() debug_mode = App.config.getConfiguration().debug_mode for priority, product_name, index, product_dir in products: if done.has_key(product_name): LOG.warn('Duplicate Product name', 'After loading Pr...
def import_products(): # Try to import each product, checking for and catching errors. done={} products = get_products() debug_mode = App.config.getConfiguration().debug_mode for priority, product_name, index, product_dir in products: if done.has_key(product_name): LOG.warn('Duplicate Product name: ' 'After loading P...
2,697
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
2,698
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
2,699