Skip to content

Commit 97616b4

Browse files
committed
Add minimal type review to case_utils
An observed behavior is that mypy will not type signature analysis until one is added in the call path, e.g. designating `def main() -> None`. This patch is the minimal set of effects of adding a None return type to unit test functions. No further changes needed. One test not committed is that, before this patch, this line could be put into a function (I chose the SPARQL selector's main()) without mypy complaining: x : str = 1 After requiring that function return a type, mypy appropriately raised an error. References: * [AC-211] Add static type checking to CASE-Utilities-Python Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent f99bcea commit 97616b4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

case_utils/case_file/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def create_file_node(graph, filepath, node_iri=None, node_prefix=DEFAULT_PREFIX,
205205

206206
return n_file
207207

208-
def main():
208+
def main() -> None:
209209
import argparse
210210
parser = argparse.ArgumentParser()
211211
parser.add_argument("--base-prefix", default=DEFAULT_PREFIX)

case_utils/case_sparql_construct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
_logger = logging.getLogger(os.path.basename(__file__))
2929

30-
def main():
30+
def main() -> None:
3131
parser = argparse.ArgumentParser()
3232
parser.add_argument("-d", "--debug", action="store_true")
3333
parser.add_argument("--disallow-empty-results", action="store_true", help="Raise error if no results are returned for query.")

case_utils/case_sparql_select/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
_logger = logging.getLogger(os.path.basename(__file__))
4444

45-
def main():
45+
def main() -> None:
4646
parser = argparse.ArgumentParser()
4747
parser.add_argument("-d", "--debug", action="store_true")
4848
parser.add_argument("--disallow-empty-results", action="store_true", help="Raise error if no results are returned for query.")

0 commit comments

Comments
 (0)