Skip to content

Commit 66c4af3

Browse files
committed
Turn off type hinting warnings by default
1 parent c51ed8a commit 66c4af3

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

fairworkflows/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515

1616
LOGGER = logging.getLogger('fairworkflows')
1717

18+
WARN_FOR_TYPE_HINTING = False
19+
1820
MANUAL_ASSISTANT_HOST = 'localhost'
1921
MANUAL_ASSISTANT_PORT = 8000

fairworkflows/fairstep.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from fairworkflows import namespaces, LinguisticSystem, LINGSYS_ENGLISH, LINGSYS_PYTHON
1616
from fairworkflows.config import DUMMY_FAIRWORKFLOWS_URI, IS_FAIRSTEP_RETURN_VALUE_PARAMETER_NAME, \
17-
LOGGER
17+
LOGGER, WARN_FOR_TYPE_HINTING
1818
from fairworkflows.prov import prov_logger, StepRetroProv
1919
from fairworkflows.rdf_wrapper import RdfWrapper, replace_in_rdf
2020
from fairworkflows import manual_assistant
@@ -504,9 +504,10 @@ def _extract_inputs_from_function(func, additional_params) -> List[FairVariable]
504504
try:
505505
computational_type = argspec.annotations[arg].__name__
506506
except KeyError:
507-
warn(f'Function input argument {arg} does not have type hinting, '
508-
'FAIR step function arguments without type hinting will not have a computational '
509-
'type associated with them see https://docs.python.org/3/library/typing.html')
507+
if WARN_FOR_TYPE_HINTING:
508+
warn(f'Function input argument {arg} does not have type hinting, '
509+
'FAIR step function arguments without type hinting will not have a computational '
510+
'type associated with them see https://docs.python.org/3/library/typing.html')
510511
computational_type = None
511512
inputs.append(FairVariable(
512513
name=arg,
@@ -524,10 +525,11 @@ def _extract_outputs_from_function(func, additional_params) -> List[FairVariable
524525
try:
525526
return_annotation = annotations['return']
526527
except KeyError:
527-
warn(f'Function output does not have type hinting, '
528-
'The outputs will not have a computational '
529-
'type associated with them. Also multiple outputs will not be captured'
530-
'correctly. See https://docs.python.org/3/library/typing.html')
528+
if WARN_FOR_TYPE_HINTING:
529+
warn(f'Function output does not have type hinting, '
530+
'The outputs will not have a computational '
531+
'type associated with them. Also multiple outputs will not be captured'
532+
'correctly. See https://docs.python.org/3/library/typing.html')
531533
return_annotation = None
532534

533535
if _is_generic_tuple(return_annotation):

0 commit comments

Comments
 (0)