summaryrefslogtreecommitdiff
path: root/SCons/Tool/FortranCommon.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2023-05-01 11:54:48 -0600
committerMats Wichmann <mats@linux.com>2023-05-01 12:06:45 -0600
commit1a103470a13a83590b3fc06e8779494e2b99751d (patch)
treeab4b5fcdbc2504ff1436387dbe82db2dcedff22b /SCons/Tool/FortranCommon.py
parent0ef81fc03600cd275a8e6733aeca26e0db268dad (diff)
downloadscons-git-1a103470a13a83590b3fc06e8779494e2b99751d.tar.gz
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/Tool/FortranCommon.py')
-rw-r--r--SCons/Tool/FortranCommon.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/SCons/Tool/FortranCommon.py b/SCons/Tool/FortranCommon.py
index aff0f9238..f893a12b7 100644
--- a/SCons/Tool/FortranCommon.py
+++ b/SCons/Tool/FortranCommon.py
@@ -30,7 +30,7 @@ from typing import Tuple
import SCons.Scanner.Fortran
import SCons.Tool
import SCons.Util
-from SCons.Action import Action
+from SCons.Action import Action, ActionBase
def isfortran(env, source) -> bool:
@@ -115,7 +115,9 @@ def ComputeFortranSuffixes(suffixes, ppsuffixes) -> None:
else:
suffixes.extend(upper_suffixes)
-def CreateDialectActions(dialect) -> Tuple[Action, Action, Action, Action]:
+def CreateDialectActions(
+ dialect: str,
+) -> Tuple[ActionBase, ActionBase, ActionBase, ActionBase]:
"""Create dialect specific actions."""
CompAction = Action(f'${dialect}COM ', cmdstr=f'${dialect}COMSTR')
CompPPAction = Action(f'${dialect}PPCOM ', cmdstr=f'${dialect}PPCOMSTR')
@@ -124,7 +126,7 @@ def CreateDialectActions(dialect) -> Tuple[Action, Action, Action, Action]:
return CompAction, CompPPAction, ShCompAction, ShCompPPAction
-def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_mods=False) -> None:
+def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_mods: bool=False) -> None:
"""Add dialect specific construction variables.
Args: