robotframework-platynui 0.9.2__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PlatynUI/__about__.py +5 -0
- PlatynUI/__init__.py +178 -0
- PlatynUI/core/__init__.py +17 -0
- PlatynUI/core/adapter.py +156 -0
- PlatynUI/core/adapterfactory.py +62 -0
- PlatynUI/core/adapterproxy.py +170 -0
- PlatynUI/core/contextbase.py +473 -0
- PlatynUI/core/ensure.py +155 -0
- PlatynUI/core/exceptions.py +81 -0
- PlatynUI/core/internal/__init__.py +0 -0
- PlatynUI/core/internal/decorator.py +152 -0
- PlatynUI/core/locatorbase.py +199 -0
- PlatynUI/core/locatorscope.py +21 -0
- PlatynUI/core/predicate.py +19 -0
- PlatynUI/core/settings.py +66 -0
- PlatynUI/core/strategies/__init__.py +5 -0
- PlatynUI/core/strategies/strategies.py +30 -0
- PlatynUI/core/strategybase.py +12 -0
- PlatynUI/core/strategyimpl.py +104 -0
- PlatynUI/core/technology.py +29 -0
- PlatynUI/core/types.py +425 -0
- PlatynUI/core/wait_for.py +51 -0
- PlatynUI/core/weight_calculator.py +114 -0
- PlatynUI/keywords/__init__.py +25 -0
- PlatynUI/keywords/activatable.py +27 -0
- PlatynUI/keywords/application.py +22 -0
- PlatynUI/keywords/assertable.py +11 -0
- PlatynUI/keywords/keyboard.py +26 -0
- PlatynUI/keywords/mouse.py +85 -0
- PlatynUI/keywords/properties.py +30 -0
- PlatynUI/keywords/text.py +21 -0
- PlatynUI/keywords/types.py +104 -0
- PlatynUI/keywords/wait.py +22 -0
- PlatynUI/py.typed +0 -0
- PlatynUI/robot/__init__.py +0 -0
- PlatynUI/robot/reporting.py +73 -0
- PlatynUI/spy/__init__.py +0 -0
- PlatynUI/spy/__main__.py +40 -0
- PlatynUI/technology/__init__.py +0 -0
- PlatynUI/technology/uiautomation/.gitignore +5 -0
- PlatynUI/technology/uiautomation/__init__.py +8 -0
- PlatynUI/technology/uiautomation/core/adapterfactory.py +91 -0
- PlatynUI/technology/uiautomation/core/displaydevice.py +27 -0
- PlatynUI/technology/uiautomation/core/impls/__init__.py +6 -0
- PlatynUI/technology/uiautomation/core/impls/control.py +35 -0
- PlatynUI/technology/uiautomation/core/impls/window.py +87 -0
- PlatynUI/technology/uiautomation/core/keyboarddevice.py +25 -0
- PlatynUI/technology/uiautomation/core/loader.py +146 -0
- PlatynUI/technology/uiautomation/core/mousedevice.py +33 -0
- PlatynUI/technology/uiautomation/core/technology.py +65 -0
- PlatynUI/technology/uiautomation/core/uiaadapter.py +199 -0
- PlatynUI/technology/uiautomation/core/uiabase.py +23 -0
- PlatynUI/technology/uiautomation/desktop.py +15 -0
- PlatynUI/technology/uiautomation/locator.py +433 -0
- PlatynUI/technology/uiautomation/spy/__init__.py +0 -0
- PlatynUI/technology/uiautomation/spy/__main__.py +50 -0
- PlatynUI/ui/__init__.py +80 -0
- PlatynUI/ui/application.py +31 -0
- PlatynUI/ui/buttons.py +96 -0
- PlatynUI/ui/combobox.py +158 -0
- PlatynUI/ui/container.py +13 -0
- PlatynUI/ui/control.py +53 -0
- PlatynUI/ui/core/__init__.py +7 -0
- PlatynUI/ui/core/devices/__init__.py +10 -0
- PlatynUI/ui/core/devices/basedisplaydevice.py +29 -0
- PlatynUI/ui/core/devices/basekeyboarddevice.py +68 -0
- PlatynUI/ui/core/devices/basemousedevice.py +34 -0
- PlatynUI/ui/core/devices/basescreendevice.py +20 -0
- PlatynUI/ui/core/devices/displaydevice.py +117 -0
- PlatynUI/ui/core/devices/inputdevice.py +28 -0
- PlatynUI/ui/core/devices/keyboarddevice.py +351 -0
- PlatynUI/ui/core/devices/keyboardproxy.py +73 -0
- PlatynUI/ui/core/devices/mousebutton.py +15 -0
- PlatynUI/ui/core/devices/mousedevice.py +278 -0
- PlatynUI/ui/core/devices/mouseproxy.py +186 -0
- PlatynUI/ui/core/ui_technology.py +35 -0
- PlatynUI/ui/core/window_manager.py +62 -0
- PlatynUI/ui/data_item.py +16 -0
- PlatynUI/ui/desktop.py +15 -0
- PlatynUI/ui/desktopbase.py +60 -0
- PlatynUI/ui/dialog.py +14 -0
- PlatynUI/ui/edit.py +13 -0
- PlatynUI/ui/element.py +270 -0
- PlatynUI/ui/graphic.py +18 -0
- PlatynUI/ui/header.py +36 -0
- PlatynUI/ui/item.py +107 -0
- PlatynUI/ui/label.py +22 -0
- PlatynUI/ui/lists.py +40 -0
- PlatynUI/ui/locator.py +433 -0
- PlatynUI/ui/menus.py +45 -0
- PlatynUI/ui/orientation.py +13 -0
- PlatynUI/ui/pane.py +18 -0
- PlatynUI/ui/proxies/__init__.py +8 -0
- PlatynUI/ui/proxies/standardproxies.py +408 -0
- PlatynUI/ui/runtime/.gitignore +7 -0
- PlatynUI/ui/runtime/__init__.py +3 -0
- PlatynUI/ui/runtime/adapter_impl.py +228 -0
- PlatynUI/ui/runtime/adapter_impl_base.py +25 -0
- PlatynUI/ui/runtime/adapterfactory_impl.py +119 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Base.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Controls.ColorPicker.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Controls.DataGrid.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Controls.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.DesignerSupport.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Desktop.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Dialogs.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Fonts.Inter.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.FreeDesktop.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Markup.Xaml.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Markup.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Metal.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.MicroCom.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Native.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.OpenGL.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.ReactiveUI.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Remote.Protocol.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Skia.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Themes.Fluent.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Themes.Simple.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Vulkan.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Win32.Automation.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.Win32.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.X11.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Avalonia.dll +0 -0
- PlatynUI/ui/runtime/coreclr/DynamicData.dll +0 -0
- PlatynUI/ui/runtime/coreclr/FluentAvalonia.dll +0 -0
- PlatynUI/ui/runtime/coreclr/HarfBuzzSharp.dll +0 -0
- PlatynUI/ui/runtime/coreclr/MessagePack.Annotations.dll +0 -0
- PlatynUI/ui/runtime/coreclr/MessagePack.dll +0 -0
- PlatynUI/ui/runtime/coreclr/MicroCom.Runtime.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Microsoft.NET.StringTools.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Microsoft.VisualStudio.Threading.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Microsoft.VisualStudio.Validation.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Nerdbank.Streams.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Newtonsoft.Json.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Extension.Provider.Client.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Extension.Win32.UiAutomation.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Platform.Win32.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Provider.Core.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Runtime.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Spy.deps.json +1045 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Spy.dll +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Spy.exe +0 -0
- PlatynUI/ui/runtime/coreclr/PlatynUI.Spy.runtimeconfig.json +15 -0
- PlatynUI/ui/runtime/coreclr/ReactiveUI.dll +0 -0
- PlatynUI/ui/runtime/coreclr/SkiaSharp.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Splat.dll +0 -0
- PlatynUI/ui/runtime/coreclr/StreamJsonRpc.dll +0 -0
- PlatynUI/ui/runtime/coreclr/System.CodeDom.dll +0 -0
- PlatynUI/ui/runtime/coreclr/System.ComponentModel.Composition.dll +0 -0
- PlatynUI/ui/runtime/coreclr/System.IO.Pipelines.dll +0 -0
- PlatynUI/ui/runtime/coreclr/System.Reactive.dll +0 -0
- PlatynUI/ui/runtime/coreclr/Tmds.DBus.Protocol.dll +0 -0
- PlatynUI/ui/runtime/coreclr/av_libglesv2.dll +0 -0
- PlatynUI/ui/runtime/coreclr/cs/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/cs/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/cs/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/de/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/de/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/de/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/es/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/es/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/es/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/fr/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/fr/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/fr/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/it/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/it/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/it/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ja/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ja/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ja/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ko/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ko/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ko/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/libHarfBuzzSharp.dll +0 -0
- PlatynUI/ui/runtime/coreclr/libSkiaSharp.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pl/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pl/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pl/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pt-BR/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pt-BR/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/pt-BR/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ru/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ru/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/ru/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/tr/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/tr/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/tr/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hans/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hans/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hant/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/coreclr/zh-Hant/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/display_device_impl.py +27 -0
- PlatynUI/ui/runtime/dotnet_interface.py +144 -0
- PlatynUI/ui/runtime/keyboard_device_impl.py +25 -0
- PlatynUI/ui/runtime/mouse_device_impl.py +33 -0
- PlatynUI/ui/runtime/providers/avalonia/MessagePack.Annotations.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/MessagePack.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Microsoft.NET.StringTools.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Microsoft.VisualStudio.Threading.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Microsoft.VisualStudio.Validation.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Nerdbank.Streams.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/Newtonsoft.Json.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/PlatynUI.Provider.Avalonia.deps.json +600 -0
- PlatynUI/ui/runtime/providers/avalonia/PlatynUI.Provider.Avalonia.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/PlatynUI.Provider.Core.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/PlatynUI.Provider.Server.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/StreamJsonRpc.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/System.IO.Pipelines.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/cs/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/cs/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/cs/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/de/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/de/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/de/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/es/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/es/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/es/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/fr/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/fr/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/fr/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/it/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/it/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/it/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ja/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ja/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ja/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ko/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ko/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ko/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pl/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pl/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pl/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pt-BR/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pt-BR/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/pt-BR/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ru/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ru/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/ru/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/tr/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/tr/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/tr/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hans/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hans/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hant/Microsoft.VisualStudio.Threading.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll +0 -0
- PlatynUI/ui/runtime/providers/avalonia/zh-Hant/StreamJsonRpc.resources.dll +0 -0
- PlatynUI/ui/runtime/technology_impl.py +63 -0
- PlatynUI/ui/scrollbar.py +13 -0
- PlatynUI/ui/strategies/__init__.py +24 -0
- PlatynUI/ui/strategies/activatable.py +31 -0
- PlatynUI/ui/strategies/application.py +32 -0
- PlatynUI/ui/strategies/closeable.py +26 -0
- PlatynUI/ui/strategies/control.py +20 -0
- PlatynUI/ui/strategies/devices.py +27 -0
- PlatynUI/ui/strategies/editable.py +17 -0
- PlatynUI/ui/strategies/element.py +69 -0
- PlatynUI/ui/strategies/expandable.py +31 -0
- PlatynUI/ui/strategies/hasnativewindowhandle.py +18 -0
- PlatynUI/ui/strategies/hasorientation.py +19 -0
- PlatynUI/ui/strategies/maximizeable.py +31 -0
- PlatynUI/ui/strategies/minimizeable.py +31 -0
- PlatynUI/ui/strategies/movable.py +18 -0
- PlatynUI/ui/strategies/resizable.py +17 -0
- PlatynUI/ui/strategies/restorable.py +17 -0
- PlatynUI/ui/strategies/selectable.py +31 -0
- PlatynUI/ui/strategies/text.py +59 -0
- PlatynUI/ui/strategies/title.py +18 -0
- PlatynUI/ui/strategies/toggleable.py +27 -0
- PlatynUI/ui/strategies/value.py +19 -0
- PlatynUI/ui/table.py +58 -0
- PlatynUI/ui/tabs.py +32 -0
- PlatynUI/ui/text.py +52 -0
- PlatynUI/ui/togglestate.py +16 -0
- PlatynUI/ui/tree.py +101 -0
- PlatynUI/ui/unknown.py +13 -0
- PlatynUI/ui/window.py +196 -0
- robotframework_platynui-0.9.2.dist-info/METADATA +192 -0
- robotframework_platynui-0.9.2.dist-info/RECORD +288 -0
- robotframework_platynui-0.9.2.dist-info/WHEEL +4 -0
- robotframework_platynui-0.9.2.dist-info/entry_points.txt +2 -0
- robotframework_platynui-0.9.2.dist-info/licenses/LICENSE.txt +73 -0
PlatynUI/__about__.py
ADDED
PlatynUI/__init__.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Daniel Biehl <daniel.biehl@imbus.de>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import inspect
|
|
6
|
+
from typing import Any, List, Optional, Tuple, Union
|
|
7
|
+
|
|
8
|
+
from assertionengine import AssertionOperator, verify_assertion
|
|
9
|
+
from robot.api.deco import library
|
|
10
|
+
from robotlibcore import DynamicCore, keyword
|
|
11
|
+
|
|
12
|
+
from .__about__ import __version__
|
|
13
|
+
from .keywords import (
|
|
14
|
+
ActivatableKeywords,
|
|
15
|
+
Application,
|
|
16
|
+
ElementDescriptor,
|
|
17
|
+
Keyboard,
|
|
18
|
+
Mouse,
|
|
19
|
+
Properties,
|
|
20
|
+
RootElementDescriptor,
|
|
21
|
+
TextKeywords,
|
|
22
|
+
Wait,
|
|
23
|
+
)
|
|
24
|
+
from .keywords.assertable import PLATYNUI_ASSERTABLE_FIELD
|
|
25
|
+
from .ui import Locator, strategies
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def convert_locator(value) -> Locator: # type: ignore
|
|
29
|
+
return Locator(path=value)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _get_args_index(args_list: List[Union[str, Tuple[str], Tuple[str, Any]]]) -> int:
|
|
33
|
+
return next(
|
|
34
|
+
(i for i, r in enumerate(args_list) if (isinstance(r, str) and r.startswith("*")) or r[0].startswith("**")),
|
|
35
|
+
len(args_list),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
_assertion_parameters = [
|
|
40
|
+
inspect.Parameter(
|
|
41
|
+
"assertion_operator",
|
|
42
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
43
|
+
annotation=Optional["AssertionOperator"],
|
|
44
|
+
default=None,
|
|
45
|
+
),
|
|
46
|
+
inspect.Parameter(
|
|
47
|
+
"assertion_expected",
|
|
48
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
49
|
+
annotation=Optional[Any],
|
|
50
|
+
default=None,
|
|
51
|
+
),
|
|
52
|
+
inspect.Parameter(
|
|
53
|
+
"assertion_message",
|
|
54
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
55
|
+
annotation=Optional[str],
|
|
56
|
+
default=None,
|
|
57
|
+
),
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _add_assertion_parameters(sig: inspect.Signature) -> inspect.Signature:
|
|
62
|
+
# Originale Parameter in Kategorien aufteilen
|
|
63
|
+
positional_only = []
|
|
64
|
+
positional_or_keyword = []
|
|
65
|
+
var_positional = None
|
|
66
|
+
keyword_only = []
|
|
67
|
+
var_keyword = None
|
|
68
|
+
|
|
69
|
+
for param in sig.parameters.values():
|
|
70
|
+
if param.kind == inspect.Parameter.POSITIONAL_ONLY:
|
|
71
|
+
positional_only.append(param)
|
|
72
|
+
elif param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
|
|
73
|
+
positional_or_keyword.append(param)
|
|
74
|
+
elif param.kind == inspect.Parameter.VAR_POSITIONAL:
|
|
75
|
+
var_positional = param
|
|
76
|
+
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
|
|
77
|
+
keyword_only.append(param)
|
|
78
|
+
elif param.kind == inspect.Parameter.VAR_KEYWORD:
|
|
79
|
+
var_keyword = param
|
|
80
|
+
|
|
81
|
+
# Neue Reihenfolge der Parameter erstellen
|
|
82
|
+
updated_parameters = (
|
|
83
|
+
positional_only
|
|
84
|
+
+ positional_or_keyword
|
|
85
|
+
+ _assertion_parameters # Neue Parameter hinzufügen
|
|
86
|
+
+ ([var_positional] if var_positional else [])
|
|
87
|
+
+ keyword_only
|
|
88
|
+
+ ([var_keyword] if var_keyword else [])
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# Neue Signatur erstellen
|
|
92
|
+
return inspect.Signature(parameters=updated_parameters)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@library(
|
|
96
|
+
scope="GLOBAL",
|
|
97
|
+
version=__version__,
|
|
98
|
+
converters={
|
|
99
|
+
RootElementDescriptor: RootElementDescriptor.convert,
|
|
100
|
+
ElementDescriptor: ElementDescriptor.convert,
|
|
101
|
+
strategies.Activatable: ElementDescriptor[strategies.Activatable].convert,
|
|
102
|
+
strategies.Deactivatable: ElementDescriptor[strategies.Deactivatable].convert,
|
|
103
|
+
strategies.HasIsActive: ElementDescriptor[strategies.HasIsActive].convert,
|
|
104
|
+
Locator: convert_locator,
|
|
105
|
+
},
|
|
106
|
+
)
|
|
107
|
+
class PlatynUI(DynamicCore):
|
|
108
|
+
def __init__(self) -> None:
|
|
109
|
+
super().__init__(
|
|
110
|
+
[Application(), ActivatableKeywords(), TextKeywords(), Keyboard(), Mouse(), Properties(), Wait()]
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def get_keyword_arguments(self, name: str) -> Any:
|
|
114
|
+
result: List[Union[str, Tuple[str], Tuple[str, Any]]] = super().get_keyword_arguments(name)
|
|
115
|
+
|
|
116
|
+
kw = self.keywords.get(name)
|
|
117
|
+
|
|
118
|
+
if kw is not None and getattr(kw, PLATYNUI_ASSERTABLE_FIELD, False):
|
|
119
|
+
kwargs_index = _get_args_index(result)
|
|
120
|
+
result.insert(kwargs_index, ("assertion_operator", None))
|
|
121
|
+
result.insert(kwargs_index + 1, ("assertion_expected", None))
|
|
122
|
+
result.insert(kwargs_index + 2, ("assertion_message", None))
|
|
123
|
+
return result
|
|
124
|
+
|
|
125
|
+
def get_keyword_types(self, name: str) -> Any:
|
|
126
|
+
result = super().get_keyword_types(name)
|
|
127
|
+
|
|
128
|
+
kw = self.keywords.get(name)
|
|
129
|
+
|
|
130
|
+
if kw is not None and getattr(kw, PLATYNUI_ASSERTABLE_FIELD, False):
|
|
131
|
+
result["assertion_operator"] = Optional[AssertionOperator]
|
|
132
|
+
result["assertion_expected"] = any
|
|
133
|
+
result["assertion_message"] = Optional[str]
|
|
134
|
+
|
|
135
|
+
return result
|
|
136
|
+
|
|
137
|
+
def run_keyword(self, name: str, args: Any, kwargs: Any = None) -> Any:
|
|
138
|
+
kw = self.keywords.get(name)
|
|
139
|
+
if kw is not None and getattr(kw, PLATYNUI_ASSERTABLE_FIELD, False):
|
|
140
|
+
|
|
141
|
+
def do_verify(
|
|
142
|
+
*args: Any,
|
|
143
|
+
assertion_operator: Optional[AssertionOperator] = None,
|
|
144
|
+
assertion_expected: Optional[Any] = None,
|
|
145
|
+
assertion_message: Optional[str] = None,
|
|
146
|
+
**kwargs: Any,
|
|
147
|
+
) -> Any:
|
|
148
|
+
return verify_assertion(
|
|
149
|
+
self.keywords[name](*args, **(kwargs or {})),
|
|
150
|
+
assertion_operator,
|
|
151
|
+
assertion_expected,
|
|
152
|
+
name,
|
|
153
|
+
assertion_message,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
new_sig = _add_assertion_parameters(inspect.signature(kw))
|
|
157
|
+
|
|
158
|
+
bound_args = new_sig.bind(*args, **(kwargs or {}))
|
|
159
|
+
bound_args.apply_defaults()
|
|
160
|
+
|
|
161
|
+
assertion_operator = bound_args.arguments.pop("assertion_operator", None)
|
|
162
|
+
assertion_expected = bound_args.arguments.pop("assertion_expected", None)
|
|
163
|
+
assertion_message = bound_args.arguments.pop("assertion_message", None)
|
|
164
|
+
|
|
165
|
+
return do_verify(
|
|
166
|
+
*bound_args.args,
|
|
167
|
+
assertion_operator=assertion_operator,
|
|
168
|
+
assertion_expected=assertion_expected,
|
|
169
|
+
assertion_message=assertion_message,
|
|
170
|
+
**(bound_args.kwargs or {}),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
return self.keywords[name](*args, **(kwargs or {}))
|
|
174
|
+
|
|
175
|
+
@keyword
|
|
176
|
+
def set_root_element(self, element: RootElementDescriptor) -> None:
|
|
177
|
+
"""Sets the context to the given locator."""
|
|
178
|
+
ElementDescriptor.set_root_element(element)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Daniel Biehl <daniel.biehl@imbus.de>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from .adapter import *
|
|
6
|
+
from .adapterfactory import *
|
|
7
|
+
from .adapterproxy import *
|
|
8
|
+
from .contextbase import *
|
|
9
|
+
from .exceptions import *
|
|
10
|
+
from .locatorbase import *
|
|
11
|
+
from .locatorscope import *
|
|
12
|
+
from .settings import *
|
|
13
|
+
from .strategybase import *
|
|
14
|
+
from .strategyimpl import *
|
|
15
|
+
from .technology import *
|
|
16
|
+
from .types import *
|
|
17
|
+
from .wait_for import *
|
PlatynUI/core/adapter.py
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Daniel Biehl <daniel.biehl@imbus.de>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import inspect
|
|
6
|
+
from abc import ABCMeta, abstractmethod
|
|
7
|
+
from typing import Any, Dict, List, Optional, Set, Type, TypeVar, overload
|
|
8
|
+
|
|
9
|
+
from .exceptions import AdapterNotSupportsStrategyError, NotAStrategyTypeError
|
|
10
|
+
from .strategybase import StrategyBase
|
|
11
|
+
from .strategyimpl import StrategyImplFactory
|
|
12
|
+
from .technology import Technology
|
|
13
|
+
|
|
14
|
+
__all__ = ["Adapter", "TStrategyBase"]
|
|
15
|
+
|
|
16
|
+
TStrategyBase = TypeVar("TStrategyBase", bound=StrategyBase)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Adapter(StrategyBase, metaclass=ABCMeta):
|
|
20
|
+
"""
|
|
21
|
+
the base adapter
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self._strategy_cache: Dict[str, StrategyBase] = {}
|
|
27
|
+
|
|
28
|
+
strategy_name = "io.platynui.Adapter"
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def valid(self) -> bool:
|
|
33
|
+
"""
|
|
34
|
+
get true if the adapter is valid at this time
|
|
35
|
+
:return:
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def id(self) -> str:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def name(self) -> str:
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
@abstractmethod
|
|
50
|
+
def class_name(self) -> str:
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def tag_name(self) -> str:
|
|
55
|
+
return ""
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
@abstractmethod
|
|
59
|
+
def role(self) -> str:
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
@abstractmethod
|
|
64
|
+
def supported_roles(self) -> Set[str]:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
@abstractmethod
|
|
69
|
+
def type(self) -> str:
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
@abstractmethod
|
|
74
|
+
def supported_types(self) -> Set[str]:
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
@abstractmethod
|
|
79
|
+
def framework_id(self) -> str:
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
@abstractmethod
|
|
84
|
+
def runtime_id(self) -> str:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def supported_strategies(self) -> Set[str]:
|
|
89
|
+
if self.valid:
|
|
90
|
+
return {
|
|
91
|
+
m.strategy_name
|
|
92
|
+
for m in inspect.getmro(type(self))
|
|
93
|
+
if hasattr(m, "strategy_name") and m.strategy_name is not None
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return set()
|
|
97
|
+
|
|
98
|
+
@overload
|
|
99
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase]) -> TStrategyBase: ...
|
|
100
|
+
|
|
101
|
+
@overload
|
|
102
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase], raise_exception: bool) -> Optional[TStrategyBase]: ...
|
|
103
|
+
|
|
104
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase], raise_exception: bool = True) -> Optional[TStrategyBase]:
|
|
105
|
+
if hasattr(strategy_type, "strategy_name"):
|
|
106
|
+
strategy_name = getattr(strategy_type, "strategy_name")
|
|
107
|
+
|
|
108
|
+
if strategy_name in self._strategy_cache:
|
|
109
|
+
result = self._strategy_cache[strategy_name]
|
|
110
|
+
if isinstance(result, strategy_type):
|
|
111
|
+
return result
|
|
112
|
+
|
|
113
|
+
if strategy_name is not None:
|
|
114
|
+
result1 = self
|
|
115
|
+
if isinstance(result1, strategy_type):
|
|
116
|
+
self._strategy_cache[strategy_name] = result1
|
|
117
|
+
return result1
|
|
118
|
+
|
|
119
|
+
result2 = StrategyImplFactory.find_strategy_impl_for(self, strategy_type)
|
|
120
|
+
if result2 is not None:
|
|
121
|
+
self._strategy_cache[strategy_name] = result2
|
|
122
|
+
return result2
|
|
123
|
+
|
|
124
|
+
if raise_exception:
|
|
125
|
+
raise AdapterNotSupportsStrategyError(
|
|
126
|
+
"adapter not supports the %s strategy" % strategy_name
|
|
127
|
+
if strategy_name is not None
|
|
128
|
+
else repr(strategy_type)
|
|
129
|
+
)
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
if raise_exception:
|
|
133
|
+
raise NotAStrategyTypeError("type %s is not a strategy type" % repr(strategy_type))
|
|
134
|
+
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
def supports_strategy(self, strategy_type: Type[TStrategyBase]) -> bool:
|
|
138
|
+
return self.get_strategy(strategy_type, False) is not None
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
@abstractmethod
|
|
142
|
+
def technology(self) -> Technology: ...
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
@abstractmethod
|
|
146
|
+
def parent(self) -> Optional["Adapter"]: ...
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
@abstractmethod
|
|
150
|
+
def children(self) -> List["Adapter"]: ...
|
|
151
|
+
|
|
152
|
+
def __eq__(self, other: Any) -> bool:
|
|
153
|
+
if isinstance(other, Adapter):
|
|
154
|
+
return self.runtime_id == other.runtime_id
|
|
155
|
+
|
|
156
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Daniel Biehl <daniel.biehl@imbus.de>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import TYPE_CHECKING, List, Optional, Type, overload
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .adapter import Adapter
|
|
10
|
+
from .contextbase import ContextBase
|
|
11
|
+
from .locatorbase import LocatorBase
|
|
12
|
+
|
|
13
|
+
__all__ = ["AdapterFactory"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AdapterFactory(ABC):
|
|
17
|
+
@overload
|
|
18
|
+
def get_adapter(
|
|
19
|
+
self,
|
|
20
|
+
locator: "LocatorBase",
|
|
21
|
+
parent: Optional["ContextBase"] = None,
|
|
22
|
+
context_type: Optional[Type["ContextBase"]] = None,
|
|
23
|
+
) -> "Adapter":
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
@overload
|
|
27
|
+
def get_adapter(
|
|
28
|
+
self,
|
|
29
|
+
locator: "LocatorBase",
|
|
30
|
+
parent: Optional["ContextBase"] = None,
|
|
31
|
+
context_type: Optional[Type["ContextBase"]] = None,
|
|
32
|
+
raise_error: bool = True,
|
|
33
|
+
) -> Optional["Adapter"]:
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def get_adapter(
|
|
38
|
+
self,
|
|
39
|
+
locator: "LocatorBase",
|
|
40
|
+
parent: Optional["ContextBase"] = None,
|
|
41
|
+
context_type: Optional[Type["ContextBase"]] = None,
|
|
42
|
+
raise_error: bool = True,
|
|
43
|
+
) -> Optional["Adapter"]:
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def get_children_adapters(
|
|
48
|
+
self,
|
|
49
|
+
parent: Optional["ContextBase"],
|
|
50
|
+
context_type: Optional[Type["ContextBase"]],
|
|
51
|
+
locator: "LocatorBase",
|
|
52
|
+
raise_error: bool = True,
|
|
53
|
+
) -> List["Adapter"]:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
@abstractmethod
|
|
57
|
+
def get_parent_adapter(
|
|
58
|
+
self,
|
|
59
|
+
adapter: Optional["ContextBase"],
|
|
60
|
+
raise_error: bool = True,
|
|
61
|
+
) -> Optional["Adapter"]:
|
|
62
|
+
pass
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Daniel Biehl <daniel.biehl@imbus.de>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from typing import Any, Callable, Dict, List, Optional, Set, Type, TypeVar, cast, overload
|
|
6
|
+
|
|
7
|
+
from .adapter import Adapter, TStrategyBase
|
|
8
|
+
from .strategybase import StrategyBase
|
|
9
|
+
from .technology import Technology
|
|
10
|
+
from .weight_calculator import WeightCalculator
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"AdapterProxy",
|
|
14
|
+
"AdapterProxyFactory",
|
|
15
|
+
"adapter_proxy_for",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AdapterProxy(Adapter):
|
|
20
|
+
def __init__(self, adapter: Adapter):
|
|
21
|
+
self._adapter = adapter
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def adapter(self) -> Adapter:
|
|
25
|
+
return self._adapter
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def valid(self) -> bool:
|
|
29
|
+
return self.adapter.valid
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def id(self) -> str:
|
|
33
|
+
return self.adapter.id
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def name(self) -> str:
|
|
37
|
+
return self.adapter.name
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def class_name(self) -> str:
|
|
41
|
+
return self.adapter.class_name
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def tag_name(self) -> str:
|
|
45
|
+
return self.adapter.tag_name
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def role(self) -> str:
|
|
49
|
+
return self.adapter.role
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def supported_roles(self) -> Set[str]:
|
|
53
|
+
return self.adapter.supported_roles
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def type(self) -> str:
|
|
57
|
+
return self.adapter.type
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def supported_types(self) -> Set[str]:
|
|
61
|
+
return self.adapter.supported_types
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def framework_id(self) -> str:
|
|
65
|
+
return self.adapter.framework_id
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def runtime_id(self) -> Any:
|
|
69
|
+
return self.adapter.runtime_id
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def technology(self) -> Technology:
|
|
73
|
+
return self.adapter.technology
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def _self_implemented_strategies(self) -> Set[str]:
|
|
77
|
+
return set(
|
|
78
|
+
[
|
|
79
|
+
getattr(i, "strategy_name")
|
|
80
|
+
for i in type(self).mro()
|
|
81
|
+
if issubclass(i, StrategyBase) and i != StrategyBase and hasattr(i, "strategy_name")
|
|
82
|
+
]
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def supported_strategies(self) -> Set[str]:
|
|
87
|
+
return self._self_implemented_strategies.union(self.adapter.supported_strategies)
|
|
88
|
+
|
|
89
|
+
@overload
|
|
90
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase]) -> TStrategyBase: ...
|
|
91
|
+
|
|
92
|
+
@overload
|
|
93
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase], raise_exception: bool) -> Optional[TStrategyBase]: ...
|
|
94
|
+
|
|
95
|
+
def get_strategy(self, strategy_type: Type[TStrategyBase], raise_exception: bool = True) -> Optional[TStrategyBase]:
|
|
96
|
+
if hasattr(strategy_type, "strategy_name"):
|
|
97
|
+
if strategy_type.strategy_name is not None:
|
|
98
|
+
if strategy_type.strategy_name in self._self_implemented_strategies:
|
|
99
|
+
return cast(strategy_type, self) # type: ignore
|
|
100
|
+
|
|
101
|
+
return self.adapter.get_strategy(strategy_type, raise_exception)
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
def parent(self) -> Optional["Adapter"]:
|
|
105
|
+
return self.adapter.parent
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def children(self) -> List["Adapter"]:
|
|
109
|
+
return self.adapter.children
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
TAdapter = TypeVar("TAdapter", bound=Adapter)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class AdapterProxyFactory:
|
|
116
|
+
class Entry:
|
|
117
|
+
def __init__(self, proxy_type: Type[AdapterProxy], criterias: Dict[str, object]):
|
|
118
|
+
self.proxy_type = proxy_type
|
|
119
|
+
self.criterias = criterias
|
|
120
|
+
|
|
121
|
+
registered_adapters: List[Entry] = []
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def register_proxy(cls, adapter_cls: Type[AdapterProxy], criterias: Dict[str, Any]) -> None:
|
|
125
|
+
cls.registered_adapters.append(AdapterProxyFactory.Entry(adapter_cls, criterias.copy()))
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def find_proxy_for(cls, adapter: TAdapter) -> TAdapter:
|
|
129
|
+
weights = []
|
|
130
|
+
calculator = WeightCalculator(adapter)
|
|
131
|
+
|
|
132
|
+
for e in cls.registered_adapters:
|
|
133
|
+
weights.append((calculator.calculate(e.criterias), e.proxy_type))
|
|
134
|
+
|
|
135
|
+
if len(weights) > 0:
|
|
136
|
+
last = sorted(weights, key=lambda x: x[0])[-1]
|
|
137
|
+
|
|
138
|
+
if last[0] > 0:
|
|
139
|
+
return cast(TAdapter, last[1](adapter))
|
|
140
|
+
|
|
141
|
+
return adapter
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def adapter_proxy_for(
|
|
145
|
+
role: Optional[str] = None,
|
|
146
|
+
framework_id: Optional[str] = None,
|
|
147
|
+
class_name: Optional[str] = None,
|
|
148
|
+
tag_name: Optional[str] = None,
|
|
149
|
+
properties: Optional[Dict[str, str]] = None,
|
|
150
|
+
technology: Optional[Type[Any]] = None,
|
|
151
|
+
native_properties: Optional[Dict[str, str]] = None,
|
|
152
|
+
**decorator_kwargs: Any,
|
|
153
|
+
) -> Callable[[Type[AdapterProxy]], Type[AdapterProxy]]:
|
|
154
|
+
def decorator(cls: Type[AdapterProxy]) -> Type[AdapterProxy]:
|
|
155
|
+
AdapterProxyFactory.register_proxy(
|
|
156
|
+
cls,
|
|
157
|
+
{
|
|
158
|
+
"role": role,
|
|
159
|
+
"framework_id": framework_id,
|
|
160
|
+
"class_name": class_name,
|
|
161
|
+
"tag_name": tag_name,
|
|
162
|
+
"technology": technology,
|
|
163
|
+
"properties": properties,
|
|
164
|
+
"native_properties": native_properties,
|
|
165
|
+
**decorator_kwargs,
|
|
166
|
+
},
|
|
167
|
+
)
|
|
168
|
+
return cls
|
|
169
|
+
|
|
170
|
+
return decorator
|