rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
pkglist ]) | ] + pkglist) | def remove_packages(pkglist): proc = subprocess.call([ 'emerge', '--unmerge', pkglist ]) return proc == os.EX_OK |
pass | def get_trac_bugs(pkgatom): query_params = [ ('format', 'csv'), ('component', 'ebuilds'), ('summary', '~' + pkgatom), ('col', [ 'id', 'summary', 'status', ]) ] query = 'query?' + urllib.urlencode(query_params, True) results = [] try: fp = csv.reader(urllib2.urlopen(TRAC_URL + query)) result = list(fp) keys = result[0] ... | def bug_report(pkgatom): pass |
sys.exit(main(sys.argv)) | bug_report('g-octave/image-1.0.0') | def main(argv): fetch.check_db_cache() conf = config.Config() # creating the overlay overlay.create_overlay() desc_tree = description_tree.DescriptionTree() # creating the ebuilds for all the packages for pkgatom in desc_tree.packages(): e = ebuild.Ebuild(pkgatom) try: e.create(nodeps=True) except: pass installed_p... |
return self.version_compare(tmp) | return tmp[-1] | def latest_version(self, pkgname): tmp = self.package_versions(pkgname) return self.version_compare(tmp) |
max = '0' for version in versions: if vercmp(max, version) < 0: max = version return max | tmp = list(versions[:]) print tmp tmp.sort(vercmp) return tmp[-1] | def version_compare(self, versions): max = '0' for version in versions: if vercmp(max, version) < 0: max = version return max |
sraise TracError('Failed to parse FORM_TOKEN.') | raise TracError('Failed to parse FORM_TOKEN.') | def _get_token(self): code, html = self.request(self.url + 'query') match = re.search(r'__FORM_TOKEN"[^>]+value="([^"]+)"', html) if match != None: return match.group(1), self.user_autenticated(html) else: sraise TracError('Failed to parse FORM_TOKEN.') |
('/usr/share', ['share/g-octave.eclass']), | ('/usr/share/g-octave', ['share/g-octave.eclass']), | def run(self): _clean.run(self) if self.all: for i in outputs: my_path = os.path.join(current_dir, i) if os.path.exists(my_path): print 'removing %s' % my_path os.remove(my_path) |
self.assertEqual(self._empty_cfg.db_mirror, 'http://g-octave.rafaelmartins.eng.br/distfiles/db/') | self.assertEqual(self._empty_cfg.db_mirror, 'http://soc.dev.gentoo.org/~rafaelmartins/g-octave/db/') | def test_empty_config_attributes(self): self.assertEqual(self._empty_cfg.db, '/var/cache/g-octave') self.assertEqual(self._empty_cfg.overlay, '/usr/local/portage/g-octave') self.assertEqual(self._empty_cfg.categories, 'main,extra,language') self.assertEqual(self._empty_cfg.db_mirror, 'http://g-octave.rafaelmartins.eng.... |
for patch in os.listdir(os.path.join(self._config.db, 'patches')): | for patch in os.listdir(patches_dir): | def __search_patches(self): tmp = [] for patch in os.listdir(os.path.join(self._config.db, 'patches')): if re.match(r'^([0-9]{3})_%s-%s' % (self.pkgname, self.version), patch): tmp.append(patch) tmp.sort() return tmp |
'keywords': self.__scm and '' or self.__keywords(accept_keywords), | 'keywords': self.__keywords(accept_keywords), | def __create(self, accept_keywords=None, manifest=True): ebuild_path = os.path.join(self._config.overlay, 'g-octave', self.pkgname) ebuild_file = os.path.join(ebuild_path, '%s-%s.ebuild' % (self.pkgname, self.version)) if not os.path.exists(ebuild_path): os.makedirs(ebuild_path, 0o755) ebuild = """\ |
fp = open(ebuild_file, 'w') fp.write(ebuild % vars) fp.close() | with open(ebuild_file, 'w') as fp: fp.write(ebuild % vars) | def __create(self, accept_keywords=None, manifest=True): ebuild_path = os.path.join(self._config.overlay, 'g-octave', self.pkgname) ebuild_file = os.path.join(ebuild_path, '%s-%s.ebuild' % (self.pkgname, self.version)) if not os.path.exists(ebuild_path): os.makedirs(ebuild_path, 0o755) ebuild = """\ |
packages = ['g_octave', 'g_octave.tinderbox'], | packages = ['g_octave'], | def run(self): _clean.run(self) if self.all: for i in outputs: my_path = os.path.join(current_dir, i) if os.path.exists(my_path): print 'removing %s' % my_path os.remove(my_path) |
self.pkg_manager.check_overlay(config.overlay, out): | if not self.pkg_manager.check_overlay(config.overlay, out): | def _init_pkg_manager(self): log.info('Initializing Package Manager.') pm = get_by_name(config.package_manager) if pm is None: raise GOctaveError('Invalid package manager: %s' % config.package_manager) self.pkg_manager = pm(self.args.ask, self.args.verbose, self.args.pretend, self.args.oneshot, not self.args.colors) #... |
return html.find('<a href="/logout">') != -1 | return html.find('logout">') != -1 | def user_autenticated(self, html): return html.find('<a href="/logout">') != -1 |
if upload: self.curl.setopt(pycurl.HTTPHEADER, ['Expect:']) | self.curl.setopt(pycurl.HTTPHEADER, ['Expect:']) | def request(self, url, params=None, upload=False): self.curl.setopt(pycurl.URL, url) if params is not None: self.curl.setopt(pycurl.POST, 1) self.curl.setopt(pycurl.HTTPPOST, params) if upload: self.curl.setopt(pycurl.HTTPHEADER, ['Expect:']) buffer = io.StringIO() self.curl.setopt(pycurl.WRITEFUNCTION, buffer.write) t... |
e = ebuild.Ebuild(pkgatom) | e = ebuild.Ebuild(pkgatom, pkg_manager=pkg_manager) | def main(argv): global trac fetch.check_db_cache() conf = config.Config() out.ebegin('Trac - user autentication') try: trac = Trac(conf.trac_user, conf.trac_passwd) except TracError as err: out.eend(1) print(err, file=sys.stderr) else: out.eend(0) # creating the overlay overlay.create_overlay() desc_tree = descript... |
my_config = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'etc', 'g-octave.cfg.devel' ) if config_file is not None: self._config_file = config_file elif os.path.exists(my_config): self._config_file = my_config else: self._config_file = '/etc/g-octave.cfg' | parsed_files = self._config.read([ os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'etc', 'g-octave.cfg' ), config_file or '/etc/g-octave.cfg', ]) | def __init__(self, fetch_phase=False, config_file=None, create_dirs=True): # Config Parser self._config = configparser.ConfigParser(self._defaults) self._fetch_phase = fetch_phase my_config = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'etc', 'g-octave.cfg.devel' ) if config_file is not None: sel... |
self._config.read(self._config_file) | if len(parsed_files) == 0: raise ConfigException('Configuration file not found.') | def __init__(self, fetch_phase=False, config_file=None, create_dirs=True): # Config Parser self._config = configparser.ConfigParser(self._defaults) self._fetch_phase = fetch_phase my_config = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'etc', 'g-octave.cfg.devel' ) if config_file is not None: sel... |
print tmp | def version_compare(self, versions): tmp = list(versions[:]) print tmp tmp.sort(vercmp) return tmp[-1] | |
self.assertEqual(self._empty_cfg.db_mirror, 'http://soc.dev.gentoo.org/~rafaelmartins/g-octave/db/') | self.assertEqual(self._empty_cfg.db_mirror, 'github://rafaelmartins/g-octave-db-test') | def test_empty_config_attributes(self): self.assertEqual(self._empty_cfg.db, '/var/cache/g-octave') self.assertEqual(self._empty_cfg.overlay, '/usr/local/portage/g-octave') self.assertEqual(self._empty_cfg.categories, 'main,extra,language') self.assertEqual(self._empty_cfg.db_mirror, 'http://soc.dev.gentoo.org/~rafaelm... |
new_license = self._config.licenses.get(self._desc['license']) | try: new_license = self._config.licenses.get(self._desc['license']) except: new_license = '' | def __init__(self, file, conf=None, parse_sysreq=True): log.info('Parsing file: %s' % file) if conf is None: conf = Config() self._config = conf |
if int(b) < 0 or int(b) > 0x7: | if int(b) < 0 or int(b) > 0x1F: | def __init__(self, devdict, groupdict, pdu_text): |
self.knx.parseVbusOutput(lineNo, timestamp, pdu) | try: self.knx.parseVbusOutput(lineNo, timestamp, pdu) except KnxParseException: print "Failed: %s: %s" %(lineNo, pdu) sys.exit(1) | def __init__(self, devicesfilename, groupaddrfilename, infilenames, dumpGAtable, types, flanksOnly, tail): |
plotData = [] | plotData = { "data" : [], "params" : "", "title" : self.addrInfo["sub"], "style" : "linespoints" } | def preparePlotData(self, basetime): |
plotData.append([timedata, val]) return plotData, self.addrInfo["sub"] | plotData["data"].append([timedata, val]) if self.type in ["temp", "%"]: smooth = "smooth unique" else: smooth = "" plotData["params"] = '1:2 %s' % smooth return plotData | def preparePlotData(self, basetime): |
plotData = {} | def plotStreams(self, groupAddrs, genImage=""): | |
plotData[ga], title = self.knxAddrStream[ga].preparePlotData(self.basetime) if len(plotData[ga]) > 0: | plotData = self.knxAddrStream[ga].preparePlotData(self.basetime) if len(plotData["data"]) > 0: | def plotStreams(self, groupAddrs, genImage=""): |
gdata.append(Gnuplot.Data( plotData[ga], using='1:2 smooth unique', title=title.encode("utf-8") )) | kwarg = { "using" : plotData["params"], "title" : plotData["title"].encode("utf-8"), "with" : plotData["style"] } gdata.append(Gnuplot.Data( plotData["data"], **kwarg )) | def plotStreams(self, groupAddrs, genImage=""): |
plotter = Gnuplot.Gnuplot() | plotter = Gnuplot.Gnuplot(debug=1) | def plotStreams(self, groupAddrs, genImage=""): |
plotter('set data style linespoints') | def plotStreams(self, groupAddrs, genImage=""): | |
plotter('set style data linespoints') | def plotStreams(self, groupAddrs, genImage=""): | |
if t not in ["temp", "time", "%"]: | if t not in ["onoff", "temp", "time", "%"]: | def floatable(str): try: float(str) return True except ValueError: return False |
"be either 'temp', 'time', or '%%', not: %s" %t) | "be either 'onoff', 'temp', 'time', or '%%', not: %s" %t) | def floatable(str): try: float(str) return True except ValueError: return False |
self.errorOut("error, value is not 16bit: %s" %val) | self.errorExit("error, value is not 16bit: %s" %val) | def val2temp(self, val): if len(val) != 5: self.errorOut("error, value is not 16bit: %s" %val) |
self.errorOut("error, value is not 8bit: %s" %val) | self.errorExit("error, value is not 8bit: %s" %val) | def val2percent(self, val): if len(val) != 2: self.errorOut("error, value is not 8bit: %s" %val) |
self.errorOut("error, value is not 24bit: %s" %val) | self.errorExit("error, value is not 24bit: %s" %val) | def val2time(self, val): |
self.errorOut("to long sender: %s(%d)" %(sender, len(sender))) | self.errorExit("to long sender: %s(%d)" %(sender, len(sender))) | def printTelegrams(self, printseq): |
self.errorOut("to long receiver: %s(%d)" %(receiver, len(receiver))) | self.errorExit("to long receiver: %s(%d)" %(receiver, len(receiver))) | def printTelegrams(self, printseq): |
def plotStreams(self, groupAddrs): | def plotStreams(self, groupAddrs, genImage=""): | def plotStreams(self, groupAddrs): |
using='1:2 smooth unique', title=title )) | using='1:2 smooth unique', title=title.encode("utf-8") )) | def plotStreams(self, groupAddrs): |
raw_input('Please press return to exit...\n') | if genImage != "": plotter('set terminal png color') plotter('set output "%s"' %genImage) plotter.replot() else: raw_input('Please press return to exit...\n') | def plotStreams(self, groupAddrs): |
dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): | dumpGAtable, groupAddrs, types, flanksOnly, tail, plot, plotImage=""): | def readParseAndPrint(devicesfilename, groupaddrfilename, infilenames, dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): # # Read in all the files... # lines = [] for infilename in infilenames: try: inf = open(infilename, "r") except IOError: print "%s: Unable to open file: %s" %(sys.argv[0], infilename) sys.ex... |
knx.plotStreams(groupAddrs) | knx.plotStreams(groupAddrs, plotImage) | def readParseAndPrint(devicesfilename, groupaddrfilename, infilenames, dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): # # Read in all the files... # lines = [] for infilename in infilenames: try: inf = open(infilename, "r") except IOError: print "%s: Unable to open file: %s" %(sys.argv[0], infilename) sys.ex... |
op.add_option("-g", "--group-address", dest="groupAddrs", type="string", action="append", help="print only this group address(es) (can be repeated)", metavar="<GROUP ADDR>") op.add_option("-t", "--type", dest="types", action="append", choices=["%", "time", "temp"], help="convert value to specified type", metavar="<TYP... | op.add_option("-g", "--group-address", action="callback", callback=groupAddr_callback, help="Specify which group address(es) to print, and optionally " "what type to convert the value to") | def readParseAndPrint(devicesfilename, groupaddrfilename, infilenames, dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): # # Read in all the files... # lines = [] for infilename in infilenames: try: inf = open(infilename, "r") except IOError: print "%s: Unable to open file: %s" %(sys.argv[0], infilename) sys.ex... |
types = {} if options.groupAddrs != None: idx = 0 for g in options.groupAddrs: try: types[g] = options.types[idx] except: break idx += 1 | def readParseAndPrint(devicesfilename, groupaddrfilename, infilenames, dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): # # Read in all the files... # lines = [] for infilename in infilenames: try: inf = open(infilename, "r") except IOError: print "%s: Unable to open file: %s" %(sys.argv[0], infilename) sys.ex... | |
options.groupAddrs, types, options.flanksOnly, | groupAddrs, types, options.flanksOnly, | def readParseAndPrint(devicesfilename, groupaddrfilename, infilenames, dumpGAtable, groupAddrs, types, flanksOnly, tail, plot): # # Read in all the files... # lines = [] for infilename in infilenames: try: inf = open(infilename, "r") except IOError: print "%s: Unable to open file: %s" %(sys.argv[0], infilename) sys.ex... |
def val2temp(self, val): | def val2tempOld(self, val): | def val2temp(self, val): if len(val) != 5: self.errorExit("error, value is not 16bit: %s" %val) |
smooth = "smooth unique" | plotData["smoothing"] = " smooth unique" | def preparePlotData(self, basetime): |
smooth = "" plotData["params"] = '1:2 %s' % smooth | plotData["smoothing"] = "" plotData["params"] = '1:2 ' | def preparePlotData(self, basetime): |
"with" : plotData["style"] } | "with" : plotData["style"] + plotData["smoothing"] } | def plotStreams(self, groupAddrs, genImage=""): |
plotter('set style fill solid') plotter('set key bottom left') | def plotStreams(self, groupAddrs, genImage=""): | |
s = ute() | s = ute(None) | def etg2(req): if inModPython: imgfile = "/tmp/2etgtemp.png" else: imgfile = "" gAddrs = ["2/3/0", "2/3/1", "2/3/2", "2/3/3", "2/3/4"] types = {} for g in gAddrs: types[g] = "temp" return _doIt(req, gAddrs, types, imgfile) |
return r"""\begin{art}%s %s \end{art} """ % (self.title, c_text) | title = self.title return r""" \theoremstyle{definition} \newtheorem*{%(title)s}{%(title)s} \begin{%(title)s} %(text)s \end{%(title)s} """ % {"title": title, "text": c_text} | def to_LaTeX(self, children, ctx): c_text = '' if children is None else ''.join(children) return r"""\begin{art}%s %s \end{art} """ % (self.title, c_text) |
return self._emptyStash() | for line in self._emptyStash(): yield line yield self.token | def _lexEnd(self): return self._emptyStash() |
self.exif_date = None | self.reliable_date = None | def __init__(self, path, album): MediaFile.__init__(self, path, album) |
self.exif_date = exif.get_date() | self.reliable_date = exif.get_date() | def info(self): if self.broken: return None try: exif = metadata.ImageInfoTags(self.path) except IOError: exif = None self.broken = True else: self.exif_date = exif.get_date() self.__date_probed = True return exif |
def has_exif_date(self): | def has_reliable_date(self): | def has_exif_date(self): if not self.__date_probed: self.info() |
if self.exif_date: | if self.reliable_date: | def has_exif_date(self): if not self.__date_probed: self.info() |
if self.exif_date: self.date_taken = self.exif_date | if self.reliable_date: self.date_taken = self.reliable_date | def get_date_taken(self): if not self.__date_probed: self.info() |
self.date_taken = datetime.datetime.fromtimestamp(self.get_mtime()) | self.date_taken = self.get_datetime() | def get_date_taken(self): if not self.__date_probed: self.info() |
def compare_date_taken(self, other_img): date1 = time.mktime(self.get_date_taken().timetuple()) date2 = time.mktime(other_img.get_date_taken().timetuple()) delta = date1 - date2 return int(delta) def compare_no_exif_date(self, other_img): if self.has_exif_date(): return 1 else: return -1 def compare_to_sort(self, ot... | def get_date_taken(self): if not self.__date_probed: self.info() | |
def has_exif_date(self): | def has_reliable_date(self): | def has_exif_date(self): return False |
def compare_to_sort(self, other_media): return self.compare_filename(other_media) | def get_date_taken(self): return self.get_datetime() | def compare_to_sort(self, other_media): return self.compare_filename(other_media) |
self.log(_("(%s) and childs have no knonw medias, skipped") | self.log(_("(%s) and childs have no known medias, skipped") | def generate(self, dest_dir, pub_url=None, check_all_dirs=False, clean_dest=False): sane_dest_dir = os.path.abspath(dest_dir) |
try: str(value).decode('utf-8') except UnicodeDecodeError: problematic_vars.append(key) | if type(value) is not unicode: try: str(value).decode('utf-8') except UnicodeDecodeError: problematic_vars.append(key) | def dump(self, values, dest): self.__complement_values(values) |
f.write('Album name "%s"\n' % self.source_dir.human_name); | f.write('Album name "%s"\n'\ % self.source_dir.human_name.encode('utf-8')); | def generate(self, md): ''' Generates new metadata file with default values. ''' |
f.write('Album image identifier "%s"\n' % md['album_picture']); | f.write('Album image identifier "%s"\n'\ % md['album_picture'].encode('utf-8')); | def generate(self, md): ''' Generates new metadata file with default values. ''' |
mtime = FileSimpleDependency.get_mtime(self) | mtime = super(FileMakeObject, self).get_mtime() | def get_mtime(self): try: mtime = FileSimpleDependency.get_mtime(self) except OSError: # Let's tell that the file is very old, older than 1.1.1970 if it # does not exist. return -1 return mtime |
return -1 | mtime = super(FileSimpleDependency, self).get_mtime() | def get_mtime(self): try: mtime = FileSimpleDependency.get_mtime(self) except OSError: # Let's tell that the file is very old, older than 1.1.1970 if it # does not exist. return -1 return mtime |
if not self.original: self.original = genfile.VideoOriginal(self.webgal, self.media) return self.original | return self.get_resized("0x0") | def get_original(self): if not self.original: self.original = genfile.VideoOriginal(self.webgal, self.media) return self.original |
self.log(_(" SKIPPED because metadata exists.")) | self.album.log(_(" SKIPPED because metadata exists.")) | def build(self): md = DirectoryMetadata(self.source_dir) |
self.log(_(" SKIPPED because directory does not contain images.")) | self.album.log(_(" SKIPPED because directory does not contain images.")) | def build(self): md = DirectoryMetadata(self.source_dir) |
self.item_template = self.album.templates['feeditem.thtml'] | self.item_template = self.album.tpl_loader.load('feeditem.thtml') | def __init__(self, album, dest_dir, pub_url): self.album = album self.pub_url = pub_url if not self.pub_url: self.pub_url = 'http://example.com' if not self.pub_url.endswith('/'): self.pub_url = self.pub_url + '/' |
self.__generate(values).render(method=self.serialization_method, out=page, encoding='utf-8') page.close() | try: self.__generate(values).render(method=self.serialization_method, out=page, encoding='utf-8') except UnicodeDecodeError: problematic_vars = [] for key, value in values.items(): try: str(value).decode('utf-8') except UnicodeDecodeError: problematic_vars.append(key) print 'Problematic template vars : %s' % ', '.join(... | def dump(self, values, dest): self.__complement_values(values) |
model = str(self._metadata['Exif.Image.Model']).strip() | model = self.get_tag_value('Exif.Image.Model').strip() | def get_camera_name(self): ''' Gets vendor and model name from EXIF and tries to construct camera name out of this. This is a bit fuzzy, because diferent vendors put different information to both tags. ''' try: model = str(self._metadata['Exif.Image.Model']).strip() # Terminate string at \x00 pos = model.find('\x00') i... |
vendor = str(self._metadata['Exif.Image.Make']).strip() | vendor = self.get_tag_value('Exif.Image.Make').strip() | def get_camera_name(self): ''' Gets vendor and model name from EXIF and tries to construct camera name out of this. This is a bit fuzzy, because diferent vendors put different information to both tags. ''' try: model = str(self._metadata['Exif.Image.Model']).strip() # Terminate string at \x00 pos = model.find('\x00') i... |
if self.clean_dest and not os.path.isdir(rmv_candidate): | if self.clean_dest and not os.path.isdir(dest_file): | def build(self): # Check dest for junk files extra_files = [] if self.source_dir.is_album_root(): extra_files.append(os.path.join(self.path, DEST_SHARED_DIRECTORY_NAME)) |
except Exception as ex: | except Exception: | def __init__(self, options): """ Initialization function. @param options: A set of options in the form of an options parser Required options: config - location of configuration File """ |
raise ex | raise Exception("Unable to get the condor configuration. If no condor configuration, assuming condor is not available. Exiting...") | def __init__(self, options): """ Initialization function. @param options: A set of options in the form of an options parser Required options: config - location of configuration File """ |
if self.config.get("general", "FLOCK_FROM"): | if self.config.has_option("general", "FLOCK_FROM"): | def Start(self): """ Start the Factory """ |
self.DeAdvertiseAds(sorted_offline[:len(new_ads)]) | self.DeAdvertiseAds(sorted_offline[:len(offline_ads) - (self.numclassads - len(new_ads))]) | def Update(self): # Check last match times for an recent match matched_sites = self.GetLastMatchedSites() # Check for expired classads, delete them (OFFLINE_EXPIRE_ADS_AFTER should do this) #self.RemoveExpiredClassads() # Check for new startd's reporting, save them while deleting the older ones (max numclassads) for... |
str_query += "Requirements = Name == \"%s\"\n\n" % ad["Name"] | str_query += "Requirements = Name == %s\n\n" % ad["Name"] | def DeAdvertiseAds(self, ads): """ DeAdvertise ads to the collector @param ads: List of ClassAd objects to deadvertise """ cmd = "condor_advertise INVALIDATE_STARTD_ADS" for ad in ads: str_query = "MyType = \"Query\"\n" str_query += "TargetType = \"Machine\"\n" str_query += "Requirements = Name == \"%s\"\n\n" % ad["N... |
(IsUndefined(MachineLastMatchTime) == False) && (MachineLastMatchTime > %(matchtime)i) \ | (IsUndefined(MachineLastMatchTime) == False) && (MachineLastMatchTime > %(matchtime)i)' \ | def GetLastMatchedSites(self): """ Return the last matched sites as configured with lastmatchtime @return: list of sites with last match """ cmd = "condor_status -const '(IsUndefined(Offline) == FALSE) && (Offline == TRUE) && \ (IsUndefined(MachineLastMatchTime) == False) && (MachineLastMatchTime > %(matchtime)i) \ -f... |
logging.debug("Running external command: %s" % command) | logging.info("Running external command: %s" % command) | def RunExternal(command, str_stdin=""): """Run an external command @param command: String of the command to execute @param stdin: String to put put in stdin @return: (str(stdout), str(stderr)) of command Returns the stdout and stderr """ logging.debug("Running external command: %s" % command) popen_inst = Popen3(com... |
logging.debug("len(str_stdin) = %i, read_from_child = %i, rlist = %s, wlist = %s", len(str_stdin), read_from_child, rlist, wlist) | def RunExternal(command, str_stdin=""): """Run an external command @param command: String of the command to execute @param stdin: String to put put in stdin @return: (str(stdout), str(stderr)) of command Returns the stdout and stderr """ logging.debug("Running external command: %s" % command) popen_inst = Popen3(com... | |
num_submit = self.GetNumSubmit(idleslots, idlejobs, num_submit[self.GetClusterUnique()]) | num_submit = self.GetNumSubmit(idleslots, idlejobs, max([ num_submit[self.GetClusterUnique()], 5 ])) | def Start(self): """ Start the Factory """ self.Intialize() |
int(self.config.get("general", "MaxIdleGlideins") - idleslots)]) | int(self.config.get("general", "MaxIdleGlideins")) - idleslots]) | def GetNumSubmit(self, idleslots, idlejobs, idleuserjobs): """ Calculate the number of glideins to submit. @param idleslots: Number of idle startd's @param idlejobs: Number of glideins in queue, but not active @param idleuserjobs: Number of idle user jobs from FLOCK_FROM @return: int - Number of glideins to submit ""... |
command = "condor_status -const '(IsUndefined(IS_GLIDEIN) == FALSE) && (IS_GLIDEIN == TRUE) && (Offline == FALSE)' -format '<glidein name=\"%s\"/>' 'Name'" | command = "condor_status -const '(IsUndefined(IS_GLIDEIN) == FALSE) && (IS_GLIDEIN == TRUE) && (IsUndefined(Offline))' -format '<glidein name=\"%s\"/>' 'Name'" | def GetId(self): self.GetIdle() return self.factory_id |
return min([int(self.config.get("general", "maxqueuedjobs")) - idlejobs, idleuserjobs]) | return min([int(self.config.get("general", "maxqueuedjobs")) - idlejobs, \ idleuserjobs,\ int(self.config.get("general", "MaxIdleGlideins") - idleslots)]) | def GetNumSubmit(self, idleslots, idlejobs, idleuserjobs): """ Calculate the number of glideins to submit. @param idleslots: Number of idle startd's @param idlejobs: Number of glideins in queue, but not active @param idleuserjobs: Number of idle user jobs from FLOCK_FROM @return: int - Number of glideins to submit ""... |
logging.info("Submitting %i glidein jobs", num_submit[self.GetClusterUnique()]) self.SubmitGlideins(num_submit[self.GetClusterUnique()]) | logging.info("Submitting %i glidein jobs", num_submit) self.SubmitGlideins(num_submit) | def Start(self): """ Start the Factory """ self.Intialize() |
self["Name"] = "offline@%s" % random.randint(1, 10000) | self["Name"] = "\"offline@%s\"" % random.randint(1, 10000) | def ConvertToOffline(self): self["PreviousName"] = self["Name"] self["Name"] = "offline@%s" % random.randint(1, 10000) self["MyCurrentTime"] = self["LastHeardFrom"] = str(int(time.time())) |
return stdout.split('\n') | return stdout.split('\n')[:len(stdout.split('\n')) -1] | def GetLastMatchedSites(self): """ Return the last matched sites as configured with lastmatchtime @return: list of sites with last match """ cmd = "condor_status -const '(IsUndefined(Offline) == FALSE) && (Offline == TRUE) && \ (IsUndefined(MachineLastMatchTime) == False) && (MachineLastMatchTime > %(matchtime)i)' \ -... |
site_dict[" ".join(words[1:])] = min( [0, self.numclassads - int(words[0])]) | site_dict[" ".join(words[1:])] = max( [0, self.numclassads - int(words[0])]) | def GetDelinquentSites(self, available_sites): """ Get the sites that have less than self.numclassads offline ads @param available_sites: list of sites to look for @return: list of lists - [ ["site", num_delinquent], ... ] """ cmd = "condor_status -const '(IsUndefined(Offline) == FALSE) && (Offline == true)' \ -form... |
self["Offline"] = True | self["Offline"] = "true" | def ConvertToOffline(self, classadlifetime): self["Offline"] = True self["PreviousName"] = self["Name"] self["Name"] = "\"offline@%s.%s\"" % (str(int(time.time())), random.randint(1, 10000000)) self["MyCurrentTime"] = self["LastHeardFrom"] = str(int(time.time())) self["ClassAdLifetime"] = str(classadlifetime) |
toSubmit = offline.Update( [self.GetClusterUnique()] ) | if self.UseOffline: toSubmit = offline.Update( [self.GetClusterUnique()] ) | def Start(self): """ Start the Factory """ self.Intialize() |
if self.config.get("general", "useoffline").lower() == "true": | if self.UseOffline: | def Start(self): """ Start the Factory """ self.Intialize() |
num_submit = self.GetNumSubmit(idleslots, idlejobs, max([ num_submit[self.GetClusterUnique()], 5 ])) logging.info("Submitting %i glidein jobs", num_submit) self.SubmitGlideins(num_submit) | idleuserjobs = max([ num_submit[self.GetClusterUnique()], 5 ]) logging.debug("OFfline ads detected jobs should be submitted. Idle user jobs set to %i", idleuserjobs) | def Start(self): """ Start the Factory """ self.Intialize() |
convertEntities=BeautifulStoneSoup.XHTML_ENTITIES).contents[0] | convertEntities=["xml", "html"]).contents[0] | def guessFile (self, page, user, channel, url, date, time): mimetype_enc= self.magic.buffer (page) g = self.mimetype_re.search(mimetype_enc) if g is not None: mimetype= g.groups()[0] encoding= g.groups()[2] else: self.logger.warn ("initial mimetype detection failed: %s" % mimetype_enc) |
config = type('config', (object,), {'command_char': '!'}) | config = {'command_char': '!'} | def test_privmsg_command_char(self): '''Calling bot.privmsg with custom command char''' # set up command char config _COMMAND_CHAR = ircbot.COMMAND_CHAR |
convertEntities=["xml", "html"]).contents[0] | convertEntities=self.entities).contents[0] | def guessFile (self, page, user, channel, url, date, time): mimetype_enc= self.magic.buffer (page) g = self.mimetype_re.search(mimetype_enc) if g is not None: mimetype= g.groups()[0] encoding= g.groups()[2] else: self.logger.warn ("initial mimetype detection failed: %s" % mimetype_enc) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.