google / google/python-fire

Use another augmented assignment statement

Offen
#359 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
28.2k
Forks
1.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

: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
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.