rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
( 'SMSToolsTests', CLAM_SANDBOXES+'CLAM_SMSTools/build/FunctionalTests/' )
( 'SMSToolsTests', baseDirOf('SMSTools')+'/build/FunctionalTests/' )
def baseDirOf(keyname) : for modulename, sandboxname, _, _ in sandboxes : if modulename.find(keyname) >= 0 : return CLAM_SANDBOXES+ sandboxname assert False, "in baseDirOf() wrong module keyname"
( 'SDIFDisplay', baseDirOf('SDIFDisplay')+'/build/' )
def baseDirOf(keyname) : for modulename, sandboxname, _, _ in sandboxes : if modulename.find(keyname) >= 0 : return CLAM_SANDBOXES+ sandboxname assert False, "in baseDirOf() wrong module keyname"
assert not name == '', 'found removed test (invalid dir or settings file)'
if name == '' : return 'found invalid test (see message above)', '', TestResulut()
def compileAndRun(name, path) : global foundCompilationErrors, foundExecutionErrors, foundTestsFailures, configurations assert not name == '', 'found removed test (invalid dir or settings file)' os.chdir(path) # compilation phase summaryText = [''] testResult = TestResult() testResult.name = name details = '' for con...
soname = target_file linkername = pieces[0]+"."+pieces[1]+"."+pieces[-1] biglinkername = pieces[0]+"."+pieces[-1]
linkername = '.'.join(pieces[0:1]) + '.dylib' soname = '.'.join( pieces[0:2]) + '.dylib' biglinkername = '.'.join( pieces[0:3] ) + '.dylib'
def make_lib_names( source, target, env ) : target_dir = os.path.dirname( str(target[0]) ) target_file = os.path.basename( str(target[0]) ) cwd = os.getcwd() os.chdir( target_dir ) pieces=target_file.split('.') if sys.platform == 'linux2' : os.system( "/sbin/ldconfig -n ." ) linkername = '.'.join(pieces[0:2]) soname ...
self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib",module)])
self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")]) self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4")])
def enable_modules(self, modules, debug=False) : import sys validModules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'Qt3Support', # The next modules have not been tested yet so, please # maybe they require additional work on non Linux platforms 'QtSql', 'QtNetwork', 'QtSvg', 'QtTest', 'QtXml', 'QtUiTools', 'QtDesigner', ] pcl...
modules.remove(module) if debug : modules = [module+debugSuffix for module in modules] self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(modules))
pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ] self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules))
def enable_modules(self, modules, debug=False) : import sys validModules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'Qt3Support', # The next modules have not been tested yet so, please # maybe they require additional work on non Linux platforms 'QtSql', 'QtNetwork', 'QtSvg', 'QtTest', 'QtXml', 'QtUiTools', 'QtDesigner', ] pcl...
os.rename( self.path+'temp', self.path+audiofilename )
os.rename( self.path+'.tempAnnotationSong', self.path+audiofilename )
def processTask(self): ids, descriptors, contentlocatoruri, metadataprovideruri, self.description = self.extractParameters()
file = open( self.path+"temp", 'w')
file = open( self.path+".tempAnnotationSong", 'w')
def downloadSong(self, locations): #EP: quan es fagi servir el ContentProvider, el nom d'arxiu sera un problemet, diria -> caldria mirar header pel nom d'arxiu? if len(locations) == 0: return None
print 'executing ',cmd
pprint('CYAN', 'executing: ', cmd)
def getStatusOutput(cmd) : "returns wheather cmd exits correctly and the output" print 'executing ',cmd stat, output = commands.getstatusoutput(cmd) if stat != 0 : print output else : print ' OK' return (stat == 0), output
print ' OK'
pprint('GREEN', '\t\t\t[ok]')
def getStatusOutput(cmd) : "returns wheather cmd exits correctly and the output" print 'executing ',cmd stat, output = commands.getstatusoutput(cmd) if stat != 0 : print output else : print ' OK' return (stat == 0), output
constantly = (len(sys.argv)==1 or sys.argv[1] == "--constantly")
constantly = (len(sys.argv)==2 and sys.argv[1] == "--constantly")
def runTests() : totalSummary = [''] # TODO depracate totalDetails = [''] # TODO depracate resultSet = TestResultSet() subj = [subject] if 'CVSROOT' not in os.environ : print 'warning: CVSROOT not found in environ using: ', CVSROOT os.environ['CVSROOT'] = CVSROOT os.environ['CVS_RSH'] = getStatusOutput('which ssh')[1]...
self.release.unitTestsFailures = nfailures
self.release.functionalTestsFailures = nfailures
def functionalTestsFailures(self, config, nfailures): self.__checkConfig(config) if config == "debug" : self.debug.functionalTestsFailures = nfailures else : self.release.unitTestsFailures = nfailures
self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules])
self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules if lib not in staticModules]) self.AppendUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])
def enable_modules(self, modules, debug=False) : import sys validModules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'Qt3Support', # The next modules have not been tested yet so, please # maybe they require additional work on non Linux platforms 'QtSql', 'QtNetwork', 'QtSvg', 'QtTest', 'QtXml', 'QtUiTools', 'QtDesigner', ] pcl...
linkername = '.'.join(target_file.split('.')[0:2]) soname = '.'.join( target_file.split('.')[0:3])
linkername = '.'.join(pieces[0:2]) soname = '.'.join( pieces[0:3]) biglinkername = '.'.join( pieces[0:4] )
def make_lib_names( source, target, env ) : target_dir = os.path.dirname( str(target[0]) ) target_file = os.path.basename( str(target[0]) ) cwd = os.getcwd() os.chdir( target_dir ) pieces=target_file.split('.') if sys.platform == 'linux2' : os.system( "ldconfig -n ." ) linkername = '.'.join(target_file.split('.')[0:2...
if "QtGui" in modules: self.AppendUnique(CPPFLAGS=["-DQT_GUI_LIB"])
def enable_modules(self, modules, debug=False) : import sys validModules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'Qt3Support', # The next modules have not been tested yet so, please # maybe they require additional work on non Linux platforms 'QtSql', 'QtNetwork', 'QtSvg', 'QtTest', 'QtXml', 'QtUiTools', ] pclessModules = [...
self.AppendUnique(LIBS=[lib+'4' for lib in modules])
if debug : debugSuffix = 'd' else : debugSuffix = '' self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules])
def enable_modules(self, modules, debug=False) : import sys validModules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'Qt3Support', # The next modules have not been tested yet so, please # maybe they require additional work on non Linux platforms 'QtSql', 'QtNetwork', 'QtSvg', 'QtTest', 'QtXml', 'QtUiTools', ] pclessModules = [...
externalApplications = [
sconsApplications = [
def baseDirOf(keyname) : for modulename, sandboxname, _, _ in sandboxes : if modulename.find(keyname) >= 0 : return CLAM_SANDBOXES+ sandboxname assert False, "in baseDirOf() wrong module keyname: %s, sandbox: %s" % \ (keyname, sandboxname)
( 'SDIFDisplay', baseDirOf('SDIFDisplay')+'/build/' )
def baseDirOf(keyname) : for modulename, sandboxname, _, _ in sandboxes : if modulename.find(keyname) >= 0 : return CLAM_SANDBOXES+ sandboxname assert False, "in baseDirOf() wrong module keyname: %s, sandbox: %s" % \ (keyname, sandboxname)
testsToRun[-1:-1] = externalApplications
testsToRun[-1:-1] = sconsApplications
def baseDirOf(keyname) : for modulename, sandboxname, _, _ in sandboxes : if modulename.find(keyname) >= 0 : return CLAM_SANDBOXES+ sandboxname assert False, "in baseDirOf() wrong module keyname: %s, sandbox: %s" % \ (keyname, sandboxname)
fh.write(pack('H', len(obj.getData().faces)))
fh.write(pack('H', num))
def export_meshes(): fh = open(framework_name + ".adrt", "wb") ## Endian fh.write(pack('h', 1)) ## Version fh.write(pack('h', 2)) ## Calculate total number of triangles obj_list = Blender.Object.Get() num = 0 for obj in obj_list: if (obj.Layer & layer_mask) == obj.Layer: if(type(obj.getData()) == Types.NMeshType): ...
fh.write(pack('I', len(obj.getData().faces)))
fh.write(pack('I', num))
def export_meshes(): fh = open(framework_name + ".adrt", "wb") ## Endian fh.write(pack('h', 1)) ## Version fh.write(pack('h', 2)) ## Calculate total number of triangles obj_list = Blender.Object.Get() num = 0 for obj in obj_list: if (obj.Layer & layer_mask) == obj.Layer: if(type(obj.getData()) == Types.NMeshType): ...
fh.write("image_size,1024,768,128,128\n")
fh.write("image_size,512,384,128,128\n")
def export_environment(): fh = open(framework_name + ".env", "w") fh.write("geometry_file," + framework_name + ".adrt\n") fh.write("properties_file," + framework_name + ".properties\n") fh.write("textures_file," + framework_name + ".textures\n") fh.write("mesh_map_file," + framework_name + ".map\n") fh.write("frames_fi...
if aniVal == 0:
if animation == 0:
def dumpFrames():
if sceneVal == 1: commands.getoutput("mkdir %s" % projectName) envFileName = projectName + "/env.db" print envFileName envFile = open(envFileName, "w") envFile.write("image_size,%d,%d\n" % (640,480)) envFile.write("rendering_method,normal\n") envFile.close(); textureFileName = projectName + "/texture.db" print tex...
commands.getoutput("mkdir %s" % projectName) envFileName = projectName + "/settings.env" print envFileName envFile = open(envFileName, "w") envFile.write("image_size,%d,%d\n" % (640,480)) envFile.write("rendering_method,normal\n") envFile.close(); textureFileName = projectName + "/texture.db" textureFile = open(tex...
def doExport(): global layerBits print "Exporting...\n" ## Built Layer Bit Mask i = 0 layerBits = 0 while i < 20: if layers[i] != 0: layerBits |= (1 << i) i += 1 if sceneVal == 1: ## Make Project Directory commands.getoutput("mkdir %s" % projectName) envFileName = projectName + "/env.db" print envFileName envFile =...
else dumpOneFrame(, 1)
def doExport(): global layerBits print "Exporting...\n" ## Built Layer Bit Mask i = 0 layerBits = 0 while i < 20: if layers[i] != 0: layerBits |= (1 << i) i += 1 if sceneVal == 1: ## Make Project Directory commands.getoutput("mkdir %s" % projectName) envFileName = projectName + "/env.db" print envFileName envFile =...
global aniVal, rppVal, meshVal, materVal, frameVal, sceneVal, rppBtn, layerBtns, layers global rppBtn, layerBtns, layers, projectName, projectButton
global animation, sceneVal, layerBtns, layers, projectName, projectButton
def buttonEvent(evt): global aniVal, rppVal, meshVal, materVal, frameVal, sceneVal, rppBtn, layerBtns, layers global rppBtn, layerBtns, layers, projectName, projectButton if evt == 8: projectName = projectButton.val if evt == 1: doExport() if evt == 2: print "Rendering...\n" elif evt == 4: aniVal = 1 - aniVal elif ev...
if evt == 2: print "Rendering...\n"
def buttonEvent(evt): global aniVal, rppVal, meshVal, materVal, frameVal, sceneVal, rppBtn, layerBtns, layers global rppBtn, layerBtns, layers, projectName, projectButton if evt == 8: projectName = projectButton.val if evt == 1: doExport() if evt == 2: print "Rendering...\n" elif evt == 4: aniVal = 1 - aniVal elif ev...
aniVal = 1 - aniVal elif evt == 5: rppVal = rppBtn.val
animation = 1 - animation
def buttonEvent(evt): global aniVal, rppVal, meshVal, materVal, frameVal, sceneVal, rppBtn, layerBtns, layers global rppBtn, layerBtns, layers, projectName, projectButton if evt == 8: projectName = projectButton.val if evt == 1: doExport() if evt == 2: print "Rendering...\n" elif evt == 4: aniVal = 1 - aniVal elif ev...
elif evt == 10: sceneVal = 1 - sceneVal elif evt == 11: meshVal = 1 - meshVal elif evt == 12: materVal = 1 - materVal elif evt == 13: frameVal = 1 - frameVal
def buttonEvent(evt): global aniVal, rppVal, meshVal, materVal, frameVal, sceneVal, rppBtn, layerBtns, layers global rppBtn, layerBtns, layers, projectName, projectButton if evt == 8: projectName = projectButton.val if evt == 1: doExport() if evt == 2: print "Rendering...\n" elif evt == 4: aniVal = 1 - aniVal elif ev...
global rppBtn, layers, layerBtns, projectName, projectButton
global layers, layerBtns, projectName, projectButton
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) BGL.glColor3f(0, 0, 0)
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
binWidth = Draw.GetStringWidth("Binary Format", 'normal') + 30 aniWidth = Draw.GetStringWidth("Save All Frames", 'normal') + 30
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
Draw.Button("Export", 1, xPad, yLoc, expWidth, 2*height, "Export Scene to Disk") projectButton = Draw.String("Project Name:", 8, expWidth + xPad, yLoc, binWidth + aniWidth, height, projectName, 32, "Project Name") yLoc += yDelta Draw.Toggle("Save All Frames", 4, expWidth + binWidth + xPad, yLoc, aniWidth, height, an...
Draw.Button("Export", 1, xPad, yLoc, expWidth, 2*height, "Export Scene")
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
layerBtns.append(Draw.Toggle(" ", layerBase + layerBtn, xpos, ypos, btnSize, btnSize, layers[layerBtn])) if (col+1) % 5: xpos += btnSize else: xpos += btnSize * 2
layerBtns.append(Draw.Toggle(" ", layerBase + layerBtn, expWidth + xpos, ypos, btnSize, btnSize, layers[layerBtn])) xpos += btnSize
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
Draw.Button("All", 6, 12*btnSize + xPad, yLoc, btnSize*5, height, "Deselect all Layers") Draw.Button("None", 7, 12*btnSize + xPad, yLoc+btnSize, btnSize*5, height, "Select all Layers")
Draw.Button("All", 6, 10*btnSize + xPad + expWidth, yLoc, btnSize*5, height, "Deselect all Layers") Draw.Button("None", 7, 10*btnSize + xPad + expWidth, yLoc+btnSize, btnSize*5, height, "Select all Layers") yLoc += yDelta yLoc += yDelta Draw.Toggle("Export Animation Data", 4, xPad, yLoc, 345, height, animation, "Exp...
def drawGUI(): global rppBtn, layers, layerBtns, projectName, projectButton ## Set background color BGL.glClearColor(0.7, 0.7, 0.6, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) ## Set text color BGL.glColor3f(0, 0, 0) xPad = 10 height = 18 yLoc = xPad + 10 yDelta = height binWidth = Draw.GetStringWidth("Binary Format", ...
fh.write(pack('B', len(obj.getName())))
fh.write(pack('B', len(obj.getName())+1))
def export_meshes(): fh = open(framework_name + ".adrt", "wb") ## Endian fh.write(pack('h', 1)) ## Version fh.write(pack('h', 2)) ## Calculate total number of triangles obj_list = Blender.Object.Get() num = 0 for obj in obj_list: if (obj.Layer & layer_mask) == obj.Layer: if(type(obj.getData()) == Types.NMeshType): ...
locator = pyre.parsing.locators.chain(locator, self.locator)
locator = pyre.parsing.locators.chain(self.locator, locator)
def setLocator(self, locator): """set my locator to <locator>; if I already have one, chain them""" if self.locator is not None: import pyre.parsing.locators locator = pyre.parsing.locators.chain(locator, self.locator)
import pyre.parsing.locators locator = pyre.parsing.locators.default()
def components(self, context=None): """return a list of my components"""
args.append(self.extra)
extra = self.extra if extra: args.extend(extra.split(' '))
def _appendMpiRunArgs(self, args): args.append(self.extra) args.extend(['-np', '%d' % self.nodes]) # use only the specific nodes specified explicitly if self.nodelist: self._appendNodeListArgs(args)
_passwordManagerName = "Plain Text"
def setPassword(password, passwordManagerName=None): pass
"""Extracts HTTP basic auth credentisla from a request.
"""Extracts HTTP basic auth credentials from a request.
def extractCredentials(self, request): """Extracts HTTP basic auth credentisla from a request.
authenticators = [queryUtility(IAuthenticationPlugin, name)
authenticators = [queryUtility(IAuthenticationPlugin, name, context=self)
def authenticate(self, request): authenticators = [queryUtility(IAuthenticationPlugin, name) for name in self.authenticators] for extractor in self.extractors: extractor = queryUtility(IExtractionPlugin, extractor) if extractor is None: continue credentials = extractor.extractCredentials(request) for authenticator in a...
extractor = queryUtility(IExtractionPlugin, extractor)
extractor = queryUtility(IExtractionPlugin, extractor, context=self)
def authenticate(self, request): authenticators = [queryUtility(IAuthenticationPlugin, name) for name in self.authenticators] for extractor in self.extractors: extractor = queryUtility(IExtractionPlugin, extractor) if extractor is None: continue credentials = extractor.extractCredentials(request) for authenticator in a...
factory)
factory, context=self)
def _create(self, meth, *args): # We got some data, lets create a user for factory in self.factories: factory = queryUtility(IPrincipalFactoryPlugin, factory) if factory is None: continue
>>> principal = factory(42) The factory uses the info to create a principal with the same ID, title, and description:
The factory must be called with a pluggable-authentication object: >>> class Auth: ... prefix = 'auth.' >>> auth = Auth() >>> principal = factory(auth) The factory uses the pluggable authentication and the info to create a principal with the same ID, title, and description:
def __repr__(self): return 'Principal(%r)' % self.id
'users.mary'
'auth.users.mary'
def __repr__(self): return 'Principal(%r)' % self.id
>>> event.principal is principal, event.authentication == 42
>>> event.principal is principal, event.authentication is auth
def __repr__(self): return 'Principal(%r)' % self.id
principal = Principal(self.info.id, self.info.title,
principal = Principal(authentication.prefix + self.info.id, self.info.title,
def __call__(self, authentication): principal = Principal(self.info.id, self.info.title, self.info.description) notify(interfaces.AuthenticatedPrincipalCreated( authentication, principal, self.info, self.request)) return principal
>>> principal = factory(42) The factory uses the info to create a principal with the same ID, title, and description:
The factory must be called with a pluggable-authentication object: >>> class Auth: ... prefix = 'auth.' >>> auth = Auth() >>> principal = factory(auth) The factory uses the pluggable-authentication object and the info to create a principal with the same ID, title, and description:
def __call__(self, authentication): principal = Principal(self.info.id, self.info.title, self.info.description) notify(interfaces.AuthenticatedPrincipalCreated( authentication, principal, self.info, self.request)) return principal
'users.sam'
'auth.users.sam'
def __call__(self, authentication): principal = Principal(self.info.id, self.info.title, self.info.description) notify(interfaces.AuthenticatedPrincipalCreated( authentication, principal, self.info, self.request)) return principal
>>> event.principal is principal, event.authentication == 42
>>> event.principal is principal, event.authentication is auth
def __call__(self, authentication): principal = Principal(self.info.id, self.info.title, self.info.description) notify(interfaces.AuthenticatedPrincipalCreated( authentication, principal, self.info, self.request)) return principal
search in groupinfo.description.lower()):
(groupinfo.description and search in groupinfo.description.lower())):
def search(self, query, start=None, batch_size=None): """ Search for groups""" search = query.get('search') if search is not None: i = 0 n = 0 search = search.lower() for id, groupinfo in self.items(): if (search in groupinfo.title.lower() or search in groupinfo.description.lower()): if not ((start is not None and i < ...
return (next is not None) and next.getPrincipal(self.prefix+id) or None
if next is not None: return next.getPrincipal(self.prefix + id) raise PrincipalLookupError(id)
def getPrincipal(self, id): if not id.startswith(self.prefix): next = queryNextUtility(self, IAuthentication) return (next is not None) and next.getPrincipal(id) or None id = id[len(self.prefix):] for name in self.authenticatorPlugins: authplugin = component.queryUtility( interfaces.IAuthenticatorPlugin, name, context=...
dc = zope.app.dublincore.interfaces.IDCDescriptiveProperties(
dc = zope.dublincore.interfaces.IDCDescriptiveProperties(
def _pluginVocabulary(context, interface, attr_name): """Vocabulary that provides names of plugins of a specified interface. Given an interface, the options should include the unique names of all of the plugins that provide the specified interface for the current context-- which is expected to be a pluggable authentic...
def siteSetUp(self, test=None):
def siteSetUp(test):
def siteSetUp(self, test=None): placefulSetUp(site=True)
def siteTearDown(self, test=None):
def siteTearDown(test):
def siteTearDown(self, test=None): placefulTearDown()
return principalfolder.PrincipalInfo(id, info.title, info.description)
return principalfolder.PrincipalInfo( self.prefix+id, info.title, info.description)
def principalInfo(self, id): if id.startswith(self.prefix): id = id[len(self.prefix):] info = self.get(id) if info is not None: return principalfolder.PrincipalInfo(id, info.title, info.description)
def setPassword(password, passwordManagerName=None): pass
def siteTearDown(test): placefulTearDown()
def setPassword(password, passwordManagerName=None): pass
password = Password( title=_("Password"), description=_("The password for the principal."))
def sessionSetUp(session_data_container_class=PersistentSessionDataContainer): placelesssetup.setUp() ztapi.provideAdapter(IRequest, IClientId, TestClientId) ztapi.provideAdapter(IRequest, ISession, Session) ztapi.provideUtility(IClientIdManager, CookieClientIdManager()) sdc = session_data_container_class() ztapi.provi...
def setPassword(password, passwordManagerName=None): pass
passwordManagerName = Choice( title=_("Password Manager"), vocabulary="Password Manager Names", description=_("The password manager will be used" " for encode/check the password"), default="Plain Text", readonly=True ) title = TextLine( title=_("Title"), description=_("Provides a title for the principal.")) descrip...
def nonHTTPSessionTestCaseSetUp(sdc_class=PersistentSessionDataContainer): placelesssetup.setUp() ztapi.provideAdapter(IRequest, IClientId, ClientId) ztapi.provideAdapter(IRequest, ISession, Session) ztapi.provideUtility(IClientIdManager, CookieClientIdManager()) sdc = sdc_class() ztapi.provideUtility(ISessionDataCont...
def setPassword(password, passwordManagerName=None): pass
class IInternalPrincipalContainer(interface.Interface): """A container that contains internal principals."""
class NonHTTPSessionTestCase(unittest.TestCase): def setUp(self): nonHTTPSessionTestCaseSetUp()
def setPassword(password, passwordManagerName=None): pass
prefix = TextLine( title=_("Prefix"), description=_( "Prefix to be added to all principal ids to assure " "that all ids are unique within the authentication service"), missing_value=u"", default=u'', readonly=True)
def tearDown(self): placefulTearDown()
def setPassword(password, passwordManagerName=None): pass
contains(IInternalPrincipal)
def test_exeractCredentials(self): plugin = SessionCredentialsPlugin() self.assertEqual(plugin.extractCredentials(base.TestRequest('/')), None) def test_challenge(self): plugin = SessionCredentialsPlugin() self.assertEqual(plugin.challenge(base.TestRequest('/')), False) def test_logout(self): plugin = SessionCreden...
def setPassword(password, passwordManagerName=None): pass
class IInternalPrincipalContained(interface.Interface): """Principal information"""
def test_suite(): return unittest.TestSuite(( doctest.DocTestSuite('zope.app.authentication.interfaces'), doctest.DocTestSuite('zope.app.authentication.password'), doctest.DocTestSuite('zope.app.authentication.generic'), doctest.DocTestSuite('zope.app.authentication.httpplugins'), doctest.DocTestSuite('zope.app.authent...
def setPassword(password, passwordManagerName=None): pass
containers(IInternalPrincipalContainer) class ISearchSchema(interface.Interface): """Search Interface for this Principal Provider""" search = TextLine( title=_("Search String"), description=_("A Search String"), required=False, default=u'', missing_value=u'') class InternalPrincipal(Persistent, Contained): """An i...
if __name__ == '__main__': unittest.main(defaultTest='test_suite')
def setPassword(password, passwordManagerName=None): pass
def memberParted( member, room ):
def memberParted( member, room, reason ):
def memberParted( member, room ): pass
mainPanel = VerticalPanel(self)
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5)
lyricsCow = GroupBox(self, text=_("lyricsCow options"), direction='v') gPanel = FlexGridPanel(lyricsCow, rows=3, cols=3, hgap=5, vgap=5)
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
gPanel.AddGrowableCol(1)
lyricsCow.AddComponent(gPanel) lyricsCow.Pack()
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
butPnl = HorizontalPanel(mainPanel)
butPnl = HorizontalPanel(self)
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
mainPanel.AddComponent(Label(mainPanel, _("Global preferences")), border=8, align='center') mainPanel.AddComponent(gPanel, border=10) mainPanel.AddComponent(butPnl, border=10, align='center') mainPanel.Pack()
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
self.AddComponent(mainPanel, expand = 'both', border=10)
self.AddComponent(lyricsCow, border=10) self.AddComponent(butPnl, border=10, align='center')
def Body(self): # Main Panel mainPanel = VerticalPanel(self) # Options gPanel = FlexGridPanel(mainPanel, rows=3, cols=3, hgap=5, vgap=5) self.baseDir = TextBox(gPanel, Value=os.path.expanduser(config.get('Output', 'BaseDir'))) self.fileModel = TextBox(gPanel, Value=config.get('Output', 'Model')) self.fileModel.OnChar...
for name, stepper in self.steppers.iteritems(): stepper.setDisabled()
if g.numTokens() == 0: g.setTokens(["X", "Y", "Z", "E", "H"]) for i in range(g.numTokens()): axis = g.tokenLetter(i) self.steppers[axis].setDisabled()
def _execute(self, g): if g.code() == "G1": # Move (G1 X0.1 Y40.2 F3000) if g.hasLetter("F"): # Get the feed rate self.feed_rate = float(g.getValueByLetter("F"))/60000.0 # Convert from mm/min to SI unit m/s g.removeTokenByLetter("F") smds = {} ...
self.fan_1.set_value(float(g.tokenValue(0))/255.0)
self.fan_1.set_value(float(g.tokenValue(0) if g.numTokens() > 0 else 255)/255.0)
def _execute(self, g): if g.code() == "G1": # Move (G1 X0.1 Y40.2 F3000) if g.hasLetter("F"): # Get the feed rate self.feed_rate = float(g.getValueByLetter("F"))/60000.0 # Convert from mm/min to SI unit m/s g.removeTokenByLetter("F") smds = {} ...
% len(gc.garbage)-lgarbage)
% (len(gc.garbage)-lgarbage))
def run_tests(options, tests, name, failures, errors): repeat = options.repeat or 1 repeat_range = iter(range(repeat)) ran = 0 gc.collect() lgarbage = len(gc.garbage) sumrc = 0 if options.report_refcounts: if options.verbose: track = TrackRefs() rc = sys.gettotalrefcount() for i in repeat_range: if repeat > 1: print...
test.debug() except: result.addError( test, sys.exc_info()[:2] + (sys.exc_info()[2].tb_next, ), ) else: result.addSuccess(test)
try: test.debug() except: result.addError( test, sys.exc_info()[:2] + (sys.exc_info()[2].tb_next, ), ) else: result.addSuccess(test) finally: result.stopTest(test)
def run_tests(options, tests, name, failures, errors): repeat = options.repeat or 1 ran = 0 for i in range(repeat): if repeat > 1: print "Iteration", i+1 if options.verbose > 0 or options.progress: print ' Running:' if options.verbose == 1 and not options.progress: print ' ', result = TestResult(options, tests) t ...
_para_re = re.compile('\s*\n\s*\n\s*')
_para_re = re.compile(r'\s*\n\s*\n\s*')
def set_unittest_reportflags(flags): """Sets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doc...
module_filter = positional.pop()
module_filter = positional.pop(0)
def get_options(args=None, defaults=None): default_setup, _ = parser.parse_args(default_setup_args) assert not _ if defaults: defaults, _ = parser.parse_args(defaults) assert not _ merge_options(defaults, default_setup) else: defaults = default_setup if args is None: args = sys.argv original_testrunner_args = args ar...
test_filter = [positional]
test_filter = positional.pop(0)
def get_options(args=None, defaults=None): default_setup, _ = parser.parse_args(default_setup_args) assert not _ if defaults: defaults, _ = parser.parse_args(defaults) assert not _ merge_options(defaults, default_setup) else: defaults = default_setup if args is None: args = sys.argv original_testrunner_args = args ar...
if modulename in self._ignore: return self._ignore[modulename] if filename.startswith('<doctest'): self._ignore[modulename] = True return trace.Ignore.names(self, filename, modulename) class MyTrace(trace.Trace):
ignore = self._ignored(modulename) if ignore is None: ignore = True if filename is not None: for d in self._test_dirs: if filename.startswith(d): ignore = False break self._ignore[modulename] = ignore return ignore class TestTrace(trace.Trace):
def names(self, filename, modulename): if modulename in self._ignore: return self._ignore[modulename]
>>> tracer = MyTrace(count=False, trace=False)
>>> tracer = TestTrace(None, count=False, trace=False)
def names(self, filename, modulename): if modulename in self._ignore: return self._ignore[modulename]
def __init__(self, *args, **kws): trace.Trace.__init__(self, *args, **kws) self.ignore = MyIgnore(kws.get("ignoremods"), kws.get("ignoredirs"))
def __init__(self, options, **kw): trace.Trace.__init__(self, **kw) if options is not None: self.ignore = TestIgnore(options)
def __init__(self, *args, **kws): trace.Trace.__init__(self, *args, **kws) self.ignore = MyIgnore(kws.get("ignoremods"), kws.get("ignoredirs")) self.started = False
tracer = MyTrace(ignoredirs=[sys.prefix, sys.exec_prefix], ignoremods=["os", "posixpath", "stat"], trace=False, count=True)
tracer = TestTrace(options, trace=False, count=True)
def run(defaults=None, args=None): if args is None: args = sys.argv # Set the default logging policy. # XXX There are no tests for this logging behavior. # It's not at all clear that the test runner should be doing this. configure_logging() # Control reporting flags during run old_reporting_flags = doctest.set_unitte...
self._ignore = {'<string>': 1}
self._ignore = {}
def __init__(self, options): self._test_dirs = [d[0] + os.path.sep for d in test_dirs(options, {})] self._ignore = {'<string>': 1} self._ignored = self._ignore.get
ignore = self._ignored(modulename)
if modulename == '<string>': return True ignore = self._ignored(filename)
def names(self, filename, modulename): ignore = self._ignored(modulename) if ignore is None: ignore = True if filename is not None: for d in self._test_dirs: if filename.startswith(d): ignore = False break self._ignore[modulename] = ignore return ignore
self._ignore[modulename] = ignore
self._ignore[filename] = ignore
def names(self, filename, modulename): ignore = self._ignored(modulename) if ignore is None: ignore = True if filename is not None: for d in self._test_dirs: if filename.startswith(d): ignore = False break self._ignore[modulename] = ignore return ignore
if sys.version_info[:3] > (2,4,1) or __debug__:
if sys.version_info[:3] > (2,4,1) or not __debug__:
def tearDown(test): sys.path, sys.argv = test.globs['saved-sys-info']
for p in options.path:
for p in options.test_path:
def remove_stale_bytecode(options): if options.keepbytecode: return for p in options.path: for dirname, dirs, files in walk_with_symlinks(options, p): for file in files: if file[-4:] in compiled_sufixes and file[:-1] not in files: fullname = os.path.join(dirname, file) print "Removing stale bytecode file", fullname os....
for dpath in options.path:
for dpath in options.test_path:
def test_dirs(options, seen): if options.package: for p in options.package: p = import_name(p) for p in p.__path__: p = os.path.abspath(p) if p in seen: continue for prefix in options.prefix: if p.startswith(prefix): seen[p] = 1 yield p break else: for dpath in options.path: yield dpath
""")
This option also specifies directories to be searched for tests. See the search_directory. """) setup.add_option( '--test-path', action="append", dest='test_path', help="""\ Specify a path to be searched for tests, but not added to the Python search path. This option can be used multiple times to specify multiple sea...
def do_pychecker(*args): if not os.environ.get("PYCHECKER"): os.environ["PYCHECKER"] = "-q" import pychecker.checker
options.path = map(os.path.abspath, options.path) options.prefix = [p + os.path.sep for p in options.path]
options.path = map(os.path.abspath, options.path or ()) options.test_path = map(os.path.abspath, options.test_path or ()) options.test_path += options.path options.prefix = [p + os.path.sep for p in options.test_path]
def get_options(args=None, defaults=None): default_setup, _ = parser.parse_args(default_setup_args) assert not _ if defaults: defaults, _ = parser.parse_args(defaults) assert not _ merge_options(defaults, default_setup) else: defaults = default_setup if args is None: args = sys.argv original_testrunner_args = args ar...
test.globs['saved-sys-info'] = sys.path, sys.argv
test.globs['saved-sys-info'] = ( sys.path[:], sys.argv[:], sys.modules.copy() )
def setUp(test): test.globs['saved-sys-info'] = sys.path, sys.argv test.globs['this_directory'] = os.path.split(__file__)[0] test.globs['testrunner_script'] = __file__
sys.path, sys.argv = test.globs['saved-sys-info']
sys.path[:], sys.argv[:] = test.globs['saved-sys-info'][:2] sys.modules.clear() sys.modules.update(test.globs['saved-sys-info'][2])
def tearDown(test): sys.path, sys.argv = test.globs['saved-sys-info']
for dirpath, dirs, files in walk_with_symlinks(options, p): yield (dirpath, dirs, files)
for sdirpath, sdirs, sfiles in walk_with_symlinks(options, p): yield (sdirpath, sdirs, sfiles)
def walk_with_symlinks(options, dir): for dirpath, dirs, files in os.walk(dir): dirs.sort() files.sort() dirs[:] = [d for d in dirs if d not in options.ignore_dir] yield (dirpath, dirs, files) for d in dirs: p = os.path.join(dirpath, d) if os.path.islink(p): for dirpath, dirs, files in walk_with_symlinks(options, p): y...
pdb.set_trace = real_pdb_set_trace
def run(defaults=None, args=None): if args is None: args = sys.argv # Control reporting flags during run old_reporting_flags = doctest.set_unittest_reportflags(0) # Make sure we start with real pdb.set_trace. This is needed # to make tests of the test runner work properly. :) pdb.set_trace = real_pdb_set_trace # Ch...
post_mortem(exc_info)
if self.options.resume_layer: print print '*'*70 print ("Can't post-mortem debug when running a layer" " as a subprocess!") print '*'*70 print else: post_mortem(exc_info)
def addError(self, test, exc_info): if self.options.verbose > 2: print " (%.3f ms)" % (time.time() - self._start_time)
if sys.argv[1] == '--resume-layer':
if len(sys.argv) > 1 and sys.argv[1] == '--resume-layer':
def main(): default = [ '--path', os.path.split(sys.argv[0])[0], '--tests-pattern', '^testrunner$', ] run(default)
failed = run_with_options(options) except EndRun: failed = True
try: failed = run_with_options(options) except EndRun: failed = True finally: if tracer: tracer.stop() if options.profile: prof.stop() prof.close() if options.profile: stats = None for file_name in glob.glob(prof_glob): loaded = hotshot.stats.load(file_name) if stats is None: stats = loaded else: stats.add(loaded) sta...
def run(defaults=None, args=None): if args is None: args = sys.argv # Control reporting flags during run old_reporting_flags = doctest.set_unittest_reportflags(0) # Check to see if we are being run as a subprocess. If we are, # then use the resume-layer and defaults passed in. if len(args) > 1 and args[1] == '--resum...
if tracer: tracer.stop()
if options.profile: for file_name in glob.glob(prof_glob): os.unlink(file_name)
def run(defaults=None, args=None): if args is None: args = sys.argv # Control reporting flags during run old_reporting_flags = doctest.set_unittest_reportflags(0) # Check to see if we are being run as a subprocess. If we are, # then use the resume-layer and defaults passed in. if len(args) > 1 and args[1] == '--resum...
'--coverage', action="store", dest='coverage',
'--coverage', action="store", type='string', dest='coverage',
def refcount_available(*args): if not hasattr(sys, "gettotalrefcount"): raise optparse.OptionValueError("""\