frida / frida-tools

Frida CLI tools
Other
338 stars 95 forks source link

tracer.py has incomplete type annotations #151

Open smcpeak opened 6 months ago

smcpeak commented 6 months ago

Although frida_tools/tracer.py has some type annotations, they are not complete, and mypy issues many complaints:

$ mypy frida_tools/tracer.py
frida_tools/tracer.py:27: error: Need type annotation for "_attributes_by_thread_id" (hint: "_attributes_by_thread_id: Dict[<type>, <type>] = ...")  [var-annotated]
frida_tools/tracer.py:166: error: Value of type "Optional[tuple[str, Union[list[str], Pattern[Any], int, str]]]" is not indexable  [index]
frida_tools/tracer.py:176: error: Argument 1 to "start_trace" of "Tracer" has incompatible type "Optional[Session]"; expected "Session"  [arg-type]
[...]
frida_tools/tracer.py:829: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
Found 48 errors in 1 file (checked 1 source file)

$ mypy --version
mypy 1.5.1 (compiled: yes)

I've added annotations to my local copy of this file that make mypy happy, and I could submit those as a PR. But the story is similar for other files in frida_tools, and I'm not sure if I want to annotate all of them, or whether any of this is considered relevant or useful by the Frida developers.

The above is with the latest frida-tools (c10668fe45).