saved_messages: List[str] = []
# Make a copy of the original program arguments.
-program_name = os.path.basename(sys.argv[0])
-original_argv = [arg for arg in sys.argv]
+program_name: str = os.path.basename(sys.argv[0])
+original_argv: List[str] = [arg for arg in sys.argv]
# A global parser that we will collect arguments into.
# It is also this variable that modules use to access parsed arguments.
# This is the data that is most interesting to our callers; it will hold
# the configuration result.
-config = {}
+config: Dict[str, Any] = {}
# It would be really nice if this shit worked from interactive python
def reorder_arg_action_groups(entry_module: Optional[str]):
+ global program_name, args
reordered_action_groups = []
for group in args._action_groups:
- if entry_module is not None and entry_module in group.title:
+ if entry_module is not None and entry_module in group.title: # type: ignore
reordered_action_groups.append(group)
- elif program_name in group.title:
+ elif program_name in group.title: # type: ignore
reordered_action_groups.append(group)
else:
reordered_action_groups.insert(0, group)
#!/usr/bin/env python3
import logging
-from typing import NamedTuple
import sys
+from typing import NamedTuple, Optional
import warnings
import requests
success: bool
response: str
audio_url: str
- audio_transcription: str
+ audio_transcription: Optional[str] # None if not available.
def __repr__(self):
return f"""
success = False
response = ""
audio = ""
- audio_transcription = ""
+ audio_transcription: Optional[str] = ""
if r.status_code == 200:
j = r.json()
success = bool(j["success"])