Return True if the backend name is valid, False otherwise. A backend name is valid if it is one of the built-in backends or has been dynamically added via an entry point. Those beginning with ``module://`` are always considered valid and are added to the current lis
(self, backend)
| 200 | return self._GUI_FRAMEWORK_TO_BACKEND.get(framework.lower()) |
| 201 | |
| 202 | def is_valid_backend(self, backend): |
| 203 | """ |
| 204 | Return True if the backend name is valid, False otherwise. |
| 205 | |
| 206 | A backend name is valid if it is one of the built-in backends or has been |
| 207 | dynamically added via an entry point. Those beginning with ``module://`` are |
| 208 | always considered valid and are added to the current list of all backends |
| 209 | within this function. |
| 210 | |
| 211 | Even if a name is valid, it may not be importable or usable. This can only be |
| 212 | determined by loading and using the backend module. |
| 213 | |
| 214 | Parameters |
| 215 | ---------- |
| 216 | backend : str |
| 217 | Name of backend. |
| 218 | |
| 219 | Returns |
| 220 | ------- |
| 221 | bool |
| 222 | True if backend is valid, False otherwise. |
| 223 | """ |
| 224 | if not backend.startswith("module://"): |
| 225 | backend = backend.lower() |
| 226 | |
| 227 | # For backward compatibility, convert ipympl and matplotlib-inline long |
| 228 | # module:// names to their shortened forms. |
| 229 | backwards_compat = { |
| 230 | "module://ipympl.backend_nbagg": "widget", |
| 231 | "module://matplotlib_inline.backend_inline": "inline", |
| 232 | } |
| 233 | backend = backwards_compat.get(backend, backend) |
| 234 | |
| 235 | if (backend in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK or |
| 236 | backend in self._backend_to_gui_framework): |
| 237 | return True |
| 238 | |
| 239 | if backend.startswith("module://"): |
| 240 | self._backend_to_gui_framework[backend] = "unknown" |
| 241 | return True |
| 242 | |
| 243 | # Only load entry points if really need to and not already done so. |
| 244 | self._ensure_entry_points_loaded() |
| 245 | if backend in self._backend_to_gui_framework: |
| 246 | return True |
| 247 | |
| 248 | return False |
| 249 | |
| 250 | def list_all(self): |
| 251 | """ |