Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect _DEFAULT typing for ConnectionParameters arguments #11

Open
rqueue opened this issue Aug 2, 2022 · 0 comments
Open

Incorrect _DEFAULT typing for ConnectionParameters arguments #11

rqueue opened this issue Aug 2, 2022 · 0 comments

Comments

@rqueue
Copy link

rqueue commented Aug 2, 2022

For the ConnectionParameters, the type are defined as follows:

class ConnectionParameters(Parameters):

    class _DEFAULT:
        ...

    def __init__(
        self,
        host: Union[str, _DEFAULT] = ...,
        port: Union[int, _DEFAULT] = ...,
        virtual_host: Union[str, _DEFAULT] = ...,
        credentials: Union[credentials_.VALID_TYPES, _DEFAULT] = ...,
        channel_max: Union[int, _DEFAULT] = ...,
        frame_max: Union[int, _DEFAULT] = ...,
        heartbeat: Union[int, _OnHeartbeatTimeoutCallback, None, _DEFAULT] = ...,
        ssl_options: Union[SSLOptions, _DEFAULT] = ...,
        connection_attempts: Union[int, _DEFAULT] = ...,
        retry_delay: Union[numbers.Real, _DEFAULT] = ...,
        socket_timeout: Union[numbers.Real, _DEFAULT] = ...,
        stack_timeout: Union[numbers.Real, _DEFAULT] = ...,
        locale: Union[str, _DEFAULT] = ...,
        blocked_connection_timeout: Union[numbers.Real, None, _DEFAULT] = ...,
        client_properties: Union[Mapping[str, Any], None, _DEFAULT] = ...,
        tcp_options: Union[Mapping[str, Any], None, _DEFAULT] = ...,
        **kwargs: Any,
    ): ...

The _DEFAULT type defined expects an instance, but the actual method only checks for the _DEFAULT type itself. I believe the _DEFAULT type should be changed to Type[_DEFAULT]:

class ConnectionParameters(Parameters):

    class _DEFAULT:
        ...

    def __init__(
        self,
        host: Union[str, Type[_DEFAULT]] = ...,
        port: Union[int, Type[_DEFAULT]] = ...,
        virtual_host: Union[str, Type[_DEFAULT]] = ...,
        credentials: Union[credentials_.VALID_TYPES, Type[_DEFAULT]] = ...,
        channel_max: Union[int, Type[_DEFAULT]] = ...,
        frame_max: Union[int, Type[_DEFAULT]] = ...,
        heartbeat: Union[int, _OnHeartbeatTimeoutCallback, None, Type[_DEFAULT]] = ...,
        ssl_options: Union[SSLOptions, Type[_DEFAULT]] = ...,
        connection_attempts: Union[int, Type[_DEFAULT]] = ...,
        retry_delay: Union[numbers.Real, Type[_DEFAULT]] = ...,
        socket_timeout: Union[numbers.Real, Type[_DEFAULT]] = ...,
        stack_timeout: Union[numbers.Real, Type[_DEFAULT]] = ...,
        locale: Union[str, Type[_DEFAULT]] = ...,
        blocked_connection_timeout: Union[numbers.Real, None, Type[_DEFAULT]] = ...,
        client_properties: Union[Mapping[str, Any], None, Type[_DEFAULT]] = ...,
        tcp_options: Union[Mapping[str, Any], None, Type[_DEFAULT]] = ...,
        **kwargs: Any,
    ): ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant