rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.locales = ('en-US',)
self.locales = None
def __init__(self, config, productName, version, tuxedoServerUrl, brandName=None, bouncerProductName=None, shippedLocales=None, addMARs=True, oldVersion=None, username=None, password=None, verbose=True, dryRun=False, platforms=None, milestone=None): self.config = config self.productName = productName self.version = ver...
print "Locales: %s" % ", ".join(self.locales) locales_post_data = ["languages=%s" % l for l in self.locales] locales_post_data = "&".join(locales_post_data) response = self.tuxedoRequest("product_add/", "product=" + quote(product) + "&" + locales_post_data)
if self.locales: print "Locales: %s" % ", ".join(self.locales) post_data = "product=" + quote(product) if self.locales: locales_post_data = ["languages=%s" % l for l in self.locales] locales_post_data = "&".join(locales_post_data) post_data += locales_post_data response = self.tuxedoRequest("product_add/", post_data)
def product_add(self, product): if self.verbose: print "Adding product: %s" % product print "Locales: %s" % ", ".join(self.locales) locales_post_data = ["languages=%s" % l for l in self.locales] locales_post_data = "&".join(locales_post_data) response = self.tuxedoRequest("product_add/", "product=" + quote(product) + "...
slavename.startswith('win32'):
slavename.startswith('win32') or slavename.startswith('w32'):
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32'): if 'try-' in slavename: buildmaster_host = TRY_...
if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in slavename: buildmaster_host = TRY_BUILDMASTER d['port'] = 9011 else: buildmaster_host = BUILD_BUILDMASTER if 'linux' in slavename or 'xserve' in slavename or \ 'darwin9...
if 'slave' in slavename: buildmaster_host = BUILD_BUILDMASTER if 'linux' in slavename or 'darwin' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
elif 'win32' in slavename or 'mw32' in slavename:
elif 'win' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
return False return True
log.error("%s differs!", signed_file) success = False return success
def sums_are_equal(base_package, packages): """ Check to make sure that the dictionaries of files:checksums are exactly equal across a list of packages """ for signed_file in base_package.keys(): log.debug("comparing file %s", signed_file) if not len([p for p in packages if p[signed_file] == packages[0][signed_file]]) ...
os.chmod(os.path.join(root, d), 2775)
os.chmod(os.path.join(root, d), 02775)
def ReleaseToCandidatesDir(options, upload_dir, files): candidatesDir = CANDIDATES_DIR % {'version': options.version, 'buildnumber': options.build_number} candidatesPath = os.path.join(NIGHTLY_PATH, candidatesDir) candidatesUrl = CANDIDATES_URL_PATH % { 'nightly_dir': options.nightly_dir, 'version': options.version, 'b...
if 'r3' in slavename: buildmaster_host = TALOS_BUILDMASTER
else: platform = re.match("t(alos)?-r3-(?P<platform>\w+)-\d+", slavename).groupdict()['platform'] for platform_list,host in TALOS_BUILDMASTERS.iteritems(): if platform in platform_list: buildmaster_host = host
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
verbose=True, dryRun=False, platforms=None):
verbose=True, dryRun=False, platforms=None, milestone=None):
def __init__(self, config, productName, version, tuxedoServerUrl, brandName=None, bouncerProductName=None, shippedLocales=None, addMARs=True, oldVersion=None, username=None, password=None, verbose=True, dryRun=False, platforms=None): self.config = config self.productName = productName self.version = version self.tuxedo...
m = re.search("(partner-repacks/\w+/|)(win32|mac|linux-i686)/([-a-zA-Z]+)/((?i)%s) Setup (\d+\.\d+(?:\.\d+)?(?:\w+\d+)?(?:\ \w+\ \d+)?)\.exe" % product, filepath)
m = re.search("(partner-repacks/[-a-zA-Z0-9_]+/|)(win32|mac|linux-i686)/([-a-zA-Z]+)/((?i)%s) Setup (\d+\.\d+(?:\.\d+)?(?:\w+\d+)?(?:\ \w+\ \d+)?)\.exe" % product, filepath)
def fileInfo(filepath, product): """Extract information about a release file. Returns a dictionary with the following keys set: 'product', 'version', 'locale', 'platform', 'contents', 'format', 'pathstyle' 'contents' is one of 'complete', 'installer' 'format' is one of 'mar' or 'exe' 'pathstyle' is either 'short' or ...
builder.category.endswith('release'):
builder.category.find('release') > -1:
def clean_dir(dirname, timestamp): """Delete old twisted log files, and old builder files from dirname""" # Clean up files older than timestamp files = os.listdir(dirname) # Look for twistd.log files for f in files: p = os.path.join(dirname, f) if f.startswith("twistd.log."): maybe_delete(p, timestamp) elif os.path.is...
l10nRepoDir = path.split(releaseConfig["l10nRepoClonePath"])[-1]
try: l10nRepoDir = path.split(releaseConfig["l10nRepoClonePath"])[-1] except KeyError: l10nRepoDir = path.split(releaseConfig["l10nRepoPath"])
def validate(options, args): err = False if not options.configfile: log.info("Must pass --configfile") sys.exit(1) releaseConfigFile = path.join("buildbot-configs", options.releaseConfig) branchConfigFile = path.join("buildbot-configs", options.configfile) branchConfigDir = path.dirname(branchConfigFile) if not path.e...
def post_multipart(host, selector, fields, files): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page. """ try...
def __init__(self, server, selector, branch, resultsname, testresult, sourcestamp, buildid, timestamp): self.server = server self.selector = selector self.branch = branch self.resultsname = resultsname self.sourcestamp = sourcestamp self.buildid = buildid self.timestamp = timestamp self.testresult = testresult
def post_multipart(host, selector, fields, files): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page. """ try...
def encode_multipart_formdata(fields, files): """ fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance """ BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'...
def doTinderboxPrint(self, contents, testlongname, testname, prettyval): lines = contents.split('\n') found = False for line in lines: if "RETURN" in line : tboxPrint = 'TinderboxPrint: ' + \ '<a title="%s" href=\'http://%s/%s\'>%s:%s</a>\n' % \ (testlongname, self.server, line.split("\t")[3], testname, prettyval) pr...
def encode_multipart_formdata(fields, files): """ fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance """ BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'...
def ReleaseToTinderboxBuilds(options, upload_dir, files, dated=True): tinderboxBuildsPath = TINDERBOX_BUILDS_PATH % \
def ReleaseToBuildDir(builds_dir, builds_url, options, upload_dir, files, dated): tinderboxBuildsPath = builds_dir % \
def ReleaseToTinderboxBuilds(options, upload_dir, files, dated=True): tinderboxBuildsPath = TINDERBOX_BUILDS_PATH % \ {'product': options.product, 'tinderbox_builds_dir': options.tinderbox_builds_dir} tinderboxUrl = TINDERBOX_URL_PATH % \ {'product': options.product, 'tinderbox_builds_dir': options.tinderbox_builds_dir...
tinderboxUrl = TINDERBOX_URL_PATH % \
tinderboxUrl = builds_url % \
def ReleaseToTinderboxBuilds(options, upload_dir, files, dated=True): tinderboxBuildsPath = TINDERBOX_BUILDS_PATH % \ {'product': options.product, 'tinderbox_builds_dir': options.tinderbox_builds_dir} tinderboxUrl = TINDERBOX_URL_PATH % \ {'product': options.product, 'tinderbox_builds_dir': options.tinderbox_builds_dir...
'--revision', revision,
def sendchange(branch, revision, username, master, configfile): """Send the change to buildbot to kick off the release automation""" cmd = [ 'buildbot', 'sendchange', '--username', username, '--master', master, '--branch', branch, '--revision', revision, '-p', 'release_config:mozilla/%s' % configfile, 'release_build' ]...
try: update(reponame, revision=relbranch) except: if not isRelbranchGenerated: log.error("Couldn't update to required relbranch '%s', fail", relbranch) raise Exception("Tagging failed") update(reponame, revision=revision) run_cmd(['hg', 'branch', relbranch], cwd=reponame)
if relbranch: try: update(reponame, revision=relbranch) except: if not isRelbranchGenerated: log.error("Couldn't update to required relbranch '%s', fail", relbranch) raise Exception("Tagging failed") update(reponame, revision=revision) run_cmd(['hg', 'branch', relbranch], cwd=reponame)
def bump_and_tag(repo, attempt, config, relbranch, isRelbranchGenerated, revision, tags): try: update(reponame, revision=relbranch) except: if not isRelbranchGenerated: log.error("Couldn't update to required relbranch '%s', fail", relbranch) raise Exception("Tagging failed") update(reponame, revision=revision) run_cmd(...
if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
d['port'] = 9982
d['port'] = 9011
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
if 'linux' in slavename or 'ubuntu' in slavename:
if 'linux' in slavename or 'ubuntu' in slavename or 'fed' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32'): if 'try-' in slavename: buildmaster_host = TRY_...
except subprocess.CalledProcessError as inst:
except subprocess.CalledProcessError, inst:
def out(src, remote, **kwargs): """Check for outgoing changesets present in a repo""" cmd = ['hg', '-q', 'out', '--template', '{node}\n'] cmd.extend(common_args(**kwargs)) cmd.append(remote) if os.path.exists(src): try: return get_output(cmd, cwd=src).rstrip().split("\n") except subprocess.CalledProcessError as inst: i...
oldBuildNumber, sourceRepo, hg, verbose)
oldBuildNumber, sourceRepo, hg)
def createSnippets(brandName, product, appName, version, oldVersion, buildNumber, oldBuildNumber, platforms, channels, oldBaseSnippetDir, stageServer, hg, sourceRepo, generatePartials, verbose): errs = [] dirs = [] snippets = ['complete.txt'] if generatePartials: snippets.append('partial.txt') previousCandidateIDs = fi...
sourceRepo, hg, verbose)
sourceRepo, hg)
def createSnippets(brandName, product, appName, version, oldVersion, buildNumber, oldBuildNumber, platforms, channels, oldBaseSnippetDir, stageServer, hg, sourceRepo, generatePartials, verbose): errs = [] dirs = [] snippets = ['complete.txt'] if generatePartials: snippets.append('partial.txt') previousCandidateIDs = fi...
"-m", mergeDir),
"-m", mergeDir,
def compareLocales(repo, locale, l10nRepoDir, localeSrcDir, l10nIni, revision="default", merge=True): mercurial(repo, "compare-locales") update("compare-locales", revision=revision) mergeDir = path.join(localeSrcDir, "merged") if path.exists(mergeDir): log.info("Deleting %s" % mergeDir) shutil.rmtree(mergeDir) run_cmd(...
bar = "
if total > 0: percentage = " %8.2f%%" % (n*100./total) else: percentage = ''
def format_hist(h, units=1): retval = [] if not h: h[0] = 0 keys = sorted(h.keys()) min_key = min(keys) max_key = max(keys) for i in range(min_key, max_key+1): n = h.get(i, 0) bar = "#" * n retval.append("%4i %s (%i)" % (i*units, bar, n)) return "\n".join(retval)
retval.append("%4i %s (%i)" % (i*units, bar, n))
retval.append("%3i: %8i%s" % (i*units, n, percentage))
def format_hist(h, units=1): retval = [] if not h: h[0] = 0 keys = sorted(h.keys()) min_key = min(keys) max_key = max(keys) for i in range(min_key, max_key+1): n = h.get(i, 0) bar = "#" * n retval.append("%4i %s (%i)" % (i*units, bar, n)) return "\n".join(retval)
print "Wait time report for %s for jobs submitted since" % options.name, time.ctime(options.starttime) print
text =[] text.append("Wait time report for %s for jobs submitted since %s\n" % (options.name, time.ctime(options.starttime)))
def add_builder(option, opt_str, value, parser, *args, **kwargs): if ":" in value: platform, builders = value.split(":", 1) builders = [b.strip() for b in builders.split(",")] else: platform = value builders = [platform]
hist = {}
hist[platform] = {}
def add_builder(option, opt_str, value, parser, *args, **kwargs): if ":" in value: platform, builders = value.split(":", 1) builders = [b.strip() for b in builders.split(",")] else: platform = value builders = [platform]
scan_builder(builder, options.starttime, options.endtime, options.minutes_per_block, hist, options.change_as_submittime)
scan_builder(builder, options.starttime, options.endtime, options.minutes_per_block, hist[platform], options.change_as_submittime)
def add_builder(option, opt_str, value, parser, *args, **kwargs): if ":" in value: platform, builders = value.split(":", 1) builders = [b.strip() for b in builders.split(",")] else: platform = value builders = [platform]
print platform print format_hist(hist, options.minutes_per_block) print
allhist = {} for i in set([x for y in hist.keys() for x in hist[y]]): allhist[i] = sum([p.get(i,0) for p in hist.values()]) total = sum(allhist.values()) text.append("Total Jobs: %i\n" % total) text.append("Wait Times") text.append(format_hist(allhist, options.minutes_per_block)) text.append("\nPlatform break down\n") ...
def add_builder(option, opt_str, value, parser, *args, **kwargs): if ":" in value: platform, builders = value.split(":", 1) builders = [b.strip() for b in builders.split(",")] else: platform = value builders = [platform]
print "The number on the left is how many minutes a build waited to start, rounded down" print "The number of hashes indicates how many builds waited that long"
text.append("The number on the left is how many minutes a build waited to start, rounded down") if not options.addresses: print "\n".join(text) else: import smtplib import sys zero_wait = 0 if total > 0: zero_wait = allhist.get(0,0)*100./total subject = "Wait: %i/%.2f%% (%s)" % (total, zero_wait, options.name) serve...
def add_builder(option, opt_str, value, parser, *args, **kwargs): if ":" in value: platform, builders = value.split(":", 1) builders = [b.strip() for b in builders.split(",")] else: platform = value builders = [platform]
"-m", path.join(localeSrcDir, "merged"),
"-m", mergeDir),
def compareLocales(repo, locale, l10nRepoDir, localeSrcDir, l10nIni, revision="default", merge=True): mercurial(repo, "compare-locales") update("compare-locales", revision=revision) run_cmd(["python", path.join("compare-locales", "scripts", "compare-locales"), "-m", path.join(localeSrcDir, "merged"), l10nIni, l10nRepoD...
l10nRepoDir = path.split(releaseConfig["l10nRepoPath"])
l10nRepoDir = path.split(releaseConfig["l10nRepoPath"])[-1]
def validate(options, args): err = False if not options.configfile: log.info("Must pass --configfile") sys.exit(1) releaseConfigFile = path.join("buildbot-configs", options.releaseConfig) branchConfigFile = path.join("buildbot-configs", options.configfile) branchConfigDir = path.dirname(branchConfigFile) if not path.e...
buildmaster_host = TALOS_BUILDMASTER
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
tryserverBuildsPath = TRYSERVER_DIR % {'who': options.who,
tryserverBuildsPath = TRYSERVER_DIR % {'product': options.product, 'who': options.who,
def ReleaseToTryserverBuilds(options, upload_dir, files): tryserverBuildsPath = TRYSERVER_DIR % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} tryserverBuildsUrl = TRYSERVER_URL_PATH % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} for f in files: Copy...
tryserverBuildsUrl = TRYSERVER_URL_PATH % {'who': options.who,
tryserverBuildsUrl = TRYSERVER_URL_PATH % {'product': options.product, 'who': options.who,
def ReleaseToTryserverBuilds(options, upload_dir, files): tryserverBuildsPath = TRYSERVER_DIR % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} tryserverBuildsUrl = TRYSERVER_URL_PATH % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} for f in files: Copy...
return [k for k, v in sl_platform_map.iteritems() if v == platform][0]
[matches.append(k) for k, v in sl_platform_map.iteritems() if v == platform][0] return matches
def shippedlocales2buildbot(platform): try: return [k for k, v in sl_platform_map.iteritems() if v == platform][0] except IndexError: return platform
return platform
return [platform]
def shippedlocales2buildbot(platform): try: return [k for k, v in sl_platform_map.iteritems() if v == platform][0] except IndexError: return platform
if shippedlocales2buildbot(platform) in platforms: platform_locales[shippedlocales2buildbot(platform)].append(locale)
for bb_platform in shippedlocales2buildbot(platform): if bb_platform in platforms: platform_locales[bb_platform].append(locale)
def getPlatformLocales(shipped_locales, platforms): platform_locales = {} for platform in platforms: platform_locales[platform] = [] for line in shipped_locales.splitlines(): entry = line.strip().split() locale = entry[0] if len(entry)>1: for platform in entry[1:]: if shippedlocales2buildbot(platform) in platforms: pla...
if 'linux' in slavename or 'darwin9' in slavename or \ 'xserve' in slavename or 'mac' in slavename:
if 'linux' in slavename or 'xserve' in slavename or \ 'darwin9' in slavename or 'darwin10' in slavename or \ 'mac' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
def filter_quick(unsigned, first_locale, product):
def random_locale(choices, product): """ Select a random locale from a list of product packages """ return fileInfo(random.choice(choices), product)['locale'] def random_partner(choices, locale, product): """ Select a random partner name from a list of product packages """ return fileInfo( random.choice( [f for f in c...
def filter_quick(unsigned, first_locale, product): """ Trim down the list of files to verify to only the firstLocale (en-US by default), one l10n repack (locale selected at random), one partner-repack with firstLocale (selected at random) and one partner-repack with the random locale""" # Select a locale at random that...
rand_locale = fileInfo( random.choice([f for f in unsigned if first_locale not in f and fileInfo(f, product)['leading_path']]), product)['locale'] rand_first_partner = fileInfo( random.choice([f for f in unsigned if first_locale in f]), product)['leading_path'] rand_locale_partner = fileInfo( random.choice([f for f in ...
valid_choices, skip_partners = get_valid_packages(unsigned_packages, first_locale, product) rand_locale = random_locale(valid_choices, product) if skip_partners: return filter_unsigned(unsigned_packages, product, (first_locale, rand_locale)) rand_first_partner = random_partner(unsigned_packages, first_locale, produc...
def filter_quick(unsigned, first_locale, product): """ Trim down the list of files to verify to only the firstLocale (en-US by default), one l10n repack (locale selected at random), one partner-repack with firstLocale (selected at random) and one partner-repack with the random locale""" # Select a locale at random that...
configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/staging_release-firefox-%s.py" % branch)
filename = "staging_release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filename)
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets): """Check the release_configs and l10n-changesets against tagged revisions""" if staging: configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/staging_release-firefox-%s.py" % branch) else: configs_url = make...
configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/release-firefox-%s.py" % branch)
filename = "release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filename)
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets): """Check the release_configs and l10n-changesets against tagged revisions""" if staging: configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/staging_release-firefox-%s.py" % branch) else: configs_url = make...
log.info("Comparing tagged revision %s to on-disk release_config.py ..." % configs_url) if not compare(official_configs, 'release_config.py'):
log.info("Comparing tagged revision %s to on-disk %s ..." % (configs_url, filename)) if not compare(official_configs, filename):
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets): """Check the release_configs and l10n-changesets against tagged revisions""" if staging: configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/staging_release-firefox-%s.py" % branch) else: configs_url = make...
self.frame = PrompterFrame(parent=None, id=-1, title='Prompter', version=self.version, config=self.config, suggestions=self.suggestions)
self.frame = PrompterFrame(parent=None, id=-1, title='pyprompter', version=self.version, config=self.config, suggestions=self.suggestions)
def OnInit(self): self.frame = PrompterFrame(parent=None, id=-1, title='Prompter', version=self.version, config=self.config, suggestions=self.suggestions) self.SetTopWindow(self.frame) return True
self.__ShowAboutDialogBox()
def __init__(self, parent, id, title, version, config, suggestions): wx.Frame.__init__(self, parent, id, title) self.version = version
dialog = wx.MessageDialog(self, message, "Prompter Help", wx.OK)
dialog = wx.MessageDialog(self, message, "pyprompter help", wx.OK)
def OnHelpMenuContents(self, event): message = "Sorry, help not written yet." dialog = wx.MessageDialog(self, message, "Prompter Help", wx.OK) dialog.ShowModal() dialog.Destroy()
name = 'Prompter'
name = 'pyprompter'
def __ShowAboutDialogBox(self): name = 'Prompter' version = self.version copyright = '(C) 2008 Matteo Vescovi' description = '''This program is intended as a demonstration of Presage ONLY.
dialog = wx.MessageDialog(self, message, "About Prompter", wx.OK)
dialog = wx.MessageDialog(self, message, "About pyprompter", wx.OK)
def __ShowAboutDialogBox(self): name = 'Prompter' version = self.version copyright = '(C) 2008 Matteo Vescovi' description = '''This program is intended as a demonstration of Presage ONLY.
def delete_event(widget, event, data=None):
def quit_app(widget):
def delete_event(widget, event, data=None): remap_keys(False) position = window.get_position() set_position_config(position[0], position[1]) gtk.main_quit() exit() return gtk.FALSE
window.connect("delete_event", delete_event)
window.connect("delete-event", delete_event)
def get_future_stream(self): return ''
utc=utc, tz=tz, enumerate=enumerate, key=key)
utc=utc, tz=tz, enumerate=enumerate, edition=edition)
def admin_classify(edition): if request.method == 'GET': tz = timezone(app.config['TIMEZONE']) return render_template('classify.html', participants=Participant.query.filter_by(edition=edition), utc=utc, tz=tz, enumerate=enumerate, key=key) elif request.method == 'POST': p = Participant.query.get(request.form['id']) if ...
return redirect(url_for('admin_approve', key=key), code=303)
return redirect(url_for('admin_approve', edition=edition), code=303)
def admin_approve(edition): if request.method == 'GET': tz = timezone(app.config['TIMEZONE']) return render_template('approve.html', participants=Participant.query.filter_by(edition=edition), utc=utc, tz=tz, enumerate=enumerate, edition=edition) elif request.method == 'POST': p = Participant.query.get(request.form['id'...
if request.method == 'GET':
if request.method == 'GET' and 'email' not in request.args: return render_template('venuereg.html', edition=edition) elif request.method =='POST' or 'email' in request.args:
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid)
formid = 'venueregemail' else: formid = request.form.get('form.id')
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
email = request.form.get('email', email)
email = request.values.get('email')
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
p = Participant.query.filter_by(email=email).first()
p = Participant.query.filter_by(edition=edition, email=email).first()
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return redirect(url_for('admin_venue', key=key), code=303)
return redirect(url_for('admin_venue', edition=edition), code=303)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return render_template('venueregdetails.html', key=key, p=p)
return render_template('venueregdetails.html', edition=edition, p=p)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return render_template('venueregnew.html', key=key, regform=regform)
regform.edition.data = edition return render_template('venueregnew.html', edition=edition, regform=regform)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return redirect(url_for('admin_venueform', key=key), code=303)
return redirect(url_for('admin_venue', edition=edition), code=303)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
makeuser(participant)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return render_template('venueregsuccess.html', key=key, p=participant)
return render_template('venueregsuccess.html', edition=edition, p=participant)
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
return render_template('venueregform.html', key=key,
return render_template('venueregform.html', edition=edition,
def admin_venue(edition): if request.method == 'GET': if 'email' in request.args: return admin_venue(key, 'venueregemail', request.args['email']) else: return render_template('venuereg.html', key=key) elif request.method =='POST': formid = request.form.get('form.id', formid) if formid == 'venueregemail': email = reques...
key = TextField('Access Key', validators=[Required()])
key = PasswordField('Access Key', validators=[Required()])
def validate_edition(self, field): if field.data == u'bangalore': raise ValidationError, "Registrations are closed for this city"
@app.route('/rsvp') def rsvp():
@app.route('/rsvp/<edition>') def rsvp(edition):
def logout(): g.user = None del session['userid'] return redirect(url_for('index'), code=303)
user.participant.rsvp = choice
participant = Participant.query.filter_by(user=user, edition=edition).first() if participant: participant.rsvp = choice else: flash(u"You did not register for this edition, %s." % user.fullname, 'error') return redirect(url_for('index'), code=303)
def rsvp(): key = request.args.get('key') choice = request.args.get('rsvp') if key is None: flash(u"You need an access key to RSVP.", 'error') return redirect(url_for('index'), code=303) if choice not in ['Y', 'N', 'M']: flash(u"You need to RSVP with Yes, No or Maybe: Y, N or M.", 'error') return redirect(url_for('inde...
flash(u"Yay! So glad you will be joining us.", 'info')
flash(u"Yay! So glad you will be joining us, %s." % user.fullname , 'info')
def rsvp(): key = request.args.get('key') choice = request.args.get('rsvp') if key is None: flash(u"You need an access key to RSVP.", 'error') return redirect(url_for('index'), code=303) if choice not in ['Y', 'N', 'M']: flash(u"You need to RSVP with Yes, No or Maybe: Y, N or M.", 'error') return redirect(url_for('inde...
flash(u"Sorry you can't make it. Hope you’ll join us next time.", 'error')
flash(u"Sorry you can't make it, %s. Hope you’ll join us next time." % user.fullname, 'error')
def rsvp(): key = request.args.get('key') choice = request.args.get('rsvp') if key is None: flash(u"You need an access key to RSVP.", 'error') return redirect(url_for('index'), code=303) if choice not in ['Y', 'N', 'M']: flash(u"You need to RSVP with Yes, No or Maybe: Y, N or M.", 'error') return redirect(url_for('inde...
flash(u"We recorded you as Maybe Attending. When you know better, could you select Yes or No?", 'info')
flash(u"We recorded you as Maybe Attending, %s. When you know better, could you select Yes or No?" % user.fullname, 'info')
def rsvp(): key = request.args.get('key') choice = request.args.get('rsvp') if key is None: flash(u"You need an access key to RSVP.", 'error') return redirect(url_for('index'), code=303) if choice not in ['Y', 'N', 'M']: flash(u"You need to RSVP with Yes, No or Maybe: Y, N or M.", 'error') return redirect(url_for('inde...
for pd in Participant.query.filter_by(edition=p.edition, email=p.email): if pd.id != p.id: if p.user:
for other in Participant.query.filter_by(edition=p.edition, email=p.email): if other.id != p.id: if other.user:
def admin_approve(edition): if request.method == 'GET': tz = timezone(app.config['TIMEZONE']) return render_template('approve.html', participants=Participant.query.filter_by(edition=edition), utc=utc, tz=tz, enumerate=enumerate, edition=edition) elif request.method == 'POST': p = Participant.query.get(request.form['id'...
f_all = 100.0 / c_all f_present = 100.0 / c_present
if c_all != 0: f_all = 100.0 / c_all else: f_all = 1 if c_present != 0: f_present = 100.0 / c_present else: f_present = 1
def admin_stats(edition): # Chart sizes CHART_X = 800 CHART_Y = 370 all_browsers = defaultdict(int) all_brver = defaultdict(int) all_platforms = defaultdict(int) present_browsers = defaultdict(int) present_brver = defaultdict(int) present_platforms = defaultdict(int) c_all = 0 c_present = 0 for p in Participant.que...
minLeadZeroCount = 0 leadZeroCounts = []
def main(): global VERBOSE_OUTPUT_ENABLED # seedq holds addresses of machines containing the file # Each element is a tuple of the form ([user@]host, file) seedq = Queue.Queue() # targetq holds addresses of machines that need the file # Each element is a tuple of the form ([user@]host, filedest) targetq = TargetQueue(...
leadZeroCounts.append(len(re.search("0*(?=.*)", first).group(0))) leadZeroCounts.append(len(re.search("0*(?=.*)", last).group(0))) if leadZeroCounts: minLeadZeroCount = min(leadZeroCounts) basehost = basehost + "0" * minLeadZeroCount for first, last in splitRanges: first = first[minLeadZeroCount:] last = last[minLeadZ...
def main(): global VERBOSE_OUTPUT_ENABLED # seedq holds addresses of machines containing the file # Each element is a tuple of the form ([user@]host, file) seedq = Queue.Queue() # targetq holds addresses of machines that need the file # Each element is a tuple of the form ([user@]host, filedest) targetq = TargetQueue(...
host = basehost + str(num)
leadingZeros = len(first) - len(str(num)) host = basehost + "0"*leadingZeros + str(num)
def main(): global VERBOSE_OUTPUT_ENABLED # seedq holds addresses of machines containing the file # Each element is a tuple of the form ([user@]host, file) seedq = Queue.Queue() # targetq holds addresses of machines that need the file # Each element is a tuple of the form ([user@]host, filedest) targetq = TargetQueue(...
first = int(rng.split("-")[0]) last = int(rng.split("-")[1]) for num in range(first, last+1):
first = rng.split("-")[0] last = rng.split("-")[1] splitRanges.append((first, last)) leadZeroCounts.append(len(re.search("0*(?=.*)", first).group(0))) leadZeroCounts.append(len(re.search("0*(?=.*)", last).group(0))) if leadZeroCounts: minLeadZeroCount = min(leadZeroCounts) basehost = basehost + "0" * minLeadZeroCount ...
def main(): global VERBOSE_OUTPUT_ENABLED # seedq holds addresses of machines containing the file # Each element is a tuple of the form ([user@]host, file) seedq = Queue.Queue() # targetq holds addresses of machines that need the file # Each element is a tuple of the form ([user@]host, filedest) targetq = TargetQueue(...
print usage
def main(): global VERBOSE_OUTPUT_ENABLED # seedq holds addresses of machines containing the file # Each element is a tuple of the form ([user@]host, file) seedq = Queue.Queue() # targetq holds addresses of machines that need the file # Each element is a tuple of the form ([user@]host, filedest) targetq = TargetQueue(...
for key,val in sys.modules.items(): print key, ":", val
def start(argv, lang): '''The orio.main.starting procedure'''
s += tstmt_s[tstmt_s.index('{'):]
if tstmt_s.count('{') > 0: s += tstmt_s[tstmt_s.index('{'):] else: s += tstmt_s
def generate(self, tnode, indent = ' ', extra_indent = ' ', doloop_inc = False): '''To generate code that corresponds to the given AST'''
double getClock() { long sec; double secx; struct tms realbuf; times(&realbuf); secx = ( realbuf.tms_stime + realbuf.tms_utime ) / (float) CLOCKS_PER_SEC; return ((double) secx); }
#ifdef __APPLE__
} double getClock() { long sec; double secx; struct tms realbuf; times(&realbuf); secx = ( realbuf.tms_stime + realbuf.tms_utime ) / (float) CLOCKS_PER_SEC; return ((double) secx);
#ifdef __APPLE__
long sec; double secx; struct tms realbuf; times(&realbuf); secx = ( realbuf.tms_stime + realbuf.tms_utime ) / (float) CLOCKS_PER_SEC; return ((double) secx);
struct timespec ts; /* CLOCK_PROCESS_CPUTIME_ID */ if (clock_get_time(CLOCK_REALTIME, &ts) != 0) return -1; return (double)(ts.tv_sec + ts.tv_nsec / 10.e-9);
#ifdef BGP_COUNTER
if 'time_limit' in params.keys(): self.time_limit = params['time_limit']
if 'search_time_limit' in params.keys(): self.time_limit = params['search_time_limit']
def __init__(self, params): '''To instantiate a search engine'''
if 'total_runs' in params.keys(): self.total_runs = params['total_runs']
if 'search_total_runs' in params.keys(): self.total_runs = params['search_total_runs']
def __init__(self, params): '''To instantiate a search engine'''
from random import uniform, randint
try: from random import randint except: from ...random import randint
def getRandomInt(self, lbound, ubound): '''To generate a random integer N such that lbound <= N <= ubound''' from random import uniform, randint if lbound > ubound: print ('internal error: the lower bound of genRandomInt must not be ' + 'greater than the upper bound') sys.exit() return randint(lbound, ubound)
real(double) :: orio_t_start, orio_t_end, orio_t_total = 0
real(double) :: orio_t_start, orio_t_end, orio_min_time, orio_delta_time
typedef struct { int testid; char coord[1024]; double tm;
orio_t_start = getClock()
call cpu_time(orio_t_start)
typedef struct { int testid; char coord[1024]; double tm;
orio_t_end = getClock() orio_t_total = orio_t_total + orio_t_end - orio_t_start
call cpu_time(orio_t_end) orio_delta_time = orio_t_end - orio_t_start if (orio_delta_time < orio_min_time) then orio_min_time = orio_delta_time end if
typedef struct { int testid; char coord[1024]; double tm;
orio_t_total = orio_t_total / REPS write(*,"(A,ES20.13,A)",advance="no") "{'!@ coordinate @!' : ", orio_t_total, "}"
write(*,"(A,ES20.13,A)",advance="no") "{'!@ coordinate @!' : ", orio_delta_time, "}"
typedef struct { int testid; char coord[1024]; double tm;
if not os.path.islink(episode_path_old) and os.path.isfile(self.episode_path_old):
if not os.path.islink(self.episode_path_old) and os.path.isfile(self.episode_path_old):
def do_move(self): if not os.path.isdir(self.episode_dir_new): os.makedirs(self.episode_dir_new) if not os.path.islink(episode_path_old) and os.path.isfile(self.episode_path_old): shutil.move(self.episode_path_old, self.episode_path_new) os.symlink(self.episode_path_new, self.episode_path_old)
except AttributeError:
except:
def usage(): print "sofabuddy.py [options]\n" print 'Example' print '\tsofabuddy.py -d "/media/downloads" -h "192.168.1.1"\n' print "Options" print "\t-?, --help\t\t\tWill bring up this message" print "\t-d, --download_dir\t\tOverride the default download directory" print "\t-n, --nuke_dir\t\t\tOverride the default nuk...
self.episode_title = re.sub('/', '-', self.episode.title)
self.episode_title = self.episode.title.encode("ascii", "replace") self.episode_title = re.sub('/', '-', self.episode_title)
def __init__(self, showname, season_no, episode_no): self.show = tvrage.api.Show(showname) self.show_name = self.show.name self.episode = self.show.season(int(season_no)).episode(int(episode_no)) self.episode_title = re.sub('/', '-', self.episode.title) self.episode_title = re.sub('\?', '-', self.episode_title)
logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + self.show_name + '\" Episode \"' + self.season_no + 'x' + self.episode_no + ' ' + self.episode_title '\" Quality \"' + self.quality + '\"'
logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + self.show_name + '\" Episode \"' + self.season_no + 'x' + self.episode_no + ' ' + self.episode_title + '\" Quality \"' + self.quality + '\"'
def do_move(self): if not os.path.isdir(self.episode_dir_new): os.makedirs(self.episode_dir_new) if not os.path.islink(self.episode_path_old): if os.path.isfile(self.episode_path_old): shutil.move(self.episode_path_old, self.episode_path_new) logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + sel...
os.renames(origfilename, newpath)
os.makedirs(sdir[0]) shutil.move(origfilename, newpath)
def find_relink(fullnukepath, nukemoveto): for x in os.listdir(download_dir): linkpath = os.path.join(download_dir, x) if os.path.islink(linkpath): if fullnukepath == os.readlink(linkpath): os.unlink(linkpath) os.symlink(nukemoveto, linkpath) break
os.renames(fullnukepath, nukemoveto)
shutil.move(fullnukepath, nukemoveto)
def find_relink(fullnukepath, nukemoveto): for x in os.listdir(download_dir): linkpath = os.path.join(download_dir, x) if os.path.islink(linkpath): if fullnukepath == os.readlink(linkpath): os.unlink(linkpath) os.symlink(nukemoveto, linkpath) break
os.renames(origfilename, nukemoveorigto)
shutil.move(origfilename, nukemoveorigto)
def find_relink(fullnukepath, nukemoveto): for x in os.listdir(download_dir): linkpath = os.path.join(download_dir, x) if os.path.islink(linkpath): if fullnukepath == os.readlink(linkpath): os.unlink(linkpath) os.symlink(nukemoveto, linkpath) break
os.renames(origfilename, newpath)
shutil.move(origfilename, newpath)
def find_relink(fullnukepath, nukemoveto): for x in os.listdir(download_dir): linkpath = os.path.join(download_dir, x) if os.path.islink(linkpath): if fullnukepath == os.readlink(linkpath): os.unlink(linkpath) os.symlink(nukemoveto, linkpath) break
logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + self.show_name + '\" Episode \"' + self.season_no + 'x' + self.episode_no + '\" Quality \"'
logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + self.show_name + '\" Episode \"' + self.season_no + 'x' + self.episode_no + '\" Quality \"' + self.quality + '\"'
def do_move(self): if not os.path.isdir(self.episode_dir_new): os.makedirs(self.episode_dir_new) if not os.path.islink(self.episode_path_old): if os.path.isfile(self.episode_path_old): shutil.move(self.episode_path_old, self.episode_path_new) logMessage = 'Processed \"' + self.episode_path_old + '\" Show Name \"' + sel...