zoukankan      html  css  js  c++  java
  • python

    归类三种注释风格:

    • 大段的自定义块状注释
    """
    #=========================================
    #     FileName: upgrade_idirector.py
    #         Desc:
    #       Author: Blithe Gu
    #        Email: bngu@wisu.com.cn
    #     HomePage: wwww.wisu.com.cn
    #      Version: 0.0.1
    #   LastChange: 2017-11-06 14:28:14
    #      History:
    #=========================================
    """
    • 大段的函数语句块注释
    #### 函数型注释 ###############################
    
    # 删除旧的idirector
    # def remove_old_idirector_path(self):
    #     if self.idirector_path == self.new_qm_path:
    #         pass
    #     elif self.idirector_path == self.old_qm_path:
    #         cmd = "rm -rf {old_path}".format(old_path=self.old_qm_path)
    #         stdout, stderr = self.local_cmd(cmd)
    #     print fmt(self.YELLOW, "[START]:remove idirector directory", "ok", "")
    
    
    
    #### 语句型注释 ###############################
        ############################# CHECK MYSQL ####################################################
        mysql_variables = func.get_mysql_variables(cur)
        …… # 其他内容
        ############################# GET VARIABLES ###################################################
        version = func.get_item(mysql_variables,'version')
        key_buffer_size = func.get_item(mysql_variables,'key_buffer_size')
        …… # 其他内容
        ############################# GET INNODB INFO ##################################################
        #innodb variables
        innodb_version = func.get_item(mysql_variables,'innodb_version')
        innodb_buffer_pool_instances = func.get_item(mysql_variables,'innodb_buffer_pool_instances')
        innodb_buffer_pool_size = func.get_item(mysql_variables,'innodb_buffer_pool_size')
        …… # 其他内容
    • 单条语句注释
    #### 小段注释内容 用于说明一部分代码内容或者单条语句内容 ######
            # check sga_param
            sga_param = oracle.get_sga_param(oracle_pool)
            if sga_param:
                …… #其他内容
        
            # check sga_usage
            sga_usage = oracle.get_sga_usage(oracle_pool)
            if sga_usage:
                …… #其他内容
    
    #### 对函数进行注释 写在函数之前 ####################
        # check_os_rsa 为检查是否存在建立安全关系的证书
        def check_os_rsa(self):
            …… #其他内容
        # check_os_hostname 为检查hostname的方法
        def check_os_hostname(self):
            …… #其他内容
  • 相关阅读:
    Windows CMD中 find命令(字符串查找)
    网络地址转换静态NAT
    网络地址转换静态NAT
    Android 的暗示 hint 用法
    Android 的暗示 hint 用法
    SQL Server 扩展事件
    SQL Server 扩展事件
    SqlServer中Exists的使用
    SqlServer中Exists的使用
    数据库还原,System.Data.SqlClient.SqlError: 因为数据库正在使用,所以无法获得对数据库的独占访问权。
  • 原文地址:https://www.cnblogs.com/blitheG/p/7793107.html
Copyright © 2011-2022 走看看