Skip to content

Commit 88547c9

Browse files
committed
Refactor option names
1 parent 2738317 commit 88547c9

File tree

5 files changed

+45
-29
lines changed

5 files changed

+45
-29
lines changed

pyarmor/docs/en/user/configuration.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ List all the options and values in this section::
9595

9696
$ pyarmor env -p info rft
9797

98-
Get only one option value. For example, `enable_argument`::
98+
Get only one option value. For example, `argument_mode`::
9999

100-
$ pyarmor env -p get rft:enable_argument
100+
$ pyarmor env -p get rft:argument_mode
101101

102102
Set option value. For example::
103103

104-
$ pyarmor env -p set rft:enable_argument 0
104+
$ pyarmor env -p set rft:argument_mode 0
105105

106106
.. flat-table:: Table-4. Section `rft` Options
107107
:widths: 20 10 10 60
@@ -119,11 +119,11 @@ Set option value. For example::
119119
- Bool
120120
- 0
121121
- Remove all the docstring in the script
122-
* - enable_builtin
122+
* - builtin_mode
123123
- Bool
124124
- 0
125125
- Rename builtin names such as `print` etc.
126-
* - enable_argument
126+
* - argument_mode
127127
- Enum
128128
- 3
129129
- How to rename arguments in the function
@@ -167,7 +167,15 @@ Set option value. For example::
167167
"func"
168168
"modname::func"
169169
"modname::cls.method"
170+
* - attr_rules
171+
- List
172+
-
173+
- Define how to rename unknown attributes
170174
* - extra_builtins
171175
- List
172176
-
173177
- Extra builtin name
178+
* - external_types
179+
- List
180+
-
181+
- Classes aren't defined in the project

pyarmor/docs/en/user/man.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ Refer to :doc:`configuration` for all available options
267267

268268
$ pyarmor env -p info rft
269269

270-
Show the usage of option `enable_argument` in the section `rft`::
270+
Show the usage of option `argument_mode` in the section `rft`::
271271

272-
$ pyarmor env -p info rft:enable_argument
272+
$ pyarmor env -p info rft:argument_mode
273273

274274
.. describe:: get
275275

@@ -279,17 +279,17 @@ Refer to :doc:`configuration` for all available options
279279

280280
OPTION may be format like `SECTION:OPTION`. For example::
281281

282-
$ pyarmor env -p get rft:enable_argument
282+
$ pyarmor env -p get rft:argument_mode
283283

284284
.. describe:: set, reset
285285

286286
Change option value or restore default value. For example::
287287

288288
$ pyarmor env -p set recursive 1
289-
$ pyarmor env -p set rft:enable_argument 0
289+
$ pyarmor env -p set rft:argument_mode 0
290290

291291
$ pyarmor env -p reset recursive
292-
$ pyarmor env -p reset rft:enable_argument
292+
$ pyarmor env -p reset rft:argument_mode
293293

294294
.. describe:: push, pop
295295

@@ -403,10 +403,10 @@ Refer to :doc:`configuration` for all available options
403403

404404
(project) info rft
405405

406-
Show option `enable_argument` usage::
406+
Show option `argument_mode` usage::
407407

408408
(project) cd rft
409-
(project)[rft] info enable_argument
409+
(project)[rft] info argument_mode
410410

411411
pyarmor build
412412
=============
@@ -460,7 +460,7 @@ Generate obfuscated scripts for project
460460

461461
When auto-fix mode is enabled
462462

463-
- Always `enable_argument = 1`
463+
- Always `argument_mode = 1`
464464
- Search all unknown attributes and add them to exclude table
465465

466466
Then build the project::

pyarmor/docs/zh/user/configuration.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ rft
9797

9898
查看单个选项的值,例如::
9999

100-
$ pyarmor env -p get rft:enable_argument
100+
$ pyarmor env -p get rft:argument_mode
101101

102102
设置选项的值,例如::
103103

104-
$ pyarmor env -p set rft:enable_argument 1
104+
$ pyarmor env -p set rft:argument_mode 1
105105

