diff options
author | Mats Wichmann <mats@linux.com> | 2023-05-01 11:54:48 -0600 |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-05-01 12:06:45 -0600 |
commit | 1a103470a13a83590b3fc06e8779494e2b99751d (patch) | |
tree | ab4b5fcdbc2504ff1436387dbe82db2dcedff22b /SCons/Utilities/sconsign.py | |
parent | 0ef81fc03600cd275a8e6733aeca26e0db268dad (diff) | |
download | scons-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/Utilities/sconsign.py')
-rw-r--r-- | SCons/Utilities/sconsign.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/SCons/Utilities/sconsign.py b/SCons/Utilities/sconsign.py index ae6919693..c12782dd2 100644 --- a/SCons/Utilities/sconsign.py +++ b/SCons/Utilities/sconsign.py @@ -72,7 +72,7 @@ def my_import(mname): class Flagger: default_value = 1 - def __setitem__(self, item, value): + def __setitem__(self, item, value) -> None: self.__dict__[item] = value self.default_value = 0 @@ -201,7 +201,7 @@ def field(name, entry, verbose=Verbose): return val -def nodeinfo_raw(name, ninfo, prefix=""): +def nodeinfo_raw(name, ninfo, prefix: str=""): """ This just formats the dictionary, which we would normally use str() to do, except that we want the keys sorted for deterministic output. @@ -219,7 +219,7 @@ def nodeinfo_raw(name, ninfo, prefix=""): return name + ': {' + ', '.join(values) + '}' -def nodeinfo_cooked(name, ninfo, prefix=""): +def nodeinfo_cooked(name, ninfo, prefix: str=""): try: field_list = ninfo.field_list except AttributeError: @@ -239,7 +239,7 @@ def nodeinfo_cooked(name, ninfo, prefix=""): nodeinfo_string = nodeinfo_cooked -def printfield(name, entry, prefix=""): +def printfield(name, entry, prefix: str="") -> None: outlist = field("implicit", entry, 0) if outlist: if Verbose: @@ -253,7 +253,7 @@ def printfield(name, entry, prefix=""): print(" " + outact) -def printentries(entries, location): +def printentries(entries, location) -> None: if Print_Entries: for name in Print_Entries: try: @@ -282,7 +282,7 @@ def printentries(entries, location): class Do_SConsignDB: - def __init__(self, dbm_name, dbm): + def __init__(self, dbm_name, dbm) -> None: self.dbm_name = dbm_name self.dbm = dbm @@ -346,7 +346,7 @@ class Do_SConsignDB: self.printentries(dir, db[dir]) @staticmethod - def printentries(dir, val): + def printentries(dir, val) -> None: try: print('=== ' + dir + ':') except TypeError: @@ -376,7 +376,7 @@ def Do_SConsignDir(name): ############################################################################## -def main(): +def main() -> None: global Do_Call global nodeinfo_string global args |