diff options
author | Mats Wichmann <mats@linux.com> | 2023-05-01 17:54:48 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-05-01 18:06:45 (GMT) |
commit | 1a103470a13a83590b3fc06e8779494e2b99751d (patch) | |
tree | ab4b5fcdbc2504ff1436387dbe82db2dcedff22b /SCons/Warnings.py | |
parent | 0ef81fc03600cd275a8e6733aeca26e0db268dad (diff) | |
download | SCons-1a103470a13a83590b3fc06e8779494e2b99751d.zip SCons-1a103470a13a83590b3fc06e8779494e2b99751d.tar.gz SCons-1a103470a13a83590b3fc06e8779494e2b99751d.tar.bz2 |
Add some cheap return and parameter annotations
Use: https://github.com/JelleZijlstra/autotyping
to add "safe" return annotations.
Where a parameter has a default value that is an obvious scalar type
(bool, int, str, etc.) add those annotations as well.
Also fixed two small bugs that popped up when sanity-checking with
mypy. One in FortranCommon, where a return had been previously
annotated to be a tuple of Action, which should be ActionBase -
Action is the factory function, not the base class. The other was
a typo in the error raised in _add_cppdefines - the message was
formatted with the value of "define" which should have been "defines".
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Warnings.py')
-rw-r--r-- | SCons/Warnings.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/SCons/Warnings.py b/SCons/Warnings.py index f77a24a..5c2a0db 100644 --- a/SCons/Warnings.py +++ b/SCons/Warnings.py @@ -144,15 +144,15 @@ _warningAsException = False # If not None, a function to call with the warning _warningOut = None -def suppressWarningClass(clazz): +def suppressWarningClass(clazz) -> None: """Suppresses all warnings of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, False)) -def enableWarningClass(clazz): +def enableWarningClass(clazz) -> None: """Enables all warnings of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, True)) -def warningAsException(flag=True): +def warningAsException(flag: bool=True): """Set global _warningAsExeption flag. Args: @@ -185,7 +185,7 @@ def warn(clazz, *args): _warningOut(warning) break -def process_warn_strings(arguments): +def process_warn_strings(arguments) -> None: """Process requests to enable/disable warnings. The requests are strings passed to the --warn option or the |