[ 
https://issues.apache.org/jira/browse/BEAM-6988?focusedWorklogId=243593&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-243593
 ]

ASF GitHub Bot logged work on BEAM-6988:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/May/19 19:16
            Start Date: 16/May/19 19:16
    Worklog Time Spent: 10m 
      Work Description: NikeNano commented on pull request #8590: [BEAM-6988] 
Implement a Python 3 version of getcallargs_forhints
URL: https://github.com/apache/beam/pull/8590#discussion_r284858804
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/decorators.py
 ##########
 @@ -314,10 +325,40 @@ def getcallargs_forhints(func, *typeargs, **typekwargs):
   return callargs
 
 
+def getcallargs_forhints_impl_py3(func, packed_typeargs, typekwargs):
+  try:
+    # TODO(udim): Function signature returned by getfullargspec (in
+    #  packed_typeargs) might differ from the one below. Migrate to use
+    #  inspect.signature in getfullargspec (for Py3).
+    signature = inspect.signature(func)
+  except ValueError as e:
+    logger.warning('Could not get signature for function: %s: %s', func, e)
+    return {}
+  try:
+    bindings = signature.bind(*packed_typeargs, **typekwargs)
+  except TypeError as e:
+    # Might be raised due to too few or too many arguments.
+    raise TypeCheckError(e)
+  bound_args = bindings.arguments
+  missing = []
 
 Review comment:
   Is missing ever used except for in the if statement?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 243593)
    Time Spent: 4h 50m  (was: 4h 40m)

> TypeHints Py3 Error: test_non_function 
> (apache_beam.typehints.typed_pipeline_test.MainInputTest) Fails on Python 3.7+
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-6988
>                 URL: https://issues.apache.org/jira/browse/BEAM-6988
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: niklas Hansson
>            Priority: Major
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> {noformat}
> Traceback (most recent call last):
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/typehints/typed_pipeline_test.py",
>  line 53, in test_non_function
>  result = ['xa', 'bbx', 'xcx'] | beam.Map(str.strip, 'x')
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/transforms/ptransform.py",
>  line 510, in _ror_
>  result = p.apply(self, pvalueish, label)
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/pipeline.py",
>  line 514, in apply
>  transform.type_check_inputs(pvalueish)
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/transforms/ptransform.py",
>  line 753, in type_check_inputs
>  hints = getcallargs_forhints(argspec_fn, *type_hints[0], **type_hints[1])
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/typehints/decorators.py",
>  line 283, in getcallargs_forhints
>  raise TypeCheckError(e)
>  apache_beam.typehints.decorators.TypeCheckError: strip() missing 1 required 
> positional argument: 'chars'{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to