flake8: depends #1282
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-17#1282
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "flake8-depends"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Formatted depends according to flake8 suggestions and slightly deduplicated the code.
Supersedes #1256.
can you make this into two statements if possible please
@ -246,2 +246,4 @@
# is the application already running? If yes then exit.
if state.enableGUI and not state.curses and not depends.check_pyqt():
sys.exit(
Better write this kind of constant messages in a help folder and import them where required.
@ -26,0 +122,4 @@
elif sys.platform.startswith('win'):
detectOS.result = "Windows"
elif os.path.isfile("/etc/os-release"):
detectOSRelease()
pep8 validation
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
I think we can move with a easy way instead of this.
/code
with open("/etc/os-release", 'r') as osRelease:
for line in osRelease:
if line.startswith("NAME="):
detectOS.result = line.split("=")[-1].strip().capitalize()
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
capitalize()? What about openSUSE?
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
BTW, it's not my code, I just moved it from
checkdeps
, see above.@ -26,0 +122,4 @@
elif sys.platform.startswith('win'):
detectOS.result = "Windows"
elif os.path.isfile("/etc/os-release"):
detectOSRelease()
wut?
@ -246,2 +246,4 @@
# is the application already running? If yes then exit.
if state.enableGUI and not state.curses and not depends.check_pyqt():
sys.exit(
This message should stay along in this module I think, any other occurrences could be eliminated.
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
ok, I think then we can have a dictionary and call the name based on the key simply.
osname = {'ubuntu' : 'Ubuntu', 'opensuse' : 'openSUSE' , ….}
with open("/etc/os-release", 'r') as osRelease:
for line in osRelease:
if line.startswith("NAME="):
detectOS.result = osname(line.split("=")[-1].strip().lower())
It seems this needs squashing...
Please rebase, I'm ready to merge.