This repository has been archived by the owner on May 11, 2018. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
get_wifi_list
wlan_status
since it wasn't being used for anythingreturncode
since it wasn't being used for anything[]
ifsudo ifup wlan0
fails. It would seem if the wifi is down, the next call to check nearby wifi access points will likely fail as well.[]
ifsudo iwlist wlan0 scan
fails. It doesn't seem to make sense to try to iterate an empty list, create a set out of an empty list and then try to sort an empty set.range
loop replaced withenumerate
since both the index and value are needediw_list[x].strip()
was being created 5 times. Also, each instance was then creating another slice. To cut down on unnecessary copies, thecurrent
variable saves the stripped current line.str.startswith
doesn't create unnecessary copies eitherend
variable was created to reuse the same slice 4 timeslist(...)
inside ofsorted(...)
since it was creating an unnecessary list instead of just creating the sorted list directly fromset(wifi_list)
add_wifi
ssid
once instead of creating it via concatenation on each iteration of the loopwifi_key_info
once instead of (potentially) multiple times inside the loop (also,if wifi_exists is False
)xrange
instead ofrange
textwrap.dedent
to keep proper indentationfile.writelines
instead offile.write
for each separate lineinternet_status
response
since it wasn't being used for anythingreturn False
immediately ifurllib2.URLError
is raisedreturn True
to theelse
statement (for readability and to stay consistent with other project files)reset_wifi
textwrap.dedent
to createlines
vpn_status
since it wasn't being used for anythingreturncode
since it wasn't being used for anythingreturn False
immediately ifCalledProcessError
is raisedreturn True
in theelse
sinceCalledProcessError
is only raised for a non-zero exit code (no need to checkreturncode == 0
)