MCPcopy Index your code
hub / github.com/bpython/bpython / main

Function main

bpython/urwid.py:1112–1363  ·  view source on GitHub ↗
(args=None, locals_=None, banner=None)

Source from the content-addressed store, hash-verified

1110
1111
1112def main(args=None, locals_=None, banner=None):
1113 translations.init()
1114
1115 def options_callback(group):
1116 group.add_argument(
1117 "--twisted",
1118 "-T",
1119 action="store_true",
1120 help=_("Run twisted reactor."),
1121 )
1122 group.add_argument(
1123 "--reactor",
1124 "-r",
1125 help=_(
1126 "Select specific reactor (see --help-reactors). "
1127 "Implies --twisted."
1128 ),
1129 )
1130 group.add_argument(
1131 "--help-reactors",
1132 action="store_true",
1133 help=_("List available reactors for -r."),
1134 )
1135 group.add_argument(
1136 "--plugin",
1137 "-p",
1138 help=_(
1139 "twistd plugin to run (use twistd for a list). "
1140 'Use "--" to pass further options to the plugin.'
1141 ),
1142 )
1143 group.add_argument(
1144 "--server",
1145 "-s",
1146 type=int,
1147 help=_("Port to run an eval server on (forces Twisted)."),
1148 )
1149
1150 # TODO: maybe support displays other than raw_display?
1151 config, options, exec_args = bpargs.parse(
1152 args,
1153 (
1154 "Urwid options",
1155 None,
1156 options_callback,
1157 ),
1158 )
1159
1160 if options.help_reactors:
1161 try:
1162 from twisted.application import reactors
1163
1164 # Stolen from twisted.application.app (twistd).
1165 for r in reactors.getReactorTypes():
1166 print(f" {r.shortName:<4}\t{r.description}")
1167 except ImportError:
1168 sys.stderr.write(
1169 "No reactors are available. Please install "

Callers 3

urwid.pyFile · 0.70
__main__.pyFile · 0.70
embedFunction · 0.70

Calls 7

getstdoutMethod · 0.95
TwistedEventLoopClass · 0.85
URWIDReplClass · 0.85
EvalFactoryClass · 0.85
updateMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected