rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
nextUrl = CHANNELS[c]['base'] + next[0].get('href') dir.Append(Function(DirectoryItem(Episodes, title='Meer ...', thumb=R(ICON_MORE)), title=title, url=nextUrl, c=c)) | next_url = CHANNELS[c]['base'] + next[0].get('href') dir.Append(Function(DirectoryItem(Episodes, title='Meer...', thumb=R(ICON_MORE)), title=title, url=next_url, c=c)) | def Episodes(sender, title, url, c): dir = MediaContainer(viewGroup='Details', title2=title, art=R(CHANNELS[c]['art'])) eps = HTTP.Request(url, errors='ignore').content episodes = HTML.ElementFromString(eps).xpath(XPATH_EPISODES) for episode in episodes: epTitle = episode.xpath('./div[@class="title"]/a/span')[0].text ... |
save = skipAsk and raw_input('Save to File?(y/n):') if save=='y': | save = not skipAsk and raw_input('Save to File?(y/n):') if save=='y' or skipAsk: | def saveTextToFile(txt, skipAsk=False, skipOverwrite=False): save = skipAsk and raw_input('Save to File?(y/n):') if save=='y': filePath = raw_input('Enter the Path>') if os.path.exists(filePath): again = True while again: again = False p = skipOverwrite and raw_input('File already Exists, (o)verwrite, (a)ppend, (p)repe... |
p = skipOverwrite and raw_input('File already Exists, (o)verwrite, (a)ppend, (p)repend or (c)ancel?>') if p=='o' or p==False: | p = not skipOverwrite and raw_input('File already Exists, (o)verwrite, (a)ppend, (p)repend or (c)ancel?>') if p=='o' or skipOverwrite: | def saveTextToFile(txt, skipAsk=False, skipOverwrite=False): save = skipAsk and raw_input('Save to File?(y/n):') if save=='y': filePath = raw_input('Enter the Path>') if os.path.exists(filePath): again = True while again: again = False p = skipOverwrite and raw_input('File already Exists, (o)verwrite, (a)ppend, (p)repe... |
if args[0]=='new' and len(args)>2: if args[1]=='template': templ = getTextFromPath(args[2]) input=len(args)>3 and extractAgrs(args[3:]) or {} txt = convertToTemplate(templ, input) print txt; print saveTextToFile(txt) elif args[1] =='real': templ = getTextFromPath(args[2]) input=len(args)>3 and extractAgrs(args[3:]) or ... | def main(args): isInInstall = os.path.exists(pjoin(installPath, '.InRoot')) | |
value = [str(item) for item in data[key]] | value = [unicode(item) for item in data[key]] | def save(self,*args,**kwargs): data = None if kwargs.get('data',None): data = kwargs['data'] del kwargs['data'] super(FormInstance,self).save(*args,**kwargs) if data: for key in data.keys(): if data[key] is not None: if type(data[key]) in(list,QuerySet,tuple): value = [str(item) for item in data[key]] value = simplejso... |
value = str(data[key]) | value = unicode(data[key]) | def save(self,*args,**kwargs): data = None if kwargs.get('data',None): data = kwargs['data'] del kwargs['data'] super(FormInstance,self).save(*args,**kwargs) if data: for key in data.keys(): if data[key] is not None: if type(data[key]) in(list,QuerySet,tuple): value = [str(item) for item in data[key]] value = simplejso... |
class FormInstance(models.Model): form = models.ForeignKey(Form,verbose_name=u'表单') name = models.CharField(u'表单名称',max_length=100) create_at = models.DatetimeField(u'创建时间') class Meta: verbose_name = u'表单实例' verbose_name_plural = u'表单实例' def __unicode__(self): return self.name | def __unicode__(self): return self._name | |
return render_to_response('autoforms/index.html',context_instance=RequestContext(request)) | return render_to_response('autoforms/index.html') | def index(request): return render_to_response('autoforms/index.html',context_instance=RequestContext(request)) |
return render_to_response(template,{'forms':forms},context_instance=RequestContext(request)) | return render_to_response(template,{'forms':forms}) | def preview(request,id=None,template='autoforms/preview.html'): if request.method == 'GET': pk = id or request.GET.get('id',None) if not pk: forms = Form.objects.all() return render_to_response(template,{'forms':forms},context_instance=RequestContext(request)) else: dform = get_object_or_404(Form,pk=pk) form = dform.as... |
return render_to_response(template,{'form':form,'dform':dform,'edit':True,'id':pk},context_instance=RequestContext(request)) | return render_to_response(template,{'form':form,'dform':dform,'edit':True,'id':pk}) | def preview(request,id=None,template='autoforms/preview.html'): if request.method == 'GET': pk = id or request.GET.get('id',None) if not pk: forms = Form.objects.all() return render_to_response(template,{'forms':forms},context_instance=RequestContext(request)) else: dform = get_object_or_404(Form,pk=pk) form = dform.as... |
return render_to_response(template,{'form':form,'dform':dform},context_instance=RequestContext(request)) | return render_to_response(template,{'form':form,'dform':dform}) | def preview(request,id=None,template='autoforms/preview.html'): if request.method == 'GET': pk = id or request.GET.get('id',None) if not pk: forms = Form.objects.all() return render_to_response(template,{'forms':forms},context_instance=RequestContext(request)) else: dform = get_object_or_404(Form,pk=pk) form = dform.as... |
return render_to_response(template,{'form':form,'dform':dform,'edit':True},context_instance=RequestContext(request)) | return render_to_response(template,{'form':form,'dform':dform,'edit':True}) | def preview(request,id=None,template='autoforms/preview.html'): if request.method == 'GET': pk = id or request.GET.get('id',None) if not pk: forms = Form.objects.all() return render_to_response(template,{'forms':forms},context_instance=RequestContext(request)) else: dform = get_object_or_404(Form,pk=pk) form = dform.as... |
return render_to_response(template,{'form':form,'dform':dform},context_instance=RequestContext(request)) | return render_to_response(template,{'form':form,'dform':dform}) | def fill(request,id,template='autoforms/fill.html',success_template='autoforms/fill_done.html'): dform = get_object_or_404(Form,pk=id) if request.method == 'GET': form = dform.as_form() return render_to_response(template,{'form':form,'dform':dform},context_instance=RequestContext(request)) else: form = AutoForm(fields=... |
return render_to_response(success_template,{'form':form,'dform':dform},context_instance=RequestContext(request)) | return render_to_response(success_template,{'form':form,'dform':dform}) | def fill(request,id,template='autoforms/fill.html',success_template='autoforms/fill_done.html'): dform = get_object_or_404(Form,pk=id) if request.method == 'GET': form = dform.as_form() return render_to_response(template,{'form':form,'dform':dform},context_instance=RequestContext(request)) else: form = AutoForm(fields=... |
subprocess.Popen(_cmd, stdin=subprocess.PIPE).communicate(str(unicode(string))) | subprocess.Popen(_cmd, stdin=subprocess.PIPE).communicate(unicode(string)) | def copy(string): """Copy given string into system clipboard.""" try: _cmd = ["xclip", "-selection", "clipboard"] subprocess.Popen(_cmd, stdin=subprocess.PIPE).communicate(str(unicode(string))) return except Exception, why: raise XclipNotFound |
print "Verified message: %s" % reply.data.is_verified | print "Verified message: %s" % reply.data.is_message_verified() | def SignedMessageDownload(): for envelope in ds_client.GetListOfReceivedMessages().data: print "ID:", envelope.dmID reply = ds_client.SignedMessageDownload(envelope.dmID) print reply.status print "ID matches:", reply.data.dmID, reply.data.dmID == envelope.dmID print "Verified message: %s" % reply.data.is_verified print... |
print "Verified message: %s" % reply.data.is_verified | print "Verified message: %s" % reply.data.is_message_verified() | def SignedSentMessageDownload(): for envelope in ds_client.GetListOfSentMessages().data: print "ID:", envelope.dmID reply = ds_client.SignedSentMessageDownload(envelope.dmID) print reply.status print "ID matches:", reply.data.dmID, reply.data.dmID == envelope.dmID print "Verified message: %s" % reply.data.is_verified p... |
print "Verified certificate: %s" % reply.data.pkcs7_data.certificates[0].is_verified | print "Verified certificate: %s" % reply.data.pkcs7_data.certificates[0].is_verified() | def GetSignedDeliveryInfo(): for envelope in ds_client.GetListOfSentMessages().data: print "ID:", envelope.dmID reply = ds_client.GetSignedDeliveryInfo(envelope.dmID) print reply.status print reply.data print "ID matches:", reply.data.dmID, reply.data.dmID == envelope.dmID print "Verified message: %s" % reply.data.is_v... |
if wsdl_path.startswith("/"): WSDL_URL_BASE = 'file://%s/' % wsdl_path else: WSDL_URL_BASE = 'file:///%s/' % wsdl_path | wsdl_path = os.path.abspath(wsdl_path) WSDL_URL_BASE = 'file://%s/' % wsdl_path | def ChangeISDSPassword(self, old_pass, new_pass): reply = self.soap_client.service.ChangeISDSPassword(old_pass, new_pass) status = models.dbStatus(reply) return Reply(status, None) |
f = open("err", "w") f.write(self.value) f.close() | def __init__(self, extension): self.id = tuple_to_OID(extension.getComponentByName("extnID")) critical = extension.getComponentByName("critical") if critical == 0: self.is_critical = False else: self.is_critical = True # set the bytes as the extension value self.value = extension.getComponentByName("extnValue")._value ... | |
soap_envelope = self.soap_client.factory.create("dmEnvelope") | soap_envelope = self.soap_client.factory.create("tMessageEnvelopeSub") | def CreateMessage(self, envelope, files): """returns message id as reply.data""" soap_envelope = self.soap_client.factory.create("dmEnvelope") envelope.copy_to_soap_object(soap_envelope) soap_files = self.soap_client.factory.create("dmFiles") for f in files: soap_file = self.soap_client.factory.create("dmFile") f.copy_... |
local = time.daylight and (0-time.altzone/60/60) or (0-time.timezone/60/60) | local = 0-time.timezone/60/60 | def __unicode__(self): s = [] s.append(Date.__unicode__(self)) s.append(Time.__unicode__(self)) return 'T'.join(s) |
log.warning("Out of boundaries of validity: %s - %s." %\ | logger.warning("Out of boundaries of validity: %s - %s." %\ | def _verify_date(certificate): ''' Checks date boundaries in the certificate (actual time must be inside). ''' tbs = certificate.getComponentByName("tbsCertificate") validity = tbs.getComponentByName("validity") start = validity.getComponentByName("notBefore").getComponentByPosition(0)._value start_time = timeutil.to_... |
cert_reqs=ssl.CERT_REQUIRED, | def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if hasattr(self, '_tunel_host') and self._tunnel_host: self.sock = sock self._tunnel() if self.FORCE_SSL_VERSION: add = {'ssl_version': self.FORCE_SSL_VERSION} else: add = {} self.sock = ssl.wrap_socket(sock, self.key_file, self.ce... | |
if self.cert_verifier: | if self.cert_verifier and self.SERVER_CERT_CHECK: | def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if hasattr(self, '_tunel_host') and self._tunnel_host: self.sock = sock self._tunnel() if self.FORCE_SSL_VERSION: add = {'ssl_version': self.FORCE_SSL_VERSION} else: add = {} self.sock = ssl.wrap_socket(sock, self.key_file, self.ce... |
try: return do() except u2.URLError, e: if "SSL23_GET_SERVER_HELLO" in str(e): log.info("Activating SSL workaround") CheckingHTTPSConnection.FORCE_SSL_VERSION = ssl.PROTOCOL_SSLv3 | for i in range(3): try: | def do(): if self.urlopener is None: return u2.urlopen(u2request) else: return self.urlopener.open(u2request) |
else: raise e | except u2.URLError, e: if "SSL23_GET_SERVER_HELLO" in str(e): log.warning("Activating SSL workaround") CheckingHTTPSConnection.FORCE_SSL_VERSION = ssl.PROTOCOL_SSLv3 elif "ASN1_item_verify:unknown message digest algorithm" in str(e): log.warning("Turning off server certificate check to work \ around a bug in Pyt... | def do(): if self.urlopener is None: return u2.urlopen(u2request) else: return self.urlopener.open(u2request) |
if reply.dbResults: | if hasattr(reply, 'dbResults') and reply.dbResults: | def FindDataBox(self, info): """info = dbOwnerInfo instance""" soap_info = self.soap_client.factory.create("dbOwnerInfo") info.copy_to_soap_object(soap_info) reply = self.soap_client.service.FindDataBox(soap_info) if reply.dbResults: ret_infos = reply.dbResults.dbOwnerInfo if type(ret_infos) != list: ret_infos = [ret_i... |
if hasattr(self, '_tunel_host') and self._tunnel_host: | if hasattr(self, '_tunnel_host') and self._tunnel_host: | def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if hasattr(self, '_tunel_host') and self._tunnel_host: self.sock = sock self._tunnel() if self.FORCE_SSL_VERSION: add = {'ssl_version': self.FORCE_SSL_VERSION} else: add = {} if self.SERVER_CERT_CHECK: add['cert_reqs'] = ssl.CERT_R... |
print dir(e) | def _verify_certificate(self, certificate): import certs.cert_verifier try: res = certs.cert_verifier.verify_certificate(certificate, self.trusted_certs) except Exception, e: print dir(e) if e.message == "No trusted certificate found": res = False else: raise e return res | |
if len(cq)==1: clearquery = "%s?%s" % (self.request['ACTUAL_URL'], cq[0]['clearquery']) voc = cq[0]['voc'] else: clearquery = '' voc = '' submenu['clearquery'] = clearquery submenu['voc'] = voc | for item in menu[mid]: cq = cq + [subitem for subitem in item['submenu'] if subitem.has_key('clearquery')] submenu['selected'] = cq | def getSubmenus(self): menu = self.getMenu() submenus = [dict(title='Region',id='ddcPlace'), dict(title='Epoch',id='ddcTime'), dict(title='Topic', id='ddcSubject') ] for submenu in submenus: mid = submenu['id'] cq = [item for item in menu[mid] if item.has_key('clearquery')] if len(cq)==1: clearquery = "%s?%s" % (self.... |
'facet.field': ['ddcPlace', 'ddcTime', 'ddcSubject']} | 'facet.field': facet_fields } | def __init__(self, context, request): self.default_query = {'facet': 'true', 'facet.field': ['ddcPlace', 'ddcTime', 'ddcSubject']} BrowserView.__init__(self, context, request) |
self.default_query = {'facet': 'true', | catalog = getToolByName(context, 'portal_catalog') types = [x for x in catalog.uniqueValuesFor('portal_type') if x not in ('Topic', 'Folder', 'Document')] self.default_query = {'portal_type': types, 'facet': 'true', | def __init__(self, context, request): self.default_query = {'facet': 'true', 'facet.field': facet_fields } BrowserView.__init__(self, context, request) |
filter = None | filt = None | def facets(self): """ prepare and return facetting info for the given SolrResponse """ results = self.kw.get('results', None) fcs = getattr(results, 'facet_counts', None) if results is not None and fcs is not None: filter = None # lambda name, count: name and count > 0 return convertFacets(fcs.get('facet_fields', {}), ... |
self.context, self.request.form, filter) | self.context, self.request.form, filt) | def facets(self): """ prepare and return facetting info for the given SolrResponse """ results = self.kw.get('results', None) fcs = getattr(results, 'facet_counts', None) if results is not None and fcs is not None: filter = None # lambda name, count: name and count > 0 return convertFacets(fcs.get('facet_fields', {}), ... |
pdf = self.context.get_review_pdf() original = pdf.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system('ulimit -t 5;pdftk %s %s cat output %s' % (cover, original, new)) if error_code: IStatusMessage(self.request).add('Creating the pdf has failed! Please try again or ask for s... | pdf = self.context.get_review_pdf()["blob"] error_code = None new = None if pdf: pdf_blob = pdf["blob"] original = pdf_blob.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system( 'ulimit -t 5;pdftk %s %s cat output %s' % ( cover, original, new ) ) if error_code or not pdf: ISta... | def __call__(self): try: cover = self.genPdfRecension() pdf = self.context.get_review_pdf() original = pdf.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system('ulimit -t 5;pdftk %s %s cat output %s' % (cover, original, new)) if error_code: IStatusMessage(self.request).add('Cr... |
pdfdata = file(new).read() | else: pdfdata = file(new).read() | def __call__(self): try: cover = self.genPdfRecension() pdf = self.context.get_review_pdf() original = pdf.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system('ulimit -t 5;pdftk %s %s cat output %s' % (cover, original, new)) if error_code: IStatusMessage(self.request).add('Cr... |
os.remove(cover) os.remove(new) | if cover: os.remove(cover) if new: os.remove(new) | def __call__(self): try: cover = self.genPdfRecension() pdf = self.context.get_review_pdf() original = pdf.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system('ulimit -t 5;pdftk %s %s cat output %s' % (cover, original, new)) if error_code: IStatusMessage(self.request).add('Cr... |
url = "http://lists.recensio.net/mailman/options/newsletter/%s?unsubconfirm=1&unsub=Unsubscribe" % emailaddress req = urllib2.Request(url=url) | url = "http://lists.recensio.net/mailman/options/newsletter" req = urllib2.Request(url=url, data="email=%s&unsubconfirm=1&login-unsub=Unsubscribe"%emailaddress) | def subscribe(self, emailaddress, name=''): """ helper method to enable mail subscription to anonymous user """ ptool = getToolByName(self.context, 'portal_url') portal = ptool.getPortalObject() pp = getToolByName(portal, 'portal_properties') sp = getattr(pp, 'site_properties', None) siteadmin = getattr(portal, 'email_... |
original = pdf.blob.open().name | original = pdf.open().name | def __call__(self): try: cover = self.genPdfRecension() pdf = self.context.get_review_pdf() original = pdf.blob.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system('ulimit -t 5;pdftk %s %s cat output %s' % (cover, original, new)) if error_code: IStatusMessage(self.request).ad... |
pdf = self.context.get_review_pdf()["blob"] | pdf = self.context.get_review_pdf() | def __call__(self): try: cover = self.genPdfRecension() pdf = self.context.get_review_pdf()["blob"] error_code = None new = None if pdf: pdf_blob = pdf["blob"] original = pdf_blob.open().name new = tempfile.mkstemp(prefix = 'final', suffix = '.pdf')[1] error_code = os.system( 'ulimit -t 5;pdftk %s %s cat output %s' % (... |
P = Paragraph(_(self.context.get_citation_string()), style) | P = Paragraph(escape(_(self.context.get_citation_string())), style) | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
P = Paragraph(self.context.get_citation_string(), style) | P = Paragraph(escape(self.context.get_citation_string()), style) | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
msgs = ['First published: ' + x for x in self.context.getFirstPublicationData()] | msgs = ['First published: ' + escape(x) for x in self.context.getFirstPublicationData()] | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
P = Paragraph(getCitationString(self.context), style) | P = Paragraph(self.context.get_citation_string(), style) | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
cover.setFont('Helvetica', 10) | cover.setFont('Arial', 10) | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
style = ParagraphStyle('citation style', fontName = 'Helvetica', \ | style = ParagraphStyle('citation style', fontName = 'Arial', \ | def _genCoverSheet(self): file_handle, tmpfile = tempfile.mkstemp(prefix='cover', suffix='.pdf') self.canvas = cover = canvas.Canvas(tmpfile, pagesize=A4) pwidth,pheight = A4 |
mesg = "UNSUBSCRIBE newsletter\n" mssg = "Your unsubscription request has been sent." | try: url = "http://lists.recensio.net/mailman/options/newsletter/%s?unsubconfirm=1&unsub=Unsubscribe" % emailaddress req = urllib2.Request(url=url) f = urllib2.urlopen(req) retval = f.read() mssg = _(u"Your unsubscription request has been sent.") except Exception, e: mssg = _(u"Your subscription could not be sent. Plea... | def subscribe(self, emailaddress, name=''): """ helper method to enable mail subscription to anonymous user """ ptool = getToolByName(self.context, 'portal_url') portal = ptool.getPortalObject() pp = getToolByName(portal, 'portal_properties') sp = getattr(pp, 'site_properties', None) siteadmin = getattr(portal, 'email_... |
mesg = "SUBSCRIBE newsletter anonymous\n" mssg = "Your subscription request has been sent." | try: req = urllib2.Request(url='http://lists.recensio.net/mailman/subscribe/newsletter', data='email=%s&fullname=%s&email-button=Subscribe' % (emailaddress, fullname)) f = urllib2.urlopen(req) retval = f.read() mssg = _(u"Your subscription request has been sent. Please check your e-mail.") except Exception, e: mssg = _... | def subscribe(self, emailaddress, name=''): """ helper method to enable mail subscription to anonymous user """ ptool = getToolByName(self.context, 'portal_url') portal = ptool.getPortalObject() pp = getToolByName(portal, 'portal_properties') sp = getattr(pp, 'site_properties', None) siteadmin = getattr(portal, 'email_... |
recipient = sp.getProperty('listserv_email', siteadmin) sender = emailaddress if name: sender = "%s <%s>" % (name, sender) subject = '' try: self.context.MailHost.secureSend(message=mesg , mto=recipient, mfrom=sender, subject=subject) except Exception, e: mssg = "Your subscription could not be sent. Please try again.... | def subscribe(self, emailaddress, name=''): """ helper method to enable mail subscription to anonymous user """ ptool = getToolByName(self.context, 'portal_url') portal = ptool.getPortalObject() pp = getToolByName(portal, 'portal_properties') sp = getattr(pp, 'site_properties', None) siteadmin = getattr(portal, 'email_... | |
"ReviewMonograph": u"%(reviewAuthor)s, review of: %(authors)s, %(title)s%(titel_divider)s%(subtitle)s, \n%(yearOfPublication)s: %(publisher)s %(yearOfPublication)s, in: %(series)s \nBand %(seriesVol)s, p. %(pages)s, %(absolute_url)s", | "ReviewMonograph": u"%(reviewAuthor)s, review of: %(authors)s, %(title)s%(titel_divider)s%(subtitle)s, \n%(placeOfPublication)s: %(publisher)s %(yearOfPublication)s, in: %(series)s \nBand %(seriesVol)s, p. %(pages)s, %(absolute_url)s", | def __init__(self, context, request): BrowserView.__init__(self, context, request) self.copyright = u"This article may be downloaded and/or used within the private copying\nexemption. Any further use without permission of the rights shall be subject to\nlegal licences (§§ 44a-63a UrhG / German Copyright Act).\n\nDieser... |
query=make_query(params, doseq=True))) | query=make_query(params), doseq=True)) | def selected(self): """ determine selected facets and prepare links to clear them; this assumes that facets are selected using filter queries """ info = [] facets = param(self, 'facet.field') fq = param(self, 'fq') fq = [x for x in fq] fq = filter(lambda x: x.split(':')[0].strip('+') in facet_fields, fq) form = self.fo... |
('link/manual', 'http://hgroups.google.com/group/wave-helpdesk')), | ('link/manual', 'http://groups.google.com/group/wave-helpdesk')), | def create_question_wave(q_wave): '''Appends the required elements & text to make the question wave.''' # Sets the title q_wave.title = 'New Helpdesk Question' # Adds a "Heading 3" element q_wave.root_blip.append(element.Line(line_type = 'h3')) # Adds some instructions q_wave.root_blip.append('Type a summary of ' + 'yo... |
q_wave.root_blip.append(rand_texts[x][0]) q_wave.root_blip.append(rand_texts[x][1], (rand_texts[x][2])) q_wave.root_blip.append(' ', (('link/wave', None))) | q_wave.root_blip.append(rand_texts[x][0], [('style/fontStyle', 'italic')]) q_wave.root_blip.append(rand_texts[x][1], [rand_texts[x][2], ('style/fontStyle', 'italic')]) q_wave.root_blip.append(' ', [('link/wave', None), ('style/fontStyle', None)]) | def create_question_wave(q_wave): '''Appends the required elements & text to make the question wave.''' # Sets the title q_wave.title = 'New Helpdesk Question' # Adds a "Heading 3" element q_wave.root_blip.append(element.Line(line_type = 'h3')) # Adds some instructions q_wave.root_blip.append('Type a summary of ' + 'yo... |
q_wave.root_blip.append('If you have more detail to add, add it here:\n') | q_wave.root_blip.append('If you have more detail to add, add it here (optional):\n') | def create_question_wave(q_wave): '''Appends the required elements & text to make the question wave.''' # Sets the title q_wave.title = 'New Helpdesk Question' # Adds a "Heading 3" element q_wave.root_blip.append(element.Line(line_type = 'h3')) # Adds some instructions q_wave.root_blip.append('Type a summary of ' + 'yo... |
if BUGS['no-attachments']['status'] == True: q_wave.root_blip.append('\n\n' + BUGS['no-attachments']['message']) | q_wave.root_blip.append('\n\nIf you would like to include screenshots/attachments, go into \'edit\' mode (click the "edit" button on the toolbar), then attach the file/screenshot that you would like to use.\n\n') import random x = random.choice((1,2,3)) rand_texts = {1:('You might want to check our list of all previou... | def create_question_wave(q_wave): '''Appends the required elements & text to make the question wave.''' # Sets the title q_wave.title = 'New Helpdesk Question' # Adds a "Heading 3" element q_wave.root_blip.append(element.Line(line_type = 'h3')) # Adds some instructions q_wave.root_blip.append('Type a summary of ' + 'yo... |
wavelet.reply('You need to summarise your question in the question box before submitting.\nIf you are having trouble with the helpdesk, add \'nat.abbotts@wavewatchers.org\' to this wave.') | wavelet.root_blip.append('\n\nYou need to summarise your question in the question box before submitting.\nIf you are having trouble with the helpdesk, add \'nat.abbotts@wavewatchers.org\' to this wave.', [('style/backgroundColor', 'rgb(255, 229, 0)'), ('style/fontWeight', 'bold')]) | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
wavelet.root_blip.range(0, len(wavelet.root_blip.text) - 1).delete() | wavelet.root_blip.range(0, len(wavelet.root_blip.text)).delete() | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
d_wave.root_blip.append(wavelet.root_blip.text) | wavelet.data_documents['helpdesk-questionasker'] = event.modified_by d_wave.data_documents['helpdesk-questionasker'] = event.modified_by d_wave.root_blip.append('\n\n%s' % detail) | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
d_wave.root_blip.append('\nIndex of all Questions', bundled_annotations = [('link/wave', INDEX_WAVE.wave_id)]) if wavelet.root_blip.elements: import urllib2 for e in wavelet.root_blip.elements: if isinstance(e, element.Attachment): new = element.Attachment(caption = e.caption, data = urllib2.urlopen(e.attachmentUrl).r... | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... | |
wavelet.reply('''This wave is public read-only (anyone can see it, but only participants can edit). The Helpdesk Team will choose the best answer from the discussion wave, once the discussion has finished, and post it here.\n''').append('Go to the full access public Discussion Wave', bundled_annotations = [('link/wave'... | temptext = '\n\nThis wave is public read-only (anyone can see it, but '\ 'only participants can edit). The Helpdesk Team will choose the best answer '\ 'from the discussion wave, once the discussion has finished, and post it here.\n' temptext2 = 'Go to the \'Full-Access\' Public Discussion Wave\n' wavelet.root_blip.app... | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
r.append('Question Wave', bundled_annotations = [('link/wave', wavelet.wave_id)]) | r.append('Question Wave', [('link/wave', wavelet.wave_id)]) | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
r.append('Discussion Wave', bundled_annotations = [('link/wave', d_wave.wave_id)]) | r.first(' | ').clear_annotation('link/wave') r.append('Discussion Wave', [('link/wave', d_wave.wave_id)]) | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
wavelet.reply('Question Submitted to ').append('The Helpdesk', bundled_annotations=[('link/wave', INDEX_WAVE.wave_id)]) | wavelet.root_blip.append('Question Submitted to the Helpdesk: ', [('link/wave', None)]) wavelet.root_blip.append('Go to the Question Index', [('link/wave', INDEX_WAVE.wave_id), ('style/fontStyle', 'italic')]) | def OnFormButtonClicked(event, wavelet): '''Handles FormButtonClicked events. ''' # Logs the button name in the appengine logs. logging.debug('OnFormButtonClicked Called, Button Name %s' % event.button_name) # Assigns the wavelet's operation queue to opQ for easier access. opQ = wavelet.get_operation_queue() # If the b... |
goodRemoved = [] repBy = [] | goodRemoved = [] | def OnParticipantsChanged(event, wavelet): logging.info('OnParticipantsChanged Called') if ('wave-helpdesk@appspot.com' != wavelet.root_blip.creator): return badAdded = [] goodRemoved = [] #q = db.GqlQuery('SELECT * FROM UserWave WHERE wave_id = :1', wavelet.wave_id) repBy = [] #if q: # if q.reported_by: # repby = ... |
if p in PARTICIPANTS + repBy: | if p in PARTICIPANTS: | def OnParticipantsChanged(event, wavelet): logging.info('OnParticipantsChanged Called') if ('wave-helpdesk@appspot.com' != wavelet.root_blip.creator): return badAdded = [] goodRemoved = [] #q = db.GqlQuery('SELECT * FROM UserWave WHERE wave_id = :1', wavelet.wave_id) repBy = [] #if q: # if q.reported_by: # repby = ... |
if event.modified_by in PARTICIPANTS + repBy: return | def OnParticipantsChanged(event, wavelet): logging.info('OnParticipantsChanged Called') if ('wave-helpdesk@appspot.com' != wavelet.root_blip.creator): return badAdded = [] goodRemoved = [] #q = db.GqlQuery('SELECT * FROM UserWave WHERE wave_id = :1', wavelet.wave_id) repBy = [] #if q: # if q.reported_by: # repby = ... | |
wavelet.participants.set_role(event.modified_by, 'READ_ONLY') | if ('helpdesk-warninguser-%s' % event.modified_by) in wavelet.data_documents: wavelet.participants.set_role(event.modified_by, 'READ_ONLY') else: wavelet.data_documents['helpdesk-warninguser-%s' % event.modified_by] = '!' | def OnParticipantsChanged(event, wavelet): logging.info('OnParticipantsChanged Called') if ('wave-helpdesk@appspot.com' != wavelet.root_blip.creator): return badAdded = [] goodRemoved = [] #q = db.GqlQuery('SELECT * FROM UserWave WHERE wave_id = :1', wavelet.wave_id) repBy = [] #if q: # if q.reported_by: # repby = ... |
logging.write('***merge succeeded\n') | logging.write('***Merge succeeded\n') | def merge_and_build(config): base_dir = config.get('MERGEMANAGER', 'working_dir') logging.write('base dir =' + base_dir + '\n') wrepo = Repo(base_dir) compobjs = [] #Get ready to build if config.get('MERGEMANAGER', 'build_test') == '1': print 'reading buildconf' for x in config.get('MERGEMANAGER','build_conf').split('... |
clean_working_copy() continue | logging.write('***Undo failed Merge\n') clean_working_copy(wrepo) | def merge_and_build(config): base_dir = config.get('MERGEMANAGER', 'working_dir') logging.write('base dir =' + base_dir + '\n') wrepo = Repo(base_dir) compobjs = [] #Get ready to build if config.get('MERGEMANAGER', 'build_test') == '1': print 'reading buildconf' for x in config.get('MERGEMANAGER','build_conf').split('... |
if (settings.DEBUG or check_size) and len(url) > 2048: | if check_size and len(url) > 2048: | def get_url(self, check_size=True): # Set label colours to black if possible parts = [] if 'chxs' not in self and 'chxt' in self: for i in range(len(self['chxt'].split(','))): parts.append('%d,000000' % i) self['chxs'] = '|'.join(parts) self['chd'] = compress_data(self['chd']) if 'chxr' in self: self['chxr'] = strip_d... |
for user in withProgress(User.objects.all()): | users = User.objects.exclude(email__in=EXCLUDE_EMAILS) for user in withProgress(users): | def _dump_responses(filename): _log.log(filename, newLine=False) with open(filename, 'w') as ostream: earliest = datetime.datetime.now() latest = datetime.datetime.now() - datetime.timedelta(365 * 20) for user in withProgress(User.objects.all()): for response in drill_models.MultipleChoiceResponse.objects.filter( user=... |
{'profile': request.user.get_profile()}, context_instance=RequestContext(request)) | context, context_instance=RequestContext(request)) | def view_profile(request): "View an existing profile." return render_to_response('user_profile/view_profile.html', {'profile': request.user.get_profile()}, context_instance=RequestContext(request)) |
coords = reversed(ncvar.coordinates.split()) coordsdims = nc.variables[coords[0]].dimensions inextcoorddim = 0 for irdim,rdim in enumerate(rawdims): if rdim in coordsdims: rawdims[irdim] = coordsdims[inextcoorddim] inextcoorddim += 1 | coords = tuple(reversed(ncvar.coordinates.split())) if coords[0] in nc.variables: coordsdims = nc.variables[coords[0]].dimensions inextcoorddim = 0 for irdim,rdim in enumerate(rawdims): if rdim in coordsdims: rawdims[irdim] = coordsdims[inextcoorddim] inextcoorddim += 1 | def getDimensions_raw(self,reassign=True): nc = self.store.getcdf() ncvar = nc.variables[self.ncvarname] rawdims = list(ncvar.dimensions) if reassign: # Re-assign dimensions based on the "coordinates" attribute of the variable. if hasattr(ncvar,'coordinates'): coords = reversed(ncvar.coordinates.split()) coordsdims = ... |
if progresscallback is None and continuecallback is None: islicesize = stepcount | if progresscallback is None and continuecallback is None: islicesize = self.stepcount | def run(self,progresscallback=None,continuecallback=None): assert self.result.returncode==0, 'Run did not initialize successfully. %s' % self.result.errormessage # Calculate the size of time batches (small enough to respond rapidly to requests # for cancellation, and to show sufficiently detailed progress - e.g. in % ... |
parser.set_defaults(profile=False,showoptions=False,verbose=False,debug=False,nc=None) | parser.set_defaults(profile=False,showoptions=False,verbose=False,debug=False,nc=None,schemadir=None) | def getSequence(self): import visualizer return commonqt.WizardSequence([visualizer.PageVisualize,visualizer.PageReportGenerator,visualizer.PageSave,visualizer.PageFinal]) |
self.errortext.setVisible((not complete) and (self.figure.errors or self.reportnodata)) | self.errortext.setVisible((not complete) and (bool(self.figure.errors) or self.reportnodata)) | def onFigureStateChanged(self,complete): """Called when the figure state (figure shown/no figure shown) changes. """ self.errortext.setVisible((not complete) and (self.figure.errors or self.reportnodata)) if self.figure.errors: self.errortext.setText('\n'.join(self.figure.errors)) else: self.errortext.setText('No data ... |
datamin = curcoords[0] datamax = curcoords[-1] else: | def getrange(seriesinfo,axis): range = [None,None] for info in seriesinfo: if axis in info and not (hasattr(info[axis],'_mask') and numpy.all(info[axis]._mask)): curmin,curmax = info[axis].min(),info[axis].max() if range[0] is None or curmin<range[0]: range[0] = curmin if range[1] is None or curmax>range[1]: range[1] =... | |
if reverse: forcedrange[0],forcedrange[1] = forcedrange[1],forcedrange[0] | if reverse: forcedrange = forcedrange[::-1] | def addmask(mask,newmask): if mask is None: mask = numpy.empty(U.shape,dtype=numpy.bool) mask.fill(False) return numpy.logical_or(mask,newmask) |
if axisdata['reversed']: naturalrange[0],naturalrange[1] = naturalrange[1],naturalrange[0] | if axisdata['reversed']: naturalrange = naturalrange[::-1] | def addmask(mask,newmask): if mask is None: mask = numpy.empty(U.shape,dtype=numpy.bool) mask.fill(False) return numpy.logical_or(mask,newmask) |
oldmatches = dict([(target,oldmatches[source]) for target,source in curmatches.iteritems() if source in oldmatches]) | oldmatches = dict([(targetnode,oldmatches[sourcenode]) for targetnode,sourcenode in curmatches.iteritems() if sourcenode in oldmatches]) | def convert(self,source,target,callback=None,matchednodes=None,**kwargs): temptargets = [] nsteps = len(self.chain) if callback is not None: stepcallback = lambda progress,message: callback((istep+progress)/nsteps,message) else: stepcallback = None oldmatches = None for istep in range(nsteps-1): convertor = self.chain... |
if callback is not None: callback(float(istep)/nsteps,'converting to version "%s".' % target.version) if verbose: print 'Converting to final target "%s".' % target.version | if callback is not None: callback(float(istep)/nsteps,'converting to version "%s".' % convertor.targetid) if verbose: print 'Converting to final target "%s".' % convertor.targetid | def convert(self,source,target,callback=None,matchednodes=None,**kwargs): temptargets = [] nsteps = len(self.chain) if callback is not None: stepcallback = lambda progress,message: callback((istep+progress)/nsteps,message) else: stepcallback = None oldmatches = None for istep in range(nsteps-1): convertor = self.chain... |
slic = dict(slic) | slic = dict([(k,v) for k,v in slic.iteritems() if k in dims]) | def argument2value(arg,slic=None,dataonly=False): if isinstance(arg,LazyExpression): dims = list(arg.getDimensions()) procslic = {} if slic: # Separate sliced dimensions in those that can be processed by the argument, # and those that should be applied afterwards. slic = dict(slic) for idim in range(len(dims)-1,-1,-1):... |
return {} | return {'history':'auto-generated from boundary coordinates in variable %s' % self.stagname} def getDataType(self): return self.store[self.stagname].getDataType() | def getProperties(self): return {} |
self.update() | if self.animating: self.repaint() else: self.update() | def draw(self): self.replot = True self.get_renderer().clear() self.update() |
nc = pupynere.NetCDFFile(path,mode=mode) | def getNetCDFFile(path,mode='r'): """Returns a NetCDFFile file object representing the NetCDF file at the specified path. The returned object follows Scientific.IO.NetCDFFile conventions. Note: this is the *only* function that needs to know which NetCDF module to use. All other functions just operate on an object retu... | |
nc = pupynere.NetCDFFile(path,mode=mode) | nc = pupynere.NetCDFFile(path,mode=mode,mmap=False) | def getNetCDFFile(path,mode='r'): """Returns a NetCDFFile file object representing the NetCDF file at the specified path. The returned object follows Scientific.IO.NetCDFFile conventions. Note: this is the *only* function that needs to know which NetCDF module to use. All other functions just operate on an object retu... |
TempDirManager.deleteTempDir(path,unregister=False) | TempDirManager.delete(path,unregister=False) | def cleanup(): for path in TempDirManager.tempdirs: TempDirManager.deleteTempDir(path,unregister=False) |
expressions.LazyFunction.__init__(self,self.__class__.__name__,getattr(numpy,self.__class__.__name__),arg) | expressions.LazyFunction.__init__(self,self.__class__.__name__,getattr(numpy,self.__class__.__name__),arg,outsourceslices=False) self.usefirstunit = True | def __init__(self,arg): expressions.LazyFunction.__init__(self,self.__class__.__name__,getattr(numpy,self.__class__.__name__),arg) |
import gotm import matplotlib,numpy import xmlplot.data if xmlplot.data.selectednetcdfmodule is None: xmlplot.data.chooseNetCDFModule() | def onAbout(self): # For version only: import gotm import matplotlib,numpy import xmlplot.data if xmlplot.data.selectednetcdfmodule is None: xmlplot.data.chooseNetCDFModule() | |
versions = [] versions.append(('Python','%i.%i.%i %s %i' % sys.version_info)) versions.append(('Qt4',QtCore.qVersion())) versions.append(('PyQt4',QtCore.PYQT_VERSION_STR)) versions.append(('numpy',numpy.__version__)) versions.append(('matplotlib',matplotlib.__version__)) versions.append(xmlplot.data.netcdfmodules[xmlpl... | strversions = '' for v in getVersions(): strversions += '%s %s<br>' % v | def onAbout(self): # For version only: import gotm import matplotlib,numpy import xmlplot.data if xmlplot.data.selectednetcdfmodule is None: xmlplot.data.chooseNetCDFModule() |
print 'Python version: %s' % unicode(sys.version_info) print 'PyQt4 version: %s' % QtCore.PYQT_VERSION_STR print 'Qt version: %s' % QtCore.qVersion() | print 'Module versions:' for module,version in getVersions(): print ' %s %s' % (module,version) import core.common,xmlstore.xmlstore | def main(options,args): if options.verbose: print 'Python version: %s' % unicode(sys.version_info) print 'PyQt4 version: %s' % QtCore.PYQT_VERSION_STR print 'Qt version: %s' % QtCore.qVersion() core.common.verbose = True if options.nc is not None: import xmlplot.data if xmlplot.data.selectednetcdfmodule is None: xmlpl... |
self.canvas.setMinimumSize(300,250) | def __init__(self,parent,detachbutton=True): QtGui.QWidget.__init__(self,parent) | |
print "%s doesn't exist. Creating it" | print "%s doesn't exist. Creating it" % output_dir | def prepare(): for rf in required_files: if not osp.lexists(rf): print " Couldn't found required template: %s " % (rf, ) exit() if osp.lexists(output_dir): if not osp.isdir(output_dir): print "I have found %s and it is not a directory. May me you launch me from incorrect directory" % (output_dir,) exit() try : print... |
print "Removind directory and recreating it" | print "Removing directory and recreating it" | def prepare(): for rf in required_files: if not osp.lexists(rf): print " Couldn't found required template: %s " % (rf, ) exit() if osp.lexists(output_dir): if not osp.isdir(output_dir): print "I have found %s and it is not a directory. May me you launch me from incorrect directory" % (output_dir,) exit() try : print... |
for i in xrange(100): | for i in xrange(2*self.num_topics): | def initialize_topics(self): ''' initializes the topics with some random seed words so that they have enough relative bias to actually evolve when new words are passed in. ''' # we are going to create some random string from /dev/urandom. to convert # them to a string, we need a translation table that is 256 characters... |
all_words = self.words() + otherlambda.words() | all_words = self._words.keys() + otherlambda._words.keys() | def merge(self, otherlambda, rhot): ''' fold the word probabilities of another DirichletWords object into this one. assumes self.num_topics is the same for both. ''' all_words = self.words() + otherlambda.words() distinct_words = list(set(all_words)) |
print '%d distinct words' % len(distinct_words) print distinct_words print print 'lambda values before update' print self._words.items() print print 'new lambda before merge' print otherlambda._words.items() | def merge(self, otherlambda, rhot): ''' fold the word probabilities of another DirichletWords object into this one. assumes self.num_topics is the same for both. ''' all_words = self.words() + otherlambda.words() distinct_words = list(set(all_words)) | |
topic_totals = [self._topics[i].N() + otherlambda._topics[i].N() for i in self.num_topics] | topic_totals = [self._topics[i].N() + otherlambda._topics[i].N() for i in xrange(self.num_topics)] | def merge(self, otherlambda, rhot): ''' fold the word probabilities of another DirichletWords object into this one. assumes self.num_topics is the same for both. ''' all_words = self.words() + otherlambda.words() distinct_words = list(set(all_words)) |
for word in distinctwords: | for word in distinct_words: | def merge(self, otherlambda, rhot): ''' fold the word probabilities of another DirichletWords object into this one. assumes self.num_topics is the same for both. ''' all_words = self.words() + otherlambda.words() distinct_words = list(set(all_words)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.