flake8: depends #1282

Merged
g1itch merged 5 commits from flake8-depends into v0.6 2018-06-27 11:24:56 +02:00
g1itch commented 2018-06-19 16:35:20 +02:00 (Migrated from github.com)

Formatted depends according to flake8 suggestions and slightly deduplicated the code.
Supersedes #1256.

Formatted depends according to flake8 suggestions and slightly deduplicated the code. Supersedes #1256.
coffeedogs (Migrated from github.com) reviewed 2018-06-19 16:35:20 +02:00
omkar1117 (Migrated from github.com) requested changes 2018-06-23 12:27:25 +02:00
omkar1117 (Migrated from github.com) commented 2018-06-23 12:11:17 +02:00

can you make this into two statements if possible please

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(
omkar1117 (Migrated from github.com) commented 2018-06-23 12:14:13 +02:00

Better write this kind of constant messages in a help folder and import them where required.

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()
omkar1117 (Migrated from github.com) commented 2018-06-23 12:15:16 +02:00

pep8 validation

pep8 validation
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
omkar1117 (Migrated from github.com) commented 2018-06-23 12:20:03 +02:00

I think we can move with a easy way instead of this.

I think we can move with a easy way instead of this.
omkar1117 (Migrated from github.com) commented 2018-06-23 12:25:58 +02:00

/code
with open("/etc/os-release", 'r') as osRelease:
for line in osRelease:
if line.startswith("NAME="):
detectOS.result = line.split("=")[-1].strip().capitalize()

/code with open("/etc/os-release", 'r') as osRelease: for line in osRelease: if line.startswith("NAME="): detectOS.result = line.split("=")[-1].strip().capitalize()
g1itch (Migrated from github.com) reviewed 2018-06-23 12:31:30 +02:00
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
g1itch (Migrated from github.com) commented 2018-06-23 12:31:29 +02:00

capitalize()? What about openSUSE?

capitalize()? What about openSUSE?
g1itch (Migrated from github.com) reviewed 2018-06-23 12:32:54 +02:00
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
g1itch (Migrated from github.com) commented 2018-06-23 12:32:53 +02:00

BTW, it's not my code, I just moved it from checkdeps, see above.

BTW, it's not my code, I just moved it from `checkdeps`, see above.
g1itch (Migrated from github.com) reviewed 2018-06-23 12:33:20 +02:00
@ -26,0 +122,4 @@
elif sys.platform.startswith('win'):
detectOS.result = "Windows"
elif os.path.isfile("/etc/os-release"):
detectOSRelease()
g1itch (Migrated from github.com) commented 2018-06-23 12:33:20 +02:00

wut?

wut?
g1itch (Migrated from github.com) reviewed 2018-06-23 12:35:12 +02:00
@ -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(
g1itch (Migrated from github.com) commented 2018-06-23 12:35:12 +02:00

This message should stay along in this module I think, any other occurrences could be eliminated.

This message should stay along in this module I think, any other occurrences could be eliminated.
omkar1117 (Migrated from github.com) reviewed 2018-06-23 12:41:00 +02:00
@ -26,0 +141,4 @@
elif line.startswith("VERSION_ID="):
try:
version = float(line.split("=")[1].replace("\"", ""))
except ValueError:
omkar1117 (Migrated from github.com) commented 2018-06-23 12:41:00 +02:00

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())

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())
g1itch commented 2018-06-23 13:03:31 +02:00 (Migrated from github.com)

It seems this needs squashing...

It seems this needs squashing...
PeterSurda (Migrated from github.com) approved these changes 2018-06-26 21:22:18 +02:00
PeterSurda commented 2018-06-26 21:22:42 +02:00 (Migrated from github.com)

Please rebase, I'm ready to merge.

Please rebase, I'm ready to merge.
This repo is archived. You cannot comment on pull requests.
No description provided.