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


Python Parameter.getParameter方法代码示例

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


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

示例1: getParameter

# 需要导入模块: from chipwhisperer.common.utils.parameter import Parameter [as 别名]
# 或者: from chipwhisperer.common.utils.parameter.Parameter import getParameter [as 别名]
 def getParameter(self, path):
     """Return the value of a registered parameter"""
     return Parameter.getParameter(path)
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:5,代码来源:CWCoreAPI.py

示例2: addResponse

# 需要导入模块: from chipwhisperer.common.utils.parameter import Parameter [as 别名]
# 或者: from chipwhisperer.common.utils.parameter.Parameter import getParameter [as 别名]
    def addResponse(self, resp):
        """ Add a response from the system to glitch table + logs """

        normeval = self.findParam("normalresp").getValue()
        succeval = self.findParam("successresp").getValue()

        if len(normeval) > 0:
            # Check if Normal
            normresult = eval(normeval, {"s": resp}, {})
        else:
            normresult = False

        # Check if Successful
        if len(succeval) > 0:
            # Check if Normal
            succresult = eval(succeval, {"s": resp}, {})
        else:
            succresult = False

        # Check ?
        if not isinstance(normresult, bool):
            raise ValueError(
                "Result of 'normal' eval() not a bool, got %s (result: %s)" % (type(normresult), normresult)
            )

        if not isinstance(succresult, bool):
            raise ValueError(
                "Result of 'success' eval() not a bool, got %s (result: %s)" % (type(succresult), succresult)
            )

        if normresult and succresult:
            logging.warning("Both normresult and succresult True!")

        starttime = datetime.now()

        respstr = str(bytearray(resp.encode("utf-8")))
        # respstr = ' '.join(["%02x" % t for t in bytearray(resp)])

        settingsList = []
        for i in range(0, len(self.tuneParamList)):
            try:
                settingsList.append(Parameter.getParameter(self.tuneParamList[i].paramScript))
            except:
                raise StopIteration(
                    'Choose a valid Parameter Path for Tuning Parameter "%s" . Got: %s'
                    % (self.tuneParamList[i].name(), self.tuneParamList[i].paramScript)
                )
        newdata = {
            "input": "",
            "output": respstr,
            "normal": normresult,
            "success": succresult,
            "settings": settingsList,
            "date": starttime,
        }

        self.tableList.append(newdata)
        self.appendToTable(newdata)
        self.updateStatus()

        if self._campaignRunning and self.findParam(["Recordings", "saveresults"]).getValue():
            if self._autosavef is None:
                # File previously not open
                try:
                    self._autosavef = open(self._autosavefname, "w")
                except Exception as e:
                    self.findParam(["Recordings", "saveresults"]).setValue(False)
                    raise Warning(
                        "Could not save recordings to file: %s. Reason: %s. Disabling it in order to continue."
                        % (self._autosavefname, str(e))
                    )
                self.findParam(["Recordings", "savefilename"]).setValue(self._autosavefname, ignoreReadonly=True)

                # Add notes
                pickle.dump({"notes": self.findParam(["Recordings", "savenotes"]).getValue()}, self._autosavef)

                # Add headers
                cmds = [
                    self.tuneParamList[i].findParam("parampath").getValue() for i in range(0, len(self.tuneParamList))
                ]
                pickle.dump({"commands": cmds}, self._autosavef)

            # Add data
            pickle.dump({"data": newdata}, self._autosavef)
开发者ID:,项目名称:,代码行数:86,代码来源:


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