Python 2/3 compatible way of getting user input.
(text='> ')
| 116 | |
| 117 | |
| 118 | def get_user_input(text='> '): |
| 119 | """Python 2/3 compatible way of getting user input.""" |
| 120 | global input |
| 121 | try: |
| 122 | # Disable pylint's redefined-builtin warning and undefined-variable |
| 123 | # (raw_input is undefined in python 3) error. |
| 124 | # pylint: disable=W0622 |
| 125 | # pylint: disable=E0602 |
| 126 | input = raw_input |
| 127 | except NameError: |
| 128 | pass |
| 129 | return input(text) |
| 130 | |
| 131 | |
| 132 | def commit_str(ci): |