Skip to content

An AI Agent that interacts with Windows OS at GUI level.

Python

Fix all pre-commit hook failures

jeomonb726cc294d54
diff --git a/.gitignore b/.gitignore
index a64699b..883e354 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,4 +27,4 @@ logs
# Electron UI
ui/node_modules/
ui/dist/
-ui/out/
\ No newline at end of file
+ui/out/
diff --git a/AGENTS.md b/AGENTS.md
index dba48ba..f2f8fba 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -72,4 +72,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
## Security
- This project has the ability to operate ones windows OS at GUI level. So be careful while using this project.
-- Best pratice launch the project in a virtual machine, so that if something goes wrong, you can revert the changes.
\ No newline at end of file
+- Best pratice launch the project in a virtual machine, so that if something goes wrong, you can revert the changes.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2cffc18..5c0b979 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.7.4] - 2026-01-30
### Changed
-- **Performance Optimization**:
+- **Performance Optimization**:
- Significant improvement in **Tree Traversal speed** (0.2-0.8s).
- **Desktop State Capture** optimized to (0.4-1.0s).
- Reduced computation expense by removing reliance on the root level children.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ddf9318..d51c6d5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -143,4 +143,4 @@ If you need help with your contribution:
- Reach out to the maintainers
- Check existing code for examples
-Thank you for contributing to Windows-Use!
\ No newline at end of file
+Thank you for contributing to Windows-Use!
diff --git a/LICENSE b/LICENSE
index 5ef9336..c44aebb 100644
--- a/LICENSE
+++ b/LICENSE
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/SECURITY.md b/SECURITY.md
index 5e801a3..752fc0b 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -185,5 +185,5 @@ For security-related questions (not vulnerabilities):
---
-**Last Updated**: November 26, 2025
+**Last Updated**: November 26, 2025
**Version**: 1.0.0
diff --git a/docs/functions/AccNotifyTouchInteraction.md b/docs/functions/AccNotifyTouchInteraction.md
index 906f9a2..189c135 100644
--- a/docs/functions/AccNotifyTouchInteraction.md
+++ b/docs/functions/AccNotifyTouchInteraction.md
@@ -47,16 +47,16 @@ When an AT is consuming touch data (such as when using the [RegisterPointerInput
This code example shows how to call the **AccNotifyTouchInteraction** function.
```
-// pTargetElement is the element being interacted with by the user, hwndApp
+// pTargetElement is the element being interacted with by the user, hwndApp
// represents an HWND owned by the AT.
-HRESULT PerformTouchBasedInteraction(IUIAutomationElement *pTargetElement,
+HRESULT PerformTouchBasedInteraction(IUIAutomationElement *pTargetElement,
HWND hwndApp)
{
HRESULT hr = S_OK;
- // Set the focus to the element and then notify the system that the
- // interaction is occurring due to a touch gesture. This would also apply
- // to pattern-based interactions (such as calls to
+ // Set the focus to the element and then notify the system that the
+ // interaction is occurring due to a touch gesture. This would also apply
+ // to pattern-based interactions (such as calls to
// IUIAutomationInvokePattern::Invoke)
hr = pTargetElement->SetFocus();
if (SUCCEEDED(hr))
@@ -65,14 +65,14 @@ HRESULT PerformTouchBasedInteraction(IUIAutomationElement *pTargetElement,
POINT ptTarget;
BOOL fGotClickablePoint;
- // If the current element does not have a native window handle, an
- // alternate method (such as walking up the parent chain) is required
+ // If the current element does not have a native window handle, an
+ // alternate method (such as walking up the parent chain) is required
// to get the nearest valid HWND.
hr = pTargetElement->get_CurrentNativeWindowHandle((UIA_HWND *)(&hwndTarget));
if (SUCCEEDED(hr))
{
- // If the provider doesn't return a clickable point, an alternate
- // method (such as using the bounding rectangle) will be required
+ // If the provider doesn't return a clickable point, an alternate
+ // method (such as using the bounding rectangle) will be required
// to get the center point of the current element.
hr = pTargetElement->GetClickablePoint(&ptTarget, &fGotClickablePoint);
}
diff --git a/docs/functions/AccSetRunningUtilityState.md b/docs/functions/AccSetRunningUtilityState.md
index a4a71bb..5d7253e 100644
--- a/docs/functions/AccSetRunningUtilityState.md
+++ b/docs/functions/AccSetRunningUtilityState.md
@@ -28,7 +28,7 @@ The handle of the AT application window. This parameter must not be **NULL**.
Type: **DWORD**
-A
+A
mask that indicates the system values being set. It can be a combination of the following values:
#### ANRUS\_ON\_SCREEN\_KEYBOARD\_ACTIVE
@@ -73,10 +73,10 @@ This code example shows how to call the **AccSetRunningUtilityState** function.
```
if (SUCCEEDED(hr))
{
- // Tell the system that an AT application has registered with the
+ // Tell the system that an AT application has registered with the
// touch redirector.
- hr = AccSetRunningUtilityState(hwndTouchWindow,
- ANRUS_TOUCH_MODIFICATION_ACTIVE,
+ hr = AccSetRunningUtilityState(hwndTouchWindow,
+ ANRUS_TOUCH_MODIFICATION_ACTIVE,
ANRUS_TOUCH_MODIFICATION_ACTIVE);
if (FAILED(hr))
{
diff --git a/docs/functions/AccessibleObjectFromEvent.md b/docs/functions/AccessibleObjectFromEvent.md
index 5aa03b4..adbab67 100644
--- a/docs/functions/AccessibleObjectFromEvent.md
+++ b/docs/functions/AccessibleObjectFromEvent.md
@@ -77,17 +77,17 @@ This function fails if called in response to [EVENT\_OBJECT\_CREATE](/en-us/wind
The following example code shows this method being called in a [WinEventProc](/en-us/windows/desktop/api/winuser/nc-winuser-wineventproc) event handler.
```
-void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
- LONG idObject, LONG idChild,
+void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
+ LONG idObject, LONG idChild,
DWORD dwEventThread, DWORD dwmsEventTime)
{
IAccessible* pAcc = NULL;
VARIANT varChild;
- HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
+ HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
if ((hr == S_OK) && (pAcc != NULL))
{
- // Do something with the accessible object, then release it.
- // ...
+ // Do something with the accessible object, then release it.
+ // ...
pAcc->Release();
}
}
diff --git a/docs/functions/AddFocusChangedEventHandler.md b/docs/functions/AddFocusChangedEventHandler.md
index 8dcd160..9bdc52c 100644
--- a/docs/functions/AddFocusChangedEventHandler.md
+++ b/docs/functions/AddFocusChangedEventHandler.md
@@ -49,8 +49,8 @@ The following example function creates an object that implements [IUIAutomationF
```
HRESULT AddFocusHandler(IUIAutomation* pAutomation)
-{
- // CFocusHandler is a class that implements IUIAutomationFocusChangedEventHandler.
+{
+ // CFocusHandler is a class that implements IUIAutomationFocusChangedEventHandler.
CFocusHandler* pFocusHandler = new CFocusHandler();
if (!pFocusHandler)
{
diff --git a/docs/functions/CoCreateLocally.md b/docs/functions/CoCreateLocally.md
index 9ec6947..f760396 100644
--- a/docs/functions/CoCreateLocally.md
+++ b/docs/functions/CoCreateLocally.md
@@ -6,7 +6,7 @@
Clients call **ICoCreateLocally::CoCreateLocally** to create a helper object in the same context as the server object. This allows clients to increase performance because they are running in the server application.
-**Note**  Active Accessibility Text Services is deprecated. Please see
+**Note**  Active Accessibility Text Services is deprecated. Please see
[Microsoft Windows Text Services Framework](/en-us/windows/win32/tsf/text-services-framework) for more information on advanced text input and natural language technologies.
## Syntax
diff --git a/docs/functions/ElementProviderFromPoint.md b/docs/functions/ElementProviderFromPoint.md
index 2ee2e93..153c053 100644
--- a/docs/functions/ElementProviderFromPoint.md
+++ b/docs/functions/ElementProviderFromPoint.md
@@ -59,7 +59,7 @@ the UI Automation provider for that item.
```
HRESULT STDMETHODCALLTYPE ListProvider::ElementProviderFromPoint(double x, double y, IRawElementProviderFragment** pRetVal)
{
- if (pRetVal == NULL)
+ if (pRetVal == NULL)
{
return E_INVALIDARG;
}
@@ -68,13 +68,13 @@ HRESULT STDMETHODCALLTYPE ListProvider::ElementProviderFromPoint(double x, doubl
pt.y = (LONG)y;
ScreenToClient(m_controlHwnd, &pt);
int itemIndex = this->m_pControl->IndexFromY(m_controlHwnd, pt.y);
- ListItemProvider* pItem = GetItemByIndex(itemIndex);
+ ListItemProvider* pItem = GetItemByIndex(itemIndex);
if (pItem != NULL)
{
*pRetVal = (IRawElementProviderFragment*)pItem;
pItem->AddRef();
}
- else
+ else
{
pRetVal = (IRawElementProviderFragment*)this;
pItem->AddRef();
diff --git a/docs/functions/GetAdjacentFragment.md b/docs/functions/GetAdjacentFragment.md
index 3692a6b..c97c07a 100644
--- a/docs/functions/GetAdjacentFragment.md
+++ b/docs/functions/GetAdjacentFragment.md
@@ -47,34 +47,34 @@ The following C++ code example shows how to implement the **GetAdjacentFragment*
```
IFACEMETHODIMP CProviderWindowlessSite::GetAdjacentFragment(
- enum NavigateDirection direction, IRawElementProviderFragment **ppFragment)
+ enum NavigateDirection direction, IRawElementProviderFragment **ppFragment)
{
if (ppFragment == NULL)
{
return E_INVALIDARG;
}
-
+
*ppFragment = NULL;
HRESULT hr = S_OK;
switch (direction)
{
case NavigateDirection_Parent:
- {
+ {
IRawElementProviderSimple *pSimple = NULL;
// Call an application-defined function to retrieve the
// parent provider interface.
- hr = GetParentProvider(&pSimple);
- if (SUCCEEDED(hr))
- {
+ hr = GetParentProvider(&pSimple);
+ if (SUCCEEDED(hr))
+ {
// Get the parent's IRawElementProviderFragment interface.
- hr = pSimple->QueryInterface(IID_PPV_ARGS(ppFragment));
- pSimple->Release();
- }
- }
- break;
-
+ hr = pSimple->QueryInterface(IID_PPV_ARGS(ppFragment));
+ pSimple->Release();
+ }
+ }
+ break;
+
case NavigateDirection_FirstChild:
case NavigateDirection_LastChild:
hr = E_INVALIDARG;
@@ -82,11 +82,11 @@ IFACEMETHODIMP CProviderWindowlessSite::GetAdjacentFragment(
// Ignore NavigateDirection_NextSibling and NavigateDirection_PreviousSibling
// because there are no adjacent fragments.
- default:
- break;
- }
-
- return hr;
+ default:
+ break;
+ }
+
+ return hr;
}
```
diff --git a/docs/functions/GetPropertyValue.md b/docs/functions/GetPropertyValue.md
index 686bb66..0216ec2 100644
--- a/docs/functions/GetPropertyValue.md
+++ b/docs/functions/GetPropertyValue.md
@@ -66,7 +66,7 @@ The following example returns various property values. The **UiaIds** structure
property identifiers; to see how it is initialized, see [UiaLookupId](/en-us/windows/desktop/api/uiautomationcoreapi/nf-uiautomationcoreapi-uialookupid).
```
-HRESULT STDMETHODCALLTYPE Provider::GetPropertyValue(PROPERTYID propertyId,
+HRESULT STDMETHODCALLTYPE Provider::GetPropertyValue(PROPERTYID propertyId,
VARIANT* pRetVal)
{
if (propertyId == UiaIds.ControlTypeProperty)
@@ -75,9 +75,9 @@ HRESULT STDMETHODCALLTYPE Provider::GetPropertyValue(PROPERTYID propertyId,
pRetVal->lVal = UiaIds.ButtonControlType;
}
- // The Name property normally comes from the Caption property of the
- // control window, if it has one. The Name is overridden here for the
- // sake of illustration.
+ // The Name property normally comes from the Caption property of the
+ // control window, if it has one. The Name is overridden here for the
+ // sake of illustration.
else if (propertyId == UiaIds.NameProperty)
{
pRetVal->vt = VT_BSTR;
@@ -86,7 +86,7 @@ HRESULT STDMETHODCALLTYPE Provider::GetPropertyValue(PROPERTYID propertyId,
else
{
pRetVal->vt = VT_EMPTY;
- // UI Automation will attempt to get the property from the host
+ // UI Automation will attempt to get the property from the host
//window provider.
}
return S_OK;
diff --git a/docs/functions/GetRuntimeId.md b/docs/functions/GetRuntimeId.md
index 91ce06d..5f8c7aa 100644
--- a/docs/functions/GetRuntimeId.md
+++ b/docs/functions/GetRuntimeId.md
@@ -43,23 +43,23 @@ The following implementation for a list item returns a runtime identifier made u
```
HRESULT STDMETHODCALLTYPE ListItemProvider::GetRuntimeId(SAFEARRAY ** pRetVal)
{
- if (pRetVal == NULL)
+ if (pRetVal == NULL)
{
return E_INVALIDARG;
}
-
+
int rId[] = { UiaAppendRuntimeId, m_itemIndex };
SAFEARRAY *psa = SafeArrayCreateVector(VT_I4, 0, 2);
if (psa == NULL)
{
return E_OUTOFMEMORY;
}
-
+
for (LONG i = 0; i < 2; i++)
{
SafeArrayPutElement(psa, &i, (void*)&(rId[i]));
}
-
+
*pRetVal = psa;
return S_OK;
}
diff --git a/docs/functions/GetRuntimeIdPrefix.md b/docs/functions/GetRuntimeIdPrefix.md
index 70cbd1c..2e5a630 100644
--- a/docs/functions/GetRuntimeIdPrefix.md
+++ b/docs/functions/GetRuntimeIdPrefix.md
@@ -43,10 +43,10 @@ A provider typically calls this method as part of handling the [GetRuntimeId](/e
The following C++ code example shows how to implement the **GetRuntimeIdPrefix** method.
```
-IFACEMETHODIMP CProviderWindowlessSite::GetRuntimeIdPrefix(
- SAFEARRAY **ppsaPrefix)
-{
- if (ppsaPrefix == NULL)
+IFACEMETHODIMP CProviderWindowlessSite::GetRuntimeIdPrefix(
+ SAFEARRAY **ppsaPrefix)
+{
+ if (ppsaPrefix == NULL)
{
return E_INVALIDARG;
}
@@ -54,7 +54,7 @@ IFACEMETHODIMP CProviderWindowlessSite::GetRuntimeIdPrefix(
// m_siteIndex is the index of the windowless control's
// site. It is defined by the control container.
int rId[] = { UiaAppendRuntimeId, m_siteIndex };
- SAFEARRAY *psa = SafeArrayCreateVector(VT_I4, 0, 2);
+ SAFEARRAY *psa = SafeArrayCreateVector(VT_I4, 0, 2);
if (psa == NULL)
{
return E_OUTOFMEMORY;
@@ -65,8 +65,8 @@ IFACEMETHODIMP CProviderWindowlessSite::GetRuntimeIdPrefix(
SafeArrayPutElement(psa, &i, (void*)&(rId[i]));
}
- *ppsaPrefix = psa;
- return S_OK;
+ *ppsaPrefix = psa;
+ return S_OK;
}
```
diff --git a/docs/functions/LocalInit.md b/docs/functions/LocalInit.md
index 52f6226..e5978fc 100644
--- a/docs/functions/LocalInit.md
+++ b/docs/functions/LocalInit.md
@@ -6,7 +6,7 @@
Implemented by clients to return information about the local object.
-**Note**  Active Accessibility Text Services is deprecated. Please see
+**Note**  Active Accessibility Text Services is deprecated. Please see
[Microsoft Windows Text Services Framework](/en-us/windows/win32/tsf/text-services-framework) for more information on advanced text input and natural language technologies.
## Syntax
diff --git a/docs/functions/SetWinEventHook.md b/docs/functions/SetWinEventHook.md
index 0100f22..93a79df 100644
--- a/docs/functions/SetWinEventHook.md
+++ b/docs/functions/SetWinEventHook.md
@@ -141,18 +141,18 @@ void ShutdownMSAA()
// Callback function that handles events.
//
-void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
- LONG idObject, LONG idChild,
+void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
+ LONG idObject, LONG idChild,
DWORD dwEventThread, DWORD dwmsEventTime)
{
IAccessible* pAcc = NULL;
VARIANT varChild;
- HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
+ HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
if ((hr == S_OK) && (pAcc != NULL))
{
BSTR bstrName;
pAcc->get_accName(varChild, &bstrName);
- if (event == EVENT_SYSTEM_MENUSTART)
+ if (event == EVENT_SYSTEM_MENUSTART)
{
printf("Begin: ");
}
diff --git a/docs/functions/UiaHostProviderFromHwnd.md b/docs/functions/UiaHostProviderFromHwnd.md
index 949e0f8..8835073 100644
--- a/docs/functions/UiaHostProviderFromHwnd.md
+++ b/docs/functions/UiaHostProviderFromHwnd.md
@@ -47,7 +47,7 @@ this provider.
```
HRESULT STDMETHODCALLTYPE Provider::get_HostRawElementProvider(IRawElementProviderSimple** pRetVal)
{
- return UiaHostProviderFromHwnd(controlHWnd, pRetVal);
+ return UiaHostProviderFromHwnd(controlHWnd, pRetVal);
}
```
diff --git a/docs/functions/accDoDefaultAction.md b/docs/functions/accDoDefaultAction.md
index c8245e2..1d0eaec 100644
--- a/docs/functions/accDoDefaultAction.md
+++ b/docs/functions/accDoDefaultAction.md
@@ -48,11 +48,11 @@ Also, while **accDoDefaultAction** is supposed to return immediately, some imple
The following example shows a possible implementation for a custom list control whose default action is a double-click a child item. To prevent blocking, the method posts a custom message that, when received by the control window, triggers an action, such as displaying item properties.
```
-// Assume a previous definition such as this:
-// #define CUSTOMLB_DEFERDOUBLECLICK (WM_USER + 1)
+// Assume a previous definition such as this:
+// #define CUSTOMLB_DEFERDOUBLECLICK (WM_USER + 1)
-HRESULT STDMETHODCALLTYPE AccServer::accDoDefaultAction(
- VARIANT varChild)
+HRESULT STDMETHODCALLTYPE AccServer::accDoDefaultAction(
+ VARIANT varChild)
{
if (varChild.vt != VT_I4)
{
@@ -60,7 +60,7 @@ HRESULT STDMETHODCALLTYPE AccServer::accDoDefaultAction(
}
if (varChild.lVal != CHILDID_SELF)
{
- // It is assumed that the control does its own checking to see which
+ // It is assumed that the control does its own checking to see which
// item has the focus when it receives this message.
PostMessage(m_hwnd, CUSTOMLB_DEFERDOUBLECLICK, 0, 0);
}
diff --git a/docs/functions/accHitTest.md b/docs/functions/accHitTest.md
index 94d0459..19be142 100644
--- a/docs/functions/accHitTest.md
+++ b/docs/functions/accHitTest.md
@@ -74,36 +74,36 @@ When this method is used in certain situations, additional usage notes apply. Fo
The following example code shows a possible implementation for a custom list box.
```
-// m_pControl is the control that returns this accessible object.
-// m_hwnd is the HWND of the control window.
-//
-HRESULT STDMETHODCALLTYPE AccServer::accHitTest(
+// m_pControl is the control that returns this accessible object.
+// m_hwnd is the HWND of the control window.
+//
+HRESULT STDMETHODCALLTYPE AccServer::accHitTest(
long xLeft,
long yTop,
- VARIANT *pvarChild)
+ VARIANT *pvarChild)
{
POINT pt;
pt.x = xLeft;
pt.y = yTop;
- // Not in our window.
+ // Not in our window.
if (WindowFromPoint(pt) != m_hwnd)
{
pvarChild->vt = VT_EMPTY;
return S_FALSE;
}
- else // In our window; return list item, or self if in blank space.
+ else // In our window; return list item, or self if in blank space.
{
pvarChild->vt = VT_I4;
ScreenToClient(m_hwnd, &pt);
- // IndexFromY returns the 0-based index of the item at that point,
+ // IndexFromY returns the 0-based index of the item at that point,
// or -1 if the point is not on any item.
int index = m_pControl->IndexFromY(pt.y);
if (index >= 0)
{
- // Increment, because the child array is 1-based.
+ // Increment, because the child array is 1-based.
pvarChild->lVal = index + 1;
}
else
@@ -129,7 +129,7 @@ HRESULT SelectItemAtPoint(IAccessible* pAcc, POINT point)
}
VARIANT varChild;
- HRESULT hr = pAcc->accHitTest(point.x, point.y, &varChild);
+ HRESULT hr = pAcc->accHitTest(point.x, point.y, &varChild);
if ((hr == S_OK) && (varChild.lVal != CHILDID_SELF))
{
return pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varChild);
diff --git a/docs/functions/accLocation.md b/docs/functions/accLocation.md
index f0dd879..c80e990 100644
--- a/docs/functions/accLocation.md
+++ b/docs/functions/accLocation.md
@@ -74,11 +74,11 @@ This method retrieves the object's bounding rectangle. If the object has a non-r
The following example shows a possible implementation of the method for a custom list box whose list items are child elements. For the list box itself, the call is passed to the standard accessible object, which returns the screen coordinates of the window.
```
-// m_pStdAccessibleObject is the standard accessible object for the control window.
-// m_pControl is the object that represents the control. Its GetItemRect method
-// retrieves the screen coordinates of the specified item in a zero-based collection.
-//
-HRESULT STDMETHODCALLTYPE AccServer::accLocation(
+// m_pStdAccessibleObject is the standard accessible object for the control window.
+// m_pControl is the object that represents the control. Its GetItemRect method
+// retrieves the screen coordinates of the specified item in a zero-based collection.
+//
+HRESULT STDMETHODCALLTYPE AccServer::accLocation(
long *pxLeft,
long *pyTop,
long *pcxWidth,
@@ -110,7 +110,7 @@ HRESULT STDMETHODCALLTYPE AccServer::accLocation(
*pyTop = rect.top;
*pcxWidth = rect.right - rect.left;
*pcyHeight = rect.bottom - rect.top;
- return S_OK;
+ return S_OK;
}
}
};
diff --git a/docs/functions/accNavigate.md b/docs/functions/accNavigate.md
index 8846a07..c47479e 100644
--- a/docs/functions/accNavigate.md
+++ b/docs/functions/accNavigate.md
@@ -105,16 +105,16 @@ For more information, see [Object Navigation Properties and Methods](/en-us/wind
The following example shows a possible implementation of the method for a custom list box whose list items are child elements.
```
-// m_pControl is the control that returns this accessible object.
-// m_pStdAccessibleObject is the standard accessible object for the window
-// that contains the control.
+// m_pControl is the control that returns this accessible object.
+// m_pStdAccessibleObject is the standard accessible object for the window
+// that contains the control.
-HRESULT STDMETHODCALLTYPE AccServer::accNavigate(
+HRESULT STDMETHODCALLTYPE AccServer::accNavigate(
long navDir,
VARIANT varStart,
VARIANT *pvarEndUpAt)
{
- // Default value.
+ // Default value.
pvarEndUpAt->vt = VT_EMPTY;
if (varStart.vt != VT_I4)
@@ -130,7 +130,7 @@ HRESULT STDMETHODCALLTYPE AccServer::accNavigate(
pvarEndUpAt->vt = VT_I4;
pvarEndUpAt->lVal = 1;
}
- else // Starting with child.
+ else // Starting with child.
{
return S_FALSE;
}
@@ -142,26 +142,26 @@ HRESULT STDMETHODCALLTYPE AccServer::accNavigate(
pvarEndUpAt->vt = VT_I4;
pvarEndUpAt->lVal = m_pControl->GetCount();
}
- else // Starting with child.
+ else // Starting with child.
{
return S_FALSE;
}
break;
- case NAVDIR_NEXT:
+ case NAVDIR_NEXT:
case NAVDIR_DOWN:
if (varStart.lVal != CHILDID_SELF)
{
pvarEndUpAt->vt = VT_I4;
pvarEndUpAt->lVal = varStart.lVal + 1;
- // Out of range.
+ // Out of range.
if (pvarEndUpAt->lVal > m_pControl->GetCount())
{
pvarEndUpAt->vt = VT_EMPTY;
return S_FALSE;
}
}
- else // Call through to method on standard object.
+ else // Call through to method on standard object.
{
return m_pStdAccessibleObject->accNavigate(navDir, varStart, pvarEndUpAt);
}
@@ -173,27 +173,27 @@ HRESULT STDMETHODCALLTYPE AccServer::accNavigate(
{
pvarEndUpAt->vt = VT_I4;
pvarEndUpAt->lVal = varStart.lVal - 1;
- // Out of range.
+ // Out of range.
if (pvarEndUpAt->lVal <1)
{
pvarEndUpAt->vt = VT_EMPTY;
return S_FALSE;
}
}
- else // Call through to method on standard object.
+ else // Call through to method on standard object.
{
return m_pStdAccessibleObject->accNavigate(navDir, varStart, pvarEndUpAt);
}
break;
- // Unsupported directions.
+ // Unsupported directions.
case NAVDIR_LEFT:
case NAVDIR_RIGHT:
if (varStart.lVal == CHILDID_SELF)
{
return m_pStdAccessibleObject->accNavigate(navDir, varStart, pvarEndUpAt);
}
- else
+ else
{
pvarEndUpAt->vt = VT_EMPTY;
return S_FALSE;
diff --git a/docs/functions/get_DropTargetEffect.md b/docs/functions/get_DropTargetEffect.md
index c80bdf1..5d10654 100644
--- a/docs/functions/get_DropTargetEffect.md
+++ b/docs/functions/get_DropTargetEffect.md
@@ -36,7 +36,7 @@ If this property changes, the provider must notify clients by firing a [UIA\_Aut
IFACEMETHODIMP CRegionProvider::get_DropTargetEffect(BSTR * pDefaultDropAction)
{
WCHAR wszDropAction[100];
- LoadString(g_hInstance, IDS_REGION_DEFAULTDROPACTION1, wszDropAction,
+ LoadString(g_hInstance, IDS_REGION_DEFAULTDROPACTION1, wszDropAction,
ARRAYSIZE(wszDropAction));
*pDefaultDropAction = ::SysAllocString(wszDropAction);
return (*pDefaultDropAction == nullptr) ? E_OUTOFMEMORY : S_OK;
diff --git a/docs/functions/get_HostRawElementProvider.md b/docs/functions/get_HostRawElementProvider.md
index 73f014b..3b4ff0d 100644
--- a/docs/functions/get_HostRawElementProvider.md
+++ b/docs/functions/get_HostRawElementProvider.md
@@ -42,7 +42,7 @@ this provider.
```
HRESULT STDMETHODCALLTYPE Provider::get_HostRawElementProvider(IRawElementProviderSimple** pRetVal)
{
- return UiaHostProviderFromHwnd(controlHWnd, pRetVal);
+ return UiaHostProviderFromHwnd(controlHWnd, pRetVal);
}
```
diff --git a/docs/functions/get_ToggleState.md b/docs/functions/get_ToggleState.md
index 2817a5d..b6f75a3 100644
--- a/docs/functions/get_ToggleState.md
+++ b/docs/functions/get_ToggleState.md
@@ -26,7 +26,7 @@ None
## Remarks
-A control must cycle through its [ToggleState](/en-us/windows/desktop/api/uiautomationcore/ne-uiautomationcore-togglestate) in this order:
+A control must cycle through its [ToggleState](/en-us/windows/desktop/api/uiautomationcore/ne-uiautomationcore-togglestate) in this order:
**ToggleState\_On**, **ToggleState\_Off**
and, if supported, **ToggleState\_Indeterminate**.
diff --git a/docs/functions/get_accChild.md b/docs/functions/get_accChild.md
index 0c25f20..b902bd5 100644
--- a/docs/functions/get_accChild.md
+++ b/docs/functions/get_accChild.md
@@ -53,7 +53,7 @@ Servers expose elements as either elements (child IDs) or full objects ([IAccess
The following example code shows an implementation for an object that does not have any children, or whose children are elements rather than objects.
```
-HRESULT STDMETHODCALLTYPE AccServer::get_accChild(
+HRESULT STDMETHODCALLTYPE AccServer::get_accChild(
VARIANT varChild,
IDispatch **ppdispChild)
{
@@ -62,8 +62,8 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accChild(
*ppdispChild = NULL;
return E_INVALIDARG;
}
- *ppdispChild = NULL;
- return S_FALSE;
+ *ppdispChild = NULL;
+ return S_FALSE;
};
```
diff --git a/docs/functions/get_accDefaultAction.md b/docs/functions/get_accDefaultAction.md
index 1b13491..7307b3a 100644
--- a/docs/functions/get_accDefaultAction.md
+++ b/docs/functions/get_accDefaultAction.md
@@ -58,7 +58,7 @@ Only controls that perform actions support this method.
The following example code shows a possible implementation of this method for a custom list box. For simplicity, the strings are not localized.
```
-HRESULT STDMETHODCALLTYPE AccServer::get_accDefaultAction(
+HRESULT STDMETHODCALLTYPE AccServer::get_accDefaultAction(
VARIANT varChild,
BSTR *pszDefaultAction)
{
diff --git a/docs/functions/get_accDescription.md b/docs/functions/get_accDescription.md
index b9d9b74..4133366 100644
--- a/docs/functions/get_accDescription.md
+++ b/docs/functions/get_accDescription.md
@@ -59,7 +59,7 @@ This property provides a textual equivalent of the object for the user. The desc
The following example code shows one possible implementation of this method for a custom list box that maintains its own child elements. The example demonstrates the syntax, but remember that a real text-only list box would probably not need to support this property. For simplicity, the strings in the example are not localized.
```
-HRESULT STDMETHODCALLTYPE AccServer::get_accDescription(
+HRESULT STDMETHODCALLTYPE AccServer::get_accDescription(
VARIANT varChild,
BSTR *pszDescription)
{
@@ -70,13 +70,13 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accDescription(
}
if (varChild.lVal == CHILDID_SELF)
{
- *pszDescription = SysAllocString(L"List of contacts.");
-
+ *pszDescription = SysAllocString(L"List of contacts.");
+
}
else
{
- *pszDescription = SysAllocString(L"A contact.");
-
+ *pszDescription = SysAllocString(L"A contact.");
+
}
return S_OK;
};
diff --git a/docs/functions/get_accFocus.md b/docs/functions/get_accFocus.md
index eec74f1..0f52325 100644
--- a/docs/functions/get_accFocus.md
+++ b/docs/functions/get_accFocus.md
@@ -57,14 +57,14 @@ As with other [IAccessible](/en-us/windows/desktop/api/oleacc/nn-oleacc-iaccessi
The following example code shows a possible implementation of this method for a custom single-selection list box. If the control does not have the focus, VT\_EMPTY is returned in the variant by the standard accessible object for the HWND. If the control does have the focus, and an item is selected, the child ID of that item is returned; if there is no selection, CHILDID\_SELF is returned.
```
-// m_pControl is the control object that is served by this implementation.
-// m_pStdAccessibleObject is the object returned by CreateStdAccessibleObject.
+// m_pControl is the control object that is served by this implementation.
+// m_pStdAccessibleObject is the object returned by CreateStdAccessibleObject.
HRESULT STDMETHODCALLTYPE AccServer::get_accFocus(VARIANT *pvarChild)
{
- FAIL_IF_NO_CONTROL; // Macro that checks for existence of control.
+ FAIL_IF_NO_CONTROL; // Macro that checks for existence of control.
- HRESULT hr = m_pStdAccessibleObject->get_accFocus(pvarChild);
+ HRESULT hr = m_pStdAccessibleObject->get_accFocus(pvarChild);
if (pvarChild->vt != VT_I4)
{
return hr;
@@ -78,7 +78,7 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accFocus(VARIANT *pvarChild)
}
else
{
- // Convert to 1-based index for child ID.
+ // Convert to 1-based index for child ID.
pvarChild->lVal = index + 1;
}
}
diff --git a/docs/functions/get_accHelp.md b/docs/functions/get_accHelp.md
index e43bbb5..9160953 100644
--- a/docs/functions/get_accHelp.md
+++ b/docs/functions/get_accHelp.md
@@ -56,10 +56,10 @@ This property returns a string, whereas [IAccessible::get\_accHelpTopic](/en-us/
The following example code shows one possible implementation of this method for a custom list box. Different text is displayed depending on the status of the contact in the list. For simplicity, the example does not localize the returned string.
```
-// m_pControl is the custom control that returns this accessible object.
-// 'online' is an enumerated value.
+// m_pControl is the custom control that returns this accessible object.
+// 'online' is an enumerated value.
-HRESULT STDMETHODCALLTYPE AccServer::get_accHelp(
+HRESULT STDMETHODCALLTYPE AccServer::get_accHelp(
VARIANT varChild,
BSTR *pszHelp)
{
@@ -84,7 +84,7 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accHelp(
{
*pszHelp = SysAllocString(L"Online contact.");
}
- else
+ else
{
*pszHelp = SysAllocString(L"Offline contact.");
}
diff --git a/docs/functions/get_accName.md b/docs/functions/get_accName.md
index b695232..0ba7f00 100644
--- a/docs/functions/get_accName.md
+++ b/docs/functions/get_accName.md
@@ -55,11 +55,11 @@ Localize the string returned from this property.
The following example shows a possible implementation of this method for a custom list box control that manages its own child elements.
```
-// m_pStdAccessibleObject is the standard object returned by CreateStdAccessibleObject.
+// m_pStdAccessibleObject is the standard object returned by CreateStdAccessibleObject.
// m_pControl is the control object that provides this accessibility object. It maintains
-// a zero-based collection of child items.
+// a zero-based collection of child items.
-HRESULT STDMETHODCALLTYPE AccServer::get_accName(
+HRESULT STDMETHODCALLTYPE AccServer::get_accName(
VARIANT varChild,
BSTR *pszName)
{
@@ -68,22 +68,22 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accName(
*pszName = NULL;
return E_INVALIDARG;
}
- // For the control itself, let the standard accessible object return the name
- // assigned by the application. This is either the "caption" property or, if
- // there is no caption, the text of any label.
+ // For the control itself, let the standard accessible object return the name
+ // assigned by the application. This is either the "caption" property or, if
+ // there is no caption, the text of any label.
if (varChild.lVal == CHILDID_SELF)
{
- return m_pStdAccessibleObject->get_accName(varChild, pszName);
+ return m_pStdAccessibleObject->get_accName(varChild, pszName);
}
-
- // Else return the name of the item in the list.
+
+ // Else return the name of the item in the list.
else
{
CustomListControlItem* pItem = m_pControl->GetItemAt(varChild.lVal - 1);
if (pItem)
{
- *pszName = SysAllocString(pItem->GetName());
-
+ *pszName = SysAllocString(pItem->GetName());
+
}
}
return S_OK;
diff --git a/docs/functions/get_accRole.md b/docs/functions/get_accRole.md
index 9893700..4cb659b 100644
--- a/docs/functions/get_accRole.md
+++ b/docs/functions/get_accRole.md
@@ -52,7 +52,7 @@ Clients call [GetRoleText](/en-us/windows/desktop/api/oleacc/nf-oleacc-getrolete
The following example code is a possible implementation of this method for a custom list box that maintains its own list items.
```
-HRESULT STDMETHODCALLTYPE AccServer::get_accRole(
+HRESULT STDMETHODCALLTYPE AccServer::get_accRole(
VARIANT varChild,
VARIANT *pvarRole)
{
@@ -86,7 +86,7 @@ HRESULT PrintRole(IAccessible* pAcc, long childId)
DWORD roleId;
if (pAcc == NULL)
{
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
VARIANT varChild;
varChild.vt = VT_I4;
@@ -99,26 +99,26 @@ HRESULT PrintRole(IAccessible* pAcc, long childId)
UINT roleLength;
LPTSTR lpszRoleString;
- // Get the length of the string.
+ // Get the length of the string.
roleLength = GetRoleText(roleId, NULL, 0);
- // Allocate memory for the string. Add one character to
- // the length you got in the previous call to make room
- // for the null character.
+ // Allocate memory for the string. Add one character to
+ // the length you got in the previous call to make room
+ // for the null character.
lpszRoleString = (LPTSTR)malloc((roleLength+1) * sizeof(TCHAR));
if (lpszRoleString != NULL)
{
- // Get the string.
+ // Get the string.
GetRoleText(roleId, lpszRoleString, roleLength + 1);
#ifdef UNICODE
printf("Role: %S\n", lpszRoleString);
#else
printf(("Role: %s\n", lpszRoleString);
#endif
- // Free the allocated memory
+ // Free the allocated memory
free(lpszRoleString);
}
- else
+ else
{
return E_OUTOFMEMORY;
}
diff --git a/docs/functions/get_accSelection.md b/docs/functions/get_accSelection.md
index de15944..aad0682 100644
--- a/docs/functions/get_accSelection.md
+++ b/docs/functions/get_accSelection.md
@@ -56,16 +56,16 @@ As with other [IAccessible](/en-us/windows/desktop/api/oleacc/nn-oleacc-iaccessi
The following example code shows a possible implementation of this method for a custom single-selection list box. Its **GetSelectedIndex** method returns -1 if no item is selected.
```
-// m_pControl is the control that returns this accessible object.
+// m_pControl is the control that returns this accessible object.
HRESULT STDMETHODCALLTYPE AccServer::get_accSelection(VARIANT *pvarChildren)
{
- int childID = m_pControl->GetSelectedIndex() + 1; // Convert from 0-based.
+ int childID = m_pControl->GetSelectedIndex() + 1; // Convert from 0-based.
if (childID <= 0)
{
pvarChildren->vt = VT_EMPTY;
}
- else
+ else
{
pvarChildren->vt = VT_I4;
pvarChildren->lVal = childID;
diff --git a/docs/functions/get_accState.md b/docs/functions/get_accState.md
index 302d86b..b1d00a0 100644
--- a/docs/functions/get_accState.md
+++ b/docs/functions/get_accState.md
@@ -54,10 +54,10 @@ The actual state of a child often depends on the state of its ancestors. For exa
The following example code shows a possible implementation of this method for a custom list box that maintains its own child elements (list items), only one of which can be selected at a time. If the client requests the state of the list box itself, the method passes the call to the standard accessible object that serves the control window. For child items, different flags are returned depending on whether the item is selected or not.
```
-// m_pStdAccessibleObject is the standard accessible object returned by CreateAccessibleObject.
-// m_pControl is the custom control instance that returns this accessible object.
+// m_pStdAccessibleObject is the standard accessible object returned by CreateAccessibleObject.
+// m_pControl is the custom control instance that returns this accessible object.
-HRESULT STDMETHODCALLTYPE AccServer::get_accState(
+HRESULT STDMETHODCALLTYPE AccServer::get_accState(
VARIANT varChild,
VARIANT *pvarState)
{
@@ -70,7 +70,7 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accState(
{
return m_pStdAccessibleObject->get_accState(varChild, pvarState);
}
- else // For list items.
+ else // For list items.
{
DWORD flags = STATE_SYSTEM_SELECTABLE;
int index = (int)varChild.lVal - 1;
@@ -79,7 +79,7 @@ HRESULT STDMETHODCALLTYPE AccServer::get_accState(
flags |= STATE_SYSTEM_SELECTED;
}
pvarState->vt = VT_I4;
- pvarState->lVal = flags;
+ pvarState->lVal = flags;
}
return S_OK;
};
@@ -94,7 +94,7 @@ HRESULT PrintState(IAccessible* pAcc, long childId)
{
if (pAcc == NULL)
{
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
VARIANT varChild;
varChild.vt = VT_I4;
@@ -111,19 +111,19 @@ HRESULT PrintState(IAccessible* pAcc, long childId)
if (mask & stateBits)
{
- // Get the length of the string.
+ // Get the length of the string.
UINT stateLength = GetStateText(mask, NULL, 0);
- // Allocate memory for the string. Add one character to
- // the length you got in the previous call to make room
- // for the null character.
+ // Allocate memory for the string. Add one character to
+ // the length you got in the previous call to make room
+ // for the null character.
LPTSTR lpszStateString = (LPTSTR)malloc(
(stateLength + 1) * sizeof(TCHAR));
if (lpszStateString != NULL)
{
- // Get the string.
- GetStateText(mask,
- lpszStateString, stateLength + 1);
+ // Get the string.
+ GetStateText(mask,
+ lpszStateString, stateLength + 1);
#ifdef UNICODE
printf("%S\n", lpszStateString);
#else
@@ -132,7 +132,7 @@ HRESULT PrintState(IAccessible* pAcc, long childId)
// Free the allocated memory
free(lpszStateString);
}
- else
+ else
{
return E_OUTOFMEMORY;
}
diff --git a/docs/interfaces/IUIAutomation.md b/docs/interfaces/IUIAutomation.md
index d303cff..e139909 100644
--- a/docs/interfaces/IUIAutomation.md
+++ b/docs/interfaces/IUIAutomation.md
@@ -84,7 +84,7 @@ IUIAutomation *g_pAutomation;
BOOL InitializeUIAutomation()
{
CoInitialize(NULL);
- HRESULT hr = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER,
+ HRESULT hr = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER,
__uuidof(IUIAutomation), (void**)&g_pAutomation);
return (SUCCEEDED(hr));
}
diff --git a/docs/structures/MSAAMENUINFO.md b/docs/structures/MSAAMENUINFO.md
index c3f5b27..203c8d4 100644
--- a/docs/structures/MSAAMENUINFO.md
+++ b/docs/structures/MSAAMENUINFO.md
@@ -49,9 +49,9 @@ The **MSAAMENUINFO** structure cannot be a member in a class that contains virtu
The following code fragment shows the declaration of an application-specific owner-drawn menu information structure that includes **MSAAMENUINFO**:
```
-// Application-specific owner-drawn menu info struct. Owner-drawn data
-// is a pointer to one of these. MSAAMENUINFO must be the first
-// member.
+// Application-specific owner-drawn menu info struct. Owner-drawn data
+// is a pointer to one of these. MSAAMENUINFO must be the first
+// member.
struct MenuEntry
{
MSAAMENUINFO m_MSAA; // MSAA info - must be first element.
diff --git a/tests/unit/agent/test_agent_utils.py b/tests/unit/agent/test_agent_utils.py
index f434a5e..6128cb6 100644
--- a/tests/unit/agent/test_agent_utils.py
+++ b/tests/unit/agent/test_agent_utils.py
@@ -7,7 +7,6 @@ import pytest
try:
from windows_use.agent.utils import json_parser, read_file
-
from windows_use.agent.views import Action, AgentData # noqa: F401
from windows_use.messages import AIMessage
diff --git a/tests/unit/test_llm_events.py b/tests/unit/test_llm_events.py
index d2d81fe..80ff14c 100644
--- a/tests/unit/test_llm_events.py
+++ b/tests/unit/test_llm_events.py
@@ -6,8 +6,9 @@ from windows_use.providers.openai.llm import ChatOpenAI
def make_provider(model: str) -> ChatOpenAI:
- with patch("windows_use.providers.openai.llm.OpenAI"), patch(
- "windows_use.providers.openai.llm.AsyncOpenAI"
+ with (
+ patch("windows_use.providers.openai.llm.OpenAI"),
+ patch("windows_use.providers.openai.llm.AsyncOpenAI"),
):
return ChatOpenAI(model=model, api_key="test-key")
diff --git a/tests/unit/test_openai_events.py b/tests/unit/test_openai_events.py
index 0127087..a95a652 100644
--- a/tests/unit/test_openai_events.py
+++ b/tests/unit/test_openai_events.py
@@ -11,8 +11,9 @@ from windows_use.tools import Tool
def make_llm(**kwargs) -> ChatOpenAI:
- with patch("windows_use.providers.openai.llm.OpenAI"), patch(
- "windows_use.providers.openai.llm.AsyncOpenAI"
+ with (
+ patch("windows_use.providers.openai.llm.OpenAI"),
+ patch("windows_use.providers.openai.llm.AsyncOpenAI"),
):
return ChatOpenAI(api_key="test-key", **kwargs)
diff --git a/windows_use/agent/context/prompt/compact.md b/windows_use/agent/context/prompt/compact.md
index 1d66ebe..b8e3ebe 100644
--- a/windows_use/agent/context/prompt/compact.md
+++ b/windows_use/agent/context/prompt/compact.md
@@ -50,4 +50,4 @@ IMPORTANT: Structure your response EXACTLY as follows:
- Known element identifiers or locations
- Any credentials or sensitive data entered (for reuse if needed)]
-Be concise but complete—this replaces all prior conversation history. Include only what's necessary to continue effectively.
\ No newline at end of file
+Be concise but complete—this replaces all prior conversation history. Include only what's necessary to continue effectively.
diff --git a/windows_use/agent/context/prompt/state.md b/windows_use/agent/context/prompt/state.md
index 72c9774..31f06ec 100644
--- a/windows_use/agent/context/prompt/state.md
+++ b/windows_use/agent/context/prompt/state.md
@@ -4,16 +4,16 @@
{loop_warning}
[Begin of Desktop]
Active Desktop: {active_desktop}
-
+
Cursor Location: {cursor_location}
-
+
[Begin of Window Info]
Foreground Window: {active_window}
-
+
Background Windows:
{windows}
[End of Window Info]
-
+
[Begin of Screen]
List of Interactive Elements:
{interactive_elements}
@@ -21,7 +21,7 @@
List of Scrollable Elements:
{scrollable_elements}
[End of Screen]
-
+
[Begin of Virtual Desktops]
Virtual Desktops:
{desktops}
diff --git a/windows_use/agent/desktop/service.py b/windows_use/agent/desktop/service.py
index de0613b..f3724fd 100644
--- a/windows_use/agent/desktop/service.py
+++ b/windows_use/agent/desktop/service.py
@@ -610,7 +610,7 @@ class Desktop:
if self.is_overlay_window(child):
continue
- if isinstance(child, (uia.WindowControl, uia.PaneControl)):
+ if isinstance(child, uia.WindowControl | uia.PaneControl):
window_pattern = child.GetPattern(uia.PatternId.WindowPattern)
if window_pattern is None:
continue
diff --git a/windows_use/agent/tree/service.py b/windows_use/agent/tree/service.py
index 9df9756..ef65191 100644
--- a/windows_use/agent/tree/service.py
+++ b/windows_use/agent/tree/service.py
@@ -566,7 +566,7 @@ class Tree:
except Exception:
pass
- if isinstance(node, (ButtonControl, CheckBoxControl)):
+ if isinstance(node, ButtonControl | CheckBoxControl):
try:
toggle_state = node.GetCachedPropertyValue(
PropertyId.ToggleToggleStateProperty