google / google/python-fire

Use another augmented assignment statement

未关闭
#359 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
28.2k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

:eyes: Some source code analysis tools can help to find opportunities for improving software components.
:thought_balloon: I propose to [increase the usage of augmented assignment statements](https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements "Augmented assignment statements") accordingly.

```diff
diff --git a/fire/core.py b/fire/core.py
index 8ca142c..67b1c72 100644
--- a/fire/core.py
+++ b/fire/core.py
@@ -570,7 +570,7 @@ def _Fire(component, args, parsed_flag_args, context, name=None):
if used_separator:
# Add back in the arguments from after the separator.
if remaining_args:
- remaining_args = remaining_args + [separator] + saved_args
+ remaining_args += [separator] + saved_args
elif (inspect.isclass(last_component)
or inspect.isroutine(last_component)):
remaining_args = saved_args
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。