plcopen/plcopen.py
changeset 1777 c46ec818bdd7
parent 1768 691083b5682a
child 1780 c52d1460cea8
equal deleted inserted replaced
1776:81aa8aaccdd4 1777:c46ec818bdd7
   464     setattr(cls, "removedataType", removedataType)
   464     setattr(cls, "removedataType", removedataType)
   465 
   465 
   466     def getpous(self, exclude=None, filter=[]):
   466     def getpous(self, exclude=None, filter=[]):
   467         return self.xpath(
   467         return self.xpath(
   468             "ppx:types/ppx:pous/ppx:pou%s%s" %
   468             "ppx:types/ppx:pous/ppx:pou%s%s" %
   469                 (("[@name!='%s']" % exclude) if exclude is not None else '',
   469             (("[@name!='%s']" % exclude) if exclude is not None else '',
   470                  ("[%s]" % " or ".join(
   470              ("[%s]" % " or ".join(
   471                     map(lambda x: "@pouType='%s'" % x, filter)))
   471                  map(lambda x: "@pouType='%s'" % x, filter)))
   472                  if len(filter) > 0 else ""),
   472              if len(filter) > 0 else ""),
   473             namespaces=PLCOpenParser.NSMAP)
   473             namespaces=PLCOpenParser.NSMAP)
   474     setattr(cls, "getpous", getpous)
   474     setattr(cls, "getpous", getpous)
   475 
   475 
   476     setattr(cls, "getpou", gettypeElementFunc("pou"))
   476     setattr(cls, "getpou", gettypeElementFunc("pou"))
   477 
   477