2020 sys .path .insert (0 , "../" )
2121 from ipipneo .ipipneo import IpipNeo
2222
23- URL_IPIP_QUESTIONS = "https://raw.githubusercontent.com/neural7/five-factor-e/main/data/IPIP-NEO"
23+ URL_IPIP_QUESTIONS = (
24+ "https://raw.githubusercontent.com/rewire5-io/five-factor-e/main/data/IPIP-NEO"
25+ )
2426
2527
2628def load_ipip_questions (lang : int , question : int ) -> dict :
@@ -55,7 +57,10 @@ def get_questions(lang: int, question: int) -> list:
5557 - lang: The language ID.
5658 - question: Inventory model 120 or 300.
5759 """
58- return [x for x in load_ipip_questions (lang = lang , question = question ).get ("questions" , [])]
60+ return [
61+ x
62+ for x in load_ipip_questions (lang = lang , question = question ).get ("questions" , [])
63+ ]
5964
6065
6166def get_select (lang : int , question : int ) -> list :
@@ -113,7 +118,9 @@ def quiz(inventory: int, sex: str, age: int, shuffle: str, lang: int) -> None:
113118 option = int (next (filter ({"1" , "2" , "3" , "4" , "5" }.__contains__ , replies )))
114119 answers .append ({"id_question" : q .get ("id" ), "id_select" : option })
115120
116- result = IpipNeo (question = inventory ).compute (sex = sex , age = age , answers = {"answers" : answers }, compare = True )
121+ result = IpipNeo (question = inventory ).compute (
122+ sex = sex , age = age , answers = {"answers" : answers }, compare = True
123+ )
117124
118125 object = json .dumps (result , indent = 4 )
119126 fname = f"result-{ str (inventory )} -{ result .get ('id' , 'id' )} .json"
@@ -140,7 +147,11 @@ def plot_results(result: dict) -> None:
140147
141148 print (
142149 "\n Inventory:" ,
143- str (result .get ("model" )) + "-" + str (result .get ("question" )) + " v" + str (result .get ("version" )),
150+ str (result .get ("model" ))
151+ + "-"
152+ + str (result .get ("question" ))
153+ + " v"
154+ + str (result .get ("version" )),
144155 )
145156 print ("Case:" , result .get ("id" ))
146157 print ("Gender:" , result .get ("person" ).get ("sex" ))
@@ -164,7 +175,12 @@ def plot_results(result: dict) -> None:
164175 int (big5 [2 ].get ("extraversion" ).get ("traits" )[1 ].get ("gregariousness" )),
165176 int (big5 [2 ].get ("extraversion" ).get ("traits" )[2 ].get ("assertiveness" )),
166177 int (big5 [2 ].get ("extraversion" ).get ("traits" )[3 ].get ("activity_level" )),
167- int (big5 [2 ].get ("extraversion" ).get ("traits" )[4 ].get ("excitement_seeking" )),
178+ int (
179+ big5 [2 ]
180+ .get ("extraversion" )
181+ .get ("traits" )[4 ]
182+ .get ("excitement_seeking" )
183+ ),
168184 int (big5 [2 ].get ("extraversion" ).get ("traits" )[5 ].get ("cheerfulness" )),
169185 ],
170186 width = 100 ,
@@ -218,12 +234,36 @@ def plot_results(result: dict) -> None:
218234 C ,
219235 [
220236 int (big5 [1 ].get ("conscientiousness" ).get ("C" )),
221- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[0 ].get ("self_efficacy" )),
222- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[1 ].get ("orderliness" )),
223- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[2 ].get ("dutifulness" )),
224- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[3 ].get ("achievement_striving" )),
225- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[4 ].get ("self_discipline" )),
226- int (big5 [1 ].get ("conscientiousness" ).get ("traits" )[5 ].get ("cautiousness" )),
237+ int (
238+ big5 [1 ]
239+ .get ("conscientiousness" )
240+ .get ("traits" )[0 ]
241+ .get ("self_efficacy" )
242+ ),
243+ int (
244+ big5 [1 ].get ("conscientiousness" ).get ("traits" )[1 ].get ("orderliness" )
245+ ),
246+ int (
247+ big5 [1 ].get ("conscientiousness" ).get ("traits" )[2 ].get ("dutifulness" )
248+ ),
249+ int (
250+ big5 [1 ]
251+ .get ("conscientiousness" )
252+ .get ("traits" )[3 ]
253+ .get ("achievement_striving" )
254+ ),
255+ int (
256+ big5 [1 ]
257+ .get ("conscientiousness" )
258+ .get ("traits" )[4 ]
259+ .get ("self_discipline" )
260+ ),
261+ int (
262+ big5 [1 ]
263+ .get ("conscientiousness" )
264+ .get ("traits" )[5 ]
265+ .get ("cautiousness" )
266+ ),
227267 ],
228268 width = 100 ,
229269 title = "Big-Five | Consciousness" ,
@@ -250,7 +290,12 @@ def plot_results(result: dict) -> None:
250290 int (big5 [4 ].get ("neuroticism" ).get ("traits" )[0 ].get ("anxiety" )),
251291 int (big5 [4 ].get ("neuroticism" ).get ("traits" )[1 ].get ("anger" )),
252292 int (big5 [4 ].get ("neuroticism" ).get ("traits" )[2 ].get ("depression" )),
253- int (big5 [4 ].get ("neuroticism" ).get ("traits" )[3 ].get ("self_consciousness" )),
293+ int (
294+ big5 [4 ]
295+ .get ("neuroticism" )
296+ .get ("traits" )[3 ]
297+ .get ("self_consciousness" )
298+ ),
254299 int (big5 [4 ].get ("neuroticism" ).get ("traits" )[4 ].get ("immoderation" )),
255300 int (big5 [4 ].get ("neuroticism" ).get ("traits" )[5 ].get ("vulnerability" )),
256301 ],
@@ -323,9 +368,13 @@ def main() -> None:
323368
324369 print ("\n ====================================================================" )
325370 if inventory == 120 :
326- print ("The following test contains 120 questions which is estimated to take you about 15 minutes to complete!" )
371+ print (
372+ "The following test contains 120 questions which is estimated to take you about 15 minutes to complete!"
373+ )
327374 elif inventory == 300 :
328- print ("The following test contains 300 questions which is estimated to take you about 35 minutes to complete!" )
375+ print (
376+ "The following test contains 300 questions which is estimated to take you about 35 minutes to complete!"
377+ )
329378
330379 replies = map (
331380 input ,
@@ -364,7 +413,9 @@ def main() -> None:
364413 input ,
365414 chain (
366415 ["\n > Choose the language of the questions above: " ],
367- repeat ("Please, only the numbers that are on the list are valid! Try again: " ),
416+ repeat (
417+ "Please, only the numbers that are on the list are valid! Try again: "
418+ ),
368419 ),
369420 )
370421 lang = int (next (filter (set (map (str , range (0 , 3 ))).__contains__ , replies )))
0 commit comments