MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / eval_hardness

Function eval_hardness

hardness_eval.py:872–887  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

870
871
872def eval_hardness(sql):
873 count_comp1_ = count_component1(sql)
874 count_comp2_ = count_component2(sql)
875 count_others_ = count_others(sql)
876
877 if count_comp1_ <= 1 and count_others_ == 0 and count_comp2_ == 0:
878 return "easy"
879 elif (count_others_ <= 2 and count_comp1_ <= 1 and count_comp2_ == 0) or \
880 (count_comp1_ <= 2 and count_others_ < 2 and count_comp2_ == 0):
881 return "medium"
882 elif (count_others_ > 2 and count_comp1_ <= 2 and count_comp2_ == 0) or \
883 (2 < count_comp1_ <= 3 and count_others_ <= 2 and count_comp2_ == 0) or \
884 (count_comp1_ <= 1 and count_others_ == 0 and count_comp2_ <= 1):
885 return "hard"
886 else:
887 return "extra"
888
889
890def get_hardness(idx):

Callers 1

get_hardnessFunction · 0.85

Calls 3

count_component1Function · 0.70
count_component2Function · 0.70
count_othersFunction · 0.70

Tested by

no test coverage detected