Commit 39b262f
committed
cephfs-top: Removes unused
Recent flake8 runs were failing with:
```
py3: flake8==7.2.0,mccabe==0.7.0,pip==25.0.1,pycodestyle==2.13.0,pyflakes==3.3.0,setuptools==75.8.0,wheel==0.45.1
py3: commands[0] /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/cephfs/top> flake8 --ignore=W503 --max-line-length=100 cephfs-top
cephfs-top:344:9: F824 `global fs_list` is unused: name is never assigned in scope
cephfs-top:466:13: F824 `global current_states` is unused: name is never assigned in scope
cephfs-top:872:9: F824 `global metrics_dict` is unused: name is never assigned in scope
cephfs-top:872:9: F824 `global current_states` is unused: name is never assigned in scope
cephfs-top:911:9: F824 `global fs_list` is unused: name is never assigned in scope
cephfs-top:981:9: F824 `global current_states` is unused: name is never assigned in scope
cephfs-top:1126:13: F824 `global current_states` is unused: name is never assigned in scope
py3: exit 1 (0.77 seconds) /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/cephfs/top> flake8 --ignore=W503 --max-line-length=100 cephfs-top pid=2309605
py3: FAIL code 1 (8.15=setup[7.38]+cmd[0.77] seconds)
evaluation failed :( (8.24 seconds)
```
Since these variables are only being referenced and not assigned within
their scopes, the `global` declarations are unnecessary and can be
safely removed. This change:
- Removes all flagged `global` statements
- Fixes the failing flake8 checks in the CI pipeline
- Maintains the original code behavior as variable references still work without the `global` keyword
The `global` keyword is only needed when assigning to global variables
within a function scope, not when simply referencing them.
Signed-off-by: Kefu Chai <[email protected]>global statements1 parent bcc275f commit 39b262f
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
| |||
463 | 462 | | |
464 | 463 | | |
465 | 464 | | |
466 | | - | |
| 465 | + | |
467 | 466 | | |
468 | 467 | | |
469 | 468 | | |
| |||
869 | 868 | | |
870 | 869 | | |
871 | 870 | | |
872 | | - | |
873 | 871 | | |
874 | 872 | | |
875 | 873 | | |
| |||
908 | 906 | | |
909 | 907 | | |
910 | 908 | | |
911 | | - | |
912 | 909 | | |
913 | 910 | | |
914 | 911 | | |
| |||
978 | 975 | | |
979 | 976 | | |
980 | 977 | | |
981 | | - | |
| 978 | + | |
982 | 979 | | |
983 | 980 | | |
984 | 981 | | |
| |||
1123 | 1120 | | |
1124 | 1121 | | |
1125 | 1122 | | |
1126 | | - | |
| 1123 | + | |
1127 | 1124 | | |
1128 | 1125 | | |
1129 | 1126 | | |
| |||
0 commit comments