From 7a93056b5a3cd22284c1bc22ce0bc3d043631a8a Mon Sep 17 00:00:00 2001 From: tangdou1 <35254744+tangdou1@users.noreply.github.com> Date: Wed, 25 Mar 2020 10:55:51 +0800 Subject: [PATCH] Update coding_conventions.md --- docs/zh/help_zeronet/coding_conventions.md | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/zh/help_zeronet/coding_conventions.md b/docs/zh/help_zeronet/coding_conventions.md index f704eae..a6aeb5e 100644 --- a/docs/zh/help_zeronet/coding_conventions.md +++ b/docs/zh/help_zeronet/coding_conventions.md @@ -1,20 +1,20 @@ # 如果您想与ZeroNet合作,则遵守编码标准 - 遵循 [PEP8](https://www.python.org/dev/peps/pep-0008/) - - 简单比复杂更好 + - 简单比复杂好 - 过早优化是万恶之源 -### 命名 - - ClassNames: Capitalized, CamelCased - - functionNames: starts with lowercase, camelCased - - variable_names: lowercased, under_scored +### 命名规则 + - 类名(ClassNames): 大写, 骆驼命名法 + - 函数名(functionNames): 以小写字母开头, 骆驼命名法 + - 变量名(variable_names): 小写, 下划线 ### 变量 - - file_path: File path realtive to working dir (data/17ib6teRqdVgjB698T4cD1zDXKgPqpkrMg/css/all.css) - - inner_path: File relative to site dir (css/all.css) - - file_name: all.css - - file: Python file object - - privatekey: Private key for the site (without _) + - 文件路径(file_path): 相对于工作文件夹的文件路径(data/17ib6teRqdVgjB698T4cD1zDXKgPqpkrMg/css/all.css) + - 内部路径(inner_path): 相对于站点文件夹的文件路径(css/all.css) + - 文件名(file_name): all.css + - 文件(file): Python文件对象 + - 私钥(privatekey): 站点私钥(没有下划线) -### 源文件目录和命名 - - 每个文件一个类是首选 - - 源文件名和目录来自ClassName: WorkerManager class = Worker/WorkerManager.py +### 源文件文件夹和命名 + - 最好一个文件代表一个类 + - 源文件名和目录来自类名(ClassName): WorkerManager类 = Worker/WorkerManager.py