本文整理汇总了Python中pygccxml.declarations.templates.split方法的典型用法代码示例。如果您正苦于以下问题:Python templates.split方法的具体用法?Python templates.split怎么用?Python templates.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygccxml.declarations.templates
的用法示例。
在下文中一共展示了templates.split方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_ns3_relative_path
# 需要导入模块: from pygccxml.declarations import templates [as 别名]
# 或者: from pygccxml.declarations.templates import split [as 别名]
def get_ns3_relative_path(path):
l = []
head = path
while head:
head, tail = os.path.split(head)
if tail == 'ns3':
return os.path.join(*l)
l.insert(0, tail)
raise AssertionError("is the path %r inside ns3?!" % path)
示例2: scan_callback_classes
# 需要导入模块: from pygccxml.declarations import templates [as 别名]
# 或者: from pygccxml.declarations.templates import split [as 别名]
def scan_callback_classes(module_parser, callback_classes_file):
callback_classes_file.write("callback_classes = [\n")
for cls in module_parser.module_namespace.classes(function=module_parser.location_filter,
recursive=False):
if not cls.name.startswith("Callback<"):
continue
assert templates.is_instantiation(cls.decl_string), "%s is not a template instantiation" % cls
dummy_cls_name, template_parameters = templates.split(cls.decl_string)
callback_classes_file.write(" %r,\n" % template_parameters)
callback_classes_file.write("]\n")
示例3: get_ns3_relative_path
# 需要导入模块: from pygccxml.declarations import templates [as 别名]
# 或者: from pygccxml.declarations.templates import split [as 别名]
def get_ns3_relative_path(path):
l = []
head = path
while head:
new_head, tail = os.path.split(head)
if new_head == head:
raise ValueError
head = new_head
if tail == 'ns3':
return os.path.join(*l)
l.insert(0, tail)
raise AssertionError("is the path %r inside ns3?!" % path)
示例4: _get_annotation_exceptions
# 需要导入模块: from pygccxml.declarations import templates [as 别名]
# 或者: from pygccxml.declarations.templates import split [as 别名]
def _get_annotation_exceptions(self, annotation):
retval = []
for exc_name in annotation.split(','):
traits = ctypeparser.TypeTraits(normalize_name(exc_name))
if traits.type_is_reference:
name = str(traits.target)
else:
name = str(traits.ctype)
exc = self.type_registry.root_module.get(name, None)
if isinstance(exc, CppException):
retval.append(exc)
else:
raise ValueError("Thrown exception '%s' is not a CppException object: %r"
% (normalize_name(name), exc))
return retval
示例5: get_ns3_relative_path
# 需要导入模块: from pygccxml.declarations import templates [as 别名]
# 或者: from pygccxml.declarations.templates import split [as 别名]
def get_ns3_relative_path(path):
l = []
head = path
if not path:
return
while head:
new_head, tail = os.path.split(head)
if new_head == head:
raise ValueError
head = new_head
if tail == 'ns3':
return os.path.join(*l)
l.insert(0, tail)
raise AssertionError("is the path %r inside ns3?!" % path)