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

Fix return type to be instance of Api() #283

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions librouteros/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: UTF-8 -*-

import typing
from socket import create_connection
from collections import ChainMap

Expand All @@ -27,7 +26,7 @@
}


def connect(host: str, username: str, password: str, **kwargs) -> typing.Type[Api]:
def connect(host: str, username: str, password: str, **kwargs) -> Api:
"""
Connect and login to routeros device.
Upon success return a Api class.
Expand All @@ -45,7 +44,7 @@ def connect(host: str, username: str, password: str, **kwargs) -> typing.Type[Ap
arguments = ChainMap(kwargs, DEFAULTS)
transport = create_transport(host, **arguments)
protocol = ApiProtocol(transport=transport, encoding=arguments["encoding"])
api = arguments["subclass"](protocol=protocol)
api: Api = arguments["subclass"](protocol=protocol)

try:
arguments["login_method"](api=api, username=username, password=password)
Expand Down