Returns an `_ArgInfo` for each argument of `func` specified by `arg_names`. Args: func: The function whose arguments should be described. arg_names: The names of the arguments to get info for. Returns: A tuple of `_ArgInfo`s.
(func, arg_names)
| 59 | |
| 60 | |
| 61 | def _get_arg_infos(func, arg_names): |
| 62 | """Returns an `_ArgInfo` for each argument of `func` specified by `arg_names`. |
| 63 | |
| 64 | Args: |
| 65 | func: The function whose arguments should be described. |
| 66 | arg_names: The names of the arguments to get info for. |
| 67 | |
| 68 | Returns: |
| 69 | A tuple of `_ArgInfo`s. |
| 70 | """ |
| 71 | arg_infos = [] |
| 72 | |
| 73 | # Inspect the func's argspec to find the position of each arg. |
| 74 | arg_spec = tf_inspect.getargspec(func) |
| 75 | for argname in arg_names: |
| 76 | assert isinstance(argname, str) |
| 77 | is_list = argname.startswith('[') and argname.endswith(']') |
| 78 | if is_list: |
| 79 | argname = argname[1:-1] |
| 80 | if argname not in arg_spec.args: |
| 81 | raise ValueError('Argument %r not found function in %s. Args=%s' % |
| 82 | (argname, func, arg_spec.args)) |
| 83 | arg_infos.append(_ArgInfo(argname, arg_spec.args.index(argname), is_list)) |
| 84 | return arg_infos |
| 85 | |
| 86 | |
| 87 | def _is_convertible_to_tensor(value): |
no test coverage detected