aws_lambda/pytorch/source/torch/jit/annotations.py
def parse_type_line(type_line):
    """Parses a type annotation specified as a comment.

    Example inputs:
        # type: (Tensor, torch.Tensor) -> Tuple[Tensor]
        # type: (Tensor, Tuple[Tensor, Tensor]) -> Tensor
    """
    arg_ann_str, ret_ann_str = split_type_line(type_line)

    try:
        arg_ann = eval(arg_ann_str, _eval_env)
    except SyntaxError:
        raise RuntimeError("Failed to parse the argument list of a type annotation")

    if not isinstance(arg_ann, tuple):
        arg_ann = (arg_ann,)

    try:
        ret_ann = eval(ret_ann_str, _eval_env)
    except SyntaxError:
        raise RuntimeError("Failed to parse the return type of a type annotation")

    arg_types = [ann_to_type(ann) for ann in arg_ann]
    return arg_types, ann_to_type(ret_ann)
Parses a type annotation specified as a comment.

    Example inputs:
        # type: (Tensor, torch.Tensor) -> Tuple[Tensor]
        # type: (Tensor, Tuple[Tensor, Tensor]) -> Tensor
    
Parses a type annotation specified as a comment.
Parses a type annotation specified as a comment .
def parse_type_line(type_line):
    arg_ann_str, ret_ann_str = split_type_line(type_line)
    try:
        arg_ann = eval(arg_ann_str, _eval_env)
    except SyntaxError:
        raise RuntimeError("Failed to parse the argument list of a type annotation")
    if not isinstance(arg_ann, tuple):
        arg_ann = (arg_ann,)
    try:
        ret_ann = eval(ret_ann_str, _eval_env)
    except SyntaxError:
        raise RuntimeError("Failed to parse the return type of a type annotation")
    arg_types = [ann_to_type(ann) for ann in arg_ann]
    return arg_types, ann_to_type(ret_ann)
def parse_type_line ( type_line ) : arg_ann_str , ret_ann_str = split_type_line ( type_line ) try : arg_ann = eval ( arg_ann_str , _eval_env ) except SyntaxError : raise RuntimeError ( "Failed to parse the argument list of a type annotation" ) if not isinstance ( arg_ann , tuple ) : arg_ann = ( arg_ann , ) try : ret_ann = eval ( ret_ann_str , _eval_env ) except SyntaxError : raise RuntimeError ( "Failed to parse the return type of a type annotation" ) arg_types = [ ann_to_type ( ann ) for ann in arg_ann ] return arg_types , ann_to_type ( ret_ann )
Parses a type annotation specified as a comment.
Parses a type annotation specified as a comment .
"""Parses a type annotation specified as a comment.

    Example inputs:
        # type: (Tensor, torch.Tensor) -> Tuple[Tensor]
        # type: (Tensor, Tuple[Tensor, Tensor]) -> Tensor
    """
type_line