U
    Ú²g­  ã                   @   s”   d dl Z d dlZd dlmZmZ dZdZdZdZej	e
dœdd	„Ze
d
œdd„Zeeeej	eej	ej	f f dœdd„Zdd„ Zdd„ Zdd„ ZdS )é    N)ÚTupleÚUnion)Z_protosZ	_servicesZ_protos_and_services)é   é   r   zBInstall the grpcio-tools package (1.32.0+) to use the {} function.z@The {} function is only on available on Python 3.X interpreters.)ÚmodÚreturnc                    s   t ‡ fdd„tD ƒƒS )Nc                 3   s   | ]}t ˆ |ƒV  qd S )N)Úhasattr)Ú.0Úsym©r   © ú8/tmp/pip-unpacked-wheel-8poujhl6/grpc/_runtime_protos.pyÚ	<genexpr>   s     z-_has_runtime_proto_symbols.<locals>.<genexpr>)ÚallÚ_REQUIRED_SYMBOLSr   r   r   r   Ú_has_runtime_proto_symbols   s    r   )r   c               
   C   sL   zdd l } W dS  tk
rF } zd|jd kr0‚ W Y ¢dS d }~X Y nX d S )Nr   TÚ
grpc_toolsF)r   ÚImportErrorÚargs)r   Úer   r   r   Ú_is_grpc_tools_importable"   s    r   )Úfn_nameÚprotobuf_pathr   c                 C   sj   t jtk rtt | ¡ƒ‚nLtƒ s.tt | ¡ƒ‚ddl}t	|j
ƒrXt|j
d|  ƒ}||ƒS tt | ¡ƒ‚dS )zôCalls one of the three functions, lazily importing grpc_tools.

    Args:
      fn_name: The name of the function to import from grpc_tools.protoc.
      protobuf_path: The path to import.

    Returns:
      The appropriate module object.
    r   NÚ_)ÚsysÚversion_infoÚ_MINIMUM_VERSIONÚNotImplementedErrorÚ_VERSION_ERROR_TEMPLATEÚformatr   Ú_UNINSTALLED_TEMPLATEZgrpc_tools.protocr   ZprotocÚgetattr)r   r   r   Úfnr   r   r   Ú_call_with_lazy_import/   s    

r#   c                 C   s
   t d| ƒS )aU  Returns a module generated by the indicated .proto file.

    THIS IS AN EXPERIMENTAL API.

    Use this function to retrieve classes corresponding to message
    definitions in the .proto file.

    To inspect the contents of the returned module, use the dir function.
    For example:

    ```
    protos = grpc.protos("foo.proto")
    print(dir(protos))
    ```

    The returned module object corresponds to the _pb2.py file generated
    by protoc. The path is expected to be relative to an entry on sys.path
    and all transitive dependencies of the file should also be resolvable
    from an entry on sys.path.

    To completely disable the machinery behind this function, set the
    GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

    Args:
      protobuf_path: The path to the .proto file on the filesystem. This path
        must be resolvable from an entry on sys.path and so must all of its
        transitive dependencies.

    Returns:
      A module object corresponding to the message code for the indicated
      .proto file. Equivalent to a generated _pb2.py file.
    Úprotos©r#   ©r   r   r   r   r$   I   s    !r$   c                 C   s
   t d| ƒS )aª  Returns a module generated by the indicated .proto file.

    THIS IS AN EXPERIMENTAL API.

    Use this function to retrieve classes and functions corresponding to
    service definitions in the .proto file, including both stub and servicer
    definitions.

    To inspect the contents of the returned module, use the dir function.
    For example:

    ```
    services = grpc.services("foo.proto")
    print(dir(services))
    ```

    The returned module object corresponds to the _pb2_grpc.py file generated
    by protoc. The path is expected to be relative to an entry on sys.path
    and all transitive dependencies of the file should also be resolvable
    from an entry on sys.path.

    To completely disable the machinery behind this function, set the
    GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

    Args:
      protobuf_path: The path to the .proto file on the filesystem. This path
        must be resolvable from an entry on sys.path and so must all of its
        transitive dependencies.

    Returns:
      A module object corresponding to the stub/service code for the indicated
      .proto file. Equivalent to a generated _pb2_grpc.py file.
    Úservicesr%   r&   r   r   r   r'   m   s    "r'   c                 C   s
   t d| ƒS )a‚  Returns a 2-tuple of modules corresponding to protos and services.

    THIS IS AN EXPERIMENTAL API.

    The return value of this function is equivalent to a call to protos and a
    call to services.

    To completely disable the machinery behind this function, set the
    GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

    Args:
      protobuf_path: The path to the .proto file on the filesystem. This path
        must be resolvable from an entry on sys.path and so must all of its
        transitive dependencies.

    Returns:
      A 2-tuple of module objects corresponding to (protos(path), services(path)).
    Úprotos_and_servicesr%   r&   r   r   r   r(   ’   s    r(   )r   ÚtypesÚtypingr   r   r   r   r    r   Ú
ModuleTypeÚboolr   r   Ústrr#   r$   r'   r(   r   r   r   r   Ú<module>   s"   ÿÿ þ$%