(category)
| 418 | |
| 419 | # Helper for _setoption() |
| 420 | def _getcategory(category): |
| 421 | if not category: |
| 422 | return Warning |
| 423 | if '.' not in category: |
| 424 | import builtins as m |
| 425 | klass = category |
| 426 | else: |
| 427 | module, _, klass = category.rpartition('.') |
| 428 | try: |
| 429 | m = __import__(module, None, None, [klass]) |
| 430 | except ImportError: |
| 431 | raise _wm._OptionError("invalid module name: %r" % (module,)) from None |
| 432 | try: |
| 433 | cat = getattr(m, klass) |
| 434 | except AttributeError: |
| 435 | raise _wm._OptionError("unknown warning category: %r" % (category,)) from None |
| 436 | if not issubclass(cat, Warning): |
| 437 | raise _wm._OptionError("invalid warning category: %r" % (category,)) |
| 438 | return cat |
| 439 | |
| 440 | |
| 441 | def _is_internal_filename(filename): |
nothing calls this directly
no test coverage detected
searching dependent graphs…