The names and values of options in a group. Useful for copying options into Application settings:: from tornado.options import define, parse_command_line, options define('template_path', group='application') define('static_path', group='application')
(self, group: str)
| 191 | return set(opt.group_name for opt in self._options.values()) |
| 192 | |
| 193 | def group_dict(self, group: str) -> Dict[str, Any]: |
| 194 | """The names and values of options in a group. |
| 195 | |
| 196 | Useful for copying options into Application settings:: |
| 197 | |
| 198 | from tornado.options import define, parse_command_line, options |
| 199 | |
| 200 | define('template_path', group='application') |
| 201 | define('static_path', group='application') |
| 202 | |
| 203 | parse_command_line() |
| 204 | |
| 205 | application = Application( |
| 206 | handlers, **options.group_dict('application')) |
| 207 | |
| 208 | .. versionadded:: 3.1 |
| 209 | """ |
| 210 | return dict( |
| 211 | (opt.name, opt.value()) |
| 212 | for name, opt in self._options.items() |
| 213 | if not group or group == opt.group_name |
| 214 | ) |
| 215 | |
| 216 | def as_dict(self) -> Dict[str, Any]: |
| 217 | """The names and values of all options. |