Add type hint to L2CAP module

This commit is contained in:
Josh Wu
2023-07-27 10:46:22 +08:00
committed by Lucas Abel
parent 43234d7c3e
commit 9c70c487b9
2 changed files with 134 additions and 100 deletions
+2 -2
View File
@@ -17,7 +17,7 @@
# -----------------------------------------------------------------------------
from __future__ import annotations
import struct
from typing import List, Optional, Tuple, Union, cast
from typing import List, Optional, Tuple, Union, cast, Dict
from .company_ids import COMPANY_IDENTIFIERS
@@ -53,7 +53,7 @@ def bit_flags_to_strings(bits, bit_flag_names):
return names
def name_or_number(dictionary, number, width=2):
def name_or_number(dictionary: Dict[int, str], number: int, width: int = 2) -> str:
name = dictionary.get(number)
if name is not None:
return name