mirror of
https://github.com/adulau/nato-converter.git
synced 2024-11-21 09:37:08 +00:00
chg: [main] black it
This commit is contained in:
parent
fb8b3000cf
commit
552d5a2992
1 changed files with 9 additions and 4 deletions
|
@ -39,20 +39,23 @@ table = {
|
||||||
"6": "Soxisix",
|
"6": "Soxisix",
|
||||||
"7": "Setteseven",
|
"7": "Setteseven",
|
||||||
"8": "Oktoeight",
|
"8": "Oktoeight",
|
||||||
"9": "Novenine"
|
"9": "Novenine",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class IllegalStringSize(Exception):
|
class IllegalStringSize(Exception):
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
super(Exception, self).__init__(msg)
|
super(Exception, self).__init__(msg)
|
||||||
|
|
||||||
|
|
||||||
def find_in_table(letter):
|
def find_in_table(letter):
|
||||||
if len(letter) != 1:
|
if len(letter) != 1:
|
||||||
raise IllegalStringSize(
|
raise IllegalStringSize(
|
||||||
"The letter parameter should only contains one character")
|
"The letter parameter should only contains one character"
|
||||||
|
)
|
||||||
|
|
||||||
if letter in table:
|
if letter in table:
|
||||||
res = table[letter]
|
res = table[letter]
|
||||||
elif letter.lower() in table:
|
elif letter.lower() in table:
|
||||||
res = table[letter.lower()].upper()
|
res = table[letter.lower()].upper()
|
||||||
elif not letter or letter.isspace():
|
elif not letter or letter.isspace():
|
||||||
|
@ -61,6 +64,7 @@ def find_in_table(letter):
|
||||||
res = letter
|
res = letter
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
def convert(orig):
|
def convert(orig):
|
||||||
result = ""
|
result = ""
|
||||||
for letter in orig:
|
for letter in orig:
|
||||||
|
@ -71,6 +75,7 @@ def convert(orig):
|
||||||
result = res
|
result = res
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
orig = ""
|
orig = ""
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
|
|
Loading…
Reference in a new issue