rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) | buttons = [(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)] | def info(primary, secondary, *buttons): if not buttons: buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) dialog = _configurable(_INFO, primary, secondary, *buttons) _queue_dialog(0, dialog) |
t = utils.getHTMLSerializer(self.create_iterable(body='<img src="foo.png" />')) | t = utils.getHTMLSerializer(self.create_iterable(body='<img src="foo.png" />'), pretty_print=True) | def test_getHTMLSerializer(self): t = utils.getHTMLSerializer(self.create_iterable(body='<img src="foo.png" />')) self.failUnless(isinstance(t, serializer.XMLSerializer)) t2 = utils.getXMLSerializer(t) self.failUnless(t2 is t) self.assertEqual( '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://ww... |
t = utils.getHTMLSerializer(self.create_iterable(preamble='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n', body='<img src="foo.png" />')) | t = utils.getHTMLSerializer(self.create_iterable(preamble='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n', body='<img src="foo.png" />'), pretty_print=True) | def test_getHTMLSerializer_doctype_xhtml_serializes_to_xhtml(self): t = utils.getHTMLSerializer(self.create_iterable(preamble='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n', body='<img src="foo.png" />')) self.failUnless(isinstance(t, serial... |
def getXMLSerializer(iterable, parser=etree.XMLParser, serializer=etree.tostring, pretty_print=False, encoding='utf-8'): | def getXMLSerializer(iterable, parser=etree.XMLParser, serializer=etree.tostring, pretty_print=False, encoding=None): | def getXMLSerializer(iterable, parser=etree.XMLParser, serializer=etree.tostring, pretty_print=False, encoding='utf-8'): """Turn the given iterable into an XMLSerializer. If it is already an XMLSerializer, return as-is. Otherwise, parse the input using with the given parser in feed-parser mode and initalize an XMLSeria... |
if chunk: p.feed(chunk) | p.feed(chunk) | def getXMLSerializer(iterable, parser=etree.XMLParser, serializer=etree.tostring, pretty_print=False, encoding='utf-8'): """Turn the given iterable into an XMLSerializer. If it is already an XMLSerializer, return as-is. Otherwise, parse the input using with the given parser in feed-parser mode and initalize an XMLSeria... |
if msg[0] == '\x00': | if msg and msg[0] == '\x00': | def handle_read(self): data = self.recv(1024) logging.debug('handle_read') if not data: self.handle_close() if not self.handshaken: handshake = self.handshake(self.server.host, self.server.port, data) if handshake: self.send(handshake) self.handshaken = True else: msgs = data.split('\xff') data = msgs.pop() for msg in... |
logging.basicConfig(filename='websocket.log', level=logging.DEBUG) | logging.basicConfig(filename='websocket.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') | def handle_accept(self): sock, addr = self.accept() logging.debug('Incoming connection from %s' % repr(addr)) #print 'Incoming connection from %s' % repr(addr) self.connections.append(sock) handler = EchoHandler(sock) handler.set_server(self) handler.set_client(sock) |
print 'handskaka' | def handshake(self, host, port, data): print 'handskaka' data = data.strip() print data headers = string_to_header(data) if ('origin' not in headers): return False key = generate_handshake_key(headers, data.split('\r\n')[-1]) #print "KEY = %s" % (key) # header['host'] instead of HOST? http://code.google.com/p/phpwebso... | |
print data | logging.debug('Handshake - request: %s' % data) | def handshake(self, host, port, data): print 'handskaka' data = data.strip() print data headers = string_to_header(data) if ('origin' not in headers): return False key = generate_handshake_key(headers, data.split('\r\n')[-1]) #print "KEY = %s" % (key) # header['host'] instead of HOST? http://code.google.com/p/phpwebso... |
print handshake | logging.debug('Handshake - response: %s' % handshake) | def handshake(self, host, port, data): print 'handskaka' data = data.strip() print data headers = string_to_header(data) if ('origin' not in headers): return False key = generate_handshake_key(headers, data.split('\r\n')[-1]) #print "KEY = %s" % (key) # header['host'] instead of HOST? http://code.google.com/p/phpwebso... |
print "stang" self.close() self.server.connections.remove(self.client) for i in self.server.connections: if i != self.client: i.send("\x00%s\xff" % 'klient disconnect') | self.handle_close() | def handle_read(self): data = self.recv(1024) if not data: print "stang" self.close() self.server.connections.remove(self.client) for i in self.server.connections: if i != self.client: i.send("\x00%s\xff" % 'klient disconnect') if not self.handshaken: handshake = self.handshake(self.server.host, self.server.port, data... |
print "ta emot" | def handle_read(self): data = self.recv(1024) if not data: print "stang" self.close() self.server.connections.remove(self.client) for i in self.server.connections: if i != self.client: i.send("\x00%s\xff" % 'klient disconnect') if not self.handshaken: handshake = self.handshake(self.server.host, self.server.port, data... | |
print msg[1:] | logging.debug('Recived message:%s' % msg[1:]) | def handle_read(self): data = self.recv(1024) if not data: print "stang" self.close() self.server.connections.remove(self.client) for i in self.server.connections: if i != self.client: i.send("\x00%s\xff" % 'klient disconnect') if not self.handshaken: handshake = self.handshake(self.server.host, self.server.port, data... |
print 'Incoming connection from %s' % repr(addr) | logging.debug('Incoming connection from %s' % repr(addr)) | def handle_accept(self): sock, addr = self.accept() print 'Incoming connection from %s' % repr(addr) self.connections.append(sock) handler = EchoHandler(sock) handler.set_server(self) handler.set_client(sock) |
acl_users = app.unrestrictedTraverse(uf_path, None) if acl_users is None: raise BadRequest( 'Userfolder path %s not found' % '/'.join(uf_path)) user = acl_users.getUserById(user_id) if user is None: raise BadRequest('User %s not found' % user_id) if not hasattr(user, 'aq_base'): user = user.__of__(acl_users) | if uf_path and user_id: acl_users = app.unrestrictedTraverse(uf_path, None) if acl_users is None: raise BadRequest( 'Userfolder path %s not found' % '/'.join(uf_path)) user = acl_users.getUserById(user_id) if user is None: raise BadRequest('User %s not found' % user_id) if not hasattr(user, 'aq_base'): user = user.__of... | def _executeAsUser(portal_path, context_path, user_id, uf_path, func, *args, **kwargs): transaction = Zope2.zpublisher_transactions_manager # Supports isDoomed transaction.begin() app = Zope2.app() result = None try: try: portal = app.unrestrictedTraverse(portal_path, None) if portal is None: raise BadRequest( 'Portal ... |
user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() | if pm.isAnonymousUser(): user = None user_id = '' uf_path = '' else: user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() | def queueJobInQueue(self, queue, quota_names, func, context, *args, **kwargs): portal = getUtility(ISiteRoot) portal_path = portal.getPhysicalPath() pm = getToolByName(portal, 'portal_membership') user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() context_path... |
user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() | if pm.isAnonymousUser(): user = None user_id = '' uf_path = '' else: user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() | def _queueJobsInQueue(self, queue, quota_names, job_infos, serialize=True): portal = getUtility(ISiteRoot) portal_path = portal.getPhysicalPath() pm = getToolByName(portal, 'portal_membership') user = pm.getAuthenticatedMember() user_id = user.getId() uf_path = user.aq_parent.aq_parent.getPhysicalPath() scheduled = [] ... |
env.execute = lambda cmd: env.execute(cmd, user = env.sudouser) | env.execute = lambda cmd: sudo(cmd, user = env.sudouser) | def production(): """ Work on production environment """ env.hosts = ['%s@recensio00.gocept.net' % config.get('production', 'user')] env.webuser = 'admin' env.webpass = config.get('production', 'web_password') env.sudouser = 'recensio' env.execute = lambda cmd: env.execute(cmd, user = env.sudouser) env.path = '/home/re... |
sudo(env.serverurl % \ (env.webuser, env.webpass, ' '.join(env.profiles)), user = env.sudouser) | env.execute(env.serverurl % \ (env.webuser, env.webpass, ' '.join(env.profiles))) | def reloadProfilesAndResetCatalog(): """ Only update profiles """ with cd(env.path): sudo(env.serverurl % \ (env.webuser, env.webpass, ' '.join(env.profiles)), user = env.sudouser) |
sudo(env.create_page_command % \ (env.webuser, env.webpass), user = env.sudouser) | env.execute(env.create_page_command % \ (env.webuser, env.webpass)) | def createSite(): """ Create a new recensio site. Does not delete old one! """ update() _build() with cd(env.path): sudo(env.create_page_command % \ (env.webuser, env.webpass), user = env.sudouser) reloadProfilesAndResetCatalog() |
sudo('./bin/supervisorctl shutdown || echo Ignoring Error', user = env.sudouser) sudo('rm -rf parts var', user = env.sudouser) | env.execute('./bin/supervisorctl shutdown || echo Ignoring Error') env.execute('rm -rf parts var') | def deleteEverythingAndRebuild(): """ Deletes you checkout and rebuilds it. DANGEROUS""" with cd(env.path): sudo('./bin/supervisorctl shutdown || echo Ignoring Error', user = env.sudouser) sudo('rm -rf parts var', user = env.sudouser) createSite() |
sudo('./bin/supervisorctl shutdown || echo Ignoring Error', user = env.sudouser) sudo('./bin/buildout -c ' + env.buildoutcfg, user = env.sudouser) sudo('./bin/supervisord || echo Ignoring Error', user = env.sudouser) sudo('sleep 20', user = env.sudouser) | env.execute('./bin/supervisorctl shutdown || echo Ignoring Error') env.execute('./bin/buildout -c ' + env.buildoutcfg) env.execute('./bin/supervisord || echo Ignoring Error') env.execute('sleep 20') | def _build(): with cd(env.path): sudo('./bin/supervisorctl shutdown || echo Ignoring Error', user = env.sudouser) sudo('./bin/buildout -c ' + env.buildoutcfg, user = env.sudouser) sudo('./bin/supervisord || echo Ignoring Error', user = env.sudouser) sudo('sleep 20', user = env.sudouser) |
sudo('svn up', user = env.sudouser) sudo('./bin/develop update -f', user = env.sudouser) | env.execute('svn up') env.execute('./bin/develop update -f') | def update(): """ Update svn and development eggs """ with cd(env.path): sudo('svn up', user = env.sudouser) sudo('./bin/develop update -f', user = env.sudouser) |
def refresh(): | def reloadProfilesAndResetCatalog(): | def refresh(): """ Only update profiles """ webpass = config.get('instance-settings', 'user').split(':')[1] with cd(env.path): run(env.serverurl % \ (env.webuser, webpass, ' '.join(env.profiles))) |
_refresh() | reloadProfilesAndResetCatalog() | def createSite(): """ Create a new recensio site. Does not delete old one! """ _update() _build() webpass = config.get('instance-settings', 'user').split(':')[1] with cd(env.path): run(env.create_page_command % \ (env.webuser, webpass)) _refresh() |
def _update() | def _update(): | def _update() with cd(env.path): run('./bin/supervisord || echo Ignoring Error') run('svn up') run('./bin/develop update -f') |
env.profiles = ['example-data'] | env.profiles = ['profile-recensio.contenttypes:example_content'] | def withDemoContent(): """ The next steps will also add example data """ env.profiles = ['example-data'] |
reClass = re.compile("class.*[\s]+([^\s]+)[\s]*:[\s]*public[\s]*([^\s]+)|class.*[\s]+([^\s]+)[\s]*(:|{|;|$)") | reClass = re.compile("class.*[\s]+([^\s]+)[\s]*:[\s]*public[\s]*([A-Za-z]+)?|class.*[\s]+([^\s]+)[\s]*(:|{|;|$)") | def parseFile(inputFile): global namespace global className global parentClass global properties global includes namespace = "" className = "" parentClass = "" properties = [] includes = [] reNamespace = re.compile("namespace\s+([^\s]+)") reClass = re.compile("class.*[\s]+([^\s]+)[\s]*:[\s]*public[\s]*([^\s]+)|cl... |
reIncludes = re.compile("L_INCLUDE\s*\(\s*(.+)\s*\)") | reIncludes = re.compile("(\/\/\s*@puck\s*)?L_INCLUDE\s*\(\s*(.+)\s*\)") | def parseFile(inputFile): global namespace global className global parentClass global properties global includes namespace = "" className = "" parentClass = "" properties = [] includes = [] reNamespace = re.compile("namespace\s+([^\s]+)") reClass = re.compile("class.*[\s]+([^\s]+)[\s]*:[\s]*public[\s]*([^\s]+)|cl... |
print "Found includes ", match.group(1) includes = match.group(1) | print "Debug ", match print "Found includes ", match.group(2) includes = match.group(2) | def parseFile(inputFile): global namespace global className global parentClass global properties global includes namespace = "" className = "" parentClass = "" properties = [] includes = [] reNamespace = re.compile("namespace\s+([^\s]+)") reClass = re.compile("class.*[\s]+([^\s]+)[\s]*:[\s]*public[\s]*([^\s]+)|cl... |
s = g.findOne(Series) | s = g.findOne(Series, title = 'The Wire') | def testMediaOntology(self): self.registerMediaOntology() ontology.importClasses([ 'Series', 'Episode', 'Person' ]) |
hiresHtmlURL = 'http://www.imdb.com' + poster.find('.//a').get('href') | hiresLink = poster.find('.//a') if hiresLink.get('title') == 'Poster Not Submitted': raise SmewtException('Poster not available') hiresHtmlURL = 'http://www.imdb.com' + hiresLink.get('href') | def getPoster(self, imdbID): """Return the low- and high-resolution posters (if available) of an imdb object.""" imageDir = smewtUserDirectory('images') noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png') |
os.system('rm -f /tmp/smewt_collection_settings') os.system('rm -f ~/.config/Unknown\\ Organization.conf') os.system('rm -f ~/.config/Smewt.collection') | os.system('rm -fr ~/.config/DigitalGaia_tmp') os.system('rm -fr /tmp/smewt_test_daemon') | def testSmewtDaemon(self): # we need to remove traces of previous test runs os.system('rm -f /tmp/smewt_collection_settings') os.system('rm -f ~/.config/Unknown\\ Organization.conf') os.system('rm -f ~/.config/Smewt.collection') |
import smewt orgname = smewt.ORG_NAME appname = smewt.APP_NAME smewt.ORG_NAME = 'DigitalGaia_tmp' smewt.APP_NAME = 'Smewt_tmp' from PyQt4.QtCore import QCoreApplication app = QCoreApplication([]) app.setOrganizationName(smewt.ORG_NAME) app.setOrganizationDomain('smewt.com') app.setApplicationName(smewt.APP_NAME) | def testSmewtDaemon(self): # we need to remove traces of previous test runs os.system('rm -f /tmp/smewt_collection_settings') os.system('rm -f ~/.config/Unknown\\ Organization.conf') os.system('rm -f ~/.config/Smewt.collection') | |
smewtd.collection.settingsFile = '/tmp/smewt_collection_settings' | def testSmewtDaemon(self): # we need to remove traces of previous test runs os.system('rm -f /tmp/smewt_collection_settings') os.system('rm -f ~/.config/Unknown\\ Organization.conf') os.system('rm -f ~/.config/Smewt.collection') | |
self.collection.findOne(type = Movie, title = unicode(title)).watched = watched | self.smewtd.collection.findOne(Movie, title = unicode(title)).watched = watched | def updateWatched(self, title, watched): self.collection.findOne(type = Movie, title = unicode(title)).watched = watched |
def _adapterishRegistrations(registry): for r in registry.registeredAdapters(): yield r for r in registry.registeredSubscriptionAdapters(): yield r for r in registry.registeredHandlers(): yield r | def _adapterishRegistrations(registry): for r in registry.registeredAdapters(): yield r for r in registry.registeredSubscriptionAdapters(): yield r for r in registry.registeredHandlers(): yield r | |
return '%s/%s/%s/index.html' % (apidoc_url, getName(ns), getName(obj)) | return '%s/ZCML/%s/%s/index.html' % ( apidoc_url, getName(ns), getName(obj)) | def getMenuLink(self, node): """Return the HTML link of the node that is displayed in the menu.""" obj = node.context if isinstance(obj, Directive): ns = getParent(obj) apidoc_url = findAPIDocumentationRootURL(self.context, self.request) return '%s/%s/%s/index.html' % (apidoc_url, getName(ns), getName(obj)) return None |
tests_require = ['zope.testing'], | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() | |
'zope.securitypolicy'], | 'zope.securitypolicy', 'zope.login',], | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
node = make_node(path, relative=False) | node = Path(path).load() | def main(): path = '' if len (sys.argv) > 1: if sys.argv[1] in ['--help','help'] or len(sys.argv) < 2: usage() path = sys.argv[1] if not path: print "No path" exit() node = make_node(path, relative=False) #node.scan_directory() node.scan_filetypes() #print node.images #app.sources = node.images j = moments.journal.Jo... |
e = moments.moment.Moment() e.created = moments.timestamp.Timestamp(i.datetime()) e.tags = [ 'image', 'capture', 'camera' ] e.data = i.path j.update_entry(e) | created = moments.timestamp.Timestamp(i.datetime()) tags = [ 'image', 'capture', 'camera' ] data = str(i.path) j.make_entry(data, tags, created) | def main(): path = '' if len (sys.argv) > 1: if sys.argv[1] in ['--help','help'] or len(sys.argv) < 2: usage() path = sys.argv[1] if not path: print "No path" exit() node = make_node(path, relative=False) #node.scan_directory() node.scan_filetypes() #print node.images #app.sources = node.images j = moments.journal.Jo... |
try: (stdoutdata, stderrdata) = p.communicate() except Kill: logging.debug("sigkill!") | (stdoutdata, stderrdata) = p.communicate() | def setrlimits(): for rsrc, limits in rlimits.items(): resource.setrlimit(rsrc, limits) |
return (stdoutdata, stderrdata, timedelta) | returncode = p.returncode logging.debug("My subprocess returned returncode {0}.".format(returncode)) return (returncode, stdoutdata, stderrdata, timedelta) | def setrlimits(): for rsrc, limits in rlimits.items(): resource.setrlimit(rsrc, limits) |
(stdoutdata, stderrdata, timedelta) = run(args, rlimits) | (returncode, stdoutdata, stderrdata, timedelta) = run(args, rlimits) | def run_cbmc(options, sourcefile, rlimits): assert "--xml-ui" in options args = ["cbmc"] + options + [sourcefile] (stdoutdata, stderrdata, timedelta) = run(args, rlimits) tree = ET.fromstring(stdoutdata) status = tree.findtext('cprover-status') return (status, timedelta) |
(stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | (returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | def run_cpachecker(options, sourcefile, rlimits): args = ["cpachecker"] + options + [sourcefile] (stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) status = None for line in stdoutdata: if (line.find('java.lang.OutOfMemoryError') != -1) or\ line.startswith('out of memory'): status = 'OUT OF MEMORY' eli... |
(stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | (returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | def run_satabs(options, sourcefile, rlimits): args = ["satabs"] + options + [sourcefile] (stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) if "VERIFICATION SUCCESSFUL" in stdoutdata: status = "SUCCESS" else: status = "FAILURE" return (status, timedelta) |
for sourcefiles in test.findall("sourcefiles"): path = os.path.expandvars(os.path.expanduser(sourcefiles.text)) t.sourcefiles += glob.glob(path) | sourcefiles_tags = test.findall("sourcefiles") for sourcefiles_tag in sourcefiles_tags: sourcefiles_path = os.path.expandvars(os.path.expanduser(sourcefiles_tag.text)) if sourcefiles_path != sourcefiles_tag.text: logging.debug("I expanded a tilde and/or shell variables in expression {0} to {1}.".format( repr(sourcefile... | def load_benchmark(path): try: from xml.parsers.xmlproc import xmlval validator = xmlval.XMLValidator() validator.parse_resource(path) except ImportError: logging.debug("I cannot import xmlval so I'm skipping the validation.") logging.debug("If you want xml validation please install pyxml.") tree = ElementTree() root ... |
for i in xrange(1, len(args)): benchmark = load_benchmark(args[i]) | for arg in args[1:]: benchmark = load_benchmark(arg) | def main(argv=None): if argv is None: argv = sys.argv from optparse import OptionParser parser = OptionParser() parser.add_option("-d", "--debug", action="store_true", help="enable debug output") (options, args) = parser.parse_args(argv) if len(args) < 2: parser.error("invalid number of arguments") if (options.debug): ... |
logging.debug("I'm benchmarking '{0}'.".format(args[i])) | if len(benchmark.tests) == 1: logging.debug("I'm benchmarking {0} consisting of 1 test.".format(repr(arg))) else: logging.debug("I'm benchmarking {0} consisting of {1} tests.".format( repr(arg), len(benchmark.tests))) | def main(argv=None): if argv is None: argv = sys.argv from optparse import OptionParser parser = OptionParser() parser.add_option("-d", "--debug", action="store_true", help="enable debug output") (options, args) = parser.parse_args(argv) if len(args) < 2: parser.error("invalid number of arguments") if (options.debug): ... |
logging.debug("I think my job is done. Have a nice day!") | def main(argv=None): if argv is None: argv = sys.argv from optparse import OptionParser parser = OptionParser() parser.add_option("-d", "--debug", action="store_true", help="enable debug output") (options, args) = parser.parse_args(argv) if len(args) < 2: parser.error("invalid number of arguments") if (options.debug): ... | |
'(scripts/cpa.sh -setprop output.disable=true -config $config $benchmark > ' '$benchmark.$cn.log 2>&1)').substitute(locals()) | '(scripts/cpa.sh -setprop output.disable=true -config "$config" "$benchmark" > ' '"$benchmark.$cn.log" 2>&1)').substitute(locals()) sys.stdout.write(cmdline); | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ cn = configname(config) cmdline = Template('ulimit -t $time_limit -v $mem_li... |
logging.critical("I caught an OSError. Assure that the directory containing the tool to be benchmarked is included in the PATH environment variable.") | logging.critical("I caught an OSError. Assure that the directory containing the tool to be benchmarked is included in the PATH environment variable or an alias is set.") | def setrlimits(): for rsrc, limits in rlimits.items(): resource.setrlimit(rsrc, limits) |
(returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | (returncode, stdoutdata, stderrdata, timedelta) = run(args, rlimits) | def run_cpachecker(options, sourcefile, rlimits): args = ["cpachecker"] + options + [sourcefile] (returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) status = None for line in stdoutdata: if (line.find('java.lang.OutOfMemoryError') != -1) or\ line.startswith('out of memory'): status = 'OUT OF... |
(returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) | (returncode, stdoutdata, stderrdata, timedelta) = run(args, rlimits) | def run_satabs(options, sourcefile, rlimits): args = ["satabs"] + options + [sourcefile] (returncode, stdoutdata, stderrdata, timedelta) = run_subprocess(args, rlimits) if "VERIFICATION SUCCESSFUL" in stdoutdata: status = "SUCCESS" else: status = "FAILURE" return (status, timedelta) |
logging.debug("I'm running 'cbmc {0} {1}'.".format( " ".join(test.options), sourcefile)) | logging.debug("I'm running '{0} {1} {2}'.".format( benchmark.tool, " ".join(test.options), sourcefile)) | def main(argv=None): if argv is None: argv = sys.argv from optparse import OptionParser parser = OptionParser() parser.add_option("-d", "--debug", action="store_true", help="enable debug output") (options, args) = parser.parse_args(argv) if len(args) < 2: parser.error("invalid number of arguments") if (options.debug): ... |
sys.stdout.write(cmdline); | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ cn = configname(config) cmdline = Template('ulimit -t $time_limit -v $mem_li... | |
pl = 0 | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ pl = 0 cn = configname(config) if "s3_srvr_10_BUG.cil.c" in benchmark: pl = ... | |
if "s3_srvr_10_BUG.cil.c" in benchmark: pl = 200 elif "s3_srvr_11_BUG.cil.c" in benchmark: pl = 700 elif "s3_srvr_12_BUG.cil.c" in benchmark: pl = 1200 elif "s3_srvr_13_BUG.cil.c" in benchmark: pl = 1500 elif "s3_srvr_14_BUG.cil.c" in benchmark: pl = 300 | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ pl = 0 cn = configname(config) if "s3_srvr_10_BUG.cil.c" in benchmark: pl = ... | |
'(scripts/cpa.sh -setprop trackabstractioncomputation.pathlengthlimit=$pl -setprop output.disable=true -config $config $benchmark > ' | '(scripts/cpa.sh -setprop output.disable=true -config $config $benchmark > ' | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ pl = 0 cn = configname(config) if "s3_srvr_10_BUG.cil.c" in benchmark: pl = ... |
return tot_time, outcome, reached, pl | return tot_time, outcome, reached | def run_single(benchmark, config, time_limit, mem_limit): """\ Runs a single benchmark instance with the given configuration, time limit and memory limit. The output is saved in a file $benchmark.$config.log. Returns a pair (time, outcome) """ pl = 0 cn = configname(config) if "s3_srvr_10_BUG.cil.c" in benchmark: pl = ... |
out.write(Template('$i\t$t\t$o\tReached\tPL\n').substitute(i='INSTANCE'.ljust(maxlen), t='TIME'.rjust(maxlentime), o='OUTCOME')) | out.write(Template('$i\t$t\t$o\tReached\n').substitute(i='INSTANCE'.ljust(maxlen), t='TIME'.rjust(maxlentime), o='OUTCOME')) | def go(b, c, t, m): if verbose: sys.stdout.write('Running: %s with config: %s... ' % (b, configname(c))) sys.stdout.flush() |
line = Template('$fname\t$ftime\t$foutcome\t$freached\t$fpl') | line = Template('$fname\t$ftime\t$foutcome\t$freached') | def go(b, c, t, m): if verbose: sys.stdout.write('Running: %s with config: %s... ' % (b, configname(c))) sys.stdout.flush() |
fpl = d[name][3] | def go(b, c, t, m): if verbose: sys.stdout.write('Running: %s with config: %s... ' % (b, configname(c))) sys.stdout.flush() | |
out.write(Template('$i\t$t\t$o\t\tReached\tPL\n').substitute( | out.write(Template('$i\t$t\t$o\t\tReached\n').substitute( | def go(b, c, t, m): if verbose: sys.stdout.write('Running: %s with config: %s... ' % (b, configname(c))) sys.stdout.flush() |
if a.user == usuario: | if a and a.user == usuario: | def borrar(slug): """Elimina un slug""" if not 'REMOTE_USER' in bottle.request.environ: bottle.abort(401, "Sorry, access denied.") usuario = bottle.request.environ['REMOTE_USER'].decode('utf8') # Solo el dueño de un atajo puede borrarlo a = Atajo.get(slug) if a.user == usuario: a.delete() # FIXME: pasar un mensaje en ... |
v0vect[1] = -v0 * sin( theta0 - thetaimp - beta0 ) | v0vect[1] = v0 * sin( theta0 - thetaimp - beta0 ) | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
if return (r0tar, r0imp, v0tar, v0imp, timp - t0, logstr) | if impa > 0.: rperih = rimp *( 1. + e*cos(thetaimp) ) / ( 1. + e ) vperih = sqrt( vinf*vinf + ( 2.*mu / rperih ) ) | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
rperih = rimp *( 1. + e*cos(thetaimp) ) / ( 1. + e ) vperih = sqrt( vinf*vinf + ( 2.*mu / rperih ) ) | theta0 = arccos( ( rperih*(1. + e ) - r0 ) / ( e * r0 ) ) beta0 = arccos( L0 / ( r0*v0*mimp ) ) if e > 1.001: a = rperih / ( e - 1. ) k2 = sqrt( mu / (a*a*a) ) timp = ( (e*sqrt(e*e-1.)*sin(thetaimp))/(1. + e*cos(thetaimp) ) \ - log( (sqrt(e*e-1.) + (e - 1.)*tan( thetaimp / 2. ))/ \ (sqrt(e*e-1.) - (e - 1.)*tan( ... | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
r0 = relsep*rimp v0 = sqrt( vinf*vinf + ( 2.*mu / r0 ) ) theta0 = arccos( ( rperih*(1. + e ) - r0 ) / ( e * r0 ) ) beta0 = arccos( L0 / ( r0*v0*mimp ) ) | r0vect[0] = -r0 * cos( pi/2. - thetaimp + theta0 ) r0vect[1] = r0 * sin( pi/2. - thetaimp + theta0 ) v0vect[0] = -v0 * cos( theta0 - thetaimp - beta0 ) v0vect[1] = -v0 * sin( theta0 - thetaimp - beta0 ) tinit = timp - t0 logstr += \ " " " " " " " " " " " " " " " " " " " " " else: r0vect[1] = r0 v0vect[1] = v0 | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
if e > 1.001: a = rperih / ( e - 1. ) k2 = sqrt( mu / (a*a*a) ) timp = ( (e*sqrt(e*e-1.)*sin(thetaimp))/(1. + e*cos(thetaimp) ) \ - log( (sqrt(e*e-1.) + (e - 1.)*tan( thetaimp / 2. ))/ \ (sqrt(e*e-1.) - (e - 1.)*tan( thetaimp / 2. )) ) ) / k2 t0 = ( (e*sqrt(e*e-1.)*sin(theta0))/(1. + e*cos(theta0) ) \ - log( (sqr... | rscal = rimp / r0 mu = self.mu tinit = -sqrt(r0*r0*r0/(2.*mu))*(sqrt(rscal*(1.-rscal)) + arccos(rscal)) logstr += \ " " " " " " | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
return (r0tar, r0imp, v0tar, v0imp, timp - t0, logstr) | return (r0tar, r0imp, v0tar, v0imp, tinit, logstr) | def getInitVimpAlpha(self, vimp, impa, relsep): rimp = self.rimp mimp = self.mimp mtar = self.mtar vesc = self.vesc mu = self.mu mtot = self.mtot |
nopc = min( cfg.noplotclumps, self.noc ) | nopc = min( cfg.noplotclumps, self.maxnoc ) | def plot(self,pname,cfg,tit): fig = plt.figure() fig.clear() ax = plt.axes() nopc = min( cfg.noplotclumps, self.noc ) ME = cfg.ME (mmean, mvar) = self._getMeanMasses(cfg.avgpts) |
num2 = sys2; den2 = 2; | num2 = sys2; den2 = 1; | def feedback(sys1, sys2, sign=-1): # Get the numerator and denominator of the first system if (isinstance(sys1, (int, long, float, complex))): num1 = sys1; den1 = 1; elif (isinstance(sys1, TransferFunction)): num1 = sys1.num; den1 = sys1.den; else: raise TypeError |
child = pexpect.spawn('cpan') i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect_exact(['[yes]', PROMPT]) if i == 0: child.sendline('') else: break child.expect(PROMPT) child.sendline('quit') child.expect(pexp... | child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect_exact(['[yes]', PROMPT]) if i == 0: child.sendline('') else: break child.sendline('quit') ... | def main(argv): child = pexpect.spawn('cpan') i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect_exact(['[yes]', PROMPT]) if i == 0: child.sendline('') else: break child.expect(PROMPT) child.sendline('quit') c... |
i = child.expect([r'\[yes\]', PROMPT]) | i = child.expect([DEFAULT, PROMPT]) | def main(argv): child = cpan() try: while True: i = child.expect([CONFLICT_ERROR, UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: os.system('kill %s' % child.match.group(1)) child.close() child = cpan() elif i == 1: child.sendline('Y') elif i == 2: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) whil... |
i = child.expect(['Are you ready for manual configuration? [yes] ', PROMPT]) | i = child.expect_exact([CONF, PROMPT]) | def main(argv): child = pexpect.spawn('cpan') i = child.expect(['Are you ready for manual configuration? [yes] ', PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) else: for cmd in argv[1:]: child.sendline(cmd) child.expect(PROMPT) child.sendline('quit') |
else: for cmd in argv[1:]: child.sendline(cmd) child.expect(PROMPT) child.sendline('quit') | for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect_exact(['[yes]', PROMPT]) if i == 0: child.sendline('') else: break child.expect(PROMPT) child.sendline('quit') child.expect(pexpect.EOF) child.close() | def main(argv): child = pexpect.spawn('cpan') i = child.expect(['Are you ready for manual configuration? [yes] ', PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) else: for cmd in argv[1:]: child.sendline(cmd) child.expect(PROMPT) child.sendline('quit') |
i = child.expect([MAKE_ERROR, r'\[yes\]', PROMPT]) | i = child.expect([r'\[yes\]', PROMPT]) m = re.search(MAKE_ERROR, child.before) if m: raise RuntimeError(m.group(0)) | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expe... |
raise RuntimeError() elif i == 1: | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expe... | |
i = child.expect_exact(['[yes]', PROMPT]) | i = child.expect([MAKE_ERROR, r'\[yes\]', PROMPT]) | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect_exact(['[yes]', PROMPT]) if i == 0: child... |
elif i == 2: | elif i == 1: | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect([MAKE_ERROR, r'\[yes\]', PROMPT]) if i ==... |
child.sendline('') | child.sendline('Y') | def main(argv): child = cpan() try: while True: i = child.expect([CONFLICT_ERROR, UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: pid = re.search(KILL_MATCH, child.after).group(1) os.system('kill %s' % pid) child.close() child = cpan() elif i == 1: child.sendline('') elif i == 2: child.sendline('no') else: break for cmd in ar... |
i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) | while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect([MAKE_ERROR, r'\[yes\]', PROMPT]) if i ==... |
finally: | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: i = child.expect_exact([CONF, PROMPT]) if i == 0: child.sendline('no') child.expect(PROMPT) for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expect([MAKE_ERROR, r'\[yes\]', PROMPT]) if i ==... | |
pid = re.search(KILL_MATCH, child.after).group(1) os.system('kill %s' % pid) | os.system('kill %s' % child.match.group(1)) | def main(argv): child = cpan() try: while True: i = child.expect([CONFLICT_ERROR, UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: pid = re.search(KILL_MATCH, child.after).group(1) os.system('kill %s' % pid) child.close() child = cpan() elif i == 1: child.sendline('Y') elif i == 2: child.sendline('no') else: break for cmd in a... |
child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) | child = cpan() | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expe... |
i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) | i = child.expect([CONFLICT_ERROR, UNCLEAN_ERROR, CONF, PROMPT]) | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expe... |
elif i == 1: | elif i == 2: | def main(argv): # need a longer timeout for cpan child = pexpect.spawn('cpan', timeout=300, logfile=sys.stdout) try: while True: i = child.expect([UNCLEAN_ERROR, CONF, PROMPT]) if i == 0: child.sendline('') elif i == 1: child.sendline('no') else: break for cmd in argv[1:]: child.sendline(cmd) while True: i = child.expe... |
atexit.register(self.sendCommand("exit")) | def opts(): try: opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) except getopt.GetoptError, err: print str(err) sys.exit() global host global port host = "localhost" port = 1984 for o, a in opts: if o == "-p": port = int(a) if o == "-h": host = a | |
return self.com | return self.com.strip() | def readCommand(self): self.com = raw_input('> ') if self.com == "": self.readCommand() return self.com |
print 'BaseX 6.01 [Client]' print 'Try "help" to get some information.' | print 'BaseX Client' | def __init__(self,host,port): self.host = host self.port = port print 'BaseX 6.01 [Client]' print 'Try "help" to get some information.' |
raise IOError("Access Denied.") | raise IOError('Access Denied.') | def __init__(self, host, port, user, pw): # allocate 4kb buffer self.__buf = array.array('B', '\0' * 0x1000) self.__init() |
s.send('exit') | s.send('exit \0') | def close(self): s.send('exit') s.close() |
print "See you." | print 'See you.' | def session(self): user = raw_input('Username: '); pw = getpass.getpass('Password: '); try: global session session = Session(self.__host, self.__port, user, pw) self.__console() session.close() print "See you." except IOError as e: print e |
session.execute("SET INFO ON") | session.execute('SET INFO ON') | def __console(self): session.execute("SET INFO ON") while True: com = str(raw_input('> ')).strip() if com == 'exit': break if com: session.execute(com) print session.info() |
opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) | opts, args = getopt.getopt(sys.argv[1:], '-p:-h', ['port', 'host']) | def opts(): try: opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) except getopt.GetoptError, err: print str(err) sys.exit() global host global port host = "localhost" port = 1984 for o, a in opts: if o == "-p": port = int(a) if o == "-h": host = a |
host = "localhost" | host = 'localhost' | def opts(): try: opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) except getopt.GetoptError, err: print str(err) sys.exit() global host global port host = "localhost" port = 1984 for o, a in opts: if o == "-p": port = int(a) if o == "-h": host = a |
if o == "-p": | if o == '-p': | def opts(): try: opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) except getopt.GetoptError, err: print str(err) sys.exit() global host global port host = "localhost" port = 1984 for o, a in opts: if o == "-p": port = int(a) if o == "-h": host = a |
if o == "-h": | if o == '-h': | def opts(): try: opts, args = getopt.getopt(sys.argv[1:], "-p:-h", ["port", "host"]) except getopt.GetoptError, err: print str(err) sys.exit() global host global port host = "localhost" port = 1984 for o, a in opts: if o == "-p": port = int(a) if o == "-h": host = a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.