Skip to content

Commit

Permalink
[QMI-094] MOve back to use Mapping for input arguments, if they are…
Browse files Browse the repository at this point in the history
… to be generic key:value mapped types, and not to be changed (mutated).
  • Loading branch information
heevasti committed Aug 14, 2024
1 parent dc7b048 commit 3b375b8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions qmi/core/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import sys
import time
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
from collections.abc import Mapping
else:
from typing import MutableMapping
from typing import Mapping
from typing import Any, Dict, Optional, List, Tuple, Type

import serial
Expand Down Expand Up @@ -188,14 +188,14 @@ class TransportDescriptorParser:
def __init__(self,
interface: str,
positionals: List[Tuple[str, Tuple[Type, bool]]],
keywords: MutableMapping[str, Tuple[Type, bool]]
keywords: Mapping[str, Tuple[Type, bool]]
) -> None:
self.interface = interface
self._positionals = positionals
self._keywords = keywords

def parse_parameter_strings(
self, transport_descriptor: str, default_parameters: Optional[MutableMapping[str, Any]] = None
self, transport_descriptor: str, default_parameters: Optional[Mapping[str, Any]] = None
) -> Dict[str, Any]:
"""Method for parsing transport descriptor strings.
Expand All @@ -209,7 +209,7 @@ def parse_parameter_strings(
if default_parameters is None:
parameters = {}
else:
parameters = default_parameters.copy()
parameters = dict(default_parameters)

# Drop unexpected default parameters.
# These may be intended for a different transport interface.
Expand Down Expand Up @@ -1291,7 +1291,7 @@ def list_usbtmc_transports() -> List[str]:

def create_transport(
transport_descriptor: str, default_attributes: Optional[Dict[str, Any]] = None
) -> QMI_Transport:
) -> QMI_Transport:
"""Create a bidirectional communication channel.
A transport_descriptor specifies all information that may be needed to open a transport, including parameters
Expand Down

0 comments on commit 3b375b8

Please sign in to comment.