mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-11-23 03:39:23 +01:00
ssid_check_valid_length.py: fix pylint complaints
This commit is contained in:
parent
92f20f7027
commit
79c7167943
@ -3,6 +3,25 @@
|
|||||||
This script asks for a SSID name, counts it and tells whether it's of valid
|
This script asks for a SSID name, counts it and tells whether it's of valid
|
||||||
length
|
length
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def check_ssid_length(given_ssid_length):
|
||||||
|
"""
|
||||||
|
This function checks that the given string is below 32 characters long and
|
||||||
|
can thus be used as an SSID.
|
||||||
|
"""
|
||||||
|
# 32 bytes should be the maximum SSID length
|
||||||
|
if given_ssid_length <= 32:
|
||||||
|
print(GIVENSSID, "is", given_ssid_length, "long and thus valid length")
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
GIVENSSID,
|
||||||
|
"is",
|
||||||
|
given_ssid_length,
|
||||||
|
"to long, please select a different SSID",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Request input or assume "test" on empty.
|
# Request input or assume "test" on empty.
|
||||||
GIVENSSID = str(
|
GIVENSSID = str(
|
||||||
input(
|
input(
|
||||||
@ -15,30 +34,11 @@ GIVENSSID = str(
|
|||||||
# TODO: make this a function too
|
# TODO: make this a function too
|
||||||
GIVENSSIDLEN = len(GIVENSSID.encode("utf8"))
|
GIVENSSIDLEN = len(GIVENSSID.encode("utf8"))
|
||||||
|
|
||||||
|
|
||||||
# Checking the SSID length is done twice, so thus a function
|
# Checking the SSID length is done twice, so thus a function
|
||||||
def checkssidlen(GIVENSSIDLEN):
|
|
||||||
"""
|
|
||||||
This function checks that the given string is below 32 characters long and
|
|
||||||
can thus be used as an SSID.
|
|
||||||
"""
|
|
||||||
# 32 bytes should be the maximum SSID length
|
|
||||||
if GIVENSSIDLEN <= 32:
|
|
||||||
print(GIVENSSID, "is", GIVENSSIDLEN, "long and thus valid length")
|
|
||||||
else:
|
|
||||||
print(
|
|
||||||
GIVENSSID,
|
|
||||||
"is",
|
|
||||||
GIVENSSIDLEN,
|
|
||||||
"to long, please select a different SSID",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Checking the SSID without _nomap
|
# Checking the SSID without _nomap
|
||||||
checkssidlen(GIVENSSIDLEN)
|
check_ssid_length(GIVENSSIDLEN)
|
||||||
# TODO: make this a function too
|
|
||||||
GIVENSSIDLEN = len(GIVENSSID.encode("utf8"))
|
|
||||||
|
|
||||||
# Continuing with _nomap to ensure it also fits
|
# Continuing with _nomap to ensure it also fits
|
||||||
GIVENSSID = GIVENSSID + "_nomap"
|
GIVENSSID = GIVENSSID + "_nomap"
|
||||||
checkssidlen(GIVENSSIDLEN)
|
check_ssid_length(GIVENSSIDLEN)
|
||||||
|
Loading…
Reference in New Issue
Block a user