Skip to content

Commit

Permalink
Refactor (#90)
Browse files Browse the repository at this point in the history
* fix : dict .keys() removed

* fix : get_input_standard function modified

* doc : CHANGELOG.md updated

* fix : dependabot.yml updated
  • Loading branch information
sepandhaghighi authored Aug 7, 2024
1 parent 0aac0a3 commit 700f8f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ updates:
time: "01:30"
open-pull-requests-limit: 10
target-branch: dev
assignees:
- "sepandhaghighi"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `nava` added to `requirements.txt`
- Test system modified
- Build system modified
- `get_input_standard` function modified
- `Python 3.11` added to `test.yml`
- `Python 3.12` added to `test.yml`
- `Python 3.5` support dropped
Expand Down
23 changes: 7 additions & 16 deletions nafas/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ def input_filter(input_data):
:return: filtered data as dict
"""
filtered_data = input_data.copy()
if filtered_data["program"] not in STANDARD_MENU["program"].keys():
if filtered_data["program"] not in STANDARD_MENU["program"]:
filtered_data["program"] = 1
if filtered_data["level"] not in STANDARD_MENU["level"].keys():
if filtered_data["level"] not in STANDARD_MENU["level"]:
filtered_data["level"] = 1
return filtered_data

Expand All @@ -207,24 +207,15 @@ def get_input_standard(input_func=input):
input_data = {"program": 1, "level": 1}
for item in STANDARD_MENU_ORDER:
exit_flag = False
sorted_list = sorted(list(STANDARD_MENU[item].keys()))
sorted_list = sorted(STANDARD_MENU[item])
print("- Please choose a {0} : \n".format(item))
for i in sorted_list:
if item == "program":
program_name = STANDARD_MENU[item][i]
program_average_time = time_average_calc(
PROGRAMS[program_name])
print(
str(i) +
"- " +
program_name +
" (~ " +
time_convert(
program_average_time,
True) +
")")
program_average_time = time_average_calc(PROGRAMS[program_name])
print("{0}- {1} (~ {2})".format(i, program_name, time_convert(program_average_time, True)))
else:
print(str(i) + "- " + STANDARD_MENU[item][i])
print("{0}- {1}".format(i, STANDARD_MENU[item][i]))
while not exit_flag:
try:
input_data[item] = int(input_func(""))
Expand Down Expand Up @@ -274,7 +265,7 @@ def graphic_counter(delay_time):
time.sleep(remain_time)
if remain_time != 0:
print('.', end=' ', flush=True)
print()
print("")


def play_sound(sound_path, enable=True):
Expand Down

0 comments on commit 700f8f7

Please sign in to comment.