dmClasses.py 文件源码

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

项目:CRDataManager 作者: NobahdiAtoll 项目源码 文件源码
def ParseParameters(self, strParameters):
        """Parses Parameters of Group from a string or list of parameters"""
        if dmGlobals.TraceFunctionMessages: print 'Method: dmGroup:ParseParameters(objParameters)'
        if isinstance(strParameters, str) or isinstance(strParameters, list):
            arrParameters = list()
            if isinstance(strParameters, str):
                arrParameters = strParameters.splitlines() #split string into lines
            elif isinstance(strParameters, list):
                arrParameters = strParameters

            nReturn = 0
            #Parse Group Info from line
            if arrParameters[nReturn].startswith(GROUPHEADER):
                GroupInfo = self.ParseNodeInfo(arrParameters[nReturn])
                self.Name = GroupInfo['GROUP'].strip()
                if GroupInfo.haskey('COMMENT'):
                    self.Comment = GroupInfo['COMMENT'].strip()
                if GroupInfo.haskey('FILTERSANDDEFAULTS'):
                    self.FiltersAndDefaults = dmRuleset(self,GroupInfo['FILTERSANDDEFAULTS'].strip())
                #increment nReturn
                nReturn = nReturn + 1

            while nReturn < len(arrParameters) and not arrParameters[nReturn].startswith(GROUPENDER):
                if arrParameters[nReturn].startswith(GROUPHEADER):
                    nReturn = self.ParseGroup(arrParameters, nReturn, self)
                elif arrParameters[nReturn].startswith(RULESETHEADER) or not arrParameters[nReturn].startswith('#'):
                    nReturn = ParseRuleset(arrParameters, nReturn, self)
        elif isinstance(strParameters, XElement):
            self.FromXML(strParameters)
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号