本文整理汇总了Python中context.Context.listContext方法的典型用法代码示例。如果您正苦于以下问题:Python Context.listContext方法的具体用法?Python Context.listContext怎么用?Python Context.listContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类context.Context
的用法示例。
在下文中一共展示了Context.listContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: genBitfieldContexts
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import listContext [as 别名]
def genBitfieldContexts(enums, bitfGroups):
bitfieldEnums = [enum for enum in enums if enum.type == "GLbitfield"]
maxLength = max([len(enumBID(enum)) for enum in bitfieldEnums])
noneIdentifier = "GL_NONE_BIT"
noneValue = "0x0"
noneGroups = Context.listContext([g.name for g in bitfGroups], sortKey = lambda g: g)
bitfieldContexts = []
bitfieldContexts.append({"identifier": noneIdentifier,
"name": noneIdentifier,
"value": noneValue,
"spaces": " " * (maxLength - len(noneIdentifier)),
"generic": True,
"groups": noneGroups,
"primaryGroup": noneGroups["items"][0]["item"] if not noneGroups["empty"] else None,
"supported": (lambda feature, core, ext: True) })
for enum in bitfieldEnums:
groups = Context.listContext([g.name for g in enum.groups], sortKey = lambda g: g)
bitfieldContexts.append({"identifier": enumBID(enum),
"name": enum.name,
"value": enum.value,
"spaces": " " * (maxLength - len(enumBID(enum))),
"generic": False,
"groups": groups,
"primaryGroup": groups["items"][0]["item"] if not groups["empty"] else None,
"supported": supportedLambda(enum) })
return bitfieldContexts
示例2: genExtensionContexts
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import listContext [as 别名]
def genExtensionContexts(extensions):
extensionContexts = []
for extension in extensions:
commandContexts = Context.listContext([{"identifier": functionBID(c), "name": c.name} for c in extension.reqCommands],
sortKey = lambda c: c["identifier"])
extensionContexts.append({"identifier": extensionBID(extension),
"name": extension.name,
"incore": extension.incore,
"incoreMajor": extension.incore.major if extension.incore else None,
"incoreMinor": extension.incore.minor if extension.incore else None,
"reqCommands": commandContexts})
return extensionContexts
示例3: genFeatureContexts
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import listContext [as 别名]
def genFeatureContexts(features):
featureContexts = []
for feature in sorted(features) :
commandContexts = Context.listContext([{"identifier": c } for c in feature.reqCommandStrings],
sortKey = lambda c: c["identifier"])
featureContexts.append({
"identifier": versionBID(feature),
"major": feature.major,
"minor": feature.minor,
"reqCommandStrings": commandContexts})
return featureContexts
示例4: genEnumContexts
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import listContext [as 别名]
def genEnumContexts(allEnums):
ungroupedName = "__UNGROUPED__"
enums = [enum for enum in allEnums if enum.type == "GLenum"]
maxLength = max([len(enumBID(enum)) for enum in enums])
enumContexts = []
for enum in enums:
groups = Context.listContext([g.name for g in enum.groups] if enum.groups else [ungroupedName], sortKey = lambda g: g)
enumContexts.append({"identifier": enumBID(enum),
"name": enum.name,
"value": enum.value,
"cast": enum.value.startswith("-"),
"spaces": " " * (maxLength - len(enumBID(enum))),
"groups": groups,
"primaryGroup": groups["items"][0]["item"] if not groups["empty"] else None,
"supported": supportedLambda(enum) })
return enumContexts
示例5: genFunctionContexts
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import listContext [as 别名]
def genFunctionContexts(commands):
contexts = []
for command in commands:
paramContexts = []
for param in command.params:
paramContexts.append(
{"name": param.name,
"type": typeContext(param.groupString
if param.type == "GLbitfield" and param.groupString
else param.type, command.api) })
identifier = functionBID(command)
contexts.append({"identifier": identifier,
"identifierNoGl": identifier[2:] if identifier.startswith("gl") else identifier,
"type": typeContext(command.returntype, command.api),
"params": Context.listContext(paramContexts),
"supported": supportedLambda(command) })
return contexts