106106
.. flat-table:: 表-4. 节 rft 选项表
107107
:widths: 20 10 10 60
@@ -119,13 +119,13 @@ rft
119119
- 布尔
120120
- 0
121121
- 是否删除脚本中所有 docstring
122-
* - enable_builtin
122+
* - builtin_mode
123123
- 布尔
124124
- 0
125125
- 是否重命名内置名称,例如 print 等
126-
* - enable_argument
126+
* - argument_mode
127127
- 枚举
128-
- all
128+
- 3
129129
- 重命名参数的方式,可用值
130130

131131
- 0: 不重名所有函数的参数
@@ -174,10 +174,18 @@ rft
174174
"modname::func"
175175
"modname::cls.method"
176176

177+
* - attr_rules
178+
- 模式列表
179+
-
180+
- 处理未知类型的属性的时候,自定义重命名规则
177181
* - extra_builtins
178182
- 名称列表
179183
-
180184
- 除了 builtins 模块之外,需要作为内置名称进行处理的额外名称
185+
* - external_types
186+
- 外部类列表
187+
-
188+
- 处理未知类型的属性的时候,自动排除外部类的属性
181189

182190
..
183191
* - var_type_table

pyarmor/docs/zh/user/man.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ Pyarmor 的配置有三个域:
269269

270270
$ pyarmor env -p info rft
271271

272-
显示工程域中的节 rft 中选项 enable_argument 的设置和使用方法::
272+
显示工程域中的节 rft 中选项 argument_mode 的设置和使用方法::
273273

274-
$ pyarmor env -p info rft:enable_argument
274+
$ pyarmor env -p info rft:argument_mode
275275

276276
.. describe:: get
277277

@@ -281,17 +281,17 @@ Pyarmor 的配置有三个域:
281281

282282
OPTION 也可以使用 SECTION:OPTION 的格式,例如::
283283

284-
$ pyarmor env -p get rft:enable_argument
284+
$ pyarmor env -p get rft:argument_mode
285285

286286
.. describe:: set 和 reset
287287

288288
set 用于设置选项的值,reset 用于恢复选项的默认值,例如::
289289

290290
$ pyarmor env -p set recursive 1
291-
$ pyarmor env -p set rft:enable_argument 0
291+
$ pyarmor env -p set rft:argument_mode 0
292292

293293
$ pyarmor env -p reset recursive
294-
$ pyarmor env -p reset rft:enable_argument
294+
$ pyarmor env -p reset rft:argument_mode
295295

296296
.. describe:: push 和 pop
297297

@@ -403,10 +403,10 @@ Pyarmor 的配置有三个域:
403403

404404
(project) info rft
405405

406-
显示选项 `enable_argument` 的使用方法::
406+
显示选项 `argument_mode` 的使用方法::
407407

408408
(project) cd rft
409-
(project)[rft] info enable_argument
409+
(project)[rft] info argument_mode
410410

411411
pyarmor build
412412
=============
@@ -464,7 +464,7 @@ pyarmor build
464464

465465
其基本的工作原理是
466466

467-
- 固定配置 enable_argument = 1
467+
- 固定配置 argument_mode = 1
468468
- 如果发现某一个属性无法确定其类型,那么这个属性不进行重命名
469469

470470
如果不需要使用自动重构模式,那么使用下面的命令::

pyarmor/docs/zh/user/tutorials.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
261261

262262
如果错误提示是参数名称不存在,那么可以直接禁用重命名参数::
263263

264-
$ pyarmor env -p set rft:enable_argument 0
264+
$ pyarmor env -p set rft:argument_mode 0
265265

266266
或者也可以仅重命名 posonly 参数和 vararg 和 kwarg 参数::
267267

268-
$ pyarmor env -p set rft:enable_argument 1
268+
$ pyarmor env -p set rft:argument_mode 1
269269

270270
这样可以简化配置,但是大部分参数可能没有被重命名
271271

@@ -286,7 +286,7 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
286286

287287
使用下面的命令配置函数 `show` 的参数不能进行重命名::
288288

289-
$ pyarmor env -p set rft:enable_argument 3
289+
$ pyarmor env -p set rft:argument_mode 3
290290
$ pyarmor env -p push rft:exclude_funcs fibo::show
291291

292292
配置修改之后,需要重新构建脚本::

0 commit comments

Comments
 (0)