Skip to content

Commit 33b6bfa

Browse files
committed
refactor: Replace TypeAlias with Union for type hints in address space and clean up imports in internal server
1 parent 8da9fd7 commit 33b6bfa

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

asyncua/server/address_space.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from typing import TYPE_CHECKING, Optional, KeysView, Union
1616

1717
if TYPE_CHECKING:
18-
from typing import Callable, Dict, List, Tuple, Generator, TypeAlias
18+
from typing import Callable, Dict, List, Tuple, Generator
1919
from asyncua.ua.uaprotocol_auto import (
2020
ObjectAttributes,
2121
DataTypeAttributes,
@@ -33,8 +33,8 @@
3333
ObjectTypeAttributes,
3434
ObjectAttributes,
3535
] # FIXME Check, if there are missing attribute types.
36-
StrOrBytesPath: TypeAlias = str | bytes | PathLike[str] | PathLike[bytes]
37-
FileDescriptorOrPath: TypeAlias = int | StrOrBytesPath
36+
StrOrBytesPath = Union[str, bytes, PathLike[str],PathLike[bytes]]
37+
FileDescriptorOrPath = Union[int, StrOrBytesPath]
3838

3939
from asyncua import ua
4040
from asyncua.crypto.permission_rules import User, UserRole

asyncua/server/internal_server.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from urllib.parse import urlparse
1414

1515
from asyncua import ua
16-
from asyncua.common.session_interface import AbstractSession
1716
from asyncua.ua.uaprotocol_auto import UserNameIdentityToken
1817
from ..common.callback import CallbackService
1918
from ..common.node import Node
@@ -70,7 +69,7 @@ def __init__(
7069

7170
self._user_manager: AbstractUserManager = user_manager or PermissiveUserManager()
7271
self._aspace: AbstractAddressSpace = aspace or AddressSpace()
73-
self._certificate_validator: Optional[CertificateValidatorMethod] = certificate_validator
72+
self._certificate_validator: Optional[CertificateValidatorMethod] = certificate_validator # hook to validate a certificate, rasies a ServiceError when not valid
7473

7574
self._callback_service = CallbackService()
7675
self._attribute_service = AttributeService(aspace=self.aspace)
@@ -80,12 +79,7 @@ def __init__(
8079
self.asyncio_transports = []
8180
self._subscription_service: SubscriptionService = SubscriptionService(aspace=self.aspace)
8281
self._history_manager = HistoryManager(iserver=self)
83-
# if user_manager is None:
84-
# _logger.info("No user manager specified. Using default permissive manager instead.")
85-
# user_manager = PermissiveUserManager()
86-
# self.user_manager = user_manager
8782

88-
"""hook to validate a certificate, raises a ServiceError when not valid"""
8983
# create a session to use on server side
9084
self._isession = InternalSession(internal_server=self, name="Internal", user=User(role=UserRole.Admin))
9185
self.current_time_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime))

0 commit comments

Comments
 (0)