Give the current compiler flags by looking for _Feature instances in the globals.
(self)
| 448 | raise ValueError("Nothing selected") |
| 449 | |
| 450 | def get_compiler_flags(self) -> int: |
| 451 | """ |
| 452 | Give the current compiler flags by looking for _Feature instances |
| 453 | in the globals. |
| 454 | """ |
| 455 | flags = 0 |
| 456 | |
| 457 | for value in self.get_globals().values(): |
| 458 | try: |
| 459 | if isinstance(value, __future__._Feature): |
| 460 | f = value.compiler_flag |
| 461 | flags |= f |
| 462 | except BaseException: |
| 463 | # get_compiler_flags should never raise to not run into an |
| 464 | # `Unhandled exception in event loop` |
| 465 | |
| 466 | # See: https://github.com/prompt-toolkit/ptpython/issues/351 |
| 467 | # An exception can be raised when some objects in the globals |
| 468 | # raise an exception in a custom `__getattribute__`. |
| 469 | pass |
| 470 | |
| 471 | return flags |
| 472 | |
| 473 | def add_key_binding( |
| 474 | self, |
nothing calls this directly
no test coverage detected