(category)
| 396 | |
| 397 | # Helper for _setoption() |
| 398 | def _getcategory(category): |
| 399 | if not category: |
| 400 | return Warning |
| 401 | if '.' not in category: |
| 402 | import builtins as m |
| 403 | klass = category |
| 404 | else: |
| 405 | module, _, klass = category.rpartition('.') |
| 406 | try: |
| 407 | m = __import__(module, None, None, [klass]) |
| 408 | except ImportError: |
| 409 | raise _wm._OptionError("invalid module name: %r" % (module,)) from None |
| 410 | try: |
| 411 | cat = getattr(m, klass) |
| 412 | except AttributeError: |
| 413 | raise _wm._OptionError("unknown warning category: %r" % (category,)) from None |
| 414 | if not issubclass(cat, Warning): |
| 415 | raise _wm._OptionError("invalid warning category: %r" % (category,)) |
| 416 | return cat |
| 417 | |
| 418 | |
| 419 | def _is_internal_filename(filename): |
nothing calls this directly
no test coverage detected