模块
# Copyright 2017 Pxxx Txxx (Shanghai) Ltd.
#
# Authors: Gao Kxxxx <gaoxxxx@pxxxx.cn>
#
# Copyright (c) 2017. This file is confidential and proprietary.
# All Rights Reserved, Pxxx Txxx (Shanghai) Ltd(http://www.pxxx.cn).
- doc文档说明以3个双引号"""开始和结束,开头大写.
"""Unittest for sqlalchemy api.
Functions start with test_XXX are used for testing db.sqlalchemy.api functions.
Fake database datas are made by storplus.tests.unit.utils.
"""
- 注释中的描述文字符号不可缺省
- import模块时,引用的库放在前面,本地模块放在后面,然后按照首写字母顺序分先后,库和系列库以及本地模块间加一行空格隔开.
import abc
import six
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import importutils
from oslo_utils import timeutils
from storplus.db import base
from storplus.engine import rpcapi as engine_rpcapi
from storplus.engine import states
from storplus import exception
- class之间用两行空行隔开
- function之间用一行空行隔开
- class和function的注释写在第一行定义的下一行,前面的缩进与正文一致,class注释以"""开始和结尾,首字符大写,function除了以' # '开始注释以外,其他均一致
- " , "后面紧跟一个空格
- 所有' # ' 后面要有一个空格
- 括弧内有很多参数时,一个参数占一行,每个参数与第一个参数缩进对齐
- 缩进均使用空格键,不要使用Table
网友评论