code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def Zoom(self, zoomLevel: float, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationTransformPattern2::Zoom.
Zoom the viewport of the control.
zoomLevel: float for int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https:/... |
Call IUIAutomationTransformPattern2::Zoom.
Zoom the viewport of the control.
zoomLevel: float for int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiau... | Zoom | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ZoomByUnit(self, zoomUnit: int, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationTransformPattern2::ZoomByUnit.
Zoom the viewport of the control by the specified unit.
zoomUnit: int, a value in class `ZoomUnit`.
waitTime: float.
Return bool, True ... |
Call IUIAutomationTransformPattern2::ZoomByUnit.
Zoom the viewport of the control by the specified unit.
zoomUnit: int, a value in class `ZoomUnit`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/... | ZoomByUnit | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetValue(self, value: str, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationTransformPattern2::IUIAutomationValuePattern::SetValue.
Set the value of the element.
value: str.
waitTime: float.
Return bool, True if succeed otherwise False.
Re... |
Call IUIAutomationTransformPattern2::IUIAutomationValuePattern::SetValue.
Set the value of the element.
value: str.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomatio... | SetValue | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Realize(self, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationVirtualizedItemPattern::Realize.
Create a full UI Automation element for a virtualized item.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft... |
Call IUIAutomationVirtualizedItemPattern::Realize.
Create a full UI Automation element for a virtualized item.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiau... | Realize | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Close(self, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationWindowPattern::Close.
Close the window.
waitTime: float.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-close
... |
Call IUIAutomationWindowPattern::Close.
Close the window.
waitTime: float.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-close
| Close | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetWindowVisualState(self, state: int, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Call IUIAutomationWindowPattern::SetWindowVisualState.
Minimize, maximize, or restore the window.
state: int, a value in class `WindowVisualState`.
waitTime: float.
Return bool,... |
Call IUIAutomationWindowPattern::SetWindowVisualState.
Minimize, maximize, or restore the window.
state: int, a value in class `WindowVisualState`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/u... | SetWindowVisualState | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def CreatePattern(patternId: int, pattern: ctypes.POINTER(comtypes.IUnknown)):
"""Create a concreate pattern by pattern id and pattern(POINTER(IUnknown))."""
subPattern = pattern.QueryInterface(GetPatternIdInterface(patternId))
if subPattern:
return PatternConstructors[patternId](pattern=subPattern) | Create a concreate pattern by pattern id and pattern(POINTER(IUnknown)). | CreatePattern | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def __init__(self, searchFromControl: 'Control' = None, searchDepth: int = 0xFFFFFFFF, searchInterval: float = SEARCH_INTERVAL, foundIndex: int = 1, element=None, **searchProperties):
"""
searchFromControl: `Control` or its subclass, if it is None, search from root control(Desktop).
searchDepth:... |
searchFromControl: `Control` or its subclass, if it is None, search from root control(Desktop).
searchDepth: int, max search depth from searchFromControl.
foundIndex: int, starts with 1, >= 1.
searchInterval: float, wait searchInterval after every search in self.Refind and self.Exists, ... | __init__ | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def CreateControlFromElement(element) -> 'Control':
"""
Create a concreate `Control` from a com type `IUIAutomationElement`.
element: `ctypes.POINTER(IUIAutomationElement)`.
Return a subclass of `Control`, an instance of the control's real type.
"""
if element:
... |
Create a concreate `Control` from a com type `IUIAutomationElement`.
element: `ctypes.POINTER(IUIAutomationElement)`.
Return a subclass of `Control`, an instance of the control's real type.
| CreateControlFromElement | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def AddSearchProperties(self, **searchProperties) -> None:
"""
Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
"""
self.searchProperties.update(searchProperties)
if 'Depth' in searchProperties:
... |
Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
| AddSearchProperties | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def RemoveSearchProperties(self, **searchProperties) -> None:
"""
searchProperties: dict, same as searchProperties in `Control.__init__`.
"""
for key in searchProperties:
del self.searchProperties[key]
if key == 'RegexName':
self.regexName = None |
searchProperties: dict, same as searchProperties in `Control.__init__`.
| RemoveSearchProperties | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str:
"""keyColor, valueColor: str, color name in class ConsoleColor"""
strs = ['<Color={}>{}</Color>: <Color={}>{}</Color>'.format(keyColor if k in Control.ValidKeys else 'DarkYellow', k, valueColor,
... | keyColor, valueColor: str, color name in class ConsoleColor | GetColorfulSearchPropertiesStr | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def BoundingRectangle(self) -> Rect:
"""
Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundin... |
Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundingrectangle
rect = control.BoundingRecta... | BoundingRectangle | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ScreenShot(self, savePath: str=None) -> str:
"""
Save the control's screenshot to savePath.
savePath: str, the path to save the screenshot.
Return str, the path of the saved screenshot.
"""
rect = self.Element.CurrentBoundingRectangle
bbox = (rect.left, rect.t... |
Save the control's screenshot to savePath.
savePath: str, the path to save the screenshot.
Return str, the path of the saved screenshot.
| ScreenShot | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def NativeWindowHandle(self) -> str:
"""
Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
"... |
Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
| NativeWindowHandle | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetClickablePoint(self) -> Tuple[int, int, bool]:
"""
Call IUIAutomationElement::GetClickablePoint.
Return Tuple[int, int, bool], three items tuple (x, y, gotClickable), such as (20, 10, True)
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomati... |
Call IUIAutomationElement::GetClickablePoint.
Return Tuple[int, int, bool], three items tuple (x, y, gotClickable), such as (20, 10, True)
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
| GetClickablePoint | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetPattern(self, patternId: int):
"""
Call IUIAutomationElement::GetCurrentPattern.
Get a new pattern by pattern id if it supports the pattern.
patternId: int, a value in class `PatternId`.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiaut... |
Call IUIAutomationElement::GetCurrentPattern.
Get a new pattern by pattern id if it supports the pattern.
patternId: int, a value in class `PatternId`.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatt... | GetPattern | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetFocus(self) -> bool:
"""
Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
"""
try:
return self.Element.SetFocus() == S_OK
except comtyp... |
Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
| SetFocus | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Element(self):
"""
Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
"""
if not self._element:
self.Refind(maxSearchSeconds=TIME_OUT_SECOND, searchIntervalSeconds=self.searchInterval)
return self._element |
Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
| Element | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetCachedPattern(self, patternId: int, cache: bool):
"""
Get a pattern by patternId.
patternId: int, a value in class `PatternId`.
Return a pattern if it supports the pattern else None.
cache: bool, if True, store the pattern for later use, if False, get a new pattern by `sel... |
Get a pattern by patternId.
patternId: int, a value in class `PatternId`.
Return a pattern if it supports the pattern else None.
cache: bool, if True, store the pattern for later use, if False, get a new pattern by `self.GetPattern`.
| GetCachedPattern | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetAncestorControl(self, condition: Callable[['Control', int], bool]) -> 'Control':
"""
Get an ancestor control that matches the condition.
condition: Callable[[Control, int], bool], function(control: Control, depth: int) -> bool,
depth starts with -1 and decreses when sea... |
Get an ancestor control that matches the condition.
condition: Callable[[Control, int], bool], function(control: Control, depth: int) -> bool,
depth starts with -1 and decreses when search goes up.
Return `Control` subclass or None.
| GetAncestorControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetSiblingControl(self, condition: Callable[['Control'], bool], forward: bool = True) -> 'Control':
"""
Get a sibling control that matches the condition.
forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings.
condition:... |
Get a sibling control that matches the condition.
forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings.
condition: Callable[[Control], bool], function(control: Control) -> bool.
Return `Control` subclass or None.
| GetSiblingControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetChildControl(self, index: int, control_type: str = None) -> 'Control':
"""
Get the nth child control.
index: int, starts with 0.
control_type: `Control` or its subclass, if not None, only return the nth control that matches the control_type.
Return `Control` subclass or No... |
Get the nth child control.
index: int, starts with 0.
control_type: `Control` or its subclass, if not None, only return the nth control that matches the control_type.
Return `Control` subclass or None.
| GetChildControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetAllProgeny(self) -> List[List['Control']]:
"""
Get all progeny controls.
Return List[List[Control]], a list of list of `Control` subclasses.
"""
all_elements = []
def find_all_elements(element, depth=0):
children = element.GetChildren()
if ... |
Get all progeny controls.
Return List[List[Control]], a list of list of `Control` subclasses.
| GetAllProgeny | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetProgenyControl(self, depth: int=1, index: int=0, control_type: str = None) -> 'Control':
"""
Get the nth control in the mth depth.
depth: int, starts with 0.
index: int, starts with 0.
control_type: `Control` or its subclass, if not None, only return the nth control that m... |
Get the nth control in the mth depth.
depth: int, starts with 0.
index: int, starts with 0.
control_type: `Control` or its subclass, if not None, only return the nth control that matches the control_type.
Return `Control` subclass or None.
| GetProgenyControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetChildren(self) -> List['Control']:
"""
Return List[Control], a list of `Control` subclasses.
"""
children = []
child = self.GetFirstChildControl()
while child:
children.append(child)
child = child.GetNextSiblingControl()
return child... |
Return List[Control], a list of `Control` subclasses.
| GetChildren | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def _CompareFunction(self, control: 'Control', depth: int) -> bool:
"""
Define how to search.
control: `Control` or its subclass.
depth: int, tree depth from searchFromControl.
Return bool.
"""
for key, value in self.searchProperties.items():
if 'Contr... |
Define how to search.
control: `Control` or its subclass.
depth: int, tree depth from searchFromControl.
Return bool.
| _CompareFunction | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotExist: bool = False) -> bool:
"""
maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool... |
maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
| Exists | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotDisappear: bool = False) -> bool:
"""
maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds secon... |
maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
| Disappears | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Refind(self, maxSearchSeconds: float = TIME_OUT_SECOND, searchIntervalSeconds: float = SEARCH_INTERVAL, raiseException: bool = True) -> bool:
"""
Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
maxSearchSeconds: float.
searchIntervalSeconds: float.... |
Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
maxSearchSeconds: float.
searchIntervalSeconds: float.
raiseException: bool, if True, raise a LookupError if timeout.
Return bool, True if find.
| Refind | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def MoveCursorToInnerPos(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Tuple[int, int]:
"""
Move cursor to control's internal position, default to center.
x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore r... |
Move cursor to control's internal position, default to center.
x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, move to self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX: float.
ratioY: float.
simul... | MoveCursorToInnerPos | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Click(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, click self.BoundingRectangle.... |
x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, click self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX: float.
ratioY: float.
simulateMove: bool, if True, first move cursor to control smoothly.
wait... | Click | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def MiddleClick(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
x: int, if < 0, middle click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, middle click sel... |
x: int, if < 0, middle click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, middle click self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX: float.
ratioY: float.
simulateMove: bool, if True, first move cursor to control smoothly... | MiddleClick | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def RightClick(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, right click self.B... |
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX: float.
ratioY: float.
simulateMove: bool, if True, first move cursor to control smoothly.
... | RightClick | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def DoubleClick(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, right click self.... |
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX: float.
ratioY: float.
simulateMove: bool, if True, first move cursor to control smoothly.
... | DoubleClick | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def WheelDown(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
Make control have focus first, move cursor to the specified position and mouse wheel down.
x: int, if < 0, ... |
Make control have focus first, move cursor to the specified position and mouse wheel down.
x: int, if < 0, move x cursor to self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, move y cursor to self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratio... | WheelDown | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def WheelUp(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
Make control have focus first, move cursor to the specified position and mouse wheel up.
x: int, if < 0, move... |
Make control have focus first, move cursor to the specified position and mouse wheel up.
x: int, if < 0, move x cursor to self.BoundingRectangle.right + x, if not None, ignore ratioX.
y: int, if < 0, move y cursor to self.BoundingRectangle.bottom + y, if not None, ignore ratioY.
ratioX:... | WheelUp | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ShowWindow(self, cmdShow: int, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow.
cmdShow: int, a value in in class `SW`.
waitTime: float.
Return bool, True if succeed otherwise... |
Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow.
cmdShow: int, a value in in class `SW`.
waitTime: float.
Return bool, True if succeed otherwise False.
| ShowWindow | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool:
"""
Call native MoveWindow if control has a valid native handle.
x: int.
y: int.
width: int.
height: int.
repaint: bool.
Return bool, True if succeed otherwise Fal... |
Call native MoveWindow if control has a valid native handle.
x: int.
y: int.
width: int.
height: int.
repaint: bool.
Return bool, True if succeed otherwise False.
| MoveWindow | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetWindowText(self) -> str:
"""
Call native GetWindowText if control has a valid native handle.
"""
handle = self.NativeWindowHandle
if handle:
return GetWindowText(handle) |
Call native GetWindowText if control has a valid native handle.
| GetWindowText | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetWindowText(self, text: str) -> bool:
"""
Call native SetWindowText if control has a valid native handle.
"""
handle = self.NativeWindowHandle
if handle:
return SetWindowText(handle, text)
return False |
Call native SetWindowText if control has a valid native handle.
| SetWindowText | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SendKeys(self, text: str, interval: float = 0.01, waitTime: float = OPERATION_WAIT_TIME, charMode: bool = True) -> None:
"""
Make control have focus first and type keys.
`self.SetFocus` may not work for some controls, you may need to click it to make it have focus.
text: str, keys to... |
Make control have focus first and type keys.
`self.SetFocus` may not work for some controls, you may need to click it to make it have focus.
text: str, keys to type, see the docstring of `SendKeys`.
interval: float, seconds between keys.
waitTime: float.
charMode: bool, ... | SendKeys | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetPixelColor(self, x: int, y: int) -> int:
"""
Call native `GetPixelColor` if control has a valid native handle.
Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels.
x: int, internal x position.
y: int, internal y position.
Return... |
Call native `GetPixelColor` if control has a valid native handle.
Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels.
x: int, internal x position.
y: int, internal y position.
Return int, a color value in bgr.
r = bgr & 0x0000FF
... | GetPixelColor | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Bitmap:
"""
Capture control to a Bitmap object.
x, y: int, the point in control's internal position(from 0,0).
width, height: int, image's width and height from x, y, use 0 for entire area.
... |
Capture control to a Bitmap object.
x, y: int, the point in control's internal position(from 0,0).
width, height: int, image's width and height from x, y, use 0 for entire area.
If width(or height) < 0, image size will be control's width(or height) - width(or height).
... | ToBitmap | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool:
"""
Capture control to a image file.
savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff.
x, y: int, the point in control's internal position(from 0,0).
... |
Capture control to a image file.
savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff.
x, y: int, the point in control's internal position(from 0,0).
width, height: int, image's width and height from x, y, use 0 for entire area.
If width(or he... | CaptureToImage | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def IsTopLevel(self) -> bool:
"""Determine whether current control is top level."""
handle = self.NativeWindowHandle
if handle:
return GetAncestor(handle, GAFlag.Root) == handle
return False | Determine whether current control is top level. | IsTopLevel | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def GetTopLevelControl(self) -> 'Control':
"""
Get the top level control which current control lays.
If current control is top level, return self.
If current control is root control, return None.
Return `PaneControl` or `WindowControl` or None.
"""
handle = self.N... |
Get the top level control which current control lays.
If current control is top level, return self.
If current control is root control, return None.
Return `PaneControl` or `WindowControl` or None.
| GetTopLevelControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Select(self, itemName: str = '', condition: Callable[[str], bool] = None, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Show combobox's popup menu and select a item by name.
itemName: str.
condition: Callable[[str], bool], function(comboBoxItemName: str) -> bool, if condition i... |
Show combobox's popup menu and select a item by name.
itemName: str.
condition: Callable[[str], bool], function(comboBoxItemName: str) -> bool, if condition is valid, ignore itemName.
waitTime: float.
Some comboboxs doesn't support SelectionPattern, here is a workaround.
... | Select | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetTopmost(self, isTopmost: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Set top level window topmost.
isTopmost: bool.
waitTime: float.
"""
if self.IsTopLevel():
ret = SetWindowTopmost(self.NativeWindowHandle, isTopmost)
ti... |
Set top level window topmost.
isTopmost: bool.
waitTime: float.
| SetTopmost | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def Restore(self, waitTime: float = OPERATION_WAIT_TIME) -> bool:
"""
Restore window to normal state.
Similar to SwitchToThisWindow.
"""
if self.IsTopLevel():
return self.ShowWindow(SW.Restore, waitTime)
return False |
Restore window to normal state.
Similar to SwitchToThisWindow.
| Restore | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def MetroClose(self, waitTime: float = OPERATION_WAIT_TIME) -> None:
"""
Only work on Windows 8/8.1, if current window is Metro UI.
waitTime: float.
"""
if self.ClassName == METRO_WINDOW_CLASS_NAME:
screenWidth, screenHeight = GetScreenSize()
MoveTo(screen... |
Only work on Windows 8/8.1, if current window is Metro UI.
waitTime: float.
| MetroClose | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def SetGlobalSearchTimeout(seconds: float) -> None:
"""
seconds: float.
To make this available, you need explicitly import uiautomation:
from uiautomation import uiautomation as auto
auto.SetGlobalSearchTimeout(10)
"""
global TIME_OUT_SECOND
TIME_OUT_SECOND = seconds |
seconds: float.
To make this available, you need explicitly import uiautomation:
from uiautomation import uiautomation as auto
auto.SetGlobalSearchTimeout(10)
| SetGlobalSearchTimeout | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def WalkTree(top, getChildren: Callable[[TreeNode], List[TreeNode]] = None,
getFirstChild: Callable[[TreeNode], TreeNode] = None, getNextSibling: Callable[[TreeNode], TreeNode] = None,
yieldCondition: Callable[[TreeNode, int], bool] = None, includeTop: bool = False, maxDepth: int = 0xFFFFFFFF)... |
Walk a tree not using recursive algorithm.
top: a tree node.
getChildren: Callable[[TreeNode], List[TreeNode]], function(treeNode: TreeNode) -> List[TreeNode].
getNextSibling: Callable[[TreeNode], TreeNode], function(treeNode: TreeNode) -> TreeNode.
getNextSibling: Callable[[TreeNode], TreeNode], f... | WalkTree | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ControlFromCursor() -> Control:
"""
Call ControlFromPoint with current cursor point.
Return `Control` subclass.
"""
x, y = GetCursorPos()
return ControlFromPoint(x, y) |
Call ControlFromPoint with current cursor point.
Return `Control` subclass.
| ControlFromCursor | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def ControlFromCursor2() -> Control:
"""
Call ControlFromPoint2 with current cursor point.
Return `Control` subclass.
"""
x, y = GetCursorPos()
return ControlFromPoint2(x, y) |
Call ControlFromPoint2 with current cursor point.
Return `Control` subclass.
| ControlFromCursor2 | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def WalkControl(control: Control, includeTop: bool = False, maxDepth: int = 0xFFFFFFFF):
"""
control: `Control` or its subclass.
includeTop: bool, if True, yield (control, 0) first.
maxDepth: int, enum depth.
Yield 2 items tuple (control: Control, depth: int).
"""
if includeTop:
yiel... |
control: `Control` or its subclass.
includeTop: bool, if True, yield (control, 0) first.
maxDepth: int, enum depth.
Yield 2 items tuple (control: Control, depth: int).
| WalkControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def LogControl(control: Control, depth: int = 0, showAllName: bool = True, showPid: bool = False) -> None:
"""
Print and log control's properties.
control: `Control` or its subclass.
depth: int, current depth.
showAllName: bool, if False, print the first 30 characters of control.Name.
"""
de... |
Print and log control's properties.
control: `Control` or its subclass.
depth: int, current depth.
showAllName: bool, if False, print the first 30 characters of control.Name.
| LogControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def EnumAndLogControl(control: Control, maxDepth: int = 0xFFFFFFFF, showAllName: bool = True, showPid: bool = False, startDepth: int = 0) -> None:
"""
Print and log control and its descendants' propertyies.
control: `Control` or its subclass.
maxDepth: int, enum depth.
showAllName: bool, if False, p... |
Print and log control and its descendants' propertyies.
control: `Control` or its subclass.
maxDepth: int, enum depth.
showAllName: bool, if False, print the first 30 characters of control.Name.
startDepth: int, control's current depth.
| EnumAndLogControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def EnumAndLogControlAncestors(control: Control, showAllName: bool = True, showPid: bool = False) -> None:
"""
Print and log control and its ancestors' propertyies.
control: `Control` or its subclass.
showAllName: bool, if False, print the first 30 characters of control.Name.
"""
lists = []
... |
Print and log control and its ancestors' propertyies.
control: `Control` or its subclass.
showAllName: bool, if False, print the first 30 characters of control.Name.
| EnumAndLogControlAncestors | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def FindControl(control: Control, compare: Callable[[Control, int], bool], maxDepth: int = 0xFFFFFFFF, findFromSelf: bool = False, foundIndex: int = 1) -> Control:
"""
control: `Control` or its subclass.
compare: Callable[[Control, int], bool], function(control: Control, depth: int) -> bool.
maxDepth: i... |
control: `Control` or its subclass.
compare: Callable[[Control, int], bool], function(control: Control, depth: int) -> bool.
maxDepth: int, enum depth.
findFromSelf: bool, if False, do not compare self.
foundIndex: int, starts with 1, >= 1.
Return `Control` subclass or None if not find.
| FindControl | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def WaitHotKeyReleased(hotkey: Tuple[int, int]) -> None:
"""hotkey: Tuple[int, int], two ints tuple (modifierKey, key)"""
mod = {ModifierKey.Alt: Keys.VK_MENU,
ModifierKey.Control: Keys.VK_CONTROL,
ModifierKey.Shift: Keys.VK_SHIFT,
ModifierKey.Win: Keys.VK_LWIN
... | hotkey: Tuple[int, int], two ints tuple (modifierKey, key) | WaitHotKeyReleased | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def RunByHotKey(keyFunctions: Dict[Tuple[int, int], Callable], stopHotKey: Tuple[int, int] = None, exitHotKey: Tuple[int, int] = (ModifierKey.Control, Keys.VK_D), waitHotKeyReleased: bool = True) -> None:
"""
Bind functions with hotkeys, the function will be run or stopped in another thread when the hotkey is p... |
Bind functions with hotkeys, the function will be run or stopped in another thread when the hotkey is pressed.
keyFunctions: Dict[Tuple[int, int], Callable], such as {(uiautomation.ModifierKey.Control, uiautomation.Keys.VK_1) : function}
stopHotKey: hotkey tuple
exitHotKey: hotkey tuple
waitHotKeyR... | RunByHotKey | python | cluic/wxauto | wxauto/uiautomation.py | https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py | Apache-2.0 |
def check_setuptools_features():
"""Check if setuptools is up to date."""
import pkg_resources
try:
list(pkg_resources.parse_requirements('foo~=1.0'))
except ValueError:
sys.exit('Your Python distribution comes with an incompatible version '
'of `setuptools`. Please run:... | Check if setuptools is up to date. | check_setuptools_features | python | bigchaindb/bigchaindb | setup.py | https://github.com/bigchaindb/bigchaindb/blob/master/setup.py | Apache-2.0 |
def map_leafs(func, mapping):
"""Map a function to the leafs of a mapping."""
def _inner(mapping, path=None):
if path is None:
path = []
for key, val in mapping.items():
if isinstance(val, collections.abc.Mapping):
_inner(val, path + [key])
e... | Map a function to the leafs of a mapping. | map_leafs | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def update(d, u):
"""Recursively update a mapping (i.e. a dict, list, set, or tuple).
Conceptually, d and u are two sets trees (with nodes and edges).
This function goes through all the nodes of u. For each node in u,
if d doesn't have that node yet, then this function adds the node from u,
otherwi... | Recursively update a mapping (i.e. a dict, list, set, or tuple).
Conceptually, d and u are two sets trees (with nodes and edges).
This function goes through all the nodes of u. For each node in u,
if d doesn't have that node yet, then this function adds the node from u,
otherwise this function overwrit... | update | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def file_config(filename=None):
"""Returns the config values found in a configuration file.
Args:
filename (str): the JSON file with the configuration values.
If ``None``, CONFIG_DEFAULT_PATH will be used.
Returns:
dict: The config values in the specified config file (or the
... | Returns the config values found in a configuration file.
Args:
filename (str): the JSON file with the configuration values.
If ``None``, CONFIG_DEFAULT_PATH will be used.
Returns:
dict: The config values in the specified config file (or the
file at CONFIG_DEFAULT_PATH... | file_config | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def env_config(config):
"""Return a new configuration with the values found in the environment.
The function recursively iterates over the config, checking if there is
a matching env variable. If an env variable is found, the func updates
the configuration with that value.
The name of the env vari... | Return a new configuration with the values found in the environment.
The function recursively iterates over the config, checking if there is
a matching env variable. If an env variable is found, the func updates
the configuration with that value.
The name of the env variable is built combining a prefi... | env_config | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def update_types(config, reference, list_sep=':'):
"""Return a new configuration where all the values types
are aligned with the ones in the default configuration
"""
def _coerce(current, value):
# Coerce a value to the `current` type.
try:
# First we try to apply current to... | Return a new configuration where all the values types
are aligned with the ones in the default configuration
| update_types | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def set_config(config):
"""Set bigchaindb.config equal to the default config dict,
then update that with whatever is in the provided config dict,
and then set bigchaindb.config['CONFIGURED'] = True
Args:
config (dict): the config dict to read for changes
to the default co... | Set bigchaindb.config equal to the default config dict,
then update that with whatever is in the provided config dict,
and then set bigchaindb.config['CONFIGURED'] = True
Args:
config (dict): the config dict to read for changes
to the default config
Note:
Any pre... | set_config | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def update_config(config):
"""Update bigchaindb.config with whatever is in the provided config dict,
and then set bigchaindb.config['CONFIGURED'] = True
Args:
config (dict): the config dict to read for changes
to the default config
"""
# Update the default config wit... | Update bigchaindb.config with whatever is in the provided config dict,
and then set bigchaindb.config['CONFIGURED'] = True
Args:
config (dict): the config dict to read for changes
to the default config
| update_config | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def write_config(config, filename=None):
"""Write the provided configuration to a specific location.
Args:
config (dict): a dictionary with the configuration to load.
filename (str): the name of the file that will store the new configuration. Defaults to ``None``.
If ``None``, the H... | Write the provided configuration to a specific location.
Args:
config (dict): a dictionary with the configuration to load.
filename (str): the name of the file that will store the new configuration. Defaults to ``None``.
If ``None``, the HOME of the current user and the string ``.bigcha... | write_config | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def autoconfigure(filename=None, config=None, force=False):
"""Run ``file_config`` and ``env_config`` if the module has not
been initialized.
"""
if not force and is_configured():
logger.debug('System already configured, skipping autoconfiguration')
return
# start with the current c... | Run ``file_config`` and ``env_config`` if the module has not
been initialized.
| autoconfigure | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def load_validation_plugin(name=None):
"""Find and load the chosen validation plugin.
Args:
name (string): the name of the entry_point, as advertised in the
setup.py of the providing package.
Returns:
an uninstantiated subclass of ``bigchaindb.validation.AbstractValidationRules... | Find and load the chosen validation plugin.
Args:
name (string): the name of the entry_point, as advertised in the
setup.py of the providing package.
Returns:
an uninstantiated subclass of ``bigchaindb.validation.AbstractValidationRules``
| load_validation_plugin | python | bigchaindb/bigchaindb | bigchaindb/config_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/config_utils.py | Apache-2.0 |
def init_chain(self, genesis):
"""Initialize chain upon genesis or a migration"""
app_hash = ''
height = 0
known_chain = self.bigchaindb.get_latest_abci_chain()
if known_chain is not None:
chain_id = known_chain['chain_id']
if known_chain['is_synced']:
... | Initialize chain upon genesis or a migration | init_chain | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def check_tx(self, raw_transaction):
"""Validate the transaction before entry into
the mempool.
Args:
raw_tx: a raw string (in bytes) transaction.
"""
self.abort_if_abci_chain_is_not_synced()
logger.debug('check_tx: %s', raw_transaction)
transaction... | Validate the transaction before entry into
the mempool.
Args:
raw_tx: a raw string (in bytes) transaction.
| check_tx | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def begin_block(self, req_begin_block):
"""Initialize list of transaction.
Args:
req_begin_block: block object which contains block header
and block hash.
"""
self.abort_if_abci_chain_is_not_synced()
chain_shift = 0 if self.chain is None else self.chain['... | Initialize list of transaction.
Args:
req_begin_block: block object which contains block header
and block hash.
| begin_block | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def deliver_tx(self, raw_transaction):
"""Validate the transaction before mutating the state.
Args:
raw_tx: a raw string (in bytes) transaction.
"""
self.abort_if_abci_chain_is_not_synced()
logger.debug('deliver_tx: %s', raw_transaction)
transaction = self.... | Validate the transaction before mutating the state.
Args:
raw_tx: a raw string (in bytes) transaction.
| deliver_tx | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def end_block(self, request_end_block):
"""Calculate block hash using transaction ids and previous block
hash to be stored in the next block.
Args:
height (int): new height of the chain.
"""
self.abort_if_abci_chain_is_not_synced()
chain_shift = 0 if self.c... | Calculate block hash using transaction ids and previous block
hash to be stored in the next block.
Args:
height (int): new height of the chain.
| end_block | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def commit(self):
"""Store the new height and along with block hash."""
self.abort_if_abci_chain_is_not_synced()
data = self.block_txn_hash.encode('utf-8')
# register a new block only when new transactions are received
if self.block_txn_ids:
self.bigchaindb.store_b... | Store the new height and along with block hash. | commit | python | bigchaindb/bigchaindb | bigchaindb/core.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/core.py | Apache-2.0 |
def __init__(self, event_type, event_data):
"""Creates a new event.
Args:
event_type (int): the type of the event, see
:class:`~bigchaindb.events.EventTypes`
event_data (obj): the data of the event.
"""
self.type = event_type
self.data = ... | Creates a new event.
Args:
event_type (int): the type of the event, see
:class:`~bigchaindb.events.EventTypes`
event_data (obj): the data of the event.
| __init__ | python | bigchaindb/bigchaindb | bigchaindb/events.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/events.py | Apache-2.0 |
def get_subscriber_queue(self, event_types=None):
"""Create a new queue for a specific combination of event types
and return it.
Returns:
a :class:`multiprocessing.Queue`.
Raises:
RuntimeError if called after `run`
"""
try:
self.start... | Create a new queue for a specific combination of event types
and return it.
Returns:
a :class:`multiprocessing.Queue`.
Raises:
RuntimeError if called after `run`
| get_subscriber_queue | python | bigchaindb/bigchaindb | bigchaindb/events.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/events.py | Apache-2.0 |
def dispatch(self, event):
"""Given an event, send it to all the subscribers.
Args
event (:class:`~bigchaindb.events.EventTypes`): the event to
dispatch to all the subscribers.
"""
for event_types, queues in self.queues.items():
if event.type & e... | Given an event, send it to all the subscribers.
Args
event (:class:`~bigchaindb.events.EventTypes`): the event to
dispatch to all the subscribers.
| dispatch | python | bigchaindb/bigchaindb | bigchaindb/events.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/events.py | Apache-2.0 |
def filter_spent_outputs(self, outputs):
"""Remove outputs that have been spent
Args:
outputs: list of TransactionLink
"""
links = [o.to_dict() for o in outputs]
txs = list(query.get_spending_transactions(self.connection, links))
spends = {TransactionLink.fro... | Remove outputs that have been spent
Args:
outputs: list of TransactionLink
| filter_spent_outputs | python | bigchaindb/bigchaindb | bigchaindb/fastquery.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/fastquery.py | Apache-2.0 |
def filter_unspent_outputs(self, outputs):
"""Remove outputs that have not been spent
Args:
outputs: list of TransactionLink
"""
links = [o.to_dict() for o in outputs]
txs = list(query.get_spending_transactions(self.connection, links))
spends = {TransactionLi... | Remove outputs that have not been spent
Args:
outputs: list of TransactionLink
| filter_unspent_outputs | python | bigchaindb/bigchaindb | bigchaindb/fastquery.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/fastquery.py | Apache-2.0 |
def __init__(self, connection=None):
"""Initialize the Bigchain instance
A Bigchain instance has several configuration parameters (e.g. host).
If a parameter value is passed as an argument to the Bigchain
__init__ method, then that is the value it will have.
Otherwise, the param... | Initialize the Bigchain instance
A Bigchain instance has several configuration parameters (e.g. host).
If a parameter value is passed as an argument to the Bigchain
__init__ method, then that is the value it will have.
Otherwise, the parameter value will come from an environment variabl... | __init__ | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def update_utxoset(self, transaction):
"""Update the UTXO set given ``transaction``. That is, remove
the outputs that the given ``transaction`` spends, and add the
outputs that the given ``transaction`` creates.
Args:
transaction (:obj:`~bigchaindb.models.Transaction`): A ne... | Update the UTXO set given ``transaction``. That is, remove
the outputs that the given ``transaction`` spends, and add the
outputs that the given ``transaction`` creates.
Args:
transaction (:obj:`~bigchaindb.models.Transaction`): A new
transaction incoming into the sy... | update_utxoset | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def store_unspent_outputs(self, *unspent_outputs):
"""Store the given ``unspent_outputs`` (utxos).
Args:
*unspent_outputs (:obj:`tuple` of :obj:`dict`): Variable
length tuple or list of unspent outputs.
"""
if unspent_outputs:
return backend.query... | Store the given ``unspent_outputs`` (utxos).
Args:
*unspent_outputs (:obj:`tuple` of :obj:`dict`): Variable
length tuple or list of unspent outputs.
| store_unspent_outputs | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def get_unspent_outputs(self):
"""Get the utxoset.
Returns:
generator of unspent_outputs.
"""
cursor = backend.query.get_unspent_outputs(self.connection)
return (record for record in cursor) | Get the utxoset.
Returns:
generator of unspent_outputs.
| get_unspent_outputs | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def delete_unspent_outputs(self, *unspent_outputs):
"""Deletes the given ``unspent_outputs`` (utxos).
Args:
*unspent_outputs (:obj:`tuple` of :obj:`dict`): Variable
length tuple or list of unspent outputs.
"""
if unspent_outputs:
return backend.qu... | Deletes the given ``unspent_outputs`` (utxos).
Args:
*unspent_outputs (:obj:`tuple` of :obj:`dict`): Variable
length tuple or list of unspent outputs.
| delete_unspent_outputs | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def get_transactions_filtered(self, asset_id, operation=None, last_tx=None):
"""Get a list of transactions filtered on some criteria
"""
txids = backend.query.get_txids_filtered(self.connection, asset_id,
operation, last_tx)
for txid in tx... | Get a list of transactions filtered on some criteria
| get_transactions_filtered | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def get_outputs_filtered(self, owner, spent=None):
"""Get a list of output links filtered on some criteria
Args:
owner (str): base58 encoded public_key.
spent (bool): If ``True`` return only the spent outputs. If
``False`` return only unspent outputs. I... | Get a list of output links filtered on some criteria
Args:
owner (str): base58 encoded public_key.
spent (bool): If ``True`` return only the spent outputs. If
``False`` return only unspent outputs. If spent is
not specified (``None``) ... | get_outputs_filtered | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def get_block(self, block_id):
"""Get the block with the specified `block_id`.
Returns the block corresponding to `block_id` or None if no match is
found.
Args:
block_id (int): block id of the block to get.
"""
block = backend.query.get_block(self.connectio... | Get the block with the specified `block_id`.
Returns the block corresponding to `block_id` or None if no match is
found.
Args:
block_id (int): block id of the block to get.
| get_block | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def get_block_containing_tx(self, txid):
"""Retrieve the list of blocks (block ids) containing a
transaction with transaction id `txid`
Args:
txid (str): transaction id of the transaction to query
Returns:
Block id list (list(int))
"""
blocks ... | Retrieve the list of blocks (block ids) containing a
transaction with transaction id `txid`
Args:
txid (str): transaction id of the transaction to query
Returns:
Block id list (list(int))
| get_block_containing_tx | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def validate_transaction(self, tx, current_transactions=[]):
"""Validate a transaction against the current status of the database."""
transaction = tx
# CLEANUP: The conditional below checks for transaction in dict format.
# It would be better to only have a single format for the trans... | Validate a transaction against the current status of the database. | validate_transaction | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def migrate_abci_chain(self):
"""Generate and record a new ABCI chain ID. New blocks are not
accepted until we receive an InitChain ABCI request with
the matching chain ID and validator set.
Chain ID is generated based on the current chain and height.
`chain-X` => `chain-X-migra... | Generate and record a new ABCI chain ID. New blocks are not
accepted until we receive an InitChain ABCI request with
the matching chain ID and validator set.
Chain ID is generated based on the current chain and height.
`chain-X` => `chain-X-migrated-at-height-5`.
`chain-X-migrat... | migrate_abci_chain | python | bigchaindb/bigchaindb | bigchaindb/lib.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/lib.py | Apache-2.0 |
def setup_logging():
"""Function to configure log hadlers.
.. important::
Configuration, if needed, should be applied before invoking this
decorator, as starting the subscriber process for logging will
configure the root logger for the child process based on the
state of :obj:`... | Function to configure log hadlers.
.. important::
Configuration, if needed, should be applied before invoking this
decorator, as starting the subscriber process for logging will
configure the root logger for the child process based on the
state of :obj:`bigchaindb.config` at the mo... | setup_logging | python | bigchaindb/bigchaindb | bigchaindb/log.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/log.py | Apache-2.0 |
def validate(self, bigchain, current_transactions=[]):
"""Validate transaction spend
Args:
bigchain (BigchainDB): an instantiated bigchaindb.BigchainDB object.
Returns:
The transaction (Transaction) if the transaction is valid else it
raises an exception descr... | Validate transaction spend
Args:
bigchain (BigchainDB): an instantiated bigchaindb.BigchainDB object.
Returns:
The transaction (Transaction) if the transaction is valid else it
raises an exception describing the reason why the transaction is
invalid.
... | validate | python | bigchaindb/bigchaindb | bigchaindb/models.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/models.py | Apache-2.0 |
def merkleroot(hashes):
"""Computes the merkle root for a given list.
Args:
hashes (:obj:`list` of :obj:`bytes`): The leaves of the tree.
Returns:
str: Merkle root in hexadecimal form.
"""
# XXX TEMPORARY -- MUST REVIEW and possibly CHANGE
# The idea here is that the UTXO SET ... | Computes the merkle root for a given list.
Args:
hashes (:obj:`list` of :obj:`bytes`): The leaves of the tree.
Returns:
str: Merkle root in hexadecimal form.
| merkleroot | python | bigchaindb/bigchaindb | bigchaindb/tendermint_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/tendermint_utils.py | Apache-2.0 |
def public_key64_to_address(base64_public_key):
"""Note this only compatible with Tendermint 0.19.x"""
ed25519_public_key = public_key_from_base64(base64_public_key)
encoded_public_key = amino_encoded_public_key(ed25519_public_key)
return hashlib.new('ripemd160', encoded_public_key).hexdigest().upper() | Note this only compatible with Tendermint 0.19.x | public_key64_to_address | python | bigchaindb/bigchaindb | bigchaindb/tendermint_utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/tendermint_utils.py | Apache-2.0 |
def condition_details_has_owner(condition_details, owner):
"""Check if the public_key of owner is in the condition details
as an Ed25519Fulfillment.public_key
Args:
condition_details (dict): dict with condition details
owner (str): base58 public key of owner
Returns:
bool: True... | Check if the public_key of owner is in the condition details
as an Ed25519Fulfillment.public_key
Args:
condition_details (dict): dict with condition details
owner (str): base58 public key of owner
Returns:
bool: True if the public key is found in the condition details, False otherw... | condition_details_has_owner | python | bigchaindb/bigchaindb | bigchaindb/utils.py | https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/utils.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.