|
5 | 5 | import os |
6 | 6 | import re |
7 | 7 | import shlex |
8 | | -from typing import Dict, List, Tuple, Union |
| 8 | +from typing import Dict, Iterable, List, Optional, Tuple, Union |
9 | 9 |
|
10 | 10 | import attr |
11 | 11 |
|
@@ -270,14 +270,25 @@ class StatementParser: |
270 | 270 | Shortcuts is a list of tuples with each tuple containing the shortcut and |
271 | 271 | the expansion. |
272 | 272 | """ |
273 | | - def __init__( |
274 | | - self, |
275 | | - allow_redirection: bool = True, |
276 | | - terminators: List[str] = None, |
277 | | - multiline_commands: List[str] = None, |
278 | | - aliases: Dict[str, str] = None, |
279 | | - shortcuts: List[Tuple[str, str]] = None, |
280 | | - ): |
| 273 | + def __init__(self, |
| 274 | + allow_redirection: bool = True, |
| 275 | + terminators: Optional[Iterable[str]] = None, |
| 276 | + multiline_commands: Optional[Iterable[str]] = None, |
| 277 | + aliases: Optional[Dict[str, str]] = None, |
| 278 | + shortcuts: Optional[Iterable[Tuple[str, str]]] = None) -> None: |
| 279 | + """Initialize an instance of StatementParser. |
| 280 | +
|
| 281 | + The following will get converted to an immutable tuple before storing internally: |
| 282 | + * terminators |
| 283 | + * multiline commands |
| 284 | + * shortcuts |
| 285 | +
|
| 286 | + :param allow_redirection: (optional) should redirection and pipes be allowed? |
| 287 | + :param terminators: (optional) iterable containing strings which should terminate multiline commands |
| 288 | + :param multiline_commands: (optional) iterable containing the names of commands that accept multiline input |
| 289 | + :param aliases: (optional) dictionary contaiing aliases |
| 290 | + :param shortcuts (optional) an iterable of tuples with each tuple containing the shortcut and the expansion |
| 291 | + """ |
281 | 292 | self.allow_redirection = allow_redirection |
282 | 293 | if terminators is None: |
283 | 294 | self.terminators = (constants.MULTILINE_TERMINATOR,) |
|
0 commit comments