Skip to content

Fix mypyc compatibility #110

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

Merged
merged 2 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion bluetooth_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ async def remove_device(self, device_object_path: str) -> None:
if device in list:
list.remove(device)
await device.finalise()
del device

def switch_host(self) -> None:
self.current_host_index = (self.current_host_index + 1) % len(self.connected_hosts)
Expand Down
7 changes: 4 additions & 3 deletions hid_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ class FilterDict(TypedDict):
DEVICES_CONFIG_COMPATIBILITY_DEVICE_KEY = 'compatibility_devices'
CAPTURE_ELEMENT: Literal['capture'] = 'capture'
FILTER_ELEMENT: Literal['filter'] = 'filter'
FILTERS_PATH = Path(__file__).parent / "filters"
# TODO: https://github.com/mypyc/mypyc/issues/700
FILTERS_PATH = Path(".") / "filters" # Path(__file__).parent
REPORT_ID_PATTERN = re.compile(r"(a10185)(..)")
SDP_TEMPLATE_PATH = Path(__file__).with_name("sdp_record_template.xml")
SDP_TEMPLATE_PATH = SDP_TEMPLATE_PATH = Path("sdp_record_template.xml") # Path(__file__).with_name("sdp_record_template.xml")
SDP_OUTPUT_PATH = Path("/etc/bluetooth/sdp_record.xml")

FILTERS: dict[str, FilterDict] = {"_": {"name": "No filter", "func": lambda m: m}}
Expand Down Expand Up @@ -147,7 +148,7 @@ def __init__(self, device: _Device, filter: HIDMessageFilter,
print("HID Device ",self.device_id," created")
desc = "".join(f"{b:02x}" for b in _HIDIOCGRDESC(self.hidraw_file))
# Replace report IDs, so they can be remapped later.
self.internal_ids = tuple(m[1] for m in cast(list[str], REPORT_ID_PATTERN.findall(desc)))
self.internal_ids = tuple(m[1] for m in cast(list[tuple[str, str]], REPORT_ID_PATTERN.findall(desc)))
self.descriptor, found = REPORT_ID_PATTERN.subn(r"\1{}", desc)
# Or insert one if no report ID exists.
if found == 0:
Expand Down
Loading