Returns `true` if the given name is that of a Python builtin. Intended to be kept in sync with [`python_builtins`].
(name: &str, minor_version: u8, is_notebook: bool)
| 262 | /// |
| 263 | /// Intended to be kept in sync with [`python_builtins`]. |
| 264 | pub fn is_python_builtin(name: &str, minor_version: u8, is_notebook: bool) -> bool { |
| 265 | if is_notebook && is_ipython_builtin(name) { |
| 266 | return true; |
| 267 | } |
| 268 | matches!( |
| 269 | (minor_version, name), |
| 270 | ( |
| 271 | _, |
| 272 | "ArithmeticError" |
| 273 | | "AssertionError" |
| 274 | | "AttributeError" |
| 275 | | "BaseException" |
| 276 | | "BlockingIOError" |
| 277 | | "BrokenPipeError" |
| 278 | | "BufferError" |
| 279 | | "BytesWarning" |
| 280 | | "ChildProcessError" |
| 281 | | "ConnectionAbortedError" |
| 282 | | "ConnectionError" |
| 283 | | "ConnectionRefusedError" |
| 284 | | "ConnectionResetError" |
| 285 | | "DeprecationWarning" |
| 286 | | "EOFError" |
| 287 | | "Ellipsis" |
| 288 | | "EnvironmentError" |
| 289 | | "Exception" |
| 290 | | "False" |
| 291 | | "FileExistsError" |
| 292 | | "FileNotFoundError" |
| 293 | | "FloatingPointError" |
| 294 | | "FutureWarning" |
| 295 | | "GeneratorExit" |
| 296 | | "IOError" |
| 297 | | "ImportError" |
| 298 | | "ImportWarning" |
| 299 | | "IndentationError" |
| 300 | | "IndexError" |
| 301 | | "InterruptedError" |
| 302 | | "IsADirectoryError" |
| 303 | | "KeyError" |
| 304 | | "KeyboardInterrupt" |
| 305 | | "LookupError" |
| 306 | | "MemoryError" |
| 307 | | "ModuleNotFoundError" |
| 308 | | "NameError" |
| 309 | | "None" |
| 310 | | "NotADirectoryError" |
| 311 | | "NotImplemented" |
| 312 | | "NotImplementedError" |
| 313 | | "OSError" |
| 314 | | "OverflowError" |
| 315 | | "PendingDeprecationWarning" |
| 316 | | "PermissionError" |
| 317 | | "ProcessLookupError" |
| 318 | | "RecursionError" |
| 319 | | "ReferenceError" |
| 320 | | "ResourceWarning" |
| 321 | | "RuntimeError" |
no test coverage detected