本文整理汇总了Python中generator.code.Class.Class.optimizeEnvironmentClass方法的典型用法代码示例。如果您正苦于以下问题:Python Class.optimizeEnvironmentClass方法的具体用法?Python Class.optimizeEnvironmentClass怎么用?Python Class.optimizeEnvironmentClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类generator.code.Class.Class
的用法示例。
在下文中一共展示了Class.optimizeEnvironmentClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: classlistFromClassRecursive
# 需要导入模块: from generator.code.Class import Class [as 别名]
# 或者: from generator.code.Class.Class import optimizeEnvironmentClass [as 别名]
# calculate dependencies and add required classes
classlistFromClassRecursive(depsItem, excludeWithDeps, variants, result, warn_deps, [], allowBlockLoaddeps)
#classlistFromClassIterative(depsItem, excludeWithDeps, variants, result, warn_deps, [], allowBlockLoaddeps)
self._console.dotclear()
#print len(result)," ",
# process qx.core.Environment
if ("qx.core.Environment" in resultNames
and "variants" in script.optimize
and not processedEnvironment):
envObj = self._classesObj["qx.core.Environment"]
envTreeId = "tree-%s-%s" % (envObj.path, util.toString({})) # TODO: {} is a temp. hack
compOpts = CompileOptions(optimize=[], variants=variants)
compOpts.allClassVariants = script.classVariants([self._classesObj[x] for x in resultNames])
tree = Class.optimizeEnvironmentClass(envObj, compOpts)
self._cache.write(envTreeId, tree, memory=True, writeToFile=False)
# this is for the side-effect of leaving a modified tree for qx.core.Environmet
# in the cache!
_ = envObj.dependencies(variants, force=True)
# this is for the side-effect of re-calculating the transitive dependencies
# of qx.core.Environment!
processedEnvironment = True
else:
# We currently know that one additional iteration is enough,
# after optimizeEnvironmentClass() has run. This has to do
# with the fact that it only removes dependencies to
# qx.bom.client.* classes, which in turn do not use
# qx.core.Env calls. So after calculating the new class
# list, allClassVariants will not have changed. If it would,
# we would need to re-calculate until the class list is
示例2: optimizeEnvironmentClass
# 需要导入模块: from generator.code.Class import Class [as 别名]
# 或者: from generator.code.Class.Class import optimizeEnvironmentClass [as 别名]
def optimizeEnvironmentClass(envClass, compConf):
assert envClass.id == "qx.core.Environment"
tree = Class.optimizeEnvironmentClass(envClass, compConf)
code = Packer().serializeNode(tree, None, [u''], compConf.format)
code = u''.join(code)
return code