MCPcopy
hub / github.com/prompt-toolkit/ptpython / get_compiler_flags

Method get_compiler_flags

src/ptpython/python_input.py:450–471  ·  view source on GitHub ↗

Give the current compiler flags by looking for _Feature instances in the globals.

(self)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 2

valuesMethod · 0.80
get_globalsMethod · 0.80

Tested by

no test coverage detected