当前位置: 首页>>代码示例>>Python>>正文


Python EDConfiguration.getIntegerParamValue方法代码示例

本文整理汇总了Python中EDConfiguration.EDConfiguration.getIntegerParamValue方法的典型用法代码示例。如果您正苦于以下问题:Python EDConfiguration.getIntegerParamValue方法的具体用法?Python EDConfiguration.getIntegerParamValue怎么用?Python EDConfiguration.getIntegerParamValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EDConfiguration.EDConfiguration的用法示例。


在下文中一共展示了EDConfiguration.getIntegerParamValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testGetParamValue

# 需要导入模块: from EDConfiguration import EDConfiguration [as 别名]
# 或者: from EDConfiguration.EDConfiguration import getIntegerParamValue [as 别名]
 def testGetParamValue(self):
     """
     Testing the XSParamItem Value convertion from string to different formats
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     xsPluginItem = edConfiguration.getXSConfigurationItem("indexingMosflm")
     EDAssert.equal("/path/to/working/dir", edConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal("/path/to/working/dir", EDConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal(3, edConfiguration.getIntegerParamValue(xsPluginItem, "number"))
     EDAssert.equal(3, EDConfiguration.getIntegerParamValue(xsPluginItem, "number"))
开发者ID:antolinos,项目名称:edna,代码行数:14,代码来源:EDTestCaseEDConfiguration.py

示例2: configure

# 需要导入模块: from EDConfiguration import EDConfiguration [as 别名]
# 或者: from EDConfiguration.EDConfiguration import getIntegerParamValue [as 别名]
    def configure(self):
        """
        
        Configuration step of the plugin: mainly extend the timeout by 5 seconds to let the plugin finish. 

        """
        self.DEBUG("EDPluginWaitFile.configure : %s" % self.getClassName())
        xsPluginItem = self.getConfiguration()
        if xsPluginItem is None:
            xsPluginItem = EDApplication.getApplicationPluginConfiguration(self.getPluginName())
            if (xsPluginItem is None):
                # No application wide configuration file found! Try to find a project specific config file:
                xsPluginItem = EDApplication.getProjectPluginConfiguration(self.getPluginName())

            if (xsPluginItem is None):
                self.DEBUG("EDPlugin.execute: No plugin configuration found for " + self.getPluginName())
                xsPluginItem = XSPluginItem()
            else:
                self.setConfiguration(xsPluginItem)
        # Try to get time out from plugin configuration
        iTimeOut = EDConfiguration.getIntegerParamValue(xsPluginItem, EDPlugin.CONF_TIME_OUT)
        if iTimeOut is not None:
            self.DEBUG("EDPlugin.configure: Setting time out to %d s from plugin configuration." % iTimeOut)
            self.__timeout = iTimeOut
            self.setTimeOut(iTimeOut + EDPluginWaitFile.EXTRA_TIME)
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:27,代码来源:EDPluginWaitFile.py

示例3: testGetParamValue

# 需要导入模块: from EDConfiguration import EDConfiguration [as 别名]
# 或者: from EDConfiguration.EDConfiguration import getIntegerParamValue [as 别名]
 def testGetParamValue(self):
     """
     Testing the XSParamItem Value convertion from string to different formats
     """
     xsPluginItem = self.___edConfiguration.getPluginItem("indexingMosflm")
     EDAssert.equal("/path/to/working/dir", self.___edConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal("/path/to/working/dir", EDConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal(3, self.___edConfiguration.getIntegerParamValue(xsPluginItem, "number"))
     EDAssert.equal(3, EDConfiguration.getIntegerParamValue(xsPluginItem, "number"))
开发者ID:olofsvensson,项目名称:edna-kernel,代码行数:11,代码来源:EDTestCaseEDConfiguration.py

示例4: configure

# 需要导入模块: from EDConfiguration import EDConfiguration [as 别名]
# 或者: from EDConfiguration.EDConfiguration import getIntegerParamValue [as 别名]
    def configure(self):
        """
        Should be overridden by the Final Plugin If needed
        This method should set its proper members attributes from a Plugin configuration Object
        """
        self.DEBUG("EDPlugin.configure : %s" % self.getClassName())
        xsPluginItem = self.getConfiguration()

        if xsPluginItem is None:
            xsPluginItem = EDApplication.getApplicationPluginConfiguration(self.getPluginName())
            if (xsPluginItem is None):
                # No application wide configuration file found! Try to find a project specific config file:
                xsPluginItem = EDApplication.getProjectPluginConfiguration(self.getPluginName())

            if (xsPluginItem is None):
                self.DEBUG("EDPlugin.configure: No plugin configuration found for " + self.getPluginName())
                xsPluginItem = XSPluginItem()
            else:
                self.setConfiguration(xsPluginItem)

        # set Timeout if different from default one
        if self.getTimeOut() == self.getDefaultTimeOut():
            # Try to get time out from plugin configuration
            iTimeOut = EDConfiguration.getIntegerParamValue(xsPluginItem, EDPlugin.CONF_TIME_OUT)
            if iTimeOut is not None:
                self.DEBUG("EDPlugin.configure: Setting time out to %d s from plugin configuration." % iTimeOut)
                self.setTimeOut(iTimeOut)
        else:
            self.DEBUG("EDPlugin.configure: Working directory already set before plugin is configured.")
        # Base directory
        strBaseDirectory = self.getBaseDirectory()
        if (strBaseDirectory is None):
            # Try to get base directory from plugin configuration
            strBaseDirectory = EDConfiguration.getStringParamValue(xsPluginItem, EDPlugin.CONF_BASE_DIR_LABEL)
            if(strBaseDirectory is None):
                # Try to get working directory from environment variable
                strBaseDirectory = os.environ.get("EDNA_BASE_DIRECTORY")
                if (strBaseDirectory is None):
                    self.DEBUG("EDPlugin.configure: Using current base directory as working directory.")
                    strBaseDirectory = os.getcwd()
                else:
                    self.DEBUG("EDPlugin.configure: Setting base directory from $EDNA_WORKING_DIRECTORY.")
            else:
                if (strBaseDirectory == "."):
                    self.DEBUG("EDPlugin.configure: Using current base directory as working directory.")
                    strBaseDirectory = os.getcwd()
                else:
                    strBaseDirectory = os.path.abspath(strBaseDirectory)
                    self.DEBUG("EDPlugin.configure: Setting base directory from plugin configuration.")
            self.setBaseDirectory(strBaseDirectory)
        else:
            self.DEBUG("EDPlugin.configure: Base directory already set before plugin is configured.")
        # Working directory
        strWorkingDirectory = self.getWorkingDirectory()
        if (strWorkingDirectory is None):
            # Try to get working directory from plugin configuration
            strWorkingDirectory = EDConfiguration.getStringParamValue(xsPluginItem, EDPlugin.CONF_WORKING_DIR_LABEL)
            if(strWorkingDirectory is not None):
                self.DEBUG("EDPlugin.configure: Setting working directory from plugin configuration.")
            else:
                self.DEBUG("EDPlugin.configure: Setting working directory as base directory + base name.")
                strWorkingDirectory = os.path.join(self.getBaseDirectory(), self.getBaseName())
            self.setWorkingDirectory(strWorkingDirectory)
        else:
            self.DEBUG("EDPlugin.configure: Working directory already set before plugin is configured.")
        #
        strWriteXMLInputOutput = EDConfiguration.getStringParamValue(xsPluginItem, EDPlugin.CONF_WRITE_XML_INPUT_OUTPUT)
        if strWriteXMLInputOutput != None:
            if strWriteXMLInputOutput.lower().strip() in ["false", "0"]:
                self.__bWriteDataXMLInputOutput = False
            else:
                self.__bWriteDataXMLInputOutput = True

        strWriteXMLOutput = EDConfiguration.getStringParamValue(xsPluginItem, EDPlugin.CONF_WRITE_XML_OUTPUT)
        if strWriteXMLOutput != None:
            if strWriteXMLOutput.lower().strip()  in ["false", "0"]:
                self.__bWriteDataXMLOutput = False
            else:
                self.__bWriteDataXMLOutput = True
        strWriteXMLInput = EDConfiguration.getStringParamValue(xsPluginItem, EDPlugin.CONF_WRITE_XML_INPUT)
        if strWriteXMLInput != None:
            if strWriteXMLInput.lower().strip() in ["false", "0"]:
                self.__bWriteDataXMLInput = False
            else:
                self.__bWriteDataXMLInput = True
开发者ID:olofsvensson,项目名称:edna-kernel,代码行数:87,代码来源:EDPlugin.py

示例5: EDTestCaseEDConfiguration

# 需要导入模块: from EDConfiguration import EDConfiguration [as 别名]
# 或者: from EDConfiguration.EDConfiguration import getIntegerParamValue [as 别名]
class EDTestCaseEDConfiguration(EDTestCase):


    def __init__(self, _strTestName=None):
        EDTestCase.__init__(self, "EDTestCaseEDConfiguration")
        self.__edConfiguration = None
        strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
        strDataDir = "EDConfiguration"
        self.___strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)


    def preProcess(self):
        """
        Constructs the utilitary EDConfiguration class
        """
        #Loads py module directly using xml configuration file
        self.___edConfiguration = EDConfiguration(os.path.join(self.___strDataPath, "XSConfiguration.xml"))
        self.___edConfiguration.load()


    def testGetPluginList(self):
        """
        Testing the retrieved XSPluginList from configuration
        """
        edPluginList = self.___edConfiguration.getPluginList()
        EDAssert.equal(2, self.___edConfiguration.getPluginListSize())


    def testGetPluginItem(self):
        """
        Testing Plugin indexingMosflm Configuration
        """
        xsPluginItem = self.___edConfiguration.getPluginItem("indexingMosflm")
        EDAssert.equal("indexingMosflm", xsPluginItem.getName())

        paramList = xsPluginItem.getXSParamList()
        paramItems = paramList.getXSParamItem()

        EDAssert.equal("workingDir", paramItems[0].getName())
        EDAssert.equal("/path/to/working/dir", paramItems[0].getValue())
        EDAssert.equal("number", paramItems[1].getName())
        EDAssert.equal("3", paramItems[1].getValue())


    def testGetPluginItemError(self):
        """
        Testing the retrieval of an absent plugin
        """
        EDAssert.equal(None, self.___edConfiguration.getPluginItem("toto"))


    def testGetParamItem(self):
        """
        Testing the XSParamItem inside an XSPluginItem
        """
        xsPluginItem = self.___edConfiguration.getPluginItem("indexingMosflm")
        xsParamItem = self.___edConfiguration.getParamItem(xsPluginItem, "workingDir")
        EDAssert.equal("workingDir", xsParamItem.getName())


    def testGetParamValue(self):
        """
        Testing the XSParamItem Value convertion from string to different formats
        """
        xsPluginItem = self.___edConfiguration.getPluginItem("indexingMosflm")
        EDAssert.equal("/path/to/working/dir", self.___edConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
        EDAssert.equal("/path/to/working/dir", EDConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
        EDAssert.equal(3, self.___edConfiguration.getIntegerParamValue(xsPluginItem, "number"))
        EDAssert.equal(3, EDConfiguration.getIntegerParamValue(xsPluginItem, "number"))


    def testGetOptionItem(self):
        """
        Testing the XSOptionItem inside an XSPluginItem
        """
        xsPluginItem = self.___edConfiguration.getPluginItem("indexing")
        xsOptionItemMosflm = self.___edConfiguration.getOptionItem(xsPluginItem, "indexingMosflm")
        EDAssert.equal(True, xsOptionItemMosflm.getEnabled())

        xsOptionItemXds = self.___edConfiguration.getOptionItem(xsPluginItem, "indexingXds")
        EDAssert.equal(False, xsOptionItemXds.getEnabled())

        xsOptionItemLabelit = self.___edConfiguration.getOptionItem(xsPluginItem, "indexingLabelit")
        EDAssert.equal(False, xsOptionItemLabelit.getEnabled())


    def process(self):
        self.addTestMethod(self.testGetPluginList)
        self.addTestMethod(self.testGetPluginItem)
        self.addTestMethod(self.testGetPluginItemError)
        self.addTestMethod(self.testGetParamItem)
        self.addTestMethod(self.testGetParamValue)
        self.addTestMethod(self.testGetOptionItem)
开发者ID:olofsvensson,项目名称:edna-kernel,代码行数:95,代码来源:EDTestCaseEDConfiguration.py


注:本文中的EDConfiguration.EDConfiguration.getIntegerParamValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。