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


Python CommConfig.config_filename方法代码示例

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


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

示例1: fetch_comm_config

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
 def fetch_comm_config(self):
     """
     @brief collect connection information for the logger from the user
     """
     config_path = "%s/%s" % (self.metadata.driver_dir(), CommConfig.config_filename())
     self.comm_config = CommConfig.get_config_from_console(config_path)
     self.comm_config.get_from_console()
开发者ID:JeffRoy,项目名称:marine-integrations,代码行数:9,代码来源:start_driver.py

示例2: fetch_comm_config

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
    def fetch_comm_config(self):
        """
        @brief collect connection information for the logger from the user
        """

        config_path = "%s/%s" % (self.metadata.driver_dir(), CommConfig.config_filename())
        self.comm_config = CommConfig.get_config_from_console(config_path)
        self.comm_config.display_config()
        #self.comm_config.get_from_console()
        self.ip_address = self.comm_config.device_addr
        self.data_port = self.comm_config.data_port
        self.command_port = self.comm_config.command_port
        
        if not (self.ip_address):
            self.ip_address = prompt.text( 'Instrument IP Address', self.ip_address )
            
        if not (self.data_port):
            continuing = True
            while continuing:
                sport = prompt.text( 'Instrument Port', self.data_port )
                try:
                    self.data_port = int(sport)
                    continuing = False
                except ValueError as e:
                    print "Error converting port to number: " + str(e)
                    print "Please enter a valid port number.\n"
开发者ID:ccenter,项目名称:marine-integrations,代码行数:28,代码来源:run_instrument.py

示例3: __init__

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
    def __init__(self, metadata, log_file = None, launch_data_moniotor = False):
        """
        @brief Constructor
        @param metadata IDK Metadata object
        @param log_file File to store test results.  If none specified log to STDOUT
        """
        repo_dir = Config().get("working_repo")
        if(not repo_dir):
            raise IDKConfigMissing()
        
        # Ion scripts need to be run from the base os the repo dir so it has access
        # to resources using relative pathing.  So we just do 
        os.chdir(repo_dir)
        
        self.metadata = metadata
        if(not self.metadata.driver_name):
            raise DriverNotStarted()

        if( log_file ):
            self.log_fh = open(log_file, "w")
        else:
            self.log_fh = sys.stdout
            
        config_path = "%s/%s" % (self.metadata.driver_dir(), CommConfig.config_filename())
        self.comm_config = CommConfig.get_config_from_file(config_path)
        if(not self.comm_config):
            raise CommConfigReadFail(msg=config_path)

        self.test_runner = nose.core.TextTestRunner(stream=self.log_fh)
开发者ID:newbrough,项目名称:marine-integrations,代码行数:31,代码来源:nose_test.py

示例4: overwrite

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
 def overwrite(self):
     """
     @brief Overwrite the current files with what is stored in the current metadata file.
     """
     self.metadata = Metadata()
     config_path = "%s/%s" % (self.metadata.driver_dir(), CommConfig.config_filename())
     self.comm_config = CommConfig.get_config_from_file(config_path)
     self.generate_code(force = True)
开发者ID:JeffRoy,项目名称:marine-integrations,代码行数:10,代码来源:start_driver.py

示例5: comm_config_file

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
 def comm_config_file(cls):
     """
     @brief Return the path the the driver comm config yaml file.
     @return if comm_config.yml exists return the full path
     """
     repo_dir = Config().get('working_repo')
     driver_path = cls.test_config.driver_module
     p = re.compile('\.')
     driver_path = p.sub('/', driver_path)
     abs_path = "%s/%s/%s" % (repo_dir, os.path.dirname(driver_path), CommConfig.config_filename())
     
     log.debug(abs_path)
     return abs_path
开发者ID:tgiguere,项目名称:marine-integrations,代码行数:15,代码来源:unit_test.py

示例6: _init_test

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
    def _init_test(self, metadata):
        """
        initialize the test with driver metadata
        """
        self.metadata = metadata
        if(not self.metadata.driver_name):
            raise DriverNotStarted()

        config_path = "%s/%s" % (self.metadata.driver_dir(), CommConfig.config_filename())
        self.comm_config = CommConfig.get_config_from_file(config_path)
        if(not self.comm_config):
            raise CommConfigReadFail(msg=config_path)

        self._inspect_driver_module(self._driver_test_module())
开发者ID:ccenter,项目名称:marine-integrations,代码行数:16,代码来源:nose_test.py

示例7: _get_file

# 需要导入模块: from mi.idk.comm_config import CommConfig [as 别名]
# 或者: from mi.idk.comm_config.CommConfig import config_filename [as 别名]
def _get_file():
    """
    build the data file name.  Then loop until the file can be open successfully
    @return: file pointer to the data file
    """
    metadata = Metadata()
    config_path = "%s/%s" % (metadata.driver_dir(), CommConfig.config_filename())
    comm_config = CommConfig.get_config_from_file(config_path)
    date = time.strftime("%Y%m%d")

    filename = "%s/port_agent_%d.%s.data" % (DATADIR, comm_config.command_port, date)

    file = None
    while(not file):
        try:
            file = open(filename)
        except Exception as e:
            sys.stderr.write("file open failed: %s\n" % e)
            time.sleep(SLEEP)

    return file
开发者ID:JeffRoy,项目名称:marine-integrations,代码行数:23,代码来源:watch_data_log.py


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