Skip to content

Commit

Permalink
Turn off type hinting warnings by default
Browse files Browse the repository at this point in the history
  • Loading branch information
raar1 committed Apr 30, 2021
1 parent c51ed8a commit 66c4af3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions fairworkflows/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@

LOGGER = logging.getLogger('fairworkflows')

WARN_FOR_TYPE_HINTING = False

MANUAL_ASSISTANT_HOST = 'localhost'
MANUAL_ASSISTANT_PORT = 8000
18 changes: 10 additions & 8 deletions fairworkflows/fairstep.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from fairworkflows import namespaces, LinguisticSystem, LINGSYS_ENGLISH, LINGSYS_PYTHON
from fairworkflows.config import DUMMY_FAIRWORKFLOWS_URI, IS_FAIRSTEP_RETURN_VALUE_PARAMETER_NAME, \
LOGGER
LOGGER, WARN_FOR_TYPE_HINTING
from fairworkflows.prov import prov_logger, StepRetroProv
from fairworkflows.rdf_wrapper import RdfWrapper, replace_in_rdf
from fairworkflows import manual_assistant
Expand Down Expand Up @@ -504,9 +504,10 @@ def _extract_inputs_from_function(func, additional_params) -> List[FairVariable]
try:
computational_type = argspec.annotations[arg].__name__
except KeyError:
warn(f'Function input argument {arg} does not have type hinting, '
'FAIR step function arguments without type hinting will not have a computational '
'type associated with them see https://docs.python.org/3/library/typing.html')
if WARN_FOR_TYPE_HINTING:
warn(f'Function input argument {arg} does not have type hinting, '
'FAIR step function arguments without type hinting will not have a computational '
'type associated with them see https://docs.python.org/3/library/typing.html')
computational_type = None
inputs.append(FairVariable(
name=arg,
Expand All @@ -524,10 +525,11 @@ def _extract_outputs_from_function(func, additional_params) -> List[FairVariable
try:
return_annotation = annotations['return']
except KeyError:
warn(f'Function output does not have type hinting, '
'The outputs will not have a computational '
'type associated with them. Also multiple outputs will not be captured'
'correctly. See https://docs.python.org/3/library/typing.html')
if WARN_FOR_TYPE_HINTING:
warn(f'Function output does not have type hinting, '
'The outputs will not have a computational '
'type associated with them. Also multiple outputs will not be captured'
'correctly. See https://docs.python.org/3/library/typing.html')
return_annotation = None

if _is_generic_tuple(return_annotation):
Expand Down

0 comments on commit 66c4af3

Please sign in to comment.