rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if (not 'lon' in nc.variables.keys()) ^ ( not 'lat' in nc.variables.keys()):
if (not 'lon' in nc.variables.keys()) or ( not 'lat' in nc.variables.keys()): print("No lat/lon coordinates found, creating it")
def get_projection_from_file(nc): ## First, check if we have a global attribute 'projection' ## which contains a Proj4 string: try: p = Proj(nc.projection) print('Found projection information in global attribute, using it') except: try: ## go through variables and look for 'grid_mapping' attribute for var in nc.variab...
Hresult = integrate.odeint(SMsurface,[h_f],x_grid,atol=1.e-9,rtol=1.e-9)
Hresult = odeint(SMsurface,[h_f],x_grid,atol=1.e-9,rtol=1.e-9)
def SMsurface(h,x): b_x = SMcold_bedslope(x) s = a * abs(x) # ??? return b_x - (C / rho_g) * s**m / h**(m+1)
mbobj = json.loads(unicode(mb, 'utf-8'))
if isinstance(mb, str): mb = unicode(mb, 'utf-8') mbobj = json.loads(mb)
def make_collection_id(data): sio = StringIO.StringIO() for key in ( _version.version, 'base_url', 'script_extension', 'template_blacklist', 'template_exclusion_category', 'print_template_prefix', 'print_template_pattern', 'login_credentials', ): sio.write(repr(data.get(key))) mb = data.get('metabook') if mb: mbobj = j...
ext = ext.replace(' ', '')
def normalize_and_get_image_path(self, name): assert isinstance(name, basestring) name = unicode(name) ns, partial, fqname = self.nshandler.splitname(name, defaultns=6) if ns != 6: return
for p in "pnb ckb mwl mhr ace".split():
for p in "pnb ckb mwl mhr ace krc pcd".split():
def fix_wikipedia_siteinfo(siteinfo): # --- http://code.pediapress.com/wiki/ticket/754 if u'\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd' in [x.get("prefix", u"")[2:] for x in sitein...
namespaces = self.source.namespaces or {}
try: namespaces = self.siteinfo["namespaces"] except (AttributeError, KeyError): from mwlib import siteinfo namespaces = siteinfo.get_siteinfo("en")["namespaces"]
def NS(self, args): """Returns the name of a given namespace number.""" namespaces = self.source.namespaces or {} ns = args[0] try: retval = namespaces[ns]['*'] except KeyError: retval = ''
if getattr(img_node, 'align', None) != 'center':
if getattr(img_node, 'align', None) not in ['center', 'none']:
def getImageSize(self, img_node, img_path=None, max_print_width=None, max_print_height=None, fullsize_thumbs=False, img_size=None): max_w = getattr(img_node, 'width', None) max_h = getattr(img_node, 'height', None) if img_path: img = Image.open(img_path) px_w, px_h = img.size else: px_w, px_h = img_size ar = px_w/px_...
self.cache_dir = utils.ensure_dir(cache_dir)
self.cache_dir = cache_dir
def __init__(self, cache_dir="cache", default_writer='rl', report_from_mail=None, report_recipients=None): self.cache_dir = utils.ensure_dir(cache_dir) self.mwrender_cmd = "mw-render" self.mwrender_logfile = "render-logfile" self.mwzip_cmd = "mw-zip" self.mwzip_logfile = "zip-logfile" self.mwpost_cmd = "mw-post" self....
for i in range(0x100, 0x200): p = os.path.join(self.cache_dir, hex(i)[3:]) if not os.path.isdir(p): os.mkdir(p)
def __init__(self, cache_dir="cache", default_writer='rl', report_from_mail=None, report_recipients=None): self.cache_dir = utils.ensure_dir(cache_dir) self.mwrender_cmd = "mw-render" self.mwrender_logfile = "render-logfile" self.mwzip_cmd = "mw-zip" self.mwzip_logfile = "zip-logfile" self.mwpost_cmd = "mw-post" self....
application = Application()
cachedir = "cache" cachedir = utils.ensure_dir(cachedir) for i in range(0x100, 0x200): p = os.path.join(cachedir, hex(i)[3:]) if not os.path.isdir(p): os.mkdir(p) def app(*args, **kwargs): return Application(cachedir)(*args, **kwargs)
def main(): from gevent.wsgi import WSGIServer application = Application() address = "0.0.0.0", 8899 server = WSGIServer(address, application) try: print "listening on %s:%d" % address server.serve_forever() except KeyboardInterrupt: server.stop() print "bye."
server = WSGIServer(address, application)
server = WSGIServer(address, app)
def main(): from gevent.wsgi import WSGIServer application = Application() address = "0.0.0.0", 8899 server = WSGIServer(address, application) try: print "listening on %s:%d" % address server.serve_forever() except KeyboardInterrupt: server.stop() print "bye."
targetpath = os.path.normpath(os.path.join(dstdir, member.filename))
fn = member.filename if isinstance(fn, str): fn = unicode(fn, 'utf-8') targetpath = os.path.normpath(os.path.join(dstdir, fn))
def extract_member(zipfile, member, dstdir): """Copied and adjusted from Python 2.6 stdlib zipfile.py module. Extract the ZipInfo object 'member' to a physical file on the path targetpath. """ assert dstdir.endswith(os.path.sep), "/ missing at end" targetpath = os.path.normpath(os.path.join(dstdir, member.filename))...
raise RuntimeError("%s: [fetching %s]" % (error.get("info", ""), self._build_url(**kwargs)))
raise RuntimeError("%r: [fetching %r]" % (error.get("info", ""), self._build_url(**kwargs)))
def got_result(data): try: error = data.get("error") except: print "ERROR:", data, kwargs raise if error: raise RuntimeError("%s: [fetching %s]" % (error.get("info", ""), self._build_url(**kwargs))) merge_data(retval, data["query"]) qc = data.get("query-continue", {}).values() if qc and query_continue: kw = kwargs...
self.qpagename = pagename.replace(' ', '_')
def __init__(self, pagename='', server="http://en.wikipedia.org", revisionid=0): self.pagename = pagename self.qpagename = pagename.replace(' ', '_') self.server = server self.revisionid = revisionid self.niceurl = urlparse.urljoin(self.server, 'wiki')
def PAGENAME(self, args):
def _wrap_pagename(f): @wraps(f) def wrapper(self, args): pagename = self.pagename if args.args: pagename = args.args[0] return f(self, pagename) return wrapper def _quoted(f): @wraps(f) def wrapper(*args, **kwargs): return urlquote(f(*args, **kwargs).replace(' ', '_')) return wrapper @_wrap_pagename def PAGENAME(sel...
def __init__(self, pagename='', server="http://en.wikipedia.org", revisionid=0): self.pagename = pagename self.qpagename = pagename.replace(' ', '_') self.server = server self.revisionid = revisionid self.niceurl = urlparse.urljoin(self.server, 'wiki')
return self.pagename def PAGENAMEE(self, args): """same as PAGENAME but More URL-friendly percent encoded special characters (To use an articlename in an external link). """ return urlquote(self.qpagename) def FULLPAGENAME(self, args): return self.pagename def FULLPAGENAMEE(self, args): return urlquote(self.qpagenam...
return self.nshandler.splitname(pagename)[1] """same as PAGENAME but More URL-friendly percent encoded special characters (To use an articlename in an external link). """ PAGENAMEE = _quoted(PAGENAME) @_wrap_pagename def FULLPAGENAME(self, pagename): return pagename FULLPAGENAMEE = _quoted(FULLPAGENAME) @_wrap_page...
def PAGENAME(self, args): """Returns the name of the current page, including all levels (Title/Subtitle/Sub-subtitle)""" return self.pagename
return self.pagename.split('/')[-1] def SUBPAGENAMEE(self, args): return urlquote(self.qpagename.split('/')[-1]) def BASEPAGENAME(self, args):
return pagename.split('/')[-1] SUBPAGENAMEE = _quoted(SUBPAGENAME) @_wrap_pagename def BASEPAGENAME(self, pagename):
def SUBPAGENAME(self, args): """[MW1.6+] Returns the name of the current page, excluding parent pages ('Title/Subtitle' becomes 'Subtitle'). """ return self.pagename.split('/')[-1]
return self.pagename.rsplit('/', 1)[0] def BASEPAGENAMEE(self, args): """[MW1.7+] The basename of a subpage ('Title/Subtitle' becomes 'Title') """ return urlquote(self.qpagename.rsplit('/', 1)[0]) def NAMESPACE(self, args):
return pagename.rsplit('/', 1)[0] BASEPAGENAMEE = _quoted(BASEPAGENAME) @_wrap_pagename def NAMESPACE(self, pagename):
def BASEPAGENAME(self, args): """[MW1.7+] The basename of a subpage ('Title/Subtitle' becomes 'Title') """ return self.pagename.rsplit('/', 1)[0]
ns, partial, full = self.nshandler.splitname(self.pagename)
ns, partial, full = self.nshandler.splitname(pagename)
def NAMESPACE(self, args): """Returns the name of the namespace the current page resides in.""" ns, partial, full = self.nshandler.splitname(self.pagename) return full[:-len(partial)-1]
def NAMESPACEE(self, args): """Returns the name of the namespace the current page resides in. (quoted)""" return urlquote(self.NAMESPACE(args))
NAMESPACEE = _quoted(NAMESPACE)
def NAMESPACEE(self, args): """Returns the name of the namespace the current page resides in. (quoted)""" return urlquote(self.NAMESPACE(args))
if 'general' in siteinfo and siteinfo['general'].get('server').endswith(".wikipedia.org") and 'interwikimap' in siteinfo:
if 'general' in siteinfo and siteinfo['general'].get('server', '').endswith(".wikipedia.org") and 'interwikimap' in siteinfo:
def __init__(self, siteinfo): assert siteinfo is not None
if node.children and not _any([ parent.__class__ in self.removeNodesAllChildren.get(node.__class__) for parent in node.parents]):
if node.children and not _any([ parent.__class__ in self.removeNodesAllChildren.get(node.__class__, []) for parent in node.parents]):
def removeBrokenChildren(self, node): """Remove Nodes (while keeping their children) which can't be nested with their parents.""" if node.__class__ in self.removeNodes.keys(): if _any([parent.__class__ in self.removeNodes[node.__class__] for parent in node.parents]): if node.children and not _any([ parent.__class__ in ...
assert False, 'bla' assert cell.colspan == 2
assert cell.colspan == 1
def test_fixTableColspans2(): '''http://es.wikipedia.org/w/index.php?title=Rep%C3%BAblica_Dominicana&oldid=36394218''' raw = r'''
while sections and level<sections[-1].level:
while sections and level<=sections[-1].level:
def create(): if current.start is None or current.endtitle is None: return False l1 = tokens[current.start].text.count("=") l2 = tokens[current.endtitle].text.count("=") level = min (l1, l2)
if sections and level>sections[-1].level:
if sections:
def create(): if current.start is None or current.endtitle is None: return False l1 = tokens[current.start].text.count("=") l2 = tokens[current.endtitle].text.count("=") level = min (l1, l2)
def login(self, username, password, domain=None):
def login(self, username, password, domain=None, lgtoken=None):
def login(self, username, password, domain=None): args = dict(action="login", lgname=username.encode("utf-8"), lgpassword=password.encode("utf-8"), format="json", ) if domain is not None: args['lgdomain'] = domain.encode('utf-8') headers = {"Content-Type": "application/x-www-form-urlencoded"} postdata = urllib.urlenco...
if 'general' in siteinfo and siteinfo['general'].get('sitename') == 'Wikipedia' and 'interwikimap' in siteinfo: fix_wikipedia_siteinfo(siteinfo)
def set_redirect_matcher(self, siteinfo): if 'general' in siteinfo and siteinfo['general'].get('sitename') == 'Wikipedia' and 'interwikimap' in siteinfo: fix_wikipedia_siteinfo(siteinfo) self.redirect_matcher = get_redirect_matcher(siteinfo, self)
self.contentWithoutTextClasses = [Gallery, ImageLink]
self.contentWithoutTextClasses = [Gallery, ImageLink, ReferenceList]
def __init__(self, tree, save_reports=False, nesting_strictness='loose', status_cb=None): """Init with parsetree.
if miscutils.hasInfoboxAttrs(table):
if miscutils.hasInfoboxAttrs(table) and article_ns != 100:
def markInfoboxes(self, node): if node.__class__ == Article: tables = node.getChildNodesByClass(Table) found_infobox = False for table in tables: if miscutils.hasInfoboxAttrs(table): table.isInfobox = found_infobox = True if found_infobox or not tables: return if miscutils.articleStartsWithTable(node, max_text_until_in...
if miscutils.articleStartsWithTable(node, max_text_until_infobox=200):
if miscutils.articleStartsWithTable(node, max_text_until_infobox=200) and article_ns != 100:
def markInfoboxes(self, node): if node.__class__ == Article: tables = node.getChildNodesByClass(Table) found_infobox = False for table in tables: if miscutils.hasInfoboxAttrs(table): table.isInfobox = found_infobox = True if found_infobox or not tables: return if miscutils.articleStartsWithTable(node, max_text_until_in...
self.contentWithoutTextClasses = [Gallery, ImageLink, ReferenceList]
self.contentWithoutTextClasses = [Gallery, ImageLink]
def __init__(self, tree, save_reports=False, nesting_strictness='loose', status_cb=None): """Init with parsetree.
if node.children and not _any([ parent.__class__ in self.removeNodesAllChildren[node.__class__] for parent in node.parents]):
if node.children and not _any([ parent.__class__ in self.removeNodesAllChildren.get(node.__class__) for parent in node.parents]):
def removeBrokenChildren(self, node): """Remove Nodes (while keeping their children) which can't be nested with their parents.""" if node.__class__ in self.removeNodes.keys(): if _any([parent.__class__ in self.removeNodes[node.__class__] for parent in node.parents]): if node.children and not _any([ parent.__class__ in ...
if ref_name != ref_name.strip('"'):
if ref_name and ref_name != ref_name.strip('"'):
def fixReferenceNodes(self, node): ref_nodes = node.getChildNodesByClass(Reference) name2children = {} for ref_node in ref_nodes: ref_name = ref_node.attributes.get('name') if ref_name != ref_name.strip('"'): ref_name = ref_name.strip('"') ref_node.vlist['name'] = ref_name if ref_name and ref_node.children and not name...
Status(status_path)(status='job queued', progres=0)
Status(status_path)(status='job queued', progress=0)
def do_render(self, collection_id, post_data, is_new=False): metabook_data = post_data.get('metabook') if is_new and not metabook_data: return self.error_response('POST argument metabook or collection_id required') if not is_new and metabook_data: return self.error_response('Specify either metabook or collection_id, no...
class handler(WSGIHandler): def alog_request(self, *args, **kwargs): pass
def do_zip_post(self, collection_id, post_data, is_new=False): try: metabook_data = post_data['metabook'] except KeyError, exc: return self.error_response('POST argument required: %s' % exc) base_url = post_data.get('base_url') template_blacklist = post_data.get('template_blacklist', '') template_exclusion_category = ...
server = WSGIServer(address, application, handler_class=handler)
server = WSGIServer(address, application)
def main(): application = Application() address = "localhost", 8899 server = WSGIServer(address, application, handler_class=handler) try: print "listening on %s:%d" % address server.serve_forever() except KeyboardInterrupt: server.stop() print "Bye bye"
if last_cell.colspan != node.numcols:
if last_cell.__class__ != Cell or last_cell.colspan != node.numcols:
def unNestEndingCellContent(self, node): '''http://de.wikipedia.org/w/index.php?title=Bahnstrecke_Berlin%E2%80%93Dresden&oldid=72891289''' if node.__class__ == Table and not node.getParentNodesByClass(Table): last_row = node.children[-1] if not last_row or len(last_row.children) != 1: return last_cell = last_row.child...
del children[0]
if children[0].children: del children[0].children[0] else: del children[0]
def create_ref(self, name, vlist, inner, xopts): expander = xopts.expander if expander is not None and inner: inner = expander.parseAndExpand(inner, True)
section_title = node.children[0].children[0].caption
try: section_title = node.children[0].children[0].caption except IndexError: section_title = ''
def removeSeeAlso(self, node): try: seealso_section = _('See also') except NameError: seealso_section = 'See also'
lines = [" " + x for x in stdout[4096:].split("\n")]
lines = [" " + x for x in stdout[-4096:].split("\n")]
def system(args, timeout=None): stime=time.time() retcode, stdout = proc.run_cmd(args, timeout=timeout) d = time.time()-stime pub_args = garble_password(args) msg = [] a = msg.append a("%s %s %r\n" % (retcode, d, pub_args)) writemsg = lambda: sys.stderr.write("".join(msg)) if retcode != 0: a(stdout) a("\n=========...
Table:[DefinitionList, DefinitionDescription]
Table:[DefinitionList, DefinitionDescription],
def __init__(self, tree, save_reports=False, nesting_strictness='loose', status_cb=None): """Init with parsetree.
self.namedargs[name] = val
do_strip = False if do_strip and isinstance(val, unicode): val = val.strip() self.namedargs[name] = (do_strip, val)
def get(self, n, default): self.count += 1 if isinstance(n, (int, long)): try: a=self.args[n] except IndexError: return default if isinstance(a, unicode): return a.strip() tmp = [] flatten(a, self.expander, self.variables, tmp) _insert_implicit_newlines(tmp) tmp = u"".join(tmp).strip() if len(tmp)>256*1024: raise Memor...
val = self.namedargs[n]
do_strip, val = self.namedargs[n]
def get(self, n, default): self.count += 1 if isinstance(n, (int, long)): try: a=self.args[n] except IndexError: return default if isinstance(a, unicode): return a.strip() tmp = [] flatten(a, self.expander, self.variables, tmp) _insert_implicit_newlines(tmp) tmp = u"".join(tmp).strip() if len(tmp)>256*1024: raise Memor...
tmp=u"".join(tmp).strip() self.namedargs[n] = tmp
tmp=u"".join(tmp) if do_strip: tmp = tmp.strip() self.namedargs[n] = (do_strip, tmp)
def get(self, n, default): self.count += 1 if isinstance(n, (int, long)): try: a=self.args[n] except IndexError: return default if isinstance(a, unicode): return a.strip() tmp = [] flatten(a, self.expander, self.variables, tmp) _insert_implicit_newlines(tmp) tmp = u"".join(tmp).strip() if len(tmp)>256*1024: raise Memor...
if chunk.find('<div id="sign_in_box">') != -1:
if chunk.find('<div class="signin">') != -1:
def download_file(filename,url): global options global checksums global filesizes resume_start = 0 if os.path.exists(filename): if filename in checksums: print 'Checking existing ' + filename file_size = os.stat(filename).st_size if file_size == filesizes[filename]: file_checksum = md5_checksum(filename) if file_checks...
print "HTTP Error:",e.code , downloadurl
print "HTTP Error:",e.code , url
def download_file(filename,url): global options if options.dryrun : global download_list download_info = "download %s %s" % (filename, url) download_list.append(download_info) return True print 'Downloading ' + filename global headers req = urllib2.Request(url, None, headers) try: response = urllib2.urlopen(req) CHUN...
print "URL Error:",e.reason , downloadurl
print "URL Error:",e.reason , url
def download_file(filename,url): global options if options.dryrun : global download_list download_info = "download %s %s" % (filename, url) download_list.append(download_info) return True print 'Downloading ' + filename global headers req = urllib2.Request(url, None, headers) try: response = urllib2.urlopen(req) CHUN...
parser = OptionParser(version="%prog 0.6", usage="Usage: %prog [options] version")
parser = OptionParser(version="%prog 0.6.1", usage="Usage: %prog [options] version")
def downloadkit(version): global headers global options urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == 2: viewid= 1 # Symbian^2 if version[0] == 3: viewid= 5 # Symbian^3 url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version req = ...
parser = OptionParser(version="%prog 0.8", usage="Usage: %prog [options] version")
parser = OptionParser(version="%prog 0.9", usage="Usage: %prog [options] version")
def downloadkit(version): global headers global options urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == 2: viewid= 1 # Symbian^2 if version[0] == 3: viewid= 5 # Symbian^3 url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version req = ...
password=''
password='', debug=False
def downloadkit(version): global headers global options urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == 2: viewid= 1 # Symbian^2 if version[0] == 3: viewid= 5 # Symbian^3 url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version req = ...
unzipthread = unzipfile(filename, unziplevels, deletelevels)
unzipthread = unzipfile(filename, unziplevel, deletelevel)
def schedule_unzip(filename, unziplevel, deletelevel): global options if options.nounzip : return if options.dryrun : global unzip_list if unziplevel > 0: unzip_list.append("7z x -y %s" % filename) if unziplevel > 1: unzip_list.append("# unzip recursively %d more times" % unziplevel-1) if deletelevel > 0: unzip_list.ap...
first_chunk = True
size = 0 last_time = time.time() last_size = size
def download_file(filename,url): global options if options.dryrun : global download_list download_info = "download %s %s" % (filename, url) download_list.append(download_info) return True print 'Downloading ' + filename global headers req = urllib2.Request(url, None, headers) try: response = urllib2.urlopen(req) CHUN...
if first_chunk and chunk.find('<div id="sign_in_box">') != -1:
if size == 0 and chunk.find('<div id="sign_in_box">') != -1:
def download_file(filename,url): global options if options.dryrun : global download_list download_info = "download %s %s" % (filename, url) download_list.append(download_info) return True print 'Downloading ' + filename global headers req = urllib2.Request(url, None, headers) try: response = urllib2.urlopen(req) CHUN...
first_chunk = False
size += len(chunk) now = time.time() if options.progress and now-last_time > 20: print "- %d Kb (%d Kb/s)" % (size/1024, ((size-last_size)/1024/(now-last_time))+0.5) last_time = now last_size = size
def download_file(filename,url): global options if options.dryrun : global download_list download_info = "download %s %s" % (filename, url) download_list.append(download_info) return True print 'Downloading ' + filename global headers req = urllib2.Request(url, None, headers) try: response = urllib2.urlopen(req) CHUN...
parser = OptionParser(usage="Usage: %prog [options] version", version="%prog 0.4")
parser = OptionParser(version="%prog 0.5", usage="Usage: %prog [options] version")
def downloadkit(version): global headers global options urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == 2: viewid= 1 # Symbian^2 if version[0] == 3: viewid= 5 # Symbian^3 url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version req = ...
parser.set_defaults(dryrun=False, nosrc=False, nounzip=False)
parser.add_option("--progress", action="store_true", dest="progress", help="Report download progress") parser.set_defaults(dryrun=False, nosrc=False, nounzip=False, progress=False)
def downloadkit(version): global headers global options urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == 2: viewid= 1 # Symbian^2 if version[0] == 3: viewid= 5 # Symbian^3 url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version req = ...
reporting_url = "http://developer.symbian.org/downloadkit_report/%s/%s/args=" % (version, what)
reporting_url = "http://developer-secure.symbian.org/downloadkit_report/%s/%s/args=" % (version, what)
def report_to_symbian(version, what): global options if not options.publicity: return reporting_url = "http://developer.symbian.org/downloadkit_report/%s/%s/args=" % (version, what) if options.dryrun: reporting_url += "+dryrun" if options.nosrc: reporting_url += "+nosrc" if options.nowinscw: reporting_url += "+nowinscw...
if options.debug: f = open("downloadpage.html","w") print >>f, doc f.close()
def downloadkit(version): global headers global options global failure_list urlbase = top_level_url + '/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == '2': viewid = 1 # Symbian^2 if version[0] == '3': viewid = 5 # Symbian^3 if version.startswith('lucky'): viewid = 12 # Do you fe...
webhost = 'developer.symbian.org',
webhost = 'developer-secure.symbian.org',
def downloadkit(version): global headers global options global failure_list urlbase = top_level_url + '/main/tools_and_kits/downloads/' viewid = 5 # default to Symbian^3 if version[0] == '2': viewid = 1 # Symbian^2 if version[0] == '3': viewid = 5 # Symbian^3 if version.startswith('lucky'): viewid = 12 # Do you fe...
version = '2.1b1'
version = '2.1b2'
def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+ '\n' + 'Contributors\n' '************\n'
def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
banner_brains = self.context.getFolderContents()
catalog = getToolByName(self.context, 'portal_catalog') banner_brains = catalog.searchResults({ 'path': '/'.join(self.context.getPhysicalPath()), 'object_provides': ICarouselBanner.__identifier__, })
def getBanners(self): """ Returns a list of objects that provide ICarouselBanner. """ banner_brains = [] if IFolderish.providedBy(self.context): banner_brains = self.context.getFolderContents() elif IATTopic.providedBy(self.context): banner_brains = self.context.queryCatalog() banner_objects = [b.getObject() for b in...
banner_objects = []
banner_brains = []
def getBanners(self): """ Returns a list of objects that provide ICarouselBanner. """ banner_objects = [] if IFolderish.providedBy(self.context): banner_objects = self.context.objectValues() elif IATTopic.providedBy(self.context): banner_objects = [brain.getObject() for brain \ in self.context.queryCatalog()] return ...
banner_objects = self.context.objectValues()
banner_brains = self.context.getFolderContents()
def getBanners(self): """ Returns a list of objects that provide ICarouselBanner. """ banner_objects = [] if IFolderish.providedBy(self.context): banner_objects = self.context.objectValues() elif IATTopic.providedBy(self.context): banner_objects = [brain.getObject() for brain \ in self.context.queryCatalog()] return ...
banner_objects = [brain.getObject() for brain \ in self.context.queryCatalog()]
banner_brains = self.context.queryCatalog() banner_objects = [b.getObject() for b in banner_brains]
def getBanners(self): """ Returns a list of objects that provide ICarouselBanner. """ banner_objects = [] if IFolderish.providedBy(self.context): banner_objects = self.context.objectValues() elif IATTopic.providedBy(self.context): banner_objects = [brain.getObject() for brain \ in self.context.queryCatalog()] return ...
$self.width(500);
if ($self.is('.image-left') || $self.is('.image-right')) $self.width(230) else $self.width(500);
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; v...
catalog = getToolByName(self.context, 'portal_catalog')
def videos(self): catalog = getToolByName(self.context, 'portal_catalog') results = [] for brain in self._query(): video = brain.getObject() if not IFlowPlayable.providedBy(video): continue view = component.getMultiAdapter( (video, self.request), interface.Interface, 'flowplayer') results.append(dict(url=view.href(), t...
if ($(this).is('.minimal')) { config.plugins.controls = null; } var audio = $(this).is('.audio'); if (audio) { $(this).width(500);
var $self = $(this); if ($self.is('.minimal')) { config.plugins.controls = null; }; var audio = $self.is('.audio'); if (audio && !$self.is('.minimal')) { $self.width(500);
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
if ($(this).is('div')) {
if ($self.is('div')) {
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
config.clip.url = $(this).find('a').attr('href');
config.clip.url = $self.find('a').attr('href');
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
if ($(this).find('img').length == 0) {
if ($self.find('img').length == 0) {
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
$(this).empty();
$self.empty();
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
var audio = $(this).is('.audio');
var $self = $(this); var audio = $self.is('.audio');
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
if ($(this).is('.minimal')) { config.plugins.controls = null; } if ($(this).find('img').length > 0) {
if ($self.is('.minimal')) { config.plugins.controls = null; } if ($self.find('img').length > 0) {
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
portlet_parents = $(this).parents('.portlet');
portlet_parents = $self.parents('.portlet');
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
$(this).parent().find('.flowPlaylist-portlet-marker').attr('id', playlist_selector_id);
$self.parent().find('.flowPlaylist-portlet-marker').attr('id', playlist_selector_id);
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
if (audio) {
if (audio && !$self.is('.minimal')) {
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
$(this).show();
$self.show();
def __call__(self, request=None, response=None): """ Returns global configuration of the Flowplayer taken from portal_properties """ self.update() self.request.response.setHeader("Content-type", "text/javascript") return """(function($) { $(function() { $('.autoFlowPlayer').each(function() { var config = %(config)s; i...
os.lseek(fd, size, 0)
if size <= 0: size = 1 os.lseek(fd, size-1, 0)
def expand(self, create = False, size = None): flags = os.O_WRONLY if create: flags |= os.O_CREAT makedirs(os.path.dirname(self.lofile))
args = ["/sbin/dmsetup", "create", self.__name, "--table", table]
args = ["/sbin/dmsetup", "create", self.__name, "--uuid", "LIVECD-%s" % self.__name, "--table", table]
def create(self): if self.__created: return
long = long,
long = long + " (Basic Video)",
def __get_image_stanzas(self, isodir): versions = [] kernels = self._get_kernel_versions() for kernel in kernels: for version in kernels[kernel]: versions.append(version)
try: os.unlink(self._instroot + "/etc/sysconfig/mkinitrd") except: pass
self.__restore_file(self._instroot + "/etc/sysconfig/mkinitrd") self.__restore_file(self._instroot + "/etc/dracut.conf")
def _unmount_instroot(self): try: os.unlink(self._instroot + "/etc/sysconfig/mkinitrd") except: pass LoopImageCreator._unmount_instroot(self)
f.write('MODULES+="squashfs ext4 ext3 ext2 vfat msdos "\n') f.write('MODULES+="sr_mod sd_mod ide-cd cdrom "\n') for module in self.__modules: if module == "=usb": f.write('MODULES+="ehci_hcd uhci_hcd ohci_hcd "\n') f.write('MODULES+="usb_storage usbhid "\n') elif module == "=firewire": f.write('MODULES+="firewire-sbp2...
f.write('MODULES+="' + self.__extra_filesystems() + '"\n') f.write('MODULES+="' + self.__extra_drivers() + '"\n') f.close() def __write_dracut_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a") f.write('filesystems+="' + self.__extra_filesystems() + ' "\...
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
self.__write_initrd_conf(self._instroot + "/etc/dracut.conf")
self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
def _mount_instroot(self, base_on = None): LoopImageCreator._mount_instroot(self, base_on) self.__write_initrd_conf(self._instroot + "/etc/dracut.conf")
os.unlink(self._instroot + "/etc/dracut.conf")
os.unlink(self._instroot + "/etc/sysconfig/mkinitrd")
def _unmount_instroot(self): try: os.unlink(self._instroot + "/etc/dracut.conf") except: pass LoopImageCreator._unmount_instroot(self)
f.write('add_drivers+="squashfs ext4 ext3 ext2 vfat msdos "\n') f.write('add_drivers+="sr_mod sd_mod ide-cd cdrom "\n')
f.write('MODULES+="squashfs ext4 ext3 ext2 vfat msdos "\n') f.write('MODULES+="sr_mod sd_mod ide-cd cdrom "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
f.write('add_drivers+="ehci_hcd uhci_hcd ohci_hcd "\n') f.write('add_drivers+="usb_storage usbhid "\n')
f.write('MODULES+="ehci_hcd uhci_hcd ohci_hcd "\n') f.write('MODULES+="usb_storage usbhid "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
f.write('add_drivers+="firewire-sbp2 firewire-ohci "\n') f.write('add_drivers+="sbp2 ohci1394 ieee1394 "\n')
f.write('MODULES+="firewire-sbp2 firewire-ohci "\n') f.write('MODULES+="sbp2 ohci1394 ieee1394 "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
f.write('add_drivers+="mmc_block sdhci sdhci-pci "\n')
f.write('MODULES+="mmc_block sdhci sdhci-pci "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
f.write('add_drivers+="pata_pcmcia "\n')
f.write('MODULES+="pata_pcmcia "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
f.write('add_drivers+="' + module + ' "\n')
f.write('MODULES+="' + module + ' "\n')
def __write_initrd_conf(self, path): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a")
"/usr/share/anaconda/syslinux-vesa-splash.jpg"
"/usr/share/anaconda/boot/syslinux-vesa-splash.jpg"
def __copy_syslinux_background(self, isodest): background_path = self._instroot + \ "/usr/share/anaconda/syslinux-vesa-splash.jpg"
append initrd=initrd%(index)s.img root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s label %(short)s menu label %(long)s %(basicvideo)s kernel vmlinuz%(index)s
def __get_image_stanza(self, is_xen, isDracut, **args): if isDracut: args["rootlabel"] = "live:CDLABEL=%(fslabel)s" % args else: args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
kernel mboot.c32 append xen%(index)s.gz --- vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s --- initrd%(index)s.img label %(short)s menu label %(long)s %(basicvideo)s
def __get_image_stanza(self, is_xen, isDracut, **args): if isDracut: args["rootlabel"] = "live:CDLABEL=%(fslabel)s" % args else: args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
xdriver = "xdriver=vesa"
xdriver = "xdriver=vesa nomodeset"
def __get_image_stanzas(self, isodir): versions = [] kernels = self._get_kernel_versions() for kernel in kernels: for version in kernels[kernel]: versions.append(version)
if default: cfg += "menu default\n"
def __get_image_stanzas(self, isodir): versions = [] kernels = self._get_kernel_versions() for kernel in kernels: for version in kernels[kernel]: versions.append(version)
self.call(["/sbin/setfiles", "/etc/selinux/targeted/contexts/files/file_contexts", "-e", "/proc", "-e", "/sys", "-e", "/dev", "-e", "/selinux", "/"])
self.call(["/sbin/setfiles", "-e", "/proc", "-e", "/sys", "-e", "/dev", "-e", "/selinux", "/etc/selinux/targeted/contexts/files/file_contexts", "/"])
def relabel(self, ksselinux): # touch some files which get unhappy if they're not labeled correctly for fn in ("/etc/resolv.conf",): path = self.path(fn) f = file(path, "w+") os.chmod(path, 0644) f.close()
"/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg"
"/usr/share/anaconda/syslinux-vesa-splash.jpg"
def __copy_syslinux_background(self, isodest): background_path = self._instroot + \ "/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg"
return False
background_path = self._instroot + \ "/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg" if not os.path.exists(background_path): return False
def __copy_syslinux_background(self, isodest): background_path = self._instroot + \ "/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg"
v = v.replace("'", "\\'")
if v != None: v = v.replace("'", "\\'")
def linedataToObject(self, linedata, o): """ @type linedata: dict @param linedata: One line of BP data dict-ified. @type o: instance of mapper class from stampede_schema module. @param o: Passed in by the appropriate event handler method. Takes the dict of BP linedata, assigns contents to the class o as attribut...