rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
""" underscores in literals shouldn't do unterlining """
""" underscores in literals shouldn't do underlining """
def testUnderlinesWithoutWithspaces(self): """ underscores in literals shouldn't do unterlining """
3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431/testStructuredText.py
if v=='-': v='' Zpid=v
if v in ('-', '0', ''): USE_DAEMON=0 elif sys.platform != 'win32': USE_DAEMON = 1
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=[(a,v)] else: old.append((a,v)) return old
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
if sys.platform=='win32': Zpid=''
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=[(a,v)] else: old.append((a,v)) return old
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
if Zpid and not READ_ONLY:
PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid') if USE_DAEMON and not READ_ONLY:
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 locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' )
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, Zpid))
zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, PID_FILE))
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 locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' )
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid')
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") )
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
if not READ_ONLY:
if not USE_DAEMON and not READ_ONLY:
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") )
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
pid=str(os.getpid()) try: pid=str(os.getppid())+' '+pid except: pass
pid='%s\n' % os.getpid()
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") )
61e58cf7076cd2024e39df99896d0a31a9735f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61e58cf7076cd2024e39df99896d0a31a9735f2a/z2.py
if (hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1)):
if not parent.aq_inContextOf(self.aq_parent.aq_parent,1):
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.aq_parent,'aq_parent')): if parent is None: return 1 if (not hasattr(parent, 'aq_inContextOf') and hasattr(parent, 'im_self')): # This is a method, grab it's self. parent=parent.im_self if (hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1)): if 'Shared' in roles: # Damn, old role setting. Waaa roles=self._shared_roles(parent) if 'Anonymous' in roles: return 1 return None return 1
46a832f429236c46772695f8bd61bd1b0d9dba56 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/46a832f429236c46772695f8bd61bd1b0d9dba56/User.py
f = open(os.path.join(here, name), 'rb')
f = open(os.path.join(here, name), 'r')
def read_file(name): f = open(os.path.join(here, name), 'rb') res = f.read() f.close() return res
d9f5c90ba2a0ef2f22e631da477b688a08c02432 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d9f5c90ba2a0ef2f22e631da477b688a08c02432/testDTML.py
def d(**kw): return kw
d9f5c90ba2a0ef2f22e631da477b688a08c02432 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d9f5c90ba2a0ef2f22e631da477b688a08c02432/testDTML.py
assert res == expected, res
self.assertEqual(res,expected)
def __init__(self,key,**kw): for k in kw.keys(): self.__dict__[k]=kw[k]
d9f5c90ba2a0ef2f22e631da477b688a08c02432 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d9f5c90ba2a0ef2f22e631da477b688a08c02432/testDTML.py
if jar is None: return 1
if jar is None: if hasattr(self,'aq_parent') and hasattr(self.aq_parent, '_p_jar'): jar=self.aq_parent._p_jar if jar is None: return 0
def modified_in_session(self):
ddf351adb5e1bd23bb7201dadda825ebc55e3640 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ddf351adb5e1bd23bb7201dadda825ebc55e3640/ObjectManager.py
<dtml-var "ImageObject.tag(border=5, align=left)">
<dtml-var "ImageObject.tag(border='5', align='left')">
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'. """
6f1a8d1e5405b8b97c96fc2c9ee2d2eef03f2cf0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6f1a8d1e5405b8b97c96fc2c9ee2d2eef03f2cf0/Image.py
class ExpressionTests(unittest.TestCase):
class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
def __call__(self): return 'dummy'
8605f625ad8da861f9031e44fcd6e50a2c5c3226 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8605f625ad8da861f9031e44fcd6e50a2c5c3226/testExpressions.py
def tearDown(self): del self.e, self.ec
def setUp(self): self.e = e = Expressions.getEngine() self.ec = e.getContext( one = 1, d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'}, blank = '', dummy = Dummy() )
8605f625ad8da861f9031e44fcd6e50a2c5c3226 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8605f625ad8da861f9031e44fcd6e50a2c5c3226/testExpressions.py
$Id: Publish.py,v 1.55 1997/09/26 19:15:47 jim Exp $"""
$Id: Publish.py,v 1.56 1997/10/10 19:34:20 jim Exp $"""
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
8e064df58c28d53362c495730a365e049ce987b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8e064df58c28d53362c495730a365e049ce987b0/Publish.py
__version__='$Revision: 1.55 $'[11:-2]
__version__='$Revision: 1.56 $'[11:-2]
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
8e064df58c28d53362c495730a365e049ce987b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8e064df58c28d53362c495730a365e049ce987b0/Publish.py
except: roles=UNSPECIFIED_ROLES
except: pass
def get_module_info(self, server_name, module_name, module):
8e064df58c28d53362c495730a365e049ce987b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8e064df58c28d53362c495730a365e049ce987b0/Publish.py
URL=self.script
def publish(self, module_name, after_list, published='web_objects',
8e064df58c28d53362c495730a365e049ce987b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8e064df58c28d53362c495730a365e049ce987b0/Publish.py
ignore.append(start,end-1)
ignore.append((start,end-1))
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 THdivider = re.compile("[\=]+").match col = re.compile('\|').search innertable = re.compile('\|([-]+|[=]+)\|').search text = strip(text) rows = split(text,'\n') foo = "" for row in range(len(rows)): rows[row] = strip(rows[row]) # have indexes store if a row is a divider # or a cell part for index in range(len(rows)): tmpstr = rows[index][1:len(rows[index])-1] if TDdivider(tmpstr): indexes.append("TDdivider") elif THdivider(tmpstr): indexes.append("THdivider") else: indexes.append("cell")
a3023439a3722d7098b7aa8182e136631ca05eb8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a3023439a3722d7098b7aa8182e136631ca05eb8/DocumentClass.py
cols.append(row[index][0],row[index][1],align,valign,row[index][2])
cols.append((row[index][0],row[index][1],align,valign,row[index][2]))
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 THdivider = re.compile("[\=]+").match col = re.compile('\|').search innertable = re.compile('\|([-]+|[=]+)\|').search text = strip(text) rows = split(text,'\n') foo = "" for row in range(len(rows)): rows[row] = strip(rows[row]) # have indexes store if a row is a divider # or a cell part for index in range(len(rows)): tmpstr = rows[index][1:len(rows[index])-1] if TDdivider(tmpstr): indexes.append("TDdivider") elif THdivider(tmpstr): indexes.append("THdivider") else: indexes.append("cell")
a3023439a3722d7098b7aa8182e136631ca05eb8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a3023439a3722d7098b7aa8182e136631ca05eb8/DocumentClass.py
response.setHeader('Date', rfc1123_date(), 1)
if not hasattr(response, '_server_version'): response.setHeader('Connection', 'close') response.setHeader('Date', rfc1123_date(), 1)
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')
a4b16a96dc4a9544905ed4311254c7d2ce07206c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a4b16a96dc4a9544905ed4311254c7d2ce07206c/Resource.py
index_html_=HTML("""\
def index_html(self, REQUEST=None): """ View the STX Help Topic """ if Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object() return self.htmlfile(self, REQUEST) htmlfile = HTML("""\
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj)
b38c71929f2b00c0412bff5e1a395235424c1dcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b38c71929f2b00c0412bff5e1a395235424c1dcc/HelpTopic.py
def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST)
def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST)
b38c71929f2b00c0412bff5e1a395235424c1dcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b38c71929f2b00c0412bff5e1a395235424c1dcc/HelpTopic.py
def getUser(self, name):
def getUser(name):
def getUser(self, name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def getUser(self, name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def getUsers(self):
def getUsers():
def getUsers(self): """ Returns a sequence of all user objects which reside in the user folder.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def getUsers(self): """ Returns a sequence of all user objects which reside in the user folder.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def getUserNames(self):
def getUserNames():
def getUserNames(self): """ Returns a sequence of names of the users which reside in the user folder.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def getUserNames(self): """ Returns a sequence of names of the users which reside in the user folder.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def manage_addUser(self, name, password, roles, domains):
def manage_addUser(name, password, roles, domains):
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def manage_editUser(self, name, password, roles, domains):
def manage_editUser(name, password, roles, domains):
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
def manage_delUsers(self, names):
def manage_delUsers(names):
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
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.
0ae0fa28bf854450e68f238e212a10ad04c88b44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0ae0fa28bf854450e68f238e212a10ad04c88b44/UserFolderAPI.py
return _signals.get(n, 'unknown')
return _signals.get(n, 'signal %d' % n)
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 startswith('SIG') and not startswith('SIG_'): _signals[v] = k return _signals.get(n, 'unknown')
47f66299a9af95c52f918f90e6682ca44e6661e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/47f66299a9af95c52f918f90e6682ca44e6661e0/SignalHandler.py
{'label':'Contents', 'action':'manage_main'}, {'label':'Import/Export', 'action':'manage_importExportForm'}, {'label':'Undo', 'action':'manage_UndoForm'},
ObjectManager.manage_options + Item.manage_options
def tpId(self): return self.id
9b7435005e10b0851ab1b48e07b039245e258e44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9b7435005e10b0851ab1b48e07b039245e258e44/HelpSys.py
def manage_addZCatalog(self,id,title,REQUEST=None):
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None):
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)
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
c=ZCatalog(id,title) self._setObject(id,c)
c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c)
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)
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
return self.manage_main(self,REQUEST)
return self.manage_main(self, REQUEST) def VocabularyIDs(self): """ returns a list of acquireable vocabularies. Stole this from ZSQLMethods """ ids={} have_id=ids.has_key StringType=type('') while self is not None: if hasattr(self, 'objectValues'): for o in self.objectValues(): if (hasattr(o,'_isAVocabulary') and o._isAVocabulary and hasattr(o,'id')): id=o.id if type(id) is not StringType: id=id() if not have_id(id): if hasattr(o,'title_and_id'): o=o.title_and_id() else: o=id ids[id]=id if hasattr(self, 'aq_parent'): self=self.aq_parent else: self=None ids=map(lambda item: (item[1], item[0]), ids.items()) ids.sort() return ids
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)
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
def __init__(self,id,title=''):
_v_vocabulary = None def __init__(self, id, title='', vocab=0, vocab_id='', container=None):
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)
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
self._catalog = Catalog()
if not vocab: v = Vocabulary('Vocabulary', 'Vocabulary', globbing=1) self._setObject('Vocabulary', v) v = 'Vocabulary' else: v = vocab_id self._catalog = Catalog(vocabulary=v)
def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog()
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
self._catalog.addColumn('absolute_url') self._catalog.addIndex('absolute_url', 'FieldIndex') def getVocabulary(self): """ more ack! """ return getattr(self, self.vocab_id)
def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog()
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold))
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
apply_func(ob, (apply_path+'/'+p))
if apply_path: apply_func(ob, (apply_path+'/'+p)) else: apply_func(ob, p)
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
e48881c65b01fd747d530825a792eaf8f9585960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e48881c65b01fd747d530825a792eaf8f9585960/ZCatalog.py
if val is None or (not val and val != 0) and have_arg('null'):
if have_arg('null') and not val and val != 0:
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__
f8fffc40a67ee0b8d4cdb52eda8d131a464caa5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f8fffc40a67ee0b8d4cdb52eda8d131a464caa5c/DT_Var.py
return nobody
if roles is None: return nobody return None
def validate(self,request,auth='',roles=None):
99520b14939a900e1e03967fad49b9b0fe99852e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/99520b14939a900e1e03967fad49b9b0fe99852e/User.py
state=translate(state, tplus)
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
88d4b3d3c0dac1e4ad48084f31c09944912bdb8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/88d4b3d3c0dac1e4ad48084f31c09944912bdb8f/TreeTag.py
state=translate(state, tminus)
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(state) k=l%4 if k: state=state+'='*(4-k) state=a2b_base64(state) state=decompress(state) if find(state,'*') >= 0: raise 'Illegal State', state try: return list(eval(state,{'__builtins__':{}})) except: return []
88d4b3d3c0dac1e4ad48084f31c09944912bdb8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/88d4b3d3c0dac1e4ad48084f31c09944912bdb8f/TreeTag.py
elif hasattr(self, b): bases.append(getattr(self, b))
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" propertysheet # of a ZClass, get the class from the # propertysheet. bases.append(self._getOb(b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
ec64a204448370ac724e53a0a9791c8ddd0f03f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ec64a204448370ac724e53a0a9791c8ddd0f03f9/ZClass.py
bases.append(self._getOb(b))
base=find_class(self, b) bases.append(base)
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" propertysheet # of a ZClass, get the class from the # propertysheet. bases.append(self._getOb(b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
ec64a204448370ac724e53a0a9791c8ddd0f03f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ec64a204448370ac724e53a0a9791c8ddd0f03f9/ZClass.py
timeDict = {} timesort(timeDict,requests)
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, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
timewrite(timeDict,start,end,resolution)
timewrite(requests,start,end,resolution)
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, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
timewrite(timeDict,start,computed_end,resolution)
timewrite(requests,start,computed_end,resolution)
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, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
timewrite(timeDict,computed_start,end,resolution)
timewrite(requests,computed_start,end,resolution)
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, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
timewrite(timeDict,computed_start,computed_end,resolution)
timewrite(requests,computed_start,computed_end,resolution)
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, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
def timesort(dict,requests): for r in requests: if not r.t_end: r.t_end=r.start for t in range(r.start,r.t_end+1): if not dict.has_key(t): dict[t] = 0 dict[t]=dict[t]+1 def timewrite(dict,start,end,resolution):
def getTimeslice(period, utime): low = int(math.floor(utime)) - period + 1 high = int(math.ceil(utime)) + 1 for x in range(low, high): if x % period == 0: return x def timewrite(requests, start, end, resolution):
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
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
(tick2str(start),tick2str(end),resolution)
(tick2str(start), tick2str(end), resolution)
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(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num
d = {} for r in requests: t = r.start slice = getTimeslice(resolution,t) if d.has_key(slice): d[slice] = d[slice] + 1 else: d[slice] = 1 num = 0 hits = 0 avg_requests = None slices = d.keys() slices.sort() for slice in slices: num = d[slice] if num>max_requests: max_requests = num hits = hits + num if avg_requests is None: avg_requests = num else: avg_requests = (avg_requests + num) / 2 s = tick2str(slice)
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(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
print "Peak: %6d %4.2lf" % \
print " Peak: %6d %4.2lf" % \
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(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
print " Avg: %6d %4.2lf" % \ (avg_requests,avg_requests*1.0/resolution) print "Total: %6d n/a " % (hits)
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(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution)
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
def tick2str(t): return time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(t))
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
def usage(basic=1): usage = ( """
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
sortf = timesort
sortf = None
def usage(basic=1): usage = ( """
80ca4194666259398660aa3973c1ed8d4b99bb7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80ca4194666259398660aa3973c1ed8d4b99bb7a/requestprofiler.py
def value(self): return str(self._v)[:-1]
def value(self): result = str(self._v) if result[-1:] == 'L': return result[:-1] return result
def value(self): return str(self._v)[:-1]
643702cbcea435af26b0a5a6dc6e461932f73118 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/643702cbcea435af26b0a5a6dc6e461932f73118/ppml.py
self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), u'Le 02/05/2002 \xe0 10h00')
ok = dt.strftime('Le %d/%m/%Y a %Hh%M').replace('a', u'\xe0') self.assertEqual(dt.strftime(u'Le %d/%m/%Y \xe0 %Hh%M'), ok)
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')
3fe671ef32d8909c8642c59c6917c529f8826e5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fe671ef32d8909c8642c59c6917c529f8826e5b/testDateTime.py
from timing import start, finish, milli
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)
ae9f1be84782f767256031744538ea72bc3962de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ae9f1be84782f767256031744538ea72bc3962de/Test.py
start()
t=time.clock()
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)
ae9f1be84782f767256031744538ea72bc3962de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ae9f1be84782f767256031744538ea72bc3962de/Test.py
finish() return float(milli())/len(repeat_range)
t=(time.clock()-t)/1000.0 return float(t)/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) finish() return float(milli())/len(repeat_range)
ae9f1be84782f767256031744538ea72bc3962de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ae9f1be84782f767256031744538ea72bc3962de/Test.py
if has(o, 'im_self'):
if aq_base(o) is not o: container = aq_parent(aq_inner(o)) elif has(o, 'im_self'):
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 securityManager.validateValue(self): raise Unauthorized, name path.pop(0) path.reverse() validate = securityManager.validate object = self while path: __traceback_info__ = REQUEST name = path.pop() if isinstance(name, TupleType): object = apply(object, name) continue if name[0] == '_': # Never allowed in a URL. raise AttributeError, name if name=='..': o = get(object, 'aq_parent', M) if o is not M: if not validate(object, object, name, o): raise Unauthorized, name object=o continue t=get(object, '__bobo_traverse__', N) if t is not N: o=t(REQUEST, name) container = None if has(o, 'im_self'): container = o.im_self elif (has(get(object, 'aq_base', object), name) and get(object, name) == o): container = object if not validate(object, container, name, o): raise Unauthorized, name else: # Try an attribute. o = get(object, name, M) if o is not M: # Check access to the attribute. if has(object, 'aq_acquire'): object.aq_acquire( name, validate2, validate) else: if not validate(object, object, name, o): raise Unauthorized, name else: # Try an item. try: # XXX maybe in Python 2.2 we can just check whether # the object has the attribute "__getitem__" # instead of blindly catching exceptions. o = object[name] except AttributeError, exc: if str(exc).find('__getitem__') >= 0: # The object does not support the item interface. # Try to re-raise the original attribute error. # XXX I think this only happens with # ExtensionClass instances. get(object, name) raise except TypeError, exc: if str(exc).find('unsubscriptable') >= 0: # The object does not support the item interface. # Try to re-raise the original attribute error. # XXX This is sooooo ugly. get(object, name) raise else: # Check access to the item. if not validate(object, object, name, o): raise Unauthorized, name object = o return object
910efb13e8cd45a7f45cee8895b5e20a8403c2ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/910efb13e8cd45a7f45cee8895b5e20a8403c2ef/Expressions.py
_r=None
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.append(x)
c77c6da8f99dbef9f6537d1a311d304675c10c11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c77c6da8f99dbef9f6537d1a311d304675c10c11/DA.py
def setColorizableTexts(self, v): pass
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr = re.compile(r'(\s*[%s]+\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match):
expr = re.compile(r'(\s*[%s]\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match):
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*' # '(([a-zA-Z]|[0-9]+|[ivxlcdmIVXLCDM]+)\.)*' # '([a-zA-Z]|[0-9]+|[ivxlcdmIVXLCDM]+)\.?' # '\s+').match): top=paragraph.getColorizableTexts()[0] m=expr(top) if not m: return None subs=paragraph.getSubparagraphs() if top[-2:]=='::': subs=[StructuredTextExample(subs)] top=top[:-1] return StructuredTextNumbered(top[m.span()[1]:], subs, indent=paragraph.indent, number=top[:m.span()[1]])
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
def doc_header(self, paragraph, expr=re.compile(r'[ %s0-9.:/,-_*<>\?\'\"]+' % letters).match):
def doc_header(self, paragraph):
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 attrs when returning a paragraph kw = {} atts = getattr(paragraph, '_attributes', []) for att in atts: kw[att] = getattr(paragraph, att) return apply(ST.StructuredTextParagraph, (top[:-1], [subs]), kw)
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr=re.compile( r"(?:\s|^)'" r"([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" r"'(?:\s|[,.;:!?]|$)" ).search):
expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
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 (StructuredTextLiteral(s[start:end]), start-1, end+1) else: return None
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search
expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search
def doc_emphasize( self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr2 = re.compile(r"\[[%s0-9]+\]" % letters ).search):
expr2 = re.compile(r"\[[%s%s]+\]" % (letters, digits) ).search):
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: # the .. is somewhere else, ignore it return (StructuredTextInnerLink(s[start2+1,end2-1],start2,end2)) return None elif expr2(s) and not expr1(s): start,end = expr2(s).span() return (StructuredTextInnerLink(s[start+1:end-1]),start,end) return None
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr=re.compile(r"\_([%s0-9\s\.,\?]+)\_" % letters).search):
expr=re.compile(r'_([%s%s%s\s]+)_' % (letters, digits, under_punc)).search):
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
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search
expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search
def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
_DQUOTEDTEXT = r'("[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+")' % letters _URL_AND_PUNC = r'([%s0-9_\@\.\,\?\!\/\:\;\-\
_DQUOTEDTEXT = r'("[ %s0-9\n\r\-\.\,\;\(\)\/\:\/\*\']+")' % letters _URL_AND_PUNC = r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\
def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ):
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
expr = re.compile('\[([%s0-9\-.:/;,\n\~]+)\]' % letters).search
expr = re.compile('\[([%s0-9\-.:/;,\n\r\~]+)\]' % letters).search
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
b29008c90524f37221faf5a492ff5cfc6328548c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b29008c90524f37221faf5a492ff5cfc6328548c/DocumentClass.py
return "%s in (%s)" % (self.column,vs)
if self.op == '<>': return "%s not in (%s)" % (self.column, vs) else: return "%s in (%s)" % (self.column, vs)
def render(self, md):
9c2414a70415b91693d175c591f6ae5a10b5e94e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9c2414a70415b91693d175c591f6ae5a10b5e94e/sqltest.py
def manage_addZCatalog(self, id, title, vocab_id='', REQUEST=None):
def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None):
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)
6db738219bc3132b17271e802575f432dd707a71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6db738219bc3132b17271e802575f432dd707a71/ZCatalog.py
def __init__(self, id, title='', vocab_id='', container=None):
def __init__(self, id, title='', vocab_id=None, container=None):
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
6db738219bc3132b17271e802575f432dd707a71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6db738219bc3132b17271e802575f432dd707a71/ZCatalog.py
return not not self.evaluate(expr)
bool = self.evaluate(expr) if bool is Undefined: return bool return not not bool
def evaluateBoolean(self, expr): return not not self.evaluate(expr)
911344420e6c6ca003c882eec4727ecb9f47e0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/911344420e6c6ca003c882eec4727ecb9f47e0b8/TALES.py
if text is not None:
if text not in (None, Undefined):
def evaluateText(self, expr): text = self.evaluate(expr) if text is not None: text = str(text) return text
911344420e6c6ca003c882eec4727ecb9f47e0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/911344420e6c6ca003c882eec4727ecb9f47e0b8/TALES.py
sources=[PYEXPAT_DIR + '/expat/xmlparse/xmlparse.c', PYEXPAT_DIR + '/expat/xmlparse/hashtable.c', PYEXPAT_DIR + '/expat/xmltok/xmlrole.c', PYEXPAT_DIR + '/expat/xmltok/xmltok.c', PYEXPAT_DIR + '/dcpyexpat.c'])]
sources=[DCPYEXPAT_DIR + '/expat/xmlparse/xmlparse.c', DCPYEXPAT_DIR + '/expat/xmlparse/hashtable.c', DCPYEXPAT_DIR + '/expat/xmltok/xmlrole.c', DCPYEXPAT_DIR + '/expat/xmltok/xmltok.c', DCPYEXPAT_DIR + '/dcpyexpat.c'])]
def __init__(self, attrs): distutils.core.Distribution.__init__(self, attrs) self.cmdclass["install"] = ZopeInstall self.cmdclass["install_data"] = ZopeInstallData
ca323bcd2333cf88d119a61c4f2e66e3f3fa48b6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ca323bcd2333cf88d119a61c4f2e66e3f3fa48b6/setup.py
{'label': 'Subobjects', 'action' :'propertysheets/subobjects'},
{'label': 'Subobjects', 'action' :'propertysheets/subobjects/manage'},
def all_meta_types(self): return self.meta_types
eae37b9cff30f80579c5fdb2e7e53b45501f0033 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/eae37b9cff30f80579c5fdb2e7e53b45501f0033/ObjectManager.py
try: from types import BooleanType except ImportError: BooleanType = None
from types import BooleanType
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`
f2bb21444d066b5ee33cf7ff91c07e9942c29451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2bb21444d066b5ee33cf7ff91c07e9942c29451/Zope.py
if BooleanType and isinstance(v, BooleanType):
if isinstance(v, BooleanType):
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 ''
f2bb21444d066b5ee33cf7ff91c07e9942c29451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2bb21444d066b5ee33cf7ff91c07e9942c29451/Zope.py
if front(str): start,end = front(str).span() return end-start-1
result = front(str) if result is not None: start, end = result.span() return end-start
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
26fc2d04e153a8de76b129a45035addad30bfe75 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/26fc2d04e153a8de76b129a45035addad30bfe75/ST.py
expires=http_date(time.time() + seconds)
expires=rfc1123_date(time.time() + seconds)
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 None: if u.getUserName() != 'Anonymous User': anon = 0 phys_path = ob.getPhysicalPath() if self.hit_counts.has_key(phys_path): hits = self.hit_counts[phys_path] else: self.hit_counts[phys_path] = hits = [0,0] if anon: hits[0] = hits[0] + 1 else: hits[1] = hits[1] + 1
d8036f60d4e30b081700333e592aa20628a5b2b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d8036f60d4e30b081700333e592aa20628a5b2b0/AcceleratedHTTPCacheManager.py
print "FAILED to write INFO event", event, ":", details
try: print "FAILED to write INFO event", event, ":", details except IOError: pass
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. We don't want this to kill us print "FAILED to write INFO event", event, ":", details
14923f9be046f51c536840c6fad2f07752dd26cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14923f9be046f51c536840c6fad2f07752dd26cb/service.py
print "FAILED to write event log entry:", details print msg
try: print "FAILED to write event log entry:", details print msg except IOError: pass
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:", details print msg
14923f9be046f51c536840c6fad2f07752dd26cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14923f9be046f51c536840c6fad2f07752dd26cb/service.py
args += self._get_override("-m", "umask")
args += self._get_override("-m", "umask", oct(self.options.umask))
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._get_override("-f", "forever", flag=1) args += self._get_override("-s", "sockname") args += self._get_override("-u", "user") args += self._get_override("-m", "umask") args += self._get_override( "-x", "exitcodes", ",".join(map(str, self.options.exitcodes))) args += self._get_override("-z", "directory") args.extend(self.options.program) if self.options.daemon: flag = os.P_NOWAIT else: flag = os.P_WAIT os.spawnvp(flag, args[0], args) elif not self.zd_pid: self.send_action("start") else: print "daemon process already running; pid=%d" % self.zd_pid return self.awhile(lambda: self.zd_pid, "daemon process started, pid=%(zd_pid)d")
62402a33e90c45a4fe4efd2bb27d728b647ac3f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62402a33e90c45a4fe4efd2bb27d728b647ac3f2/zdctl.py
LOG.warn('Duplicate Product name', 'After loading Product %s from %s,\n' 'I skipped the one in %s.\n' % (
LOG.warn('Duplicate Product name: ' 'After loading Product %s from %s, ' 'I skipped the one in %s.' % (
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 Product %s from %s,\n' 'I skipped the one in %s.\n' % ( `product_name`, `done[product_name]`, `product_dir`) ) continue done[product_name]=product_dir import_product(product_dir, product_name, raise_exc=debug_mode) return done.keys()
a8f61347f0979dfa0e61440947f76538c538fbda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a8f61347f0979dfa0e61440947f76538c538fbda/Application.py
'GMT-0800','GMT-0900','GMT-1000','GMT-1100','GMT-1200']
'GMT-0800','GMT-0900','GMT-1000','GMT-1100','GMT-1200', 'GMT+1']
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')]
e3c3fc51844495761b2c4fd0f0464373800ac912 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e3c3fc51844495761b2c4fd0f0464373800ac912/DateTime.py
'gmt+0100':'GMT+1','gmt+0200':'GMT+2','gmt+0300':'GMT+3', 'gmt+0400':'GMT+4','gmt+0500':'GMT+5','gmt+0600':'GMT+6', 'gmt+0700':'GMT+7','gmt+0800':'GMT+8','gmt+0900':'GMT+9',
'gmt+0100':'GMT+1', 'gmt+0200':'GMT+2', 'gmt+0300':'GMT+3', 'gmt+0400':'GMT+4', 'gmt+0500':'GMT+5', 'gmt+0600':'GMT+6', 'gmt+0700':'GMT+7', 'gmt+0800':'GMT+8', 'gmt+0900':'GMT+9',
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')]
e3c3fc51844495761b2c4fd0f0464373800ac912 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e3c3fc51844495761b2c4fd0f0464373800ac912/DateTime.py