Skip to content

Commit b53902e

Browse files
committed
Python API: Add hints to interaction.py
1 parent e6b92a0 commit b53902e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

python/interaction.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import ctypes
2222
import traceback
2323
import webbrowser
24-
from typing import Optional, Callable
24+
from typing import Optional, Callable, List
2525

2626
# Binary Ninja components
2727
from . import _binaryninjacore as core
@@ -78,7 +78,7 @@ class TextLineField:
7878
"""
7979
``TextLineField`` Adds prompt for text string input. Result is stored in self.result as a string on completion.
8080
"""
81-
def __init__(self, prompt, default=None):
81+
def __init__(self, prompt: str, default: Optional[str] = None):
8282
self._prompt = prompt
8383
self._default = default
8484
self._result = None
@@ -118,7 +118,7 @@ class MultilineTextField:
118118
``MultilineTextField`` add multi-line text string input field. Result is stored in self.result
119119
as a string. This option is not supported on the command-line.
120120
"""
121-
def __init__(self, prompt, default=None):
121+
def __init__(self, prompt: str, default: Optional[str] = None):
122122
self._prompt = prompt
123123
self._default = default
124124
self._result = None
@@ -157,7 +157,7 @@ class IntegerField:
157157
"""
158158
``IntegerField`` add prompt for integer. Result is stored in self.result as an int.
159159
"""
160-
def __init__(self, prompt, default=None):
160+
def __init__(self, prompt: str, default: Optional[int] = None):
161161
self._prompt = prompt
162162
self._default = default
163163
self._result = None
@@ -205,7 +205,7 @@ class AddressField:
205205
:attr BinaryView view: BinaryView for the address
206206
:attr int current_address: current address to use as a base for relative calculations
207207
"""
208-
def __init__(self, prompt, view=None, current_address=0, default=None):
208+
def __init__(self, prompt: str, view: Optional['binaryview.BinaryView'] = None, current_address: int = 0, default: Optional[int] = None):
209209
self._prompt = prompt
210210
self._view = view
211211
self._current_address = current_address
@@ -270,7 +270,7 @@ class ChoiceField:
270270
:attr str prompt: prompt to be presented to the user
271271
:attr list(str) choices: list of choices to choose from
272272
"""
273-
def __init__(self, prompt, choices, default=None):
273+
def __init__(self, prompt: str, choices: List[str], default: Optional[str] = None):
274274
self._prompt = prompt
275275
self._choices = choices
276276
self._default = default
@@ -323,7 +323,7 @@ class OpenFileNameField:
323323
"""
324324
``OpenFileNameField`` prompts the user to specify a file name to open. Result is stored in self.result as a string.
325325
"""
326-
def __init__(self, prompt, ext="", default=None):
326+
def __init__(self, prompt: str, ext: str = "", default: Optional[str] = None):
327327
self._prompt = prompt
328328
self._ext = ext
329329
self._default = default

0 commit comments

Comments
 (0)