Hyphonical commited on
Commit
89fbf1a
·
1 Parent(s): 0536cec

♻️ Refactor Trivia function parameters to use string types for Category and Difficulty

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -352,7 +352,7 @@ def Plot(GiveExamplePrompt: bool = True) -> list[str]:
352
  else:
353
  return [Prompt, '']
354
 
355
- def Trivia(Category: Literal[*Categories.keys()], Difficulty: Literal[*Difficulties.keys()]) -> str: # type: ignore
356
  CategoryParam = f'&category={Categories[Category]}' if Category != 'Any Category' else ''
357
  DifficultyParam = f'&difficulty={Difficulties[Difficulty]}' if Difficulty != 'Any Difficulty' else ''
358
  Raw = requests.get(f'https://opentdb.com/api.php?amount=1{CategoryParam}{DifficultyParam}&encode=base64', headers=Headers)
 
352
  else:
353
  return [Prompt, '']
354
 
355
+ def Trivia(Category: str, Difficulty: str) -> str:
356
  CategoryParam = f'&category={Categories[Category]}' if Category != 'Any Category' else ''
357
  DifficultyParam = f'&difficulty={Difficulties[Difficulty]}' if Difficulty != 'Any Difficulty' else ''
358
  Raw = requests.get(f'https://opentdb.com/api.php?amount=1{CategoryParam}{DifficultyParam}&encode=base64', headers=Headers)