Skip to content

Commit f7876f5

Browse files
abrichrClaude
and
Claude
committed
Make BeautifulSoup import lazy in models.py
- Update models.py to use string literals for BeautifulSoup types - Allow OmniMCP to run without BeautifulSoup dependency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7fa4483 commit f7876f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

openadapt/models.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010
import textwrap
1111

12-
from bs4 import BeautifulSoup
12+
# Lazy import BeautifulSoup when needed
1313
from pynput import keyboard
1414
from PIL import Image, ImageChops
1515
import numpy as np
@@ -790,16 +790,16 @@ def __str__(self) -> str:
790790
# Return the complete representation including the truncated message
791791
return f"BrowserEvent({base_repr}, message={message_copy})"
792792

793-
def parse(self) -> tuple[BeautifulSoup, BeautifulSoup | None]:
793+
def parse(self) -> "tuple['BeautifulSoup', 'BeautifulSoup | None']":
794794
"""Parses the visible HTML and optionally extracts the target element.
795795
796796
This method processes the browser event to parse the visible HTML and,
797797
if the event has a targetId, extracts the target HTML element.
798798
799799
Returns:
800800
A tuple containing:
801-
- BeautifulSoup: The parsed soup of the visible HTML.
802-
- BeautifulSoup | None: The target HTML element if the event type is
801+
- bs4.BeautifulSoup: The parsed soup of the visible HTML.
802+
- bs4.BeautifulSoup | None: The target HTML element if the event type is
803803
"click"; otherwise, None.
804804
805805
Raises:

0 commit comments

Comments
 (0)