component.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:autosar 作者: cogu 项目源码 文件源码
def __init__(self,name, portInterfaceRef, comspec=None, parent=None):
      self.name = name      
      if portInterfaceRef is not None and not isinstance(portInterfaceRef,str):
         raise ValueError('portInterfaceRef needs to be of type None or str')
      self.portInterfaceRef = portInterfaceRef
      self.comspec=[] 
      self.parent=parent
      if comspec is not None:
         ws = self.rootWS()
         assert(ws is not None)
         if isinstance(comspec, collections.Mapping):
            comspecObj = self.createComSpecFromDict(ws,portInterfaceRef,comspec)
            if comspecObj is None:
               raise ValueError('failed to create comspec from comspec data: '+repr(comspec))
            self.comspec.append(comspecObj)
         elif isinstance(comspec, collections.Iterable):
            for data in comspec:
               comspecObj = self.createComSpecFromDict(ws,portInterfaceRef,data)
               if comspecObj is None:
                  raise ValueError('failed to create comspec from comspec data: '+repr(data))
               self.comspec.append(comspecObj)
         else:
            raise NotImplementedError("not supported")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号