rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
my_t = self._t + _tzoffset(self._tz, self._t) ob_t = other._t + _tzoffset(other._tz, other._t) return (my_t - ob_t) / 86400.0 | if 0: my_t = self._t + _tzoffset(self._tz, self._t) ob_t = other._t + _tzoffset(other._tz, other._t) return (my_t - ob_t) / 86400.0 return self._d - other._d | def __sub__(self,other): """Either a DateTime or a number may be subtracted from a DateTime, however, a DateTime may not be subtracted from a number.""" if hasattr(other, '_d'): my_t = self._t + _tzoffset(self._tz, self._t) ob_t = other._t + _tzoffset(other._tz, other._t) return (my_t - ob_t) / 86400.0 else: return self.__add__(-(other)) | 941eee025d0e497426e6949d06245abbe795ae69 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/941eee025d0e497426e6949d06245abbe795ae69/DateTime.py |
provided by default, and 'alt' comes from the 'title_or_id' method. | provided by default, and 'alt' comes from the 'title' property. | def tag(height=None, width=None, alt=None, scale=0, xscale=0, yscale=0, **args): """ This method returns a string which contains an HTML IMG tag reference to the image. | 10969ff4aa809aad48d1359503e3aef61b182522 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/10969ff4aa809aad48d1359503e3aef61b182522/Image.py |
toc = TransientObjectContainer( 'session_data', 'Session Data Container', addNotification = addnotify, delNotification = delnotify, limit=limit, period_secs=period_spec) if timeout_spec is not None: | if 1: | def install_tempfolder_and_sdc(self): app = self.getApp() from Products.ZODBMountPoint.MountedObject import manage_addMounts,\ MountedObject from Products.ZODBMountPoint.MountedObject import getConfiguration as \ getDBTabConfiguration | 84bf129802001e8aa6a1b3e60f97a29394dcf8b6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/84bf129802001e8aa6a1b3e60f97a29394dcf8b6/Application.py |
unindex[i] = () | unindex[i] = [] | def index_object(self, i, obj, tupleType=type(()), dictType=type({}), callable=callable): """Recompute index data for data with ids >= start. if 'obj' is passed in, it is indexed instead of _data[i]""" | cc1af03882b20ed1b007f695299ac2363acd450d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cc1af03882b20ed1b007f695299ac2363acd450d/UnTextIndex.py |
def _updateProperty(self, id, value): | def _updateProperty(self, id, value, meta=None): | def _updateProperty(self, id, value): # Update the value of an existing property. If value is a string, # an attempt will be made to convert the value to the type of the # existing property. if not self.hasProperty(id): raise 'Bad Request', 'The property %s does not exist.' % id if type(value)==type(''): proptype=self.propertyInfo(id).get('type', 'string') if type_converters.has_key(proptype): value=type_converters[proptype](value) setattr(self.v_self(), id, value) | f34bb02946e56415a77e27576c0a167304644020 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f34bb02946e56415a77e27576c0a167304644020/PropertySheets.py |
def _updateProperty(self, id, value): # Update the value of an existing property. If value is a string, # an attempt will be made to convert the value to the type of the # existing property. if not self.hasProperty(id): raise 'Bad Request', 'The property %s does not exist.' % id if type(value)==type(''): proptype=self.propertyInfo(id).get('type', 'string') if type_converters.has_key(proptype): value=type_converters[proptype](value) setattr(self.v_self(), id, value) | f34bb02946e56415a77e27576c0a167304644020 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f34bb02946e56415a77e27576c0a167304644020/PropertySheets.py |
||
if parent: | if parent is not None: | def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: local_roles = getattr(object, '__ac_local_roles__', None) if local_roles: if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 inner = getattr(object, 'aq_inner', object) parent = getattr(inner, 'aq_parent', None) if parent: object = parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles | 5eb1539a4f671e814fff83e262cfa7e895cb7a5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5eb1539a4f671e814fff83e262cfa7e895cb7a5b/User.py |
exc_info=exc_info()) | exc_info=True) | def __setstate__(self, state): Globals.Persistent.__setstate__(self, state) if self.connection_string: try: self.connect(self.connection_string) except: logger.error('Error connecting to relational database.', exc_info=exc_info()) | 2a3e8ea548640e920f3f43a246e45e9a7aaaa0be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2a3e8ea548640e920f3f43a246e45e9a7aaaa0be/Connection.py |
error=exc_info()) | exc_info=True) | def manage_close_connection(self, REQUEST=None): " " try: if hasattr(self,'_v_database_connection'): self._v_database_connection.close() except: logger.error('Error closing relational database connection.', error=exc_info()) self._v_connected='' if REQUEST is not None: return self.manage_main(self, REQUEST) | 2a3e8ea548640e920f3f43a246e45e9a7aaaa0be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2a3e8ea548640e920f3f43a246e45e9a7aaaa0be/Connection.py |
klass=self.aq_inner.aq_parent.aq_parent._zclass_ | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ klass=self.aq_inner.aq_parent.aq_parent._zclass_ if meta_type: self.setClassAttr('meta_type', meta_type) if file: # and hasattr(file, 'content_type'): if hasattr(klass, 'ziconImage'): klass.ziconImage.manage_upload(file) else: self.setClassAttr('ziconImage', OFS.Image.Image('ziconImage','',file)) if not icon: self.setClassAttr('icon', REQUEST['URL1']+'/ziconImage') | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
|
if hasattr(klass, 'ziconImage'): klass.ziconImage.manage_upload(file) else: | __traceback_info__=file image=self.getClassAttr('ziconImage', None) if image is None: | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ klass=self.aq_inner.aq_parent.aq_parent._zclass_ if meta_type: self.setClassAttr('meta_type', meta_type) if file: # and hasattr(file, 'content_type'): if hasattr(klass, 'ziconImage'): klass.ziconImage.manage_upload(file) else: self.setClassAttr('ziconImage', OFS.Image.Image('ziconImage','',file)) if not icon: self.setClassAttr('icon', REQUEST['URL1']+'/ziconImage') | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
if not icon: self.setClassAttr('icon', REQUEST['URL1']+'/ziconImage') | else: image.manage_upload(file) if (not icon) and REQUEST: icon=(REQUEST['URL3'][len(REQUEST['BASE1'])+1:] +'/ziconImage') | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ klass=self.aq_inner.aq_parent.aq_parent._zclass_ if meta_type: self.setClassAttr('meta_type', meta_type) if file: # and hasattr(file, 'content_type'): if hasattr(klass, 'ziconImage'): klass.ziconImage.manage_upload(file) else: self.setClassAttr('ziconImage', OFS.Image.Image('ziconImage','',file)) if not icon: self.setClassAttr('icon', REQUEST['URL1']+'/ziconImage') | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
class ziconImage(ExtensionClass.Base): "Computed icon attribute" def __of__(self, parent): return _ziconImage() | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ klass=self.aq_inner.aq_parent.aq_parent._zclass_ if meta_type: self.setClassAttr('meta_type', meta_type) if file: # and hasattr(file, 'content_type'): if hasattr(klass, 'ziconImage'): klass.ziconImage.manage_upload(file) else: self.setClassAttr('ziconImage', OFS.Image.Image('ziconImage','',file)) if not icon: self.setClassAttr('icon', REQUEST['URL1']+'/ziconImage') | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
|
ziconImage=ziconImage() | def icon(self): return self.getClassAttr('icon','') | def __of__(self, parent): return _ziconImage() | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
def icon_(self): icon=self.aq_inner.aq_parent.aq_parent._zclass_.icon class _ziconImage(ExtensionClass.Base): "The real Computed icon attribute" def __of__(self, ps): klass=ps.aq_inner.aq_parent.aq_parent._zclass_ return klass.ziconImage | def meta_type(self): return self.getClassAttr('meta_type','') | def icon_(self): icon=self.aq_inner.aq_parent.aq_parent._zclass_.icon | e15046bc07bbc7acdb100b4ed05c4d3e3af5048f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e15046bc07bbc7acdb100b4ed05c4d3e3af5048f/Basic.py |
$Id: Publish.py,v 1.53 1997/09/23 10:32:57 jim Exp $""" | $Id: Publish.py,v 1.54 1997/09/24 18:47:18 jim Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | e30df7f7307b319c1beffb3e9dd071fe09e39f2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e30df7f7307b319c1beffb3e9dd071fe09e39f2f/Publish.py |
__version__='$Revision: 1.53 $'[11:-2] | __version__='$Revision: 1.54 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | e30df7f7307b319c1beffb3e9dd071fe09e39f2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e30df7f7307b319c1beffb3e9dd071fe09e39f2f/Publish.py |
if fslist is None: form={'BODY':fs} | if fslist is None: form={'BODY':fs.value} | def __init__(self, | e30df7f7307b319c1beffb3e9dd071fe09e39f2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e30df7f7307b319c1beffb3e9dd071fe09e39f2f/Publish.py |
def manage_profile_stats(self, sort='time', limit=200): | def manage_profile_stats(self, sort='time', limit=200, stripDirs=1, mode='stats'): | def manage_profile_stats(self, sort='time', limit=200): """Return profile data if available""" stats=getattr(sys, '_ps_', None) if stats is None: return None output=StringIO() stdout=sys.stdout sys.stdout=output stats.strip_dirs().sort_stats(sort).print_stats(limit) sys.stdout.flush() sys.stdout=stdout return output.getvalue() | a6b6ca2dac85b96607ed83d69ae54501f29d8aab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6b6ca2dac85b96607ed83d69ae54501f29d8aab/ApplicationManager.py |
stats.strip_dirs().sort_stats(sort).print_stats(limit) | getattr(stats,'print_%s' % mode)(limit) | def manage_profile_stats(self, sort='time', limit=200): """Return profile data if available""" stats=getattr(sys, '_ps_', None) if stats is None: return None output=StringIO() stdout=sys.stdout sys.stdout=output stats.strip_dirs().sort_stats(sort).print_stats(limit) sys.stdout.flush() sys.stdout=stdout return output.getvalue() | a6b6ca2dac85b96607ed83d69ae54501f29d8aab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6b6ca2dac85b96607ed83d69ae54501f29d8aab/ApplicationManager.py |
container_class = 'OFS.Folder.Folder' | def __init__(self, section): self.container_class = section.container_class or 'OFS.Folder.Folder' ZODBDatabase.__init__(self, section) | def root_config(section): from ZConfig import ConfigurationError here = os.path.dirname(os.path.abspath(__file__)) swhome = os.path.dirname(os.path.dirname(here)) section.softwarehome = swhome section.zopehome = os.path.dirname(os.path.dirname(swhome)) if section.cgi_environment is None: section.cgi_environment = {} if section.clienthome is None: section.clienthome = os.path.join(section.instancehome, "var") # set up defaults for pid_filename and lock_filename if they're # not in the config if section.pid_filename is None: section.pid_filename = os.path.join(section.clienthome, 'Z2.pid') if section.lock_filename is None: section.lock_filename = os.path.join(section.clienthome, 'Z2.lock') if not section.databases: section.databases = getDefaultDatabaseFactories(section) mount_factories = {} # { name -> factory} mount_points = {} # { virtual path -> name } dup_err = ('Invalid configuration: ZODB databases named "%s" and "%s" are ' 'both configured to use the same mount point, named "%s"') for database in section.databases: points = database.getVirtualMountPaths() name = database.config.getSectionName() mount_factories[name] = database for point in points: if mount_points.has_key(point): raise ConfigurationError(dup_err % (mount_points[point], name, point)) mount_points[point] = name from DBTab.DBTab import DBTab section.dbtab = DBTab(mount_factories, mount_points) return section | f26d1eed503ca0c13407d67927e22c6fdea7fa54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f26d1eed503ca0c13407d67927e22c6fdea7fa54/datatypes.py |
print DB, DB.klass | def open(self): DB = self.createDB() if self.config.connection_class: # set the connection class DB.klass = self.config.connection_class print DB, DB.klass if self.config.class_factory is not None: DB.setClassFactory(self.config.class_factory) from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) return DB | f26d1eed503ca0c13407d67927e22c6fdea7fa54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f26d1eed503ca0c13407d67927e22c6fdea7fa54/datatypes.py |
|
class_factory=None)) | class_factory=None, container_class=None)) | def getSectionName(self): return self.name | f26d1eed503ca0c13407d67927e22c6fdea7fa54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f26d1eed503ca0c13407d67927e22c6fdea7fa54/datatypes.py |
class_factory=None)) temporary.container_class = ('Products.TemporaryFolder.TemporaryFolder.' 'SimpleTemporaryContainer') | class_factory=None, container_class=('Products.TemporaryFolder.' 'TemporaryFolder.' 'SimpleTemporaryContainer') )) | def getSectionName(self): return self.name | f26d1eed503ca0c13407d67927e22c6fdea7fa54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f26d1eed503ca0c13407d67927e22c6fdea7fa54/datatypes.py |
{'id':'height', 'type':'int'}, {'id':'width', 'type':'int'}, | {'id':'height', 'type':'string'}, {'id':'width', 'type':'string'}, | def manage_addImage(self,id,file,title='',REQUEST=None): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """ id, title = cookId(id, title, file) self._setObject(id, Image(id,title,file)) if REQUEST is not None: return self.manage_main(self,REQUEST) return id | 6bd79887a07dbc93d57c7722754cb242c0ecaca6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6bd79887a07dbc93d57c7722754cb242c0ecaca6/Image.py |
return '%s %s' % (url, join(out,' / ')) | return '%s%s' % (url, join(out,'/')) | def tabs_path_default(self, REQUEST, # Static var unquote=urllib.unquote, ): steps = REQUEST._steps[:-1] script = REQUEST['BASEPATH1'] linkpat = '<a href="%s/manage_workspace">%s</a>' out = [] url = linkpat % (script, ' /') if not steps: return url last = steps.pop() for step in steps: script = '%s/%s' % (script, step) out.append(linkpat % (script, unquote(step))) out.append(unquote(last)) return '%s %s' % (url, join(out,' / ')) | f00ae92a03e2f8e17bbb2875721627d7cb9c4c5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f00ae92a03e2f8e17bbb2875721627d7cb9c4c5d/Management.py |
del self._index[entry] | try: del self._index[entry] except KeyError: pass if isinstance(self.__len__, BTrees.Length.Length): self._length = self.__len__ del self.__len__ | def removeForwardIndexEntry(self, entry, documentId): """Take the entry provided and remove any reference to documentId in its entry in the index. """ indexRow = self._index.get(entry, _marker) if indexRow is not _marker: try: indexRow.remove(documentId) if not indexRow: del self._index[entry] self._length.change(-1) | 7a57f1df31dfda68af941f77aa36ee5c12af91ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a57f1df31dfda68af941f77aa36ee5c12af91ab/UnIndex.py |
self._length.change(1) | try: self._length.change(1) except AttributeError: if isinstance(self.__len__, BTrees.Length.Length): self._length = self.__len__ del self.__len__ self._length.change(1) | def insertForwardIndexEntry(self, entry, documentId): """Take the entry provided and put it in the correct place in the forward index. | 7a57f1df31dfda68af941f77aa36ee5c12af91ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a57f1df31dfda68af941f77aa36ee5c12af91ab/UnIndex.py |
return getattr(self.aq_parent, '%s__roles__' % self.__name__) | imp = getattr(self.aq_parent, '%s__roles__' % self.__name__) return imp.__of__(self) | def _get__roles__(self): return getattr(self.aq_parent, '%s__roles__' % self.__name__) | 1bdaa0e92976cff987cde1af6f33227361262c37 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1bdaa0e92976cff987cde1af6f33227361262c37/special_dtml.py |
from cStringIO import cStringIO self.ParseStream(cStringIO(s)) | from cStringIO import StringIO self.parseStream(StringIO(s)) | def parseString(self, s): from cStringIO import cStringIO self.ParseStream(cStringIO(s)) | bd2c8f37e751abc2a9953eb8d5ab2ba5e154cb6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bd2c8f37e751abc2a9953eb8d5ab2ba5e154cb6d/XMLParser.py |
return pt_render(extra_context=bound_names) | return self.pt_render(extra_context=bound_names) | def _exec(self, bound_names, args, kw): """Call a Page Template""" bound_names['options'] = kw | dd9765e487aa0237cbe572a69c2cd7d75dd52f10 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dd9765e487aa0237cbe572a69c2cd7d75dd52f10/ZopePageTemplate.py |
query_string='?'+query_string[1:] | query_string='?'+query_string[1:] | def __getitem__(self,key): | 784d503c5b233b4146c3dc3360497eb711566134 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/784d503c5b233b4146c3dc3360497eb711566134/DT_In.py |
'<span tal:replace="structure foo" i18n:name="foo_name"/>' | '<span tal:replace="structure foo" i18n:name="foo_name"' ' i18n:translate=""/>' | def test_structure_replace_with_messageid_and_i18nname(self): program, macros = self._compile( '<div i18n:translate="" >' '<span tal:replace="structure foo" i18n:name="foo_name"/>' '</div>') self._check(program, '<div>FOOVALUE</div>\n') | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
'<em i18n:name="foo_name">' | '<em i18n:name="foo_name" tal:omit-tag="">' | def test_complex_replace_with_messageid_and_i18nname(self): program, macros = self._compile( '<div i18n:translate="" >' '<em i18n:name="foo_name">' '<span tal:replace="foo"/>' '</em>' '</div>') self._check(program, '<div>FOOVALUE</div>\n') | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
program = [('version', '1.5'), | program = [('version', '1.6'), | def test_translate_static_text_as_dynamic_from_bytecode(self): program = [('version', '1.5'), | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
def _getCollectingTranslationDomain(self): class CollectingTranslationService(DummyTranslationService): data = [] def translate(self, domain, msgid, mapping=None, context=None, target_language=None, default=None): self.data.append((msgid, mapping)) return DummyTranslationService.translate( self, domain, msgid, mapping, context, target_language, default) xlatsvc = CollectingTranslationService() self.engine.translationService = xlatsvc return xlatsvc | def _getCollectingTranslationDomain(self): class CollectingTranslationService(DummyTranslationService): data = [] | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
|
xlatdmn = self._getCollectingTranslationDomain() | self.engine.translationDomain.clearMsgids() | def test_for_correct_msgids(self): xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate="">This is text for ' '<span i18n:translate="" tal:content="bar" ' 'i18n:name="bar_name"/>.</div>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual('BaRvAlUe', msgids[0][0]) self.assertEqual('This is text for ${bar_name}.', msgids[1][0]) self.assertEqual({'bar_name': '<span>BARVALUE</span>'}, msgids[1][1]) self.assertEqual( '<div>THIS IS TEXT FOR <span>BARVALUE</span>.</div>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
msgids = list(xlatdmn.data) | msgids = self.engine.translationDomain.getMsgids('default') | def test_for_correct_msgids(self): xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate="">This is text for ' '<span i18n:translate="" tal:content="bar" ' 'i18n:name="bar_name"/>.</div>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual('BaRvAlUe', msgids[0][0]) self.assertEqual('This is text for ${bar_name}.', msgids[1][0]) self.assertEqual({'bar_name': '<span>BARVALUE</span>'}, msgids[1][1]) self.assertEqual( '<div>THIS IS TEXT FOR <span>BARVALUE</span>.</div>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
xlatdmn = self._getCollectingTranslationDomain() | self.engine.translationDomain.clearMsgids() | def test_for_raw_msgids(self): # Test for Issue 314: i18n:translate removes line breaks from # <pre>...</pre> contents # HTML mode xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n' ' \tfor\n div. </div>' '<pre i18n:translate=""> This is text\n' ' <b>\tfor</b>\n pre. </pre>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' This is text\n <b>\tfor</b>\n pre. ', msgids[0][0]) self.assertEqual('This is text for div.', msgids[1][0]) self.assertEqual( '<div>THIS IS TEXT FOR DIV.</div>' '<pre> THIS IS TEXT\n <B>\tFOR</B>\n PRE. </pre>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
msgids = list(xlatdmn.data) | msgids = self.engine.translationDomain.getMsgids('default') | def test_for_raw_msgids(self): # Test for Issue 314: i18n:translate removes line breaks from # <pre>...</pre> contents # HTML mode xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n' ' \tfor\n div. </div>' '<pre i18n:translate=""> This is text\n' ' <b>\tfor</b>\n pre. </pre>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' This is text\n <b>\tfor</b>\n pre. ', msgids[0][0]) self.assertEqual('This is text for div.', msgids[1][0]) self.assertEqual( '<div>THIS IS TEXT FOR DIV.</div>' '<pre> THIS IS TEXT\n <B>\tFOR</B>\n PRE. </pre>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
xlatdmn = self._getCollectingTranslationDomain() | self.engine.translationDomain.clearMsgids() | def test_for_raw_msgids(self): # Test for Issue 314: i18n:translate removes line breaks from # <pre>...</pre> contents # HTML mode xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n' ' \tfor\n div. </div>' '<pre i18n:translate=""> This is text\n' ' <b>\tfor</b>\n pre. </pre>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' This is text\n <b>\tfor</b>\n pre. ', msgids[0][0]) self.assertEqual('This is text for div.', msgids[1][0]) self.assertEqual( '<div>THIS IS TEXT FOR DIV.</div>' '<pre> THIS IS TEXT\n <B>\tFOR</B>\n PRE. </pre>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
msgids = list(xlatdmn.data) | msgids = self.engine.translationDomain.getMsgids('default') | def test_for_raw_msgids(self): # Test for Issue 314: i18n:translate removes line breaks from # <pre>...</pre> contents # HTML mode xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n' ' \tfor\n div. </div>' '<pre i18n:translate=""> This is text\n' ' <b>\tfor</b>\n pre. </pre>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' This is text\n <b>\tfor</b>\n pre. ', msgids[0][0]) self.assertEqual('This is text for div.', msgids[1][0]) self.assertEqual( '<div>THIS IS TEXT FOR DIV.</div>' '<pre> THIS IS TEXT\n <B>\tFOR</B>\n PRE. </pre>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
xlatdmn = self._getCollectingTranslationDomain() | self.engine.translationDomain.clearMsgids() | def test_raw_msgids_and_i18ntranslate_i18nname(self): xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n \tfor\n' '<pre tal:content="raw" i18n:name="raw"' ' i18n:translate=""></pre>.</div>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' \tRaW\n ', msgids[0][0]) self.assertEqual('This is text for ${raw}.', msgids[1][0]) self.assertEqual({'raw': '<pre> \tRAW\n </pre>'}, msgids[1][1]) self.assertEqual( u'<div>THIS IS TEXT FOR <pre> \tRAW\n </pre>.</div>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
msgids = list(xlatdmn.data) | msgids = self.engine.translationDomain.getMsgids('default') | def test_raw_msgids_and_i18ntranslate_i18nname(self): xlatdmn = self._getCollectingTranslationDomain() result = StringIO() program, macros = self._compile( '<div i18n:translate=""> This is text\n \tfor\n' '<pre tal:content="raw" i18n:name="raw"' ' i18n:translate=""></pre>.</div>') self.interpreter = TALInterpreter(program, {}, self.engine, stream=result) self.interpreter() msgids = list(xlatdmn.data) msgids.sort() self.assertEqual(2, len(msgids)) self.assertEqual(' \tRaW\n ', msgids[0][0]) self.assertEqual('This is text for ${raw}.', msgids[1][0]) self.assertEqual({'raw': '<pre> \tRAW\n </pre>'}, msgids[1][1]) self.assertEqual( u'<div>THIS IS TEXT FOR <pre> \tRAW\n </pre>.</div>\n', result.getvalue()) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
def test_unicode_mixed_unknown_encoding(self): text = u"foo ${bar}" mapping = {u'bar': 'd\xe9j\xe0'} expected = u"foo d\\xe9j\\xe0" self.assertEqual(interpolate(text, mapping), expected) | def test_unicode_mixed_unknown_encoding(self): # This test assumes that sys.getdefaultencoding is ascii... text = u"foo ${bar}" mapping = {u'bar': 'd\xe9j\xe0'} expected = u"foo d\\xe9j\\xe0" self.assertEqual(interpolate(text, mapping), expected) | 7a4a610b6943a4f0e0eff9fe7a51800ee82104d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4a610b6943a4f0e0eff9fe7a51800ee82104d5/test_talinterpreter.py |
|
def __init__(self, basepath): | def __init__(self, basepath, verbosity=VERBOSE): | def __init__(self, basepath): # initialize python path self.basepath=path=basepath pjoin=os.path.join if sys.platform == 'win32': sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, pjoin(path, 'bin/lib')) sys.path.insert(2, pjoin(path, 'bin/lib/plat-win')) sys.path.insert(3, pjoin(path, 'bin/lib/win32')) sys.path.insert(4, pjoin(path, 'bin/lib/win32/lib')) sys.path.insert(5, path) else: sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, path) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
file = open(filepath, 'r') text = file.read() file.close() return ((find(text, 'unittest') > -1) or (find(text, 'framework.py') > -1)) | path, name = os.path.split(filepath) fname, ext = os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ name != 'testrunner.py': file=open(filepath, 'r') lines=file.readlines() file.close() for line in lines: if (find(line, 'def test_suite(') > -1) or \ (find(line, 'framework(') > -1): return 1 return 0 | def smellsLikeATest(self, filepath, find=string.find): file = open(filepath, 'r') text = file.read() file.close() return ((find(text, 'unittest') > -1) or (find(text, 'framework.py') > -1)) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
runner=unittest.TextTestRunner(verbosity=VERBOSE) | runner=unittest.TextTestRunner(verbosity=self.verbosity) | def runSuite(self, suite): runner=unittest.TextTestRunner(verbosity=VERBOSE) runner.run(suite) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ name != 'testrunner.py': filepath=os.path.join(pathname, name) if self.smellsLikeATest(filepath): self.runFile(filepath) for name in names: | def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" if not os.path.isabs(pathname): pathname = os.path.join(self.basepath, pathname) names=os.listdir(pathname) for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ name != 'testrunner.py': filepath=os.path.join(pathname, name) if self.smellsLikeATest(filepath): self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
|
try: suite=self.getSuiteFromFile(filename) | try: suite=self.getSuiteFromFile(name) | def runFile(self, filename): """Run the test suite defined by filename.""" working_dir = os.getcwd() dirname, name = os.path.split(filename) if dirname: os.chdir(dirname) self.report('Running: %s' % filename) try: suite=self.getSuiteFromFile(filename) except: traceback.print_exc() suite=None if suite is None: self.report('No test suite found in file:\n%s' % filename) return self.runSuite(suite) os.chdir(working_dir) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
suite=None if suite is None: self.report('No test suite found in file:\n%s' % filename) return self.runSuite(suite) | suite=None if suite is not None: self.runSuite(suite) else: self.report('No test suite found in file:\n%s\n' % filename) | def runFile(self, filename): """Run the test suite defined by filename.""" working_dir = os.getcwd() dirname, name = os.path.split(filename) if dirname: os.chdir(dirname) self.report('Running: %s' % filename) try: suite=self.getSuiteFromFile(filename) except: traceback.print_exc() suite=None if suite is None: self.report('No test suite found in file:\n%s' % filename) return self.runSuite(suite) os.chdir(working_dir) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
def runFile(self, filename): """Run the test suite defined by filename.""" working_dir = os.getcwd() dirname, name = os.path.split(filename) if dirname: os.chdir(dirname) self.report('Running: %s' % filename) try: suite=self.getSuiteFromFile(filename) except: traceback.print_exc() suite=None if suite is None: self.report('No test suite found in file:\n%s' % filename) return self.runSuite(suite) os.chdir(working_dir) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
||
whether it succeeded. Quiet mode prints a period as each test runs. | whether it succeeded. Running with -q is the same as running with -v1. | def main(args): usage_msg="""Usage: python testrunner.py options If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run. -q Run tests without producing verbose output. The tests are normally run in verbose mode, which produces a line of output for each test that includes the name of the test and whether it succeeded. Quiet mode prints a period as each test runs. -h Display usage information. """ pathname=None filename=None test_all=None options, arg=getopt.getopt(args, 'ahd:f:q') if not options: err_exit(usage_msg) for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) elif name == 'h': err_exit(usage_msg, 0) elif name == 'q': global VERBOSE VERBOSE = 1 else: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
options, arg=getopt.getopt(args, 'ahd:f:q') | verbosity = VERBOSE options, arg=getopt.getopt(args, 'ahd:f:v:q') | def main(args): usage_msg="""Usage: python testrunner.py options If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run. -q Run tests without producing verbose output. The tests are normally run in verbose mode, which produces a line of output for each test that includes the name of the test and whether it succeeded. Quiet mode prints a period as each test runs. -h Display usage information. """ pathname=None filename=None test_all=None options, arg=getopt.getopt(args, 'ahd:f:q') if not options: err_exit(usage_msg) for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) elif name == 'h': err_exit(usage_msg, 0) elif name == 'q': global VERBOSE VERBOSE = 1 else: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
global VERBOSE VERBOSE = 1 | verbosity = 1 | def main(args): usage_msg="""Usage: python testrunner.py options If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run. -q Run tests without producing verbose output. The tests are normally run in verbose mode, which produces a line of output for each test that includes the name of the test and whether it succeeded. Quiet mode prints a period as each test runs. -h Display usage information. """ pathname=None filename=None test_all=None options, arg=getopt.getopt(args, 'ahd:f:q') if not options: err_exit(usage_msg) for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) elif name == 'h': err_exit(usage_msg, 0) elif name == 'q': global VERBOSE VERBOSE = 1 else: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
testrunner=TestRunner(os.getcwd()) | testrunner = TestRunner(os.getcwd(), verbosity=verbosity) | def main(args): usage_msg="""Usage: python testrunner.py options If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run. -q Run tests without producing verbose output. The tests are normally run in verbose mode, which produces a line of output for each test that includes the name of the test and whether it succeeded. Quiet mode prints a period as each test runs. -h Display usage information. """ pathname=None filename=None test_all=None options, arg=getopt.getopt(args, 'ahd:f:q') if not options: err_exit(usage_msg) for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) elif name == 'h': err_exit(usage_msg, 0) elif name == 'q': global VERBOSE VERBOSE = 1 else: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0) | 877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/877d2f5faac346ab0f13fd2a8d682e4d0c5d4ef7/testrunner.py |
'--ignore-pyexpat', 'prefix=', | 'ignore-pyexpat', 'prefix=', | def main(): # below assumes this script is in the BASE_DIR/inst directory global PREFIX BASE_DIR=os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0]))) BUILD_BASE=os.path.join(os.getcwd(), 'build-base') PYTHON=sys.executable MAKEFILE=open(os.path.join(BASE_DIR, 'inst', IN_MAKEFILE)).read() REQUIRE_LF_ENABLED = 1 REQUIRE_ZLIB = 1 REQURE_PYEXPAT = 1 INSTALL_FLAGS = '' DISTUTILS_OPTS = '' try: longopts = ['help', 'ignore-largefile', 'ignore-zlib', '--ignore-pyexpat', 'prefix=', 'build-base=', 'optimize', 'no-compile', 'quiet'] opts, args = getopt.getopt(sys.argv[1:], 'h', longopts) except getopt.GetoptError, v: print v usage() sys.exit(1) for o, a in opts: if o in ('-h', '--help'): usage() sys.exit() if o == '--prefix': PREFIX=os.path.abspath(os.path.expanduser(a)) if o == '--ignore-largefile': REQUIRE_LF_ENABLED=0 if o == '--ignore-zlib': REQUIRE_ZLIB=0 if o == '--ignore-pyexpat': REQUIRE_PYEXPAT=0 if o == '--optimize': INSTALL_FLAGS = '--optimize=1 --no-compile' if o == '--no-compile': INSTALL_FLAGS = '--no-compile' if o == '--build-base': BUILD_BASE = a if o == '--quiet': DISTUTILS_OPTS = '-q' global QUIET QUIET = 1 if REQUIRE_LF_ENABLED: test_largefile() if REQUIRE_ZLIB: test_zlib() if REQUIRE_PYEXPAT: test_pyexpat() out(' - Zope top-level binary directory will be %s.' % PREFIX) if INSTALL_FLAGS: out(' - Distutils install flags will be "%s"' % INSTALL_FLAGS) idata = { '<<PYTHON>>':PYTHON, '<<PREFIX>>':PREFIX, '<<BASE_DIR>>':BASE_DIR, '<<BUILD_BASE>>':BUILD_BASE, '<<INSTALL_FLAGS>>':INSTALL_FLAGS, '<<ZOPE_MAJOR_VERSION>>':versions.ZOPE_MAJOR_VERSION, '<<ZOPE_MINOR_VERSION>>':versions.ZOPE_MINOR_VERSION, '<<VERSION_RELEASE_TAG>>':versions.VERSION_RELEASE_TAG, '<<DISTUTILS_OPTS>>':DISTUTILS_OPTS, } for k,v in idata.items(): MAKEFILE = MAKEFILE.replace(k, v) f = open(os.path.join(os.getcwd(), 'makefile'), 'w') f.write(MAKEFILE) out(' - Makefile written.') out('') out(' Next, run %s.' % MAKE_COMMAND) out('') | 7e1009e4638ee990d14c441ca6f2182d1d07ed03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7e1009e4638ee990d14c441ca6f2182d1d07ed03/configure.py |
if uri[0]=='/': uri=uri[1:] return uri | return urllib.unquote(uri) | def url(self, ftype=urllib.splittype, fhost=urllib.splithost): """Return a SCRIPT_NAME-based url for an object.""" if hasattr(self, 'DestinationURL') and \ callable(self.DestinationURL): url='%s/%s' % (self.DestinationURL(), self.id) else: url=self.absolute_url() type, uri=ftype(url) host, uri=fhost(uri) script_name=self.REQUEST['SCRIPT_NAME'] __traceback_info__=(`uri`, `script_name`) if script_name: uri=filter(None, string.split(uri, script_name))[0] uri=uri or '/' if uri[0]=='/': uri=uri[1:] return uri | 6b73e55c3db9929e609f44b4b499e0ff7c024295 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6b73e55c3db9929e609f44b4b499e0ff7c024295/CatalogAwareness.py |
if md.has_key(args['header']): output(md.getitem(args['header'],0)( | doc=args['header'] if hasattr(self, doc): doc=getattr(self, doc) elif md.has_key(doc): doc=md.getitem(args['header'],0) else: doc=None if doc is not None: output(doc( | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None): "Render a tree as a table" have_arg=args.has_key if level >= 0: tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 exp=0 sub=None output=data.append script=md['SCRIPT_NAME'] try: items=getattr(self, args['branches'])() except: items=None if not items and have_arg('leaves'): items=1 if (args.has_key('sort')) and (items is not None) and (items != 1): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] diff.append(id) if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### if exp: treeData['tree-item-expanded']=1 output('<A HREF="%s?tree-c=%s">' '<IMG SRC="%s/p_/mi" BORDER=0></A>' % (root_url,s, script)) else: output('<A HREF="%s?tree-e=%s">' '<IMG SRC="%s/p_/pl" BORDER=0></A>' % (root_url,s, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, 'tpId'): id=item.tpId() elif hasattr(item, '_p_oid'): id=item._p_oid else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data | 7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84/TreeTag.py |
treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) | doc=args['leaves'] if hasattr(self, doc): doc=getattr(self, doc) elif md.has_key(doc): doc=md.getitem(args['header'],0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(doc( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None): "Render a tree as a table" have_arg=args.has_key if level >= 0: tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 exp=0 sub=None output=data.append script=md['SCRIPT_NAME'] try: items=getattr(self, args['branches'])() except: items=None if not items and have_arg('leaves'): items=1 if (args.has_key('sort')) and (items is not None) and (items != 1): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] diff.append(id) if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### if exp: treeData['tree-item-expanded']=1 output('<A HREF="%s?tree-c=%s">' '<IMG SRC="%s/p_/mi" BORDER=0></A>' % (root_url,s, script)) else: output('<A HREF="%s?tree-e=%s">' '<IMG SRC="%s/p_/pl" BORDER=0></A>' % (root_url,s, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, 'tpId'): id=item.tpId() elif hasattr(item, '_p_oid'): id=item._p_oid else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data | 7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84/TreeTag.py |
if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( | doc=args['footer'] if hasattr(self, doc): doc=getattr(self, doc) elif md.has_key(doc): doc=md.getitem(args['header'],0) else: doc=None if doc is not None: output(doc( | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None): "Render a tree as a table" have_arg=args.has_key if level >= 0: tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 exp=0 sub=None output=data.append script=md['SCRIPT_NAME'] try: items=getattr(self, args['branches'])() except: items=None if not items and have_arg('leaves'): items=1 if (args.has_key('sort')) and (items is not None) and (items != 1): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] diff.append(id) if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### if exp: treeData['tree-item-expanded']=1 output('<A HREF="%s?tree-c=%s">' '<IMG SRC="%s/p_/mi" BORDER=0></A>' % (root_url,s, script)) else: output('<A HREF="%s?tree-e=%s">' '<IMG SRC="%s/p_/pl" BORDER=0></A>' % (root_url,s, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, 'tpId'): id=item.tpId() elif hasattr(item, '_p_oid'): id=item._p_oid else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data | 7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a4ebe6c44825ec69cc9b8da8a9f06c33da63e84/TreeTag.py |
$Id: Publish.py,v 1.22 1996/10/25 19:34:27 jim Exp $""" | $Id: Publish.py,v 1.23 1996/10/28 22:13:45 jim Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | a9c09bb3ec7b6f1475a6dc3852a4a28ef8626816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a9c09bb3ec7b6f1475a6dc3852a4a28ef8626816/Publish.py |
__version__='$Revision: 1.22 $'[11:-2] | __version__='$Revision: 1.23 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | a9c09bb3ec7b6f1475a6dc3852a4a28ef8626816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a9c09bb3ec7b6f1475a6dc3852a4a28ef8626816/Publish.py |
self.code[at:at]=rcode | self.code[at + 1:at + 1] = [self.code[at]] self.code[at + 1:at + 1] = rcode del self.code[at] | def insert_code(self, rcode, at = None): opn = self.opn # rcode is passed as a (callables, args) pair rcode = map(apply, rcode[0], rcode[1]) if at is None: at = opn self.code[at:at]=rcode self.opn = opn + len(rcode) return rcode | dbede1d87414cf30481c485ea45263ac140151df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dbede1d87414cf30481c485ea45263ac140151df/VSExec.py |
result.append(r"fters") | def query(self, pattern): """ """ result = [] for x in self.lexicon.get(pattern): if self.globbing: result.append(self.lexicon._inverseLex[x]) else: result.append(pattern) | c6ec26aa6c146b64a575af8af3bb3a32c806edbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c6ec26aa6c146b64a575af8af3bb3a32c806edbf/Vocabulary.py |
|
LOG('UnTextIndex', PROBLEM, | LOG('UnTextIndex', ERROR, | def unindex_object(self, i, tt=type(()) ): """ carefully unindex document with integer id 'i' from the text index and do not fail if it does not exist """ index = self._index unindex = self._unindex val = unindex.get(i, None) if val is not None: for n in val: v = index.get(n, None) if type(v) is tt: del index[n] elif v is not None: try: del index[n][i] except (KeyError, IndexError, TypeError): LOG('UnTextIndex', PROBLEM, 'unindex_object tried to unindex nonexistent' ' document %s' % str(i)) del unindex[i] self._index = index self._unindex = unindex | d1dc226b88d495bb66544f4850d944dbcbc72fcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d1dc226b88d495bb66544f4850d944dbcbc72fcf/UnTextIndex.py |
'''Return items in the reciever that are not in the argument''' | '''Return items in the receiver that are not in the argument''' | def and_not(self, x): '''Return items in the reciever that are not in the argument''' result = self.__class__() for key,v in self.items(): try: x[key] except KeyError: result[key] = v return result | 21938926dae32d414f4ec813fbb8f02a43bfac4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/21938926dae32d414f4ec813fbb8f02a43bfac4d/InvertedIndex.py |
result[key] = positionsr | result[key] = score,positionsr | def near(self, x, distance = 1): '''\ near(rl, distance = 1) Returns a ResultList containing documents which contain''' result = self.__class__() for key, v in self.items(): try: value = x[key] except KeyError: value = None if value is None: continue positions = v[1] + value[1] positions.sort() positionsr = [] rel = pow(v[0] * value[0], 0.5) pl = positions[0] rl = -1 for i in range(1, len(positions)): p = positions[i] d = p - pl if d > 0 and d <= distance: if pl != rl: positionsr.append(pl) positionsr.append(p) rl = p pl = p if (len(positionsr)): result[key] = positionsr return result | 21938926dae32d414f4ec813fbb8f02a43bfac4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/21938926dae32d414f4ec813fbb8f02a43bfac4d/InvertedIndex.py |
return self.__snd_request('UNLOCK', self.uri, headers, body) | return self.__snd_request('UNLOCK', self.uri, headers) | def unlock(self, token, **kw): """Remove the lock identified by token from the resource and all other resources included in the lock. If all resources which have been locked under the submitted lock token can not be unlocked the unlock method will fail.""" headers=self.__get_headers(kw) token='<opaquelocktoken:%s>' % str(token) headers['Lock-Token']=token return self.__snd_request('UNLOCK', self.uri, headers, body) | 61995c12cd4bee320ae675f6232cfe9196319754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61995c12cd4bee320ae675f6232cfe9196319754/client.py |
r.data_record_score__ = 1 | r.data_record_score_ = 1 | def __getitem__(self, index, ttype=type(())): """ Returns instances of self._v_brains, or whatever is passed into self.useBrains. """ if type(index) is ttype: normalized_score, score, key = index r=self._v_result_class(self.data[key]).__of__(self.aq_parent) r.data_record_id_ = key r.data_record_score_ = score r.data_record_normalized_score_ = normalized_score else: r=self._v_result_class(self.data[index]).__of__(self.aq_parent) r.data_record_id_ = index r.data_record_score__ = 1 r.data_record_normalized_score_ = 1 return r | abb87ad31505c48d7bc291cf4aa615ac0bfc7a68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/abb87ad31505c48d7bc291cf4aa615ac0bfc7a68/Catalog.py |
return '%s&%s=%s' % (url, name, bid) | return '%s&%s=%s' % (url, name, bid) | def encodeUrl(self, url, create=1): """ encode a URL with the browser id as a postfixed query string element """ bid = self.getBrowserId(create) if bid is None: raise BrowserIdManagerErr, 'There is no current browser id.' name = self.getBrowserIdName() if '?' in url: return '%s&%s=%s' % (url, name, bid) else: return '%s?%s=%s' % (url, name, bid) | d0055a1ac336d28e0b45079d863ae496f7924dec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0055a1ac336d28e0b45079d863ae496f7924dec/BrowserIdManager.py |
def objectIds(self,t=None): | def objectIds(self, spec=None): | def objectIds(self,t=None): # Return a list of subobject ids | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
if t is not None: if type(t)==type('s'): t=(t,) return filter(None, map(lambda x,v=t: (x['meta_type'] in v) and x['id'] or None, self._objects)) | if spec is not None: if type(spec)==type('s'): spec=[spec] set=[] for ob in self._objects: if ob['meta_type'] in spec: set.append(ob['id']) return set | def objectIds(self,t=None): # Return a list of subobject ids | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
def objectValues(self,t=None): | def objectValues(self, spec=None): | def objectValues(self,t=None): # Return a list of the actual subobjects | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
if t is not None: if type(t)==type('s'): t=(t,) return filter(None, map(lambda x,v=t,s=self: (x['meta_type'] in v) and getattr(s,x['id']) or None, self._objects)) | if spec is not None: if type(spec)==type('s'): spec=[spec] set=[] for ob in self._objects: if ob['meta_type'] in spec: set.append(getattr(self, ob['id'])) return set | def objectValues(self,t=None): # Return a list of the actual subobjects | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
def objectItems(self,t=None): | def objectItems(self, spec=None): | def objectItems(self,t=None): # Return a list of (id, subobject) tuples | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
if t is not None: if type(t)==type('s'): t=(t,) return filter(None, map(lambda x,v=t,s=self: (x['meta_type'] in v) and \ (x['id'],getattr(s,x['id'])) or None, self._objects)) | if spec is not None: if type(spec)==type('s'): spec=[spec] set=[] for ob in self._objects: if ob['meta_type'] in spec: set.append((ob['id'], getattr(self, ob['id']))) | def objectItems(self,t=None): # Return a list of (id, subobject) tuples | 4412eb897eed25f7076a35e60a63e2b4b1dc97f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4412eb897eed25f7076a35e60a63e2b4b1dc97f5/ObjectManager.py |
CVS = os.path.normcase("CVS") | CVS_DIRS = [os.path.normcase("CVS"), os.path.normcase(".svn")] | def copyskel(sourcedir, targetdir, uid, gid, **replacements): """ This is an independent function because we'd like to import and call it from mkzopeinstance """ # Create the top of the instance: if not os.path.exists(targetdir): os.makedirs(targetdir) # This is fairly ugly. The chdir() makes path manipulation in the # walk() callback a little easier (less magical), so we'll live # with it. pwd = os.getcwd() os.chdir(sourcedir) try: try: os.path.walk(os.curdir, copydir, (targetdir, replacements, uid, gid)) finally: os.chdir(pwd) except (IOError, OSError), msg: print >>sys.stderr, msg sys.exit(1) | e2dae3e07e3173d5bf9c4dc6721fc71adba1ee34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e2dae3e07e3173d5bf9c4dc6721fc71adba1ee34/copyzopeskel.py |
if os.path.normcase(name) == CVS: | if os.path.normcase(name) in CVS_DIRS: | def copydir((targetdir, replacements, uid, gid), sourcedir, names): # Don't recurse into CVS directories: for name in names[:]: if os.path.normcase(name) == CVS: names.remove(name) elif os.path.isfile(os.path.join(sourcedir, name)): # Copy the file: sn, ext = os.path.splitext(name) if os.path.normcase(ext) == ".in": dst = os.path.join(targetdir, sourcedir, sn) if os.path.exists(dst): continue copyin(os.path.join(sourcedir, name), dst, replacements, uid, gid) if uid is not None: os.chown(dst, uid, gid) else: src = os.path.join(sourcedir, name) dst = os.path.join(targetdir, src) if os.path.exists(dst): continue shutil.copyfile(src, dst) shutil.copymode(src, dst) if uid is not None: os.chown(dst, uid, gid) else: # Directory: dn = os.path.join(targetdir, sourcedir, name) if not os.path.exists(dn): os.mkdir(dn) shutil.copymode(os.path.join(sourcedir, name), dn) if uid is not None: os.chown(dn, uid, gid) | e2dae3e07e3173d5bf9c4dc6721fc71adba1ee34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e2dae3e07e3173d5bf9c4dc6721fc71adba1ee34/copyzopeskel.py |
if k=='' or k in '().012FGIJKLMNTUVX]adeghjlpqrstu}': | if k=='' or k in '().012FGIJKLMNTUVXS]adeghjlpqrstu}': | def refuse_to_unpickle(self): raise pickle.UnpicklingError, 'Refused' | 0f7afa6d2bd9ffe9bcbff548137dce145b5e8136 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0f7afa6d2bd9ffe9bcbff548137dce145b5e8136/TreeTag.py |
elif k in [pickle.STRING]: pass | def refuse_to_unpickle(self): raise pickle.UnpicklingError, 'Refused' | 0f7afa6d2bd9ffe9bcbff548137dce145b5e8136 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0f7afa6d2bd9ffe9bcbff548137dce145b5e8136/TreeTag.py |
|
_should_fail('hello',0) | def _test(): _should_fail('hello',0) _should_succeed('hello') _should_succeed(1) _should_succeed(1L) _should_succeed(1.0) _should_succeed((1,2,3)) _should_succeed([1,2,3]) _should_succeed({1:2,3:4}) _should_fail(open) _should_fail(_junk_class) _should_fail(_junk_class()) | 0f7afa6d2bd9ffe9bcbff548137dce145b5e8136 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0f7afa6d2bd9ffe9bcbff548137dce145b5e8136/TreeTag.py |
|
manage_menu =HTMLFile('dtml/menu', globals()) | manage_menu =DTMLFile('dtml/menu', globals()) | def tabs_path_info(self, script, path, # Static vars quote=urllib.quote, ): out=[] while path[:1]=='/': path=path[1:] while path[-1:]=='/': path=path[:-1] while script[:1]=='/': script=script[1:] while script[-1:]=='/': script=script[:-1] path=split(path,'/')[:-1] if script: path=[script]+path if not path: return '' script='' last=path[-1] del path[-1] for p in path: script="%s/%s" % (script, quote(p)) out.append('<a href="%s/manage_workspace">%s</a>' % (script, p)) out.append(last) return join(out, '/') | 8f292c1be20e547bd8de0628deb9bbce762eed80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8f292c1be20e547bd8de0628deb9bbce762eed80/Management.py |
manage_zmi_prefs=HTMLFile('dtml/manage_zmi_prefs', globals()) | manage_zmi_prefs=DTMLFile('dtml/manage_zmi_prefs', globals()) | def manage_zmi_logout(self, REQUEST, RESPONSE): """Logout current user""" p = getattr(REQUEST, '_logout_path', None) if p is not None: return apply(self.restrictedTraverse(p)) | 8f292c1be20e547bd8de0628deb9bbce762eed80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8f292c1be20e547bd8de0628deb9bbce762eed80/Management.py |
else: hide_tracebacks=None | else: hide_tracebacks=1 | def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ elif os.environ.has_key('BOBO_REALM'): realm=request.environ['BOBO_REALM'] else: realm=module_name # Check for debug mode if hasattr(module,'__bobo_debug_mode__'): debug_mode=not not module.__bobo_debug_mode__ elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE']) if debug_mode=='y' or debug_mode=='yes': debug_mode=1 else: try: debug_mode=atoi(debug_mode) except: debug_mode=None else: debug_mode=None # Check whether tracebacks should be hidden: if hasattr(module,'__bobo_hide_tracebacks__'): hide_tracebacks=not not module.__bobo_hide_tracebacks__ elif os.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=lower(os.environ['BOBO_HIDE_TRACEBACKS']) if hide_tracebacks=='y' or hide_tracebacks=='yes': hide_tracebacks=1 else: try: hide_tracebacks=atoi(hide_tracebacks) except: hide_tracebacks=None else: hide_tracebacks=None # Reset response handling of tracebacks, if necessary: if debug_mode or not hide_tracebacks: def hack_response(): import Response Response._tbopen = '<PRE>' Response._tbclose = '</PRE>' hack_response() if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name, debug_mode) modules[module_name]=modules[module_name+'.cgi']=info return info except: if hasattr(sys, 'exc_info'): t,v,tb=sys.exc_info() else: t, v, tb = sys.exc_type, sys.exc_value, sys.exc_traceback v=str(v) raise ImportError, (t, v), tb finally: tb=None release() | 85a3536746b2d943046a43eb7bcaa11de8848e76 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/85a3536746b2d943046a43eb7bcaa11de8848e76/Publish.py |
self.pt_edit(REQUEST.get('BODY', '')) | text = REQUEST.get('BODY', '') content_type = guess_type('', text) self.pt_edit(text, content_type, self.output_encoding) | def PUT(self, REQUEST, RESPONSE): """ Handle HTTP PUT requests """ self.dav__init(REQUEST, RESPONSE) self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1) ## XXX this should be unicode or we must pass an encoding self.pt_edit(REQUEST.get('BODY', '')) RESPONSE.setStatus(204) return RESPONSE | c81a09c8042d7dbba800e0f6f0621b5909243537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c81a09c8042d7dbba800e0f6f0621b5909243537/ZopePageTemplate.py |
self.REQUEST.RESPONSE.setHeader('Content-Type', self.content_type) return self.read() | return self.pt_render() | def manage_FTPget(self): "Get source for FTP download" self.REQUEST.RESPONSE.setHeader('Content-Type', self.content_type) return self.read() | c81a09c8042d7dbba800e0f6f0621b5909243537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c81a09c8042d7dbba800e0f6f0621b5909243537/ZopePageTemplate.py |
for sub in ast[2][2][1:]: | for sub in ast[i][2][1:]: | def item_munge(ast, i): # Munge an item access into a function call name=ast[i][2][1] args=[arglist] append=args.append a=(factor, (power, (atom, (NAME, '_vars')))) a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, a))))))))))) append(a) append([COMMA,',']) a=ast[:i] a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, (factor, a)))))))))))) append(a) append([COMMA,',']) for sub in ast[2][2][1:]: if sub[0]==COMMA: append(sub) else: if len(sub) != 2: raise ParseError, 'Invalid slice in subscript' append([argument, sub[1]]) return [power, [atom, [NAME, '__guarded_getitem__']], [trailer, [LPAR, '('], args, [RPAR, ')'], ] ] | c40ace88f846709a5fc46043f857f2dc2cf09d7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c40ace88f846709a5fc46043f857f2dc2cf09d7f/gparse.py |
[trailer, [LPAR, '('], args, [RPAR, ')'], ] | [trailer, [LPAR, '('], args, [RPAR, ')']], | def dot_munge(ast, i): # Munge an attribute access into a function call name=ast[i][2][1] args=[arglist] append=args.append a=(factor, (power, (atom, (NAME, '_vars')))) a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, a))))))))))) append(a) append([COMMA,',']) a=ast[:i] a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, (factor, a)))))))))))) append(a) append([COMMA,',']) a=(factor, (power, (atom, (STRING, `name`)))) a=(argument, (test, (and_test, (not_test, (comparison, (expr, (xor_expr, (and_expr, (shift_expr, (arith_expr, (term, a))))))))))) append(a) return [power, [atom, [NAME, '__guarded_getattr__']], [trailer, [LPAR, '('], args, [RPAR, ')'], ] ] | c40ace88f846709a5fc46043f857f2dc2cf09d7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c40ace88f846709a5fc46043f857f2dc2cf09d7f/gparse.py |
def spam(): # Regression test import traceback ok=1 for expr1, expr2 in ( ("a*b", "__guarded_mul__(_vars, a, b)"), ("a*b*c", "__guarded_mul__(_vars, __guarded_mul__(_vars, a, b), c)" ), ("a.b", "__guarded_getattr__(_vars, a, 'b')"), ("a[b]", "__guarded_getitem__(_vars, a, b)"), ("a[b,c]", "__guarded_getitem__(_vars, a, b, c)"), ("a[b:c]", "__guarded_getslice__(_vars, a, b, c)"), ("a[:c]", "__guarded_getslice__(_vars, a, 0, c)"), ("a[b:]", "__guarded_getslice__(_vars, a, b)"), ("a[:]", "__guarded_getslice__(_vars, a)"), ("_vars['sequence-index'] % 2", "__guarded_getitem__(_vars, _vars, 'sequence-index') % 2" ), ): l1=munge(astl(expr1)) l2=astl(expr2) try: c1=compileast(sequence2ast(l1)) except: traceback.print_exc c1=None c2=compileast(sequence2ast(l2)) if c1 !=c2: ok=0 print 'test failed', expr1, expr2 print print l1 print print l2 print ast=parser.sequence2ast(l1) c=parser.compileast(ast) if ok: print 'all tests succeeded' | c40ace88f846709a5fc46043f857f2dc2cf09d7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c40ace88f846709a5fc46043f857f2dc2cf09d7f/gparse.py |
||
def unindex_object(self, i): """ Unindex the object with integer id 'i' """ index = self._index unindex = self._unindex | 98f35321cf8fda0a7001bab839f869968aef3aaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/98f35321cf8fda0a7001bab839f869968aef3aaf/UnKeywordIndex.py |
||
if not hasattr(Folder, name): setattr(Folder, name, method) | if not hasattr(Folder.Folder, name): setattr(Folder.Folder, name, method) | def install_product(app, product_dir, product_name, meta_types, folder_permissions, raise_exc=0, log_exc=1): path_join=os.path.join isdir=os.path.isdir exists=os.path.exists DictType=type({}) global_dict=globals() silly=('__doc__',) if 1: # Preserve indentation for diff :-) package_dir=path_join(product_dir, product_name) __traceback_info__=product_name if not isdir(package_dir): return if not exists(path_join(package_dir, '__init__.py')): if not exists(path_join(package_dir, '__init__.pyc')): return try: product=__import__("Products.%s" % product_name, global_dict, global_dict, silly) # Install items into the misc_ namespace, used by products # and the framework itself to store common static resources # like icon images. misc_=pgetattr(product, 'misc_', {}) if misc_: if type(misc_) is DictType: misc_=Misc_(product_name, misc_) Application.misc_.__dict__[product_name]=misc_ # Here we create a ProductContext object which contains # information about the product and provides an interface # for registering things like classes and help topics that # should be associated with that product. Products are # expected to implement a method named 'initialize' in # their __init__.py that takes the ProductContext as an # argument. productObject=App.Product.initializeProduct( product, product_name, package_dir, app) context=ProductContext(productObject, app, product) # Look for an 'initialize' method in the product. If it does # not exist, then this is an old product that has never been # updated. In that case, we will analyze the product and # build up enough information to do initialization manually. initmethod=pgetattr(product, 'initialize', None) if initmethod is not None: initmethod(context) # Support old-style product metadata. Older products may # define attributes to name their permissions, meta_types, # constructors, etc. permissions={} new_permissions={} for p in pgetattr(product, '__ac_permissions__', ()): permission, names, default = ( tuple(p)+('Manager',))[:3] if names: for name in names: permissions[name]=permission elif not folder_permissions.has_key(permission): new_permissions[permission]=() for meta_type in pgetattr(product, 'meta_types', ()): # Modern product initialization via a ProductContext # adds 'product' and 'permission' keys to the meta_type # mapping. We have to add these here for old products. pname=permissions.get(meta_type['action'], None) if pname is not None: meta_type['permission']=pname meta_type['product']=productObject.id meta_types.append(meta_type) for name,method in pgetattr( product, 'methods', {}).items(): if not hasattr(Folder, name): setattr(Folder, name, method) if name[-9:]!='__roles__': # not Just setting roles if (permissions.has_key(name) and not folder_permissions.has_key( permissions[name])): permission=permissions[name] if new_permissions.has_key(permission): new_permissions[permission].append(name) else: new_permissions[permission]=[name] if new_permissions: new_permissions=new_permissions.items() for permission, names in new_permissions: folder_permissions[permission]=names new_permissions.sort() Folder.Folder.__dict__['__ac_permissions__']=tuple( list(Folder.Folder.__ac_permissions__)+new_permissions) if (os.environ.get('ZEO_CLIENT') and not os.environ.get('FORCE_PRODUCT_LOAD')): # we don't want to install products from clients # (unless FORCE_PRODUCT_LOAD is defined). get_transaction().abort() else: get_transaction().note('Installed product '+product_name) get_transaction().commit() except: if log_exc: LOG('Zope',ERROR,'Couldn\'t install %s' % product_name, error=sys.exc_info()) get_transaction().abort() if raise_exc: raise | 55aea706df39bbe0c5a6760e178e99c8b3c2dd36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/55aea706df39bbe0c5a6760e178e99c8b3c2dd36/Application.py |
tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl | if level >= 0: tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None): "Render a tree as a table" have_arg=args.has_key tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 exp=0 sub=None output=data.append try: items=getattr(self, args['branches'])() except: items=None if not items and have_arg('leaves'): items=1 if (args.has_key('sort')) and (items is not None) and (items != 1): # Faster/less mem in-place sort sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] diff.append(id) if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] #################################### if exp: treeData['tree-item-expanded']=1 output('<A HREF="%s?tree-c=%s">%s</A>' % (root_url,s, icoMinus)) else: output('<A HREF="%s?tree-e=%s">%s</A>' % (root_url,s, icoPlus)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, 'tpId'): id=item.tpId() elif hasattr(item, '_p_oid'): id=item._p_oid else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data | bad17ae311a8a52df030437d07b35ad36eaddba1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bad17ae311a8a52df030437d07b35ad36eaddba1/TreeTag.py |
header_re=regex.compile( | header_re=ts_regex.compile( | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), | space_re=ts_regex.compile('\([ \t]+\)'), name_re=ts_regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
if header_re.match(html) < 0: | ts_results = header_re.match_group(html, (1,3)) if not ts_results: | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
headers, html = header_re.group(1,3) | headers, html = ts_results[1] | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
elif space_re.match(headers[i]) >= 0: | continue ts_results = space_re.match_group(headers[i], (1,)) if ts_results: | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
headers[i][len(space_re.group(1)):]) | headers[i][len(ts_results[1]):]) | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
else: i=i+1 | continue i=i+1 | def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re.group(1,3) headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] elif space_re.match(headers[i]) >= 0: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(space_re.group(1)):]) del headers[i] else: i=i+1 for i in range(len(headers)): if name_re.match(headers[i]) >= 0: k, v = name_re.group(1,2) v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | fb76d2fc46a3786951890b362b197fc303527dc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb76d2fc46a3786951890b362b197fc303527dc3/DTMLMethod.py |
Subsets and Splits