-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit is the next in a commit chain improving the granularity of warning messages, en-route to resolving feature request #73 kindly submitted several lifetimes ago by Stuttgart `typing` master @amogorkon (Anselm Kiefner). Specifically, this commit exhaustively debugs and tests our recently defined private `beartype._util.error.utilerrwarn.reissue_warnings_placeholder()` utility function that is key to this special madness.: Thanks so much to @amogorkon for gently prodding us to do this several lifetimes ago. This miracle on Earth is happening because of you. (*Fractious fractions in an insatiate satisfaction!*)
- Loading branch information
Showing
11 changed files
with
309 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env python3 | ||
# --------------------( LICENSE )-------------------- | ||
# Copyright (c) 2014-2024 Beartype authors. | ||
# See "LICENSE" for further details. | ||
|
||
''' | ||
Project-wide **exception testers** (i.e., low-level callables introspecting | ||
metadata associated with various types of exceptions). | ||
This private submodule is *not* intended for importation by downstream callers. | ||
''' | ||
|
||
# ....................{ IMPORTS }.................... | ||
|
||
# ....................{ TESTERS }.................... | ||
#FIXME: Unit test us up, please. | ||
def is_exception_message_str(exception: Exception) -> bool: | ||
''' | ||
:data:`True` only if the message encapsulated by the passed exception is a | ||
simple string (as is typically but *not* necessarily the case). | ||
Parameters | ||
---------- | ||
exception : Exception | ||
Exception to be inspected. | ||
Returns | ||
------- | ||
bool | ||
:data:`True` only if this exception's message is a simple string. | ||
''' | ||
assert isinstance(exception, Exception), f'{repr(exception)} not exception.' | ||
|
||
# Return true only if... | ||
return bool( | ||
# Exception arguments are a tuple (as is typically but not necessarily | ||
# the case) *AND*... | ||
isinstance(exception.args, tuple) and | ||
# This tuple is non-empty (as is typically but not necessarily the | ||
# case) *AND*... | ||
exception.args and | ||
# The first item of this tuple is a string providing this exception's | ||
# message (as is typically but *NOT* necessarily the case)... | ||
isinstance(exception.args[0], str) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.