|
21 | 21 | import ctypes |
22 | 22 | import traceback |
23 | 23 | import webbrowser |
24 | | -from typing import Optional, Callable |
| 24 | +from typing import Optional, Callable, List |
25 | 25 |
|
26 | 26 | # Binary Ninja components |
27 | 27 | from . import _binaryninjacore as core |
@@ -78,7 +78,7 @@ class TextLineField: |
78 | 78 | """ |
79 | 79 | ``TextLineField`` Adds prompt for text string input. Result is stored in self.result as a string on completion. |
80 | 80 | """ |
81 | | - def __init__(self, prompt, default=None): |
| 81 | + def __init__(self, prompt: str, default: Optional[str] = None): |
82 | 82 | self._prompt = prompt |
83 | 83 | self._default = default |
84 | 84 | self._result = None |
@@ -118,7 +118,7 @@ class MultilineTextField: |
118 | 118 | ``MultilineTextField`` add multi-line text string input field. Result is stored in self.result |
119 | 119 | as a string. This option is not supported on the command-line. |
120 | 120 | """ |
121 | | - def __init__(self, prompt, default=None): |
| 121 | + def __init__(self, prompt: str, default: Optional[str] = None): |
122 | 122 | self._prompt = prompt |
123 | 123 | self._default = default |
124 | 124 | self._result = None |
@@ -157,7 +157,7 @@ class IntegerField: |
157 | 157 | """ |
158 | 158 | ``IntegerField`` add prompt for integer. Result is stored in self.result as an int. |
159 | 159 | """ |
160 | | - def __init__(self, prompt, default=None): |
| 160 | + def __init__(self, prompt: str, default: Optional[int] = None): |
161 | 161 | self._prompt = prompt |
162 | 162 | self._default = default |
163 | 163 | self._result = None |
@@ -205,7 +205,7 @@ class AddressField: |
205 | 205 | :attr BinaryView view: BinaryView for the address |
206 | 206 | :attr int current_address: current address to use as a base for relative calculations |
207 | 207 | """ |
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): |
209 | 209 | self._prompt = prompt |
210 | 210 | self._view = view |
211 | 211 | self._current_address = current_address |
@@ -270,7 +270,7 @@ class ChoiceField: |
270 | 270 | :attr str prompt: prompt to be presented to the user |
271 | 271 | :attr list(str) choices: list of choices to choose from |
272 | 272 | """ |
273 | | - def __init__(self, prompt, choices, default=None): |
| 273 | + def __init__(self, prompt: str, choices: List[str], default: Optional[str] = None): |
274 | 274 | self._prompt = prompt |
275 | 275 | self._choices = choices |
276 | 276 | self._default = default |
@@ -323,7 +323,7 @@ class OpenFileNameField: |
323 | 323 | """ |
324 | 324 | ``OpenFileNameField`` prompts the user to specify a file name to open. Result is stored in self.result as a string. |
325 | 325 | """ |
326 | | - def __init__(self, prompt, ext="", default=None): |
| 326 | + def __init__(self, prompt: str, ext: str = "", default: Optional[str] = None): |
327 | 327 | self._prompt = prompt |
328 | 328 | self._ext = ext |
329 | 329 | self._default = default |
|
0 commit comments