From 5e322f067b9d721e19ef7208c81f178c12ca74ff Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Fri, 20 Aug 2021 19:27:44 +0800 Subject: [PATCH] requirements.txt includes dependencies of the program. difficulty.py is modified in this fix. Not sure why build.sh is included. --- app/difficulty.py | 10 ++++++++-- build.sh | 0 requirements.txt | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) mode change 100755 => 100644 build.sh create mode 100644 requirements.txt diff --git a/app/difficulty.py b/app/difficulty.py index ccd9b6f..50aa179 100644 --- a/app/difficulty.py +++ b/app/difficulty.py @@ -55,11 +55,17 @@ def get_difficulty_level(d1, d2): def revert_dict(d): ''' - In d2, time is the key, and the value is a list of words picked at that time. + In d, word is the key, and value is a list of dates. + In d2 (the returned value of this function), time is the key, and the value is a list of words picked at that time. ''' d2 = {} for k in d: - lst = d[k] + if type(d[k]) is list: # d[k] is a list of dates. + lst = d[k] + elif type(d[k]) is int: # for backward compatibility. d was sth like {'word':1}. The value d[k] is not a list of dates, but a number representing how frequent this word had been added to the new word book. + freq = d[k] + lst = freq*['2021082019'] # why choose this date? No particular reasons. I fix the bug in this date. + for time_info in lst: date = time_info[:10] # until hour if not date in d2: diff --git a/build.sh b/build.sh old mode 100755 new mode 100644 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d42ebf8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Flask==1.1.2 +selenium==3.141.0