rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
classVariants = self.classVariants(generate=False) | classVariants = getClassVariants(self.id, self.path, None, context["cache"], context["console"], generate=False) | def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to return trees which have been optimized, as unoptimized |
tree = self._getSourceTree(unoptCacheId, tradeSpaceForSpeed) classVariants= self._variantsFromTree(tree) | tree = self._getSourceTree(unoptCacheId) classVariants= getClassVariantsFromTree(tree, context["console"]) | def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to return trees which have been optimized, as unoptimized |
opttree = self._getSourceTree(unoptCacheId, tradeSpaceForSpeed) | opttree = self._getSourceTree(unoptCacheId) | def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to return trees which have been optimized, as unoptimized |
opttree.cacheId = cacheId | def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to return trees which have been optimized, as unoptimized | |
classinfo, _ = self._getClassCache() | cache = self.context["cache"] cacheId = "class-%s" % (self.path,) classinfo, _ = cache.readmulti(cacheId, self.path) | def classVariants(self, generate=True): |
if 'svariants' not in classinfo: | if classinfo == None or 'svariants' not in classinfo: | def classVariants(self, generate=True): |
classvariants = self._variantsFromTree(tree) | classvariants = getClassVariantsFromTree(tree, self.context["console"]) | def classVariants(self, generate=True): |
self._writeClassCache (classinfo) | cache.writemulti(cacheId, classinfo) | def classVariants(self, generate=True): |
def _variantsFromTree(self, node): classvariants = set([]) variants = treeutil.findVariablePrefix(node, "qx.core.Variant") for variant in variants: if not variant.hasParentContext("call/operand"): continue variantMethod = treeutil.selectNode(variant, "identifier[4]/@name") if variantMethod not in ["select", "isSet", "... | def classVariants(self, generate=True): | |
classInfo, cacheModTime = self._getClassCache() deps = classInfo[cacheId] if cacheId in classInfo else None | deps, cacheModTime = cache.readmulti(cacheId, self.path) | def transitiveDepsAreFresh(depsStruct, cacheModTime): if cacheModTime is None: # TODO: this can currently only occur with a Cache.memcache result return False for dep in depsStruct["load"]: if dep.requestor != self.id: # this was included through a recursive traversal if dep.name in self._classesObj: classObj = self._... |
classInfo[cacheId] = deps self._writeClassCache(classInfo) | cache.writemulti(cacheId, deps) | def transitiveDepsAreFresh(depsStruct, cacheModTime): if cacheModTime is None: # TODO: this can currently only occur with a Cache.memcache result return False for dep in depsStruct["load"]: if dep.requestor != self.id: # this was included through a recursive traversal if dep.name in self._classesObj: classObj = self._... |
def getScript(node, fileId): | def getScript(node, fileId, ): | def getScript(node, fileId): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # same in memory, e.g. wh... |
if _memo[0] == rootNode: | if _memo1_[0] == rootNode: | def getScript(node, fileId): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # same in memory, e.g. wh... |
script = _memo[1] | script = _memo1_[1] | def getScript(node, fileId): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # same in memory, e.g. wh... |
_memo[0] = rootNode _memo[1] = script | _memo1_[0], _memo1_[1] = rootNode, script | def getScript(node, fileId): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # same in memory, e.g. wh... |
assert fcnScope != None, "idString: '%s', idStr: '%s', fileId: '%s'" % (idString, idStr, fileId) | def getLeadingId(idStr): leadingId = idStr dotIdx = idStr.find('.') if dotIdx > -1: leadingId = idStr[:dotIdx] return leadingId | |
def getTransitiveDeps(self, depsItem, variants, checkSet=None): | def getTransitiveDeps(self, depsItem, variants): | def getTransitiveDeps(self, depsItem, variants, checkSet=None): |
def getTransitiveDepsR1(dependencyItem, variants, totalDeps): classId = dependencyItem.name methodId = dependencyItem.attribute function_pruned = False if classId not in self._classesObj: console.debug("Skipping unknown class of dependency: %s dependencyItem.requestor, dependencyItem.line)) return set() elif cla... | def getTransitiveDepsR1(dependencyItem, variants, totalDeps): | |
checkset = checkSet or set() | checkset = set() | def getTransitiveDepsR1(dependencyItem, variants, totalDeps): |
resourceList = self._resourceHandler.findAllResources([lib], None) for resource in resourceList: if skippatt.search(resource): continue if assetFilter(resource): resList.append(resource) if CombinedImage.isCombinedImage(resource): resId, resVal = libObj.analyseResource(resource,) combObj = CombImage(resource) co... | def collectResources(libs, assetFilter, ): filteredResources = [] combinedImages = {} skippatt = re.compile(r'\.(meta|py)$', re.I) for lib in libs: libObj = [x for x in script.libraries if x.namespace == lib["namespace"]][0] resList = [] filteredResources.append((libObj, resList)) resourceList = self._res... | |
allresources = [] for libObj, resList in filteredResources: allresources.extend(resList) for combId, combObj in combinedImages.items(): if self._resourceHandler.embedsInList(combObj, allresources): for libObj, resList in filteredResources: if libObj == combObj.lib: resList.append(combObj.path) break return filteredRe... | def incorporateCombinedImages(filteredResources, combinedImages): # make a long list of all resources allresources = [] for libObj, resList in filteredResources: allresources.extend(resList) # check for usable comb.images for combId, combObj in combinedImages.items(): if self._resourceHandler.embedsInList(combObj, allr... | |
if False: (filteredResources, combinedImages) = collectResources(libs, assetFilter, ) filteredResources = incorporateCombinedImages(filteredResources, combinedImages) resdata = self._resourceHandler.createResourceStruct(filteredResources, formatAsTree = resources_tree, updateOnlyExistingSprites = True) el... | (filteredResources, combinedImages) = collectResources(libs, assetFilter, ) filteredResources = incorporateCombinedImages(filteredResources, combinedImages) resdata = self._resourceHandler.createResourceStruct1(filteredResources, formatAsTree = resources_tree, | def incorporateCombinedImages1(filteredResources, combinedImages): # make a long list of all resources allresources = [] for libObj, resList in filteredResources: allresources.extend(resList) # check for usable comb.images for combId, combObj in combinedImages.items(): #if self._resourceHandler.embedsInList(combObj, al... |
self._console.progress(pos, length) | self._console.progress(pos+1, length) | def storeApi(self, include, apiPath): self._console.info("Generating API data...") self._console.indent() |
and self.context['jobconf'].get("dependencies/follow-static-initializers", False) | def followCallDeps(self, node, fileId, className): if (className and className in self._classesObj # we have a class id and className != fileId #and self.context['jobconf'].get("dependencies/follow-static-initializers", False) and ( node.hasParentContext("keyvalue/value/call/operand") # it's a method call as map valu... | |
result = set(clsDepsObj.data['require']) if not "auto-require" in (x.name for x in clsDepsObj.data['ignore']): | result = set(clsDepsObj.data['require']) ignores = map(attrgetter("name"), clsDepsObj.data['ignore']) optionals = map(attrgetter("name"), clsDepsObj.data['optional']) requires = map(attrgetter("name"), clsDepsObj.data['require']) uses = map(attrgetter("name"), clsDepsObj.data['use']) if not "auto-require" in... | def getLoadDeps(clsDepsObj): result = set(clsDepsObj.data['require']) if not "auto-require" in (x.name for x in clsDepsObj.data['ignore']): for dep in clsDepsObj.dependencyIterator(): if dep.isLoadDep: if dep in clsDepsObj.data['optional']: pass elif dep in clsDepsObj.data['require']: console.warn("%s: #require(%s) is ... |
if dep in clsDepsObj.data['optional']: | if dep.name in optionals: | def getLoadDeps(clsDepsObj): result = set(clsDepsObj.data['require']) if not "auto-require" in (x.name for x in clsDepsObj.data['ignore']): for dep in clsDepsObj.dependencyIterator(): if dep.isLoadDep: if dep in clsDepsObj.data['optional']: pass elif dep in clsDepsObj.data['require']: console.warn("%s: #require(%s) is ... |
elif dep in clsDepsObj.data['require']: | elif dep.name in requires: | def getLoadDeps(clsDepsObj): result = set(clsDepsObj.data['require']) if not "auto-require" in (x.name for x in clsDepsObj.data['ignore']): for dep in clsDepsObj.dependencyIterator(): if dep.isLoadDep: if dep in clsDepsObj.data['optional']: pass elif dep in clsDepsObj.data['require']: console.warn("%s: #require(%s) is ... |
def getRunDeps(clsDepsObj, loadDeps=[]): | def getRunDeps(clsDepsObj): | def getRunDeps(clsDepsObj, loadDeps=[]): result = set(clsDepsObj.data ['use']) if not "auto-use" in (x.name for x in clsDepsObj.data ['ignore']): for dep in clsDepsObj.dependencyIterator (): if self.id == 'gui.Application': #import pydb; pydb.debugger() pass if not dep.isLoadDep: if dep in clsDepsObj.data ['optional']:... |
loadDeps = getLoadDeps (shallowDeps) runDeps = getRunDeps (shallowDeps, loadDeps) | loadDeps, runDeps = getDeps (shallowDeps) | def getRunDeps(clsDepsObj, loadDeps=[]): result = set(clsDepsObj.data ['use']) if not "auto-use" in (x.name for x in clsDepsObj.data ['ignore']): for dep in clsDepsObj.dependencyIterator (): if self.id == 'gui.Application': #import pydb; pydb.debugger() pass if not dep.isLoadDep: if dep in clsDepsObj.data ['optional']:... |
JSON.write("\n\n\n") | JSON.write("\n\n") | def CreateNewDemoJson(): source = "" build = "" scategories = {} bcategories = {} fJSON = "./config.demo.new.json" # Pre-processing JSON = open(fJSON,"w") JSON.write('// This file is dynamically created by the generator!\n') JSON.write('{\n') # top-level includes default_json = 'tool' + '/' + 'default.json' assert os... |
self.libraries = self.getLibraries(manifests) | self.children = self.getLibraries(manifests) | def __init__(self, repoDir, config=None): self.dir = os.path.abspath(repoDir) self.validator = LibraryValidator(config) self.data = [] self.issues = {} if not self.hasExplicitIncludes(): manifests = self.scanRepository() else: try: manifests = self.getExplicitManifests() if len(manifests) == 0: manifests = self.scanRe... |
for libraryName, library in self.libraries.iteritems(): | for libraryName, library in self.children.iteritems(): | def buildAllDemos(self, buildTarget="build", demoBrowser=None, copyDemos=False): if demoBrowser: demoBrowser = os.path.abspath(demoBrowser) console.info("Generating demos for all known libraries") console.indent() for libraryName, library in self.libraries.iteritems(): library.buildAllDemos(buildTarget, demoBrowser, c... |
if not os.path.isdir(path): os.makedirs(path) path = os.path.join(path, "demodata.json") storeDemoData(self.data, path) | def getChildrenData(item, itemData): for childName, child in item.children.iteritems(): childData = copy.deepcopy(child.data) childData["issues"] = child.issues if hasattr(child, "children"): childData = getChildrenData(child, childData) if type(itemData) == list: itemData.append(childData) elif "children" in itemDa... | def storeData(self, path): if not os.path.isdir(path): os.makedirs(path) path = os.path.join(path, "demodata.json") storeDemoData(self.data, path) |
for libraryName, library in self.libraries.iteritems(): | for libraryName, library in self.children.iteritems(): | def lintCheckAll(self): for libraryName, library in self.libraries.iteritems(): for versionName, libraryVersion in library.children.iteritems(): console.info("Lint results for %s %s:" %(libraryName, versionName)) result = libraryVersion.getLintResult() logLintResult(result) |
for libraryName, library in self.libraries.iteritems(): | for libraryName, library in self.children.iteritems(): | def runGeneratorForAll(self, job, cwd=False): console.indent() for libraryName, library in self.libraries.iteritems(): for versionName, libraryVersion in library.children.iteritems(): console.info("Running job %s on %s %s..." %(job, libraryName, versionName)) ret, out, err = runGenerator(libraryVersion.path, job, cwd) ... |
def getIssues(self): issues = self.issues for libraryName, library in self.libraries.iteritems(): if len(library.issues) > 0: issues[libraryName] = { "issues": library.issues } for versionName, libraryVersion in library.children.iteritems(): if len(libraryVersion.issues) > 0: if libraryName not in issues: issues[li... | def runGeneratorForAll(self, job, cwd=False): console.indent() for libraryName, library in self.libraries.iteritems(): for versionName, libraryVersion in library.children.iteritems(): console.info("Running job %s on %s %s..." %(job, libraryName, versionName)) ret, out, err = runGenerator(libraryVersion.path, job, cwd) ... | |
self.parent.data.append(self.data) | def __init__(self, name, path, repository): self.name = name self.path = path self.parent = repository self.children = {} self.issues = [] self.readme = self._getReadme() self.data = { "classname": name, "children" : [], "readme" : self.readme } self.parent.data.append(self.data) | |
self.parent.data["children"].append(self.data) | def __init__(self, name, path, library): self.name = name self.path = path self.parent = library self.manifest = self._getManifest() self.issues = [] self.readme = self._getReadme() self.data = { "classname" : self.name, "tests" : [], "manifest" : self.manifest, "readme" : self.readme } self.parent.data["children"].ap... | |
if buildTarget in variant.issues: console.warn("%s %s demo %s %s generation against qooxdoo %s failed!" %(self.parent.name, self.name, variantName, buildTarget, qxVersion)) console.warn(variant.issues[buildTarget]) elif demoBrowser: | for issue in variant.issues: if buildTarget in issue: buildOk = False console.warn("%s %s demo %s %s generation against qooxdoo %s failed!" %(self.parent.name, self.name, variantName, buildTarget, qxVersion)) console.warn(repr(issue[buildTarget])) if demoBrowser and buildOk: | def buildAllDemos(self, buildTarget="build", demoBrowser=None, copyDemos=False): qxVersions = self.manifest["info"]["qooxdoo-versions"] for variantName, variant in self.children.iteritems(): # build version: link demo against each compatible qooxdoo version if buildTarget == "build": #get the compatible qooxdoo version... |
if buildTarget in variant.issues: console.warn("%s %s demo %s %s generation failed!" %(self.parent.name, self.name, variantName, buildTarget)) console.warn(variant.issues[buildTarget]) elif demoBrowser: | for issue in variant.issues: if buildTarget in issue: buildOk = False console.warn("%s %s demo %s %s generation failed!" %(self.parent.name, self.name, variantName, buildTarget)) console.warn(issue[buildTarget]) if demoBrowser and buildOk: | def buildAllDemos(self, buildTarget="build", demoBrowser=None, copyDemos=False): qxVersions = self.manifest["info"]["qooxdoo-versions"] for variantName, variant in self.children.iteritems(): # build version: link demo against each compatible qooxdoo version if buildTarget == "build": #get the compatible qooxdoo version... |
console.info("Generating %s version of demo variant %s for library %s version %s..." %(target, self.name, self.parent.parent.name, self.parent.name) ) | def build(self, target="build", macro=None): console.info("Generating %s version of demo variant %s for library %s version %s..." %(target, self.name, self.parent.parent.name, self.parent.name) ) try: rcode, output, errout = runGenerator(self.path, target, macro) except Exception, e: self.issues.append( {target : str(... | |
if options.storeissues: repository.storeIssues() | def main(): (options,args) = getComputedConf() config = None if options.configfile: config = getDataFromJsonFile(options.configfile) repository = Repository(options.workdir, config) if options.demobrowser: if not os.path.isabs(options.demobrowser): options.demobrowser = os.path.abspath(options.demobrowser) if optio... | |
_libs = {} | def mostRecentlyChangedIn(lib): # this should go into another class youngFiles = {} # for each interesting library part for category in ["class", "translation", "resource"]: catPath = os.path.normpath(os.path.join(lib["path"], lib[category])) if category == "translation" and not os.path.isdir(catPath): continue # find... | |
return (_namespaces, _classes, _docs, _translations, _libs) | return (_namespaces, _classes, _docs, _translations, _libraries) | def mostRecentlyChangedIn(lib): # this should go into another class youngFiles = {} # for each interesting library part for category in ["class", "translation", "resource"]: catPath = os.path.normpath(os.path.join(lib["path"], lib[category])) if category == "translation" and not os.path.isdir(catPath): continue # find... |
_libs[namespace] = lib | def mostRecentlyChangedIn(lib): # this should go into another class youngFiles = {} # for each interesting library part for category in ["class", "translation", "resource"]: catPath = os.path.normpath(os.path.join(lib["path"], lib[category])) if category == "translation" and not os.path.isdir(catPath): continue # find... | |
return (_namespaces, _classes, _classesObj, _docs, _translations, _libs, _libraries) | return (_namespaces, _classes, _classesObj, _docs, _translations, _libraries) | def mostRecentlyChangedIn(lib): # this should go into another class youngFiles = {} # for each interesting library part for category in ["class", "translation", "resource"]: catPath = os.path.normpath(os.path.join(lib["path"], lib[category])) if category == "translation" and not os.path.isdir(catPath): continue # find... |
self._libs, | def printVariantInfo(variantSetNum, variants, variantSets, variantData): if len(variantSets) < 2: # only log when more than 1 set return variantStr = json.dumps(variants,ensure_ascii=False) self._console.head("Processing variant set %s/%s" % (variantSetNum+1, len(variantSets))) | |
def reportResults(self, aut, start_date, log_file, ignore=[]): | def reportResults(self, aut, start_date, log_file, ignore=None): | def reportResults(self, aut, start_date, log_file, ignore=[]): from simulationLogParser import SimulationLogParser if (self.sim): self.log("SIMULATION: Getting report data for " + aut) return else: self.log("Getting report data for " + aut) try: import json except ImportError, e: try: import simplejson as json except... |
self.versionPath = os.path.join(self.library.repository.dir, self.library.dir, self.dir) | self.path = os.path.join(self.library.repository.dir, self.library.dir, self.dir) | def __init__(self, library, versionDir = None): if not (library and versionDir): raise RuntimeError, "Both the library and this version's directory must be defined!" self.library = library self.dir = versionDir self.versionPath = os.path.join(self.library.repository.dir, self.library.dir, self.dir) try: self.manifest ... |
if os.path.isdir(os.path.join(self.versionPath, "source")): | if os.path.isdir(os.path.join(self.path, "source")): | def checkStructure(self): if os.path.isdir(os.path.join(self.versionPath, "source")): self.hasSourceDir = True if os.path.isdir(os.path.join(self.versionPath, "demo")): self.hasDemoDir = True self.demoVariants = self.getDemoVariants() if os.path.isfile(os.path.join(self.versionPath, "README")): self.hasReadmeFile = T... |
if os.path.isdir(os.path.join(self.versionPath, "demo")): | if os.path.isdir(os.path.join(self.path, "demo")): | def checkStructure(self): if os.path.isdir(os.path.join(self.versionPath, "source")): self.hasSourceDir = True if os.path.isdir(os.path.join(self.versionPath, "demo")): self.hasDemoDir = True self.demoVariants = self.getDemoVariants() if os.path.isfile(os.path.join(self.versionPath, "README")): self.hasReadmeFile = T... |
if os.path.isfile(os.path.join(self.versionPath, "README")): | if os.path.isfile(os.path.join(self.path, "README")): | def checkStructure(self): if os.path.isdir(os.path.join(self.versionPath, "source")): self.hasSourceDir = True if os.path.isdir(os.path.join(self.versionPath, "demo")): self.hasDemoDir = True self.demoVariants = self.getDemoVariants() if os.path.isfile(os.path.join(self.versionPath, "README")): self.hasReadmeFile = T... |
if os.path.isfile(os.path.join(self.versionPath, "generate.py")): | if os.path.isfile(os.path.join(self.path, "generate.py")): | def checkStructure(self): if os.path.isdir(os.path.join(self.versionPath, "source")): self.hasSourceDir = True if os.path.isdir(os.path.join(self.versionPath, "demo")): self.hasDemoDir = True self.demoVariants = self.getDemoVariants() if os.path.isfile(os.path.join(self.versionPath, "README")): self.hasReadmeFile = T... |
manifestPath = os.path.join(self.versionPath, "Manifest.json") | manifestPath = os.path.join(self.path, "Manifest.json") | def getManifest(self): try: return self.manifest except AttributeError: pass manifestPath = os.path.join(self.versionPath, "Manifest.json") try: manifestFile = open(manifestPath) except: raise RuntimeError, "Manifest file %s not found" %manifestPath manifest = json.load(manifestFile) return manifest |
manifestPath = os.path.join(self.versionPath, "demo", demoVariant, "Manifest.json") | manifestPath = os.path.join(self.path, "demo", demoVariant, "Manifest.json") | def getDemoManifest(self, demoVariant = "default"): manifestPath = os.path.join(self.versionPath, "demo", demoVariant, "Manifest.json") try: manifestFile = open(manifestPath) except: raise RuntimeError, "Manifest file %s not found" %manifestPath manifest = json.load(manifestFile) return manifest |
lintOpts = LintOpts(self.versionPath) | lintOpts = LintOpts(self.path) | def __init__(self,workdir,mailto = None): self.workdir = workdir self.mailto = mailto self.outputfile = None |
cmd = "svnversion %s" %self.versionPath | cmd = "svnversion %s" %self.path | def getSvnRevision(self): try: return self.svnRevision except: pass cmd = "svnversion %s" %self.versionPath rcode, output, errout = shell.execute_piped(cmd) if rcode > 0: raise RuntimeError, "Error while retrieving SVN version: " + errout svnRevision = output.rstrip('\n') return svnRevision |
demoPath = os.path.join(self.versionPath, "demo") | demoPath = os.path.join(self.path, "demo") | def getDemoVariants(self): if not self.hasDemoDir: return False demoVariants = [] demoPath = os.path.join(self.versionPath, "demo") for root, dirs, files in os.walk(demoPath, topdown=True): for name in dirs: if root == demoPath and name[0] != ".": demoVariants.append(name) return demoVariants |
key = lib["path"] | def mostRecentlyChangedIn(lib): # this should go into another class youngFiles = {} # for each interesting library part for category in ["class", "translation", "resource"]: catPath = os.path.normpath(os.path.join(lib["path"], lib[category])) if category == "translation" and not os.path.isdir(catPath): continue # find... | |
"type" : "JCompileJob", | "type" : "JClassDepJob", | def listJobTriggers(): return { "api" : { "type" : "JClassDepJob" }, "collect-environment-info" : { "type" : "JSimpleJob" }, |
if "provider" in jobTriggers: script.locales = config.get("compile-options/code/locales", []) CodeProvider.runProvider(script, self) | def printVariantInfo(variantSetNum, variants, variantSets, variantData): if len(variantSets) < 2: # only log when more than 1 set return variantStr = json.dumps(variants,ensure_ascii=False) self._console.head("Processing variant set %s/%s" % (variantSetNum+1, len(variantSets))) | |
self.scopes = None | def __init__(self, id, path, library, context, container): #__slots__ = ('id', 'path', 'size', 'encoding', 'library', 'context', 'source', 'scopes', 'translations') global console, cache, DefaultIgnoredNamesDynamic super(Class, self).__init__(path) self.id = id # qooxdoo name of class, classId self.libr... | |
cache = self.context["cache"] cacheId = "class-%s" % (self.path,) classinfo, _ = cache.readmulti(cacheId, self.path) | classinfo = self._getClassCache() | def classVariants(self, generate=True): |
cache.writemulti(cacheId, classinfo) | self._writeClassCache (classinfo) | def classVariants(self, generate=True): |
def getScript(node, fileId, __memo=[None,None]): | def getScript(node, fileId): | def getScript(node, fileId, __memo=[None,None]): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # sam... |
if __memo[0] == rootNode: | if _memo[0] == rootNode: | def getScript(node, fileId, __memo=[None,None]): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # sam... |
script = __memo[1] | script = _memo[1] | def getScript(node, fileId, __memo=[None,None]): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # sam... |
__memo[0] = rootNode __memo[1] = script | _memo[0] = rootNode _memo[1] = script | def getScript(node, fileId, __memo=[None,None]): # TODO: checking the root nodes is a fix, as they sometimes differ (because of caching) # -- looking up nodes in a Script() uses object identity for comparison; sometimes, the # tree _analyzeClassDepsNode works on and the tree Script is built from are not the # sam... |
self._console.progress(pos, length) | self._console.progress(pos + 1, length) | def compileClassesXX(self, classes, variants, optimize, format): content = "" length = len(classes) for pos, classId in enumerate(classes): self._console.progress(pos, length) content += self.getCompiled(classId, variants, optimize, format) return content |
copier = CopyTool(sourceDir, targetDir, update=True) copier.copy() | copier = CopyTool() copier.parse_args(["-u", sourceDir, targetDir]) copier.do_work() | def buildAllDemos(self, demoVersion="build", demoBrowser=None, copyDemos=False): if demoBrowser: demoBrowser = os.path.abspath(demoBrowser) console.info("Generating demos for all known libraries") demoData = [] console.indent() for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "c... |
result = "" vals = {} | result = "" vals = {} loader_with_boot = self._job.get("packages/loader-with-boot", True) | def loadTemplate(bootCode): # try custom loader templates loaderFile = compConf.get("paths/loader-template", None) if not loaderFile: # use default templates if version=="build": #loaderFile = os.path.join(filetool.root(), os.pardir, "data", "generator", "loader-build.tmpl.js") # TODO: test-wise using generic template ... |
vals["BootIsInline"] = json.dumpsCode(self._job.get("packages/loader-with-boot", True)) | vals["BootIsInline"] = json.dumpsCode(loader_with_boot) | def loadTemplate(bootCode): # try custom loader templates loaderFile = compConf.get("paths/loader-template", None) if not loaderFile: # use default templates if version=="build": #loaderFile = os.path.join(filetool.root(), os.pardir, "data", "generator", "loader-build.tmpl.js") # TODO: test-wise using generic template ... |
cParts = {} loader_with_boot = self._job.get("packages/loader-with-boot", True) | cParts = {} if version == "build": | def loadTemplate(bootCode): # try custom loader templates loaderFile = compConf.get("paths/loader-template", None) if not loaderFile: # use default templates if version=="build": #loaderFile = os.path.join(filetool.root(), os.pardir, "data", "generator", "loader-build.tmpl.js") # TODO: test-wise using generic template ... |
if self.id == "qx.event.Registration": print treeDeps | def buildShallowDeps(): | |
def dependencies1(self, variantSet): | def dependencies(self, variantSet): | def dependencies1(self, variantSet): |
def dependencies(self, variants): | def dependencies1(self, variants): | def dependencies(self, variants): |
>>> po = polib.pofile('tests/test_weird_occurrences.po') | >>> po = polib.pofile('tests/test_weird_occurrences.po', ... check_for_duplicates=True) | def pofile(fpath, **kwargs): """ Convenience function that parse the po/pot file *fpath* and return a POFile instance. **Keyword arguments**: - *fpath*: string, full or relative path to the po/pot file to parse - *wrapwidth*: integer, the wrap width, only useful when -w option was passed to xgettext (optional, default... |
parser = _POFileParser(fpath, enc) | check_for_duplicates = kwargs.get('check_for_duplicates', False) parser = _POFileParser( fpath, encoding=enc, check_for_duplicates=kwargs.get('check_for_duplicates', False) ) | def pofile(fpath, **kwargs): """ Convenience function that parse the po/pot file *fpath* and return a POFile instance. **Keyword arguments**: - *fpath*: string, full or relative path to the po/pot file to parse - *wrapwidth*: integer, the wrap width, only useful when -w option was passed to xgettext (optional, default... |
>>> mo = polib.mofile('tests/test_utf8.mo') | >>> mo = polib.mofile('tests/test_utf8.mo', check_for_duplicates=True) | def mofile(fpath, **kwargs): """ Convenience function that parse the mo file *fpath* and return a MOFile instance. **Keyword arguments**: - *fpath*: string, full or relative path to the mo file to parse - *wrapwidth*: integer, the wrap width, only useful when -w option was passed to xgettext to generate the po file th... |
parser = _MOFileParser(fpath, enc) | parser = _MOFileParser( fpath, encoding=enc, check_for_duplicates=kwargs.get('check_for_duplicates', False) ) | def mofile(fpath, **kwargs): """ Convenience function that parse the mo file *fpath* and return a MOFile instance. **Keyword arguments**: - *fpath*: string, full or relative path to the mo file to parse - *wrapwidth*: integer, the wrap width, only useful when -w option was passed to xgettext to generate the po file th... |
st = st.replace('\t', r'\t') st = st.replace('\r', r'\r') st = st.replace('\n', r'\n') return st | return st.replace('\\', r'\\')\ .replace('\t', r'\t')\ .replace('\r', r'\r')\ .replace('\n', r'\n')\ .replace('\"', r'\"') | def escape(st): """ Escape special chars and return the given string *st*. **Examples**: >>> escape('\\t and \\n and \\r and " and \\\\') '\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\' """ #st = st.replace('\\', r'\\') st = st.replace('\t', r'\t') st = st.replace('\r', r'\r') st = st.replace('\n', r'\n') #st = st... |
""" st = st.replace(r'\n', '\n') st = st.replace(r'\r', '\r') st = st.replace(r'\t', '\t') return st | >>> unescape(r'\\n') '\\n' >>> unescape(r'\\\\n') '\\\\n' """ raw_strings = [ (r'\\n', r'\n', '\n'), (r'\\r', r'\r', '\r'), (r'\\t', r'\t', '\t'), ] for a, b, c in raw_strings: if a in st: st = st.replace(a, b) else: st = st.replace(b, c) return st.replace(r'\"', '"').replace(r'\\', '\\') | def unescape(st): """ Unescape special chars and return the given string *st*. **Examples**: >>> unescape('\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\') '\\t and \\n and \\r and " and \\\\' """ #st = st.replace(r'\"', '"') st = st.replace(r'\n', '\n') st = st.replace(r'\r', '\r') st = st.replace(r'\t', '\t') #st... |
def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): | def __init__(self, *args, **kwargs): | def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): """ Constructor. |
format the mo file, default to 78 (optional). | format the mo file, default to 78 (optional), - *encoding*: string, the encoding to use, defaults to "default_encoding" global variable (optional), - *check_for_duplicates*: whether to check for duplicate entries when adding entries to the file, default: False (optional). | def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): """ Constructor. |
self.fpath = fpath | self.fpath = kwargs.get('fpath') | def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): """ Constructor. |
self.wrapwidth = wrapwidth | self.wrapwidth = kwargs.get('wrapwidth', 78) | def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): """ Constructor. |
self.encoding = encoding | self.encoding = kwargs.get('encoding', default_encoding) self.check_for_duplicates = kwargs.get('check_for_duplicates', False) | def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): """ Constructor. |
import array | def to_binary(self): """Return the mofile binary representation.""" import struct import array output = '' offsets = [] ids = strs = '' entries = self.translated_entries() # the keys are sorted in the .mo file def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: ... | |
ids = strs = '' | def to_binary(self): """Return the mofile binary representation.""" import struct import array output = '' offsets = [] ids = strs = '' entries = self.translated_entries() # the keys are sorted in the .mo file def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: ... | |
msgid = e.msgid | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 | |
msgid = msgid + '\0' + e.msgid_plural | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 | |
msgstr = '\0'.join(msgstr) | msgid = self._encode(e.msgid + '\0' + e.msgid_plural) msgstr = self._encode('\0'.join(msgstr)) | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 |
msgstr = e.msgstr | msgid = self._encode(e.msgid) msgstr = self._encode(e.msgstr) | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 |
ids += e.msgid + '\0' strs += e.msgstr + '\0' | ids += msgid + '\0' strs += msgstr + '\0' | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 |
def __init__(self, fpath, enc=default_encoding): | def __init__(self, fpath, *args, **kwargs): | def __init__(self, fpath, enc=default_encoding): """ Constructor. |
**Keyword argument**: | **Arguments**: | def __init__(self, fpath, enc=default_encoding): """ Constructor. |
""" | - *encoding*: string, the encoding to use, defaults to "default_encoding" global variable (optional), - *check_for_duplicates*: whether to check for duplicate entries when adding entries to the file, default: False (optional). """ enc = kwargs.get('encoding', default_encoding) check_dup = kwargs.get('check_for_duplicat... | def __init__(self, fpath, enc=default_encoding): """ Constructor. |
self.instance = POFile(fpath=fpath, encoding=enc) | self.instance = POFile( fpath=fpath, encoding=enc, check_for_duplicates=check_dup ) | def __init__(self, fpath, enc=default_encoding): """ Constructor. |
def __init__(self, fpath, enc=default_encoding): """_MOFileParser constructor.""" | def __init__(self, fpath, *args, **kwargs): """ Constructor. **Arguments**: - *fpath*: string, path to the po file - *encoding*: string, the encoding to use, defaults to "default_encoding" global variable (optional), - *check_for_duplicates*: whether to check for duplicate entries when adding entries to the file, defa... | def __init__(self, fpath, enc=default_encoding): """_MOFileParser constructor.""" self.fhandle = open(fpath, 'rb') self.instance = MOFile(fpath=fpath, encoding=enc) |
self.instance = MOFile(fpath=fpath, encoding=enc) | self.instance = MOFile( fpath=fpath, encoding=enc, check_for_duplicates=check_dup ) | def __init__(self, fpath, enc=default_encoding): """_MOFileParser constructor.""" self.fhandle = open(fpath, 'rb') self.instance = MOFile(fpath=fpath, encoding=enc) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.