rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
break | def _newBase(newTrv): """ This creates three different troves. Read carefully or it's really confusing: | |
'mungeMake' : True, | 'autoBuildMakeDependencies' : True, | def __init__(self, recipe, *args, **keywords): _FileAction.__init__(self, recipe, *args, **keywords) |
def mungeMakefiles(self, dir, command): | def buildMakeDependencies(self, dir, command): """ build and remove make dependencies so that when the test suite is run, the makefile does spuriously require the capability to build any already built test executables """ | def mungeMakefiles(self, dir, command): |
self.mungeMakefiles(fullpath, command) | self.buildMakeDependencies(fullpath, command) | def mungeMakefiles(self, dir, command): |
if self.mungeMake: self.mungeMakeCommand() | self.mungeMakeCommand() if self.autoBuildMakeDependencies: | def do(self, macros): |
self.mungeMakefiles(util.normpath(self.macros.builddir + os.sep + self.dir), self.command) | self.buildMakeDependencies(util.normpath(self.macros.builddir + os.sep + self.dir), self.command) | def do(self, macros): |
import lib lib.epdb.st() | def get(self): import lib lib.epdb.st() | |
return self._value | return bool(self._value) | def __nonzero__(self): if self._track and self._value is not None: self._used = True return self._value |
self[key] = Flag(value=value, name=key, parent=self, | self[key] = Flag(value=bool(value), name=key, parent=self, | def _override(self, key, value): if key in self: self[key]._set(bool(value)) else: # override flag values that haven't been entered yet self[key] = Flag(value=value, name=key, parent=self, createOnAccess=self._createOnAccess, required=self._required, track=self._track) |
self._overrides[key] = value | self._overrides[key] = bool(value) | def _override(self, key, value): if key in self: self[key]._set(bool(value)) else: # override flag values that haven't been entered yet self[key] = Flag(value=value, name=key, parent=self, createOnAccess=self._createOnAccess, required=self._required, track=self._track) |
if 'Use' in self: | if 'Use' in self and self.Use.keys(): | def toDependency(self, recipename=''): """ Convert this flag set to a list of dependencies """ # XXX this code should probably disappear with the reworking of # flavors and their relationship with deps, but for now, # it is very handy set = deps.DependencySet() if self._name != '__GLOBAL__': self = self.asSet() if 'Use... |
if 'Flags' in self: | if 'Flags' in self and self.Flags.keys(): | def toDependency(self, recipename=''): """ Convert this flag set to a list of dependencies """ # XXX this code should probably disappear with the reworking of # flavors and their relationship with deps, but for now, # it is very handy set = deps.DependencySet() if self._name != '__GLOBAL__': self = self.asSet() if 'Use... |
dep = deps.Dependency('use', stringDeps) set.addDep(deps.UseDependency, dep) | if stringDeps: dep = deps.Dependency('use', stringDeps) set.addDep(deps.UseDependency, dep) | def toDependency(self, recipename=''): """ Convert this flag set to a list of dependencies """ # XXX this code should probably disappear with the reworking of # flavors and their relationship with deps, but for now, # it is very handy set = deps.DependencySet() if self._name != '__GLOBAL__': self = self.asSet() if 'Use... |
elif (args[0] == "commit") or (args[0] == "ci") | elif (args[0] == "commit") or (args[0] == "ci"): | def sourceCommand(cfg, args, argSet, profile=False, callback = None): if not callback: callback = CheckinCallback() if not args: return usage() elif (args[0] == "add"): if len(args) < 2: return usage() checkin.addFiles(args[1:]) elif (args[0] == "checkout") or (args[0] == "co"): if argSet.has_key("dir"): dir = argSet[... |
dumpFile(name, tag, size, fcf, | s += dumpFile(name, tag, size, fcf, | def sizeCallback(dumpString, name, tag, size): hdr = struct.pack("!HHIH%ds%ds" % (len(name), len(tag)), SUBFILE_MAGIC, len(name), size, len(tag), name, tag) dumpString(hdr) |
f.write(pkgName, "removed\n", | f.write("removed %s %s\n" % | def formatToFile(self, cfg, f): |
return [ (versions.VersionFromString(x[0]), deps.ThawDependencySet([1])) for x in | return [ (versions.VersionFromString(x[1]), deps.ThawDependencySet(x[0])) for x in | def getTroveFlavorsLatestVersion(self, troveName, branch): |
if not self.theobject.__dict__.has_key(key): | if key not in self.theobject.__dict__: | def __call__(self, *args, **keywords): |
def addPatch(self, file, level='1', backup='', extractDir='', keyid=None, use=None): self._appendSource(file, keyid, 'patch', extractDir, use, (level, backup)) | def addPatch(self, file, level='1', backup='', extractDir='', keyid=None, use=None, macros=False): self._appendSource(file, keyid, 'patch', extractDir, use, (level, backup, macros)) | def addPatch(self, file, level='1', backup='', extractDir='', keyid=None, use=None): |
(level, backup) = args | (level, backup, macros) = args | def unpackSources(self, builddir): |
util.execute('%s %s | patch -d %s -p%s %s' %(provides, f, destDir, level, backup)) | if macros: print '+ applying macros to %s' %f pin = os.popen('%s %s' %(provides, f)) print '+ patch -d %s -p%s %s' %(destDir, level, backup) pout = os.popen('patch -d %s -p%s %s' %(destDir, level, backup), 'w') pout.write(pin.read()%self.macros) pin.close() pout.close() else: util.execute('%s %s | patch -d %s -p%s %s' ... | def unpackSources(self, builddir): |
if self.build == []: print '\n\n\n' print ' +++ default build rules DEPRECATED, please set build rules explicitly! +++' print '\n\n\n' self.build = self.defaultbuild | def doBuild(self, buildpath, root): builddir = buildpath + "/" + self.mainDir() | |
self.defaultbuild = [build.Make(), build.MakeInstall()] | def __init__(self, cfg, laReposCache, srcdirs, extraMacros=()): assert(self.__class__ is not Recipe) | |
return t.serialize(encoding="utf-8", cfg = self.cfg, **values) | return t.serialize(encoding = "utf-8", cfg = self.cfg, req = self.req, hasWrite = self.hasWrite, isAdmin = self.isAdmin, currentUser = self.authToken[0], **values) @checkAuth(write=False) def main(self, auth): self._redirect("browse") | def _write(self, templateName, **values): path = os.path.join(self.templatePath, templateName + ".kid") t = kid.load_template(path) return t.serialize(encoding="utf-8", cfg = self.cfg, **values) |
def main(self, auth): return self._write("main_page") | def login(self, auth): self._redirect("browse") | def main(self, auth): return self._write("main_page") |
return self._write("notice", message = "Password successfully changed", | return self._write("notice", message = message, | def chPass(self, auth, username, oldPassword, password1, password2): admin = self.repServer.auth.check(self.authToken, admin=True) |
flavor.union(finalFlavor, deps.DEP_MERGE_TYPE_OVERRIDE) | if score is not None: flavor = deps.overrideFlavor(finalFlavor, flavor) | def fullUpdateItemList(self): # ignore updates that just switch version, not flavor or # branch items = ( x for x in self.getPrimaryLocalUpdates() if (x[1][0] is None or not deps.compatibleFlavors(x[1][1], x[2][1]) or x[1][0].branch() != x[2][0].branch())) items = [ (x[0], x[2][0], x[2][1]) for x in items if not x[2][0... |
' for all files on update.' ' file information on update.') | ' for all files on update.') | def cookObject(repos, cfg, recipeClass, sourceVersion, changeSetFile = None, prep=True, macros={}, targetLabel = None, resume = None, alwaysBumpCount = False, allowUnknownFlags = False, allowMissingSource = False, ignoreDeps = False, logBuild = False, crossCompile = None, callback = None, requireCleanSources = False, d... |
if type is exceptions.IOError: sys.stderr.write('%s\n' % value) sys.exit(1) | def excepthook(type, value, tb): if type is exceptions.IOError: sys.stderr.write('%s\n' % value) sys.exit(1) sys.excepthook = sys.__excepthook__ lines = traceback.format_exception(type, value, tb) print string.joinfields(lines, "") pdb.post_mortem(tb) | |
if cfg.cookNewBranches or not repos.hasPackage(buildLabel.getHost(), fullName): buildBranch = versions.Version([buildLabel]) else: vers = repos.getTroveLeavesByLabel([fullName], buildLabel)[fullName] if not len(vers): | vers = repos.getTroveLeavesByLabel([fullName], buildLabel)[fullName] if not vers: srcName = fullName + ":source" vers = repos.getTroveLeavesByLabel([srcName], buildLabel)[srcName] if len(vers) > 1: raise CookError('Multiple branches labeled %s exist for ' 'trove %s' % (fullName, buildLabel.asString)) elif not len(ve... | def cookObject(repos, cfg, recipeClass, buildLabel, changeSetFile = None, prep=True, macros={}, buildBranch = None): """ Turns a recipe object into a change set, and sometimes commits the result. @param repos: Repository to both look for source files and file id's in. @type repos: repository.Repository @param cfg: con... |
elif len(vers) > 1: raise CookError('Multiple branches labeled %s exist for ' 'trove %s' % (fullName, buildLabel.asString)) | else: | def cookObject(repos, cfg, recipeClass, buildLabel, changeSetFile = None, prep=True, macros={}, buildBranch = None): """ Turns a recipe object into a change set, and sometimes commits the result. @param repos: Repository to both look for source files and file id's in. @type repos: repository.Repository @param cfg: con... |
cu = self.db.cursor() cu.execute('CREATE TEMPORARY TABLE neededIds (num INT, %s STR)' % self.strName) | cu = self.db.cursor() cu.execute('CREATE TEMPORARY TABLE neededIds (num INTEGER, %s VARCHAR(767))' % self.strName) | def getOrAddIds(self, items): cu = self.db.cursor() cu.execute('CREATE TEMPORARY TABLE neededIds (num INT, %s STR)' % self.strName) for num, item in enumerate(items): cu.execute('INSERT INTO neededIds VALUES (?, ?)', num, item) |
assert(type(theId) is int) | assert(isinstance(theId, (int, long))) | def delId(self, theId): assert(type(theId) is int) cu = self.db.cursor() cu.execute("DELETE FROM %s WHERE %s=?" %(self.tableName, self.keyName), (theId,)) |
csf.addFile(hash, filecontents.FromString(str), "1 diff") | csf.addFile(hash, filecontents.FromString(str), "1 " + tag[4:]) | def writeAllContents(self, csf): # diffs go out, then we write out whatever contents are left assert(not self.filesRead) self.filesRead = True |
header = lines[0] l = header.split() pkgType = l[0] | def __init__(self, buf): | |
os.environ['GCONF_CONFIG_SOURCE'] = gin.read()[:-1] | gconvEnv = gin.read()[:-1] | def apply(self): |
os.environ['GCONF_CONFIG_SOURCE'] = 'xml::/etc/gconf/gconf.xml.defaults' | gconvEnv = 'xml::/etc/gconf/gconf.xml.defaults' | def apply(self): |
exec 'import build' in d | exec 'from build import build' in d | def setupRecipeDict(d, filename): exec 'import build' in d exec 'from build.recipe import PackageRecipe' in d exec 'from build.recipe import GroupRecipe' in d exec 'from build.recipe import FilesetRecipe' in d exec 'from build.recipe import loadRecipe' in d exec 'import build, os, package, sys, stat, util' in d exec 'f... |
exec 'import build, os, package, sys, stat, util' in d | exec 'import os, package, sys, stat, util' in d | def setupRecipeDict(d, filename): exec 'import build' in d exec 'from build.recipe import PackageRecipe' in d exec 'from build.recipe import GroupRecipe' in d exec 'from build.recipe import FilesetRecipe' in d exec 'from build.recipe import loadRecipe' in d exec 'import build, os, package, sys, stat, util' in d exec 'f... |
if package == recipeName: | if packageName == recipeName: | def setBuildFlagsFromFlavor(recipeName, flavor): """ Sets the truth of the build Flags based on the build flavor. All the set build flags must already exist. Flags not mentioned in this flavor will be untouched. XXX should this create flags as well as set them? Problem with that is that we don't know whether the flag... |
Flags._override(flag, value) | LocalFlags._override(flag, value) | def setBuildFlagsFromFlavor(recipeName, flavor): """ Sets the truth of the build Flags based on the build flavor. All the set build flags must already exist. Flags not mentioned in this flavor will be untouched. XXX should this create flags as well as set them? Problem with that is that we don't know whether the flag... |
" r.Provides('file: %s')", path, info, info) | " r.Provides('file', '%s')", path, info, info) | def _addRequirement(self, path, info, flags, pkg, depClass): if depClass == deps.FileDependencies: pathMap = self.recipe.autopkg.pathMap if info in pathMap and info not in pkg.providesMap: # if a package requires a file, includes that file, # and does not provide that file, it should error out self.error('%s requires %... |
def __eq__(self): raise NotImplementedError | def twm(self, diff, base): | |
"WHERE _ROWID_ = NEW._ROWID_ " %(table, column, column)) | "WHERE _ROWID_ = NEW._ROWID_ ; " %(table, column, column)) | def createTrigger(self, table, column, onAction, pinned=False): onAction = onAction.lower() name = "%s_%s" % (table, onAction) assert(onAction in ["insert", "update"]) |
"WHERE _ROWID_ = NEW._ROWID_ " %(table, column)) | "WHERE _ROWID_ = NEW._ROWID_ ; " %(table, column)) | def createTrigger(self, table, column, onAction, pinned=False): onAction = onAction.lower() name = "%s_%s" % (table, onAction) assert(onAction in ["insert", "update"]) |
sql = "SET NEW.%s = OLD.%s" % (column, column) | sql = "SET NEW.%s = OLD.%s ; " % (column, column) | def createTrigger(self, table, column, onAction, pinned=False): onAction = onAction.lower() name = "%s_%s" % (table, onAction) assert(onAction in ["insert", "update"]) |
sql = "SET NEW.%s = current_timestamp() + 0" % (column,) | sql = "SET NEW.%s = current_timestamp() + 0 ; " % (column,) | def createTrigger(self, table, column, onAction, pinned=False): onAction = onAction.lower() name = "%s_%s" % (table, onAction) assert(onAction in ["insert", "update"]) |
src = lookaside.findAll(cfg, file, recipeObj.name, srcdirs) | src = lookaside.findAll(cfg, lcache, file, recipeObj.name, srcdirs) | def cook(repos, cfg, recipeFile, prep=0): if type(recipeFile) is types.ClassType: classList = {recipeFile.__name__: recipeFile} else: classList = recipe.RecipeLoader(recipeFile) built = [] for (className, recipeClass) in classList.items(): print "Building", className # Find the files and ids which were owned by the l... |
print "a:", [ x.asString() for x in versionList ] | def parseFile(self, f, packageNamespace, repos): | |
res = troveSource.getTroveVersionssByBranch(self.queryNoFlavor) | res = troveSource.getTroveVersionsByBranch(self.queryNoFlavor) | def _findAllNoFlavor(self, troveSource, missing, finalMap): if self.getLeaves: res = troveSource.getTroveLeavesByBranch(self.queryNoFlavor, bestFlavor=False) else: res = troveSource.getTroveVersionssByBranch(self.queryNoFlavor) |
"WHERE instanceId = ? ?" % sort, | "WHERE instanceId = ? %s" %sort, | def iterFilesInTrove(self, troveName, troveVersion, troveFlavor, sortByPath = False, withFiles = False): |
"not printing information about this " "trove", % trove.getName()) | "not printing information about this " "trove" % trove.getName()) | def displayChangeSet(db, repos, cs, troveList, cfg, ls = False, tags = False, info=False, fullVersions=False, showChanges=False): (troves, hasVersions) = getTroves(cs, troveList) if not (ls or tags): if hasVersions: includeChildTroves(cs, troves) # create display cache containing appropriate version strings displayC =... |
select tablename as name | select tablename as name, schemaname as schema | def loadSchema(self): BaseDatabase.loadSchema(self) c = self.cursor() # get tables c.execute(""" select tablename as name from pg_tables where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for table, in c.fetchall(): self.tables[table] = Llist() if not len(self.tables): return self.version # v... |
where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for table, in c.fetchall(): self.tables[table] = Llist() | where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') and ( schemaname !~ '^pg_temp_' OR schemaname = (pg_catalog.current_schemas(true))[1]) """) for table, schema in c.fetchall(): if schema.startswith("pg_temp"): self.tempTables[table] = Llist() else: self.tables[table] = Llist() | def loadSchema(self): BaseDatabase.loadSchema(self) c = self.cursor() # get tables c.execute(""" select tablename as name from pg_tables where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for table, in c.fetchall(): self.tables[table] = Llist() if not len(self.tables): return self.version # v... |
select indexname as name, tablename as table | select indexname as name, tablename as table, schemaname as schema | def loadSchema(self): BaseDatabase.loadSchema(self) c = self.cursor() # get tables c.execute(""" select tablename as name from pg_tables where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for table, in c.fetchall(): self.tables[table] = Llist() if not len(self.tables): return self.version # v... |
where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for (name, table) in c.fetchall(): self.tables.setdefault(table, Llist()).append(name) | where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') and ( schemaname !~ '^pg_temp_' OR schemaname = (pg_catalog.current_schemas(true))[1]) """) for (name, table, schema) in c.fetchall(): if schema.startswith("pg_temp"): self.tempTables.setdefault(table, Llist()).append(name) else: self.tables.setde... | def loadSchema(self): BaseDatabase.loadSchema(self) c = self.cursor() # get tables c.execute(""" select tablename as name from pg_tables where schemaname not in ('pg_catalog', 'pg_toast', 'information_schema') """) for table, in c.fetchall(): self.tables[table] = Llist() if not len(self.tables): return self.version # v... |
self.closed = False | def __init__(self, path): self.path = path self.startLog() self.closed = False | |
if not self.closed: | if self.logging and not self.closed: | def __del__(self): if not self.closed: self.close() |
print "\n".join([str((x[0], x[1].asString(), deps.formatFlavor(x[2]))) for x in updateItems ]) | for n, v, f in updateItems: if not v: v = '' else: v = v.asString() if not f: f = '' else: f = deps.formatFlavor(f) print (n,v,f) | def updateAll(cfg, info = False, depCheck = True, replaceFiles = False, depsRecurse = True, recurse = True, test = False): client = conaryclient.ConaryClient(cfg) items = client.db.findUnreferencedTroves() installed = client.db.findByNames([ x[0] for x in items ]) installedDict = {} for (name, version, release) in in... |
def iterTrovePerFlavorLeafs(troveName, branch): cu = db.cursor() | def iterTrovePerFlavorLeafs(self, troveName, branch): cu = self.db.cursor() | def iterTrovePerFlavorLeafs(troveName, branch): |
WHERE Nodes.itemId=(SELECT itemId from Items WHERE item=%s) AND branchId=(SELECT branchId from Branch WHERE branch=%s) | WHERE Nodes.itemId=(SELECT itemId FROM Items WHERE item=%s) AND branchId=(SELECT branchId FROM Branches WHERE branch=%s) | def iterTrovePerFlavorLeafs(troveName, branch): |
root = HtmlDocument() | root = StaticHtmlDocument() | def test01(self): "Location arithmetics" root = HtmlDocument() self.assertEqual(root.location,"") self.assertEqual(root.filename(),"index.html") foo=root.addChild(location="foo") self.assertEqual(foo.location,"foo") self.assertEqual(foo.filename(),"index.html") bar=foo.addChild(location="bar") self.assertEqual(bar.lo... |
packages = [PY_PACKAGE], package_dir = { PY_PACKAGE: os.path.join('python', 'curl') }, | def get_data_files(): # a list of tuples with (path to install to, a list of local files) data_files = [] if sys.platform == "win32": datadir = os.path.join("doc", PACKAGE) else: datadir = os.path.join("share", "doc", PACKAGE) # files = ["ChangeLog", "COPYING", "INSTALL", "README", "TODO",] if files: data_files.append(... | |
if string.find(sys.version, "MSC") != 1: | if string.find(sys.version, "MSC") != -1: | def add_libdirs(envvar, sep, fatal=1): v = os.environ.get(envvar) if not v: return for dir in string.split(v, sep): dir = string.strip(dir) if not dir: continue dir = os.path.normpath(dir) if os.path.isdir(dir): if not dir in library_dirs: library_dirs.append(dir) elif fatal: print "FATAL: bad directory %s in environme... |
def __init__(self, queue): | def __init__(self, queue, render): | def __init__(self, queue): threading.Thread.__init__(self) self.queue = queue |
url, html, handle = self.queue.get() | url, handle = self.queue.get() | def run(self): while 1: url, html, handle = self.queue.get() if url == None: break b = cStringIO.StringIO() curl = pycurl.Curl() curl.setopt(pycurl.WRITEFUNCTION, b.write) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.perform() curl.close() threads_enter() html... |
break | raise SystemExit | def run(self): while 1: url, html, handle = self.queue.get() if url == None: break b = cStringIO.StringIO() curl = pycurl.Curl() curl.setopt(pycurl.WRITEFUNCTION, b.write) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.perform() curl.close() threads_enter() html... |
curl.perform() | try: curl.perform() except: print 'Error retrieving', url | def run(self): while 1: url, html, handle = self.queue.get() if url == None: break b = cStringIO.StringIO() curl = pycurl.Curl() curl.setopt(pycurl.WRITEFUNCTION, b.write) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.perform() curl.close() threads_enter() html... |
threads_enter() html.write(handle, b.getvalue()) html.end(handle, HTML_STREAM_OK) threads_leave() | self.render.append((b, handle)) | def run(self): while 1: url, html, handle = self.queue.get() if url == None: break b = cStringIO.StringIO() curl = pycurl.Curl() curl.setopt(pycurl.WRITEFUNCTION, b.write) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.perform() curl.close() threads_enter() html... |
t = WorkerThread(self.queue) | t = WorkerThread(self.queue, self.render) | def __init__(self): GtkHTML.__init__(self) self.queue = Queue.Queue() self.threads = [] for num_threads in range(NUM_THREADS): t = WorkerThread(self.queue) t.start() self.threads.append(t) |
t.queue.put((None, None, None)) t.join() | t.queue.put((None, None)) | def mainquit(self, *args): for t in self.threads: t.queue.put((None, None, None)) t.join() mainquit() |
self.queue.put((url, html, handle)) | self.queue.put((url, handle)) self.num_obj += 1 | def request_url(self, html, url, handle): url = urllib.basejoin(history[-1], url) print "Requesting URL: ", url self.queue.put((url, html, handle)) |
UIINFO_ITEM_STOCK('Quit', None, mainquit, STOCK_MENU_QUIT), | UIINFO_ITEM_STOCK('Quit', None, html.mainquit, STOCK_MENU_QUIT), | def do_reload(self, _b): if len(history) == 0: return url = history[-1] del history[-1] self.load_url(html, url) |
self.header = StringIO() | self.hrd = "" | def __init__(self, base_url="", fakeheaders=[]): self.handle = pycurl.Curl() # These members might be set. self.set_url(base_url) self.verbosity = 0 self.fakeheaders = fakeheaders # Nothing past here should be modified by the caller. self.payload = "" self.header = StringIO() # Verify that we've got the right site; har... |
self.header.write(x) | self.hdr += x | def header_callback(x): self.header.write(x) |
self.header.seek(0,0) | def __request(self, relative_url=None): "Perform the pending request." if self.fakeheaders: self.set_option(pycurl.HTTPHEADER, self.fakeheaders) if relative_url: self.set_option(pycurl.URL,os.path.join(self.base_url,relative_url)) self.header.seek(0,0) self.payload = "" self.handle.perform() return self.payload | |
return self.header.getvalue() | return self.hdr | def header(self): "Return the header from the last response." return self.header.getvalue() |
if self.header: self.header.close() | def close(self): "Close a session, freeing resources." if self.handle: self.handle.close() if self.header: self.header.close() self.handle = None self.header = None self.payload = "" | |
self.header = None | self.hdr = "" | def close(self): "Close a session, freeing resources." if self.handle: self.handle.close() if self.header: self.header.close() self.handle = None self.header = None self.payload = "" |
break | raise SystemExit | def run(self): while 1: try: url, filename = self.queue.get_nowait() except Queue.Empty: break f = open(filename, "wb") curl = pycurl.Curl() curl.setopt(pycurl.HTTPHEADER, ["User-Agent: PycURL"]) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.setopt(pycurl.WRITE... |
pass | import traceback traceback.print_exc(file=sys.stderr) sys.stderr.flush() | def run(self): while 1: try: url, filename = self.queue.get_nowait() except Queue.Empty: break f = open(filename, "wb") curl = pycurl.Curl() curl.setopt(pycurl.HTTPHEADER, ["User-Agent: PycURL"]) curl.setopt(pycurl.FOLLOWLOCATION, 1) curl.setopt(pycurl.MAXREDIRS, 5) curl.setopt(pycurl.URL, url) curl.setopt(pycurl.WRITE... |
html = HtmlWindow() | def do_reload(self, _b): if len(history) == 0: return url = history[-1] del history[-1] self.load_url(html, url) | |
def flag_command(self, func): | def flag_command(self, func, line): | def flag_command(self, func): if line.strip() in ("on", "enable", "yes"): func(True) elif line.strip() in ("off", "disable", "no"): func(False) else: print >>sys.stderr, "linksys: unknown switch value" return 0 |
self.flag_command(self.session.set_verbosity) | self.flag_command(self.session.set_verbosity, line) | def do_verbose(self, line): self.flag_command(self.session.set_verbosity) |
self.flag_command(self.session.set_wireless) | self.flag_command(self.session.set_wireless, line) | def do_wireless(self, line): self.flag_command(self.session.set_wireless) return 0 |
self.flag_command(self.session.set_SSID_broadcast) | self.flag_command(self.session.set_SSID_broadcast, line) | def do_ssid_broadcast(self, line): self.flag_command(self.session.set_SSID_broadcast) return 0 |
self.flag_command(self.session.set_WEP) | self.flag_command(self.session.set_WEP, line) | def do_wep(self, line): self.flag_command(self.session.set_WEP) return 0 |
self.flag_command(self.session.set_UPnP) | self.flag_command(self.session.set_UPnP, line) | def do_upnp(self, line): self.flag_command(self.session.set_UPnP) return 0 |
self.flag_command(self.session.set_DHCP) | self.flag_command(self.session.set_DHCP, line) | def do_dhcp(self, line): self.flag_command(self.session.set_DHCP) |
self.flag_command(self.session.set_logging) | self.flag_command(self.session.set_logging, line) | def do_logging(self, line): self.flag_command(self.session.set_logging) |
threads_enter() | def progress(download_t, download_d, upload_t, upload_d): global round, pbar threads_enter() if download_t == 0: pbar.set_activity_mode(1) round = round + 0.1 if round >= 1.0: round = 0.0 else: pbar.set_activity_mode(0) round = float(download_d) / float(download_t) pbar.update(round) threads_leave() return 0 # Anythin... | |
pbar.set_activity_mode(1) | def progress(download_t, download_d, upload_t, upload_d): global round, pbar threads_enter() if download_t == 0: pbar.set_activity_mode(1) round = round + 0.1 if round >= 1.0: round = 0.0 else: pbar.set_activity_mode(0) round = float(download_d) / float(download_t) pbar.update(round) threads_leave() return 0 # Anythin... | |
pbar.set_activity_mode(0) | def progress(download_t, download_d, upload_t, upload_d): global round, pbar threads_enter() if download_t == 0: pbar.set_activity_mode(1) round = round + 0.1 if round >= 1.0: round = 0.0 else: pbar.set_activity_mode(0) round = float(download_d) / float(download_t) pbar.update(round) threads_leave() return 0 # Anythin... | |
s += " " + ci.__str__() | s += " " + str(ci) | def __str__(self): """Show a string with both current and removed creatures.""" self.creatures.sort(creatureComp) s = self.fullname() + ":" for ci in self.creatures: s += " " + ci.__str__() for ci in self.removed: s += " " + ci.__str__() + "-" return s |
s += " " + ci.__str__() + "-" | s += " " + str(ci) + "-" | def __str__(self): """Show a string with both current and removed creatures.""" self.creatures.sort(creatureComp) s = self.fullname() + ":" for ci in self.creatures: s += " " + ci.__str__() for ci in self.removed: s += " " + ci.__str__() + "-" return s |
return self.__str__() | return str(self) | def __repr__(self): return self.__str__() |
def getSibling(self): if self.parent is None: return None return self.parent.getOtherChild(self) | def getSibling(self): if self.parent is None: return None return self.parent.getOtherChild(self) | |
print "revealCreatures for", self, cnl | def revealCreatures(self, cnl): """cnl is a list of creature names""" print "revealCreatures for", self, cnl if ((not cnl) or (superset(getCreatureNames(self.getCertainCreatures()), cnl) and (self.allDescendentsCertain()))): print "no new information, exiting" return | |
print "no new information, exiting" | def revealCreatures(self, cnl): """cnl is a list of creature names""" print "revealCreatures for", self, cnl if ((not cnl) or (superset(getCreatureNames(self.getCertainCreatures()), cnl) and (self.allDescendentsCertain()))): print "no new information, exiting" return | |
print " near end revealCreatures", self | def revealCreatures(self, cnl): """cnl is a list of creature names""" print "revealCreatures for", self, cnl if ((not cnl) or (superset(getCreatureNames(self.getCertainCreatures()), cnl) and (self.allDescendentsCertain()))): print "no new information, exiting" return |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.