Best Python code snippet using yandex-tank
top_view_preview.py
Source:top_view_preview.py  
...18        self.square_size = self.scaleSlider.value()19        self.x = self.horizontalSlider.value()20        self.y = self.verticalSlider.value()21        self.transform_matrix = np.ones((3, 3), dtype=np.float32)22        self.update_view()23        self.horizontalSlider.valueChanged.connect(self.update_x)24        self.verticalSlider.valueChanged.connect(self.update_y)25        self.scaleSlider.valueChanged.connect(self.update_scale)26    def init(self, frame: np.ndarray, source_square: list):27        self.image = frame28        self.source_square = np.asarray(source_square, dtype=np.float32)29        self.pixmap_item.setPixmap(QtGui.QPixmap.fromImage(cv_to_qimage(frame)))30        self.update_view()31    def update_view(self):32        if self.source_square is None or self.image is None:33            return34        dest_square = np.asarray([35            [self.x, self.y],36            [self.x + self.square_size, self.y],37            [self.x + self.square_size, self.y + self.square_size],38            [self.x, self.y + self.square_size]39        ], dtype=np.float32)40        self.data_changed.emit((dest_square.tolist(), self.square_size))41        self.transform_matrix = cv.getPerspectiveTransform(self.source_square, dest_square)42        self.update()43    def update_x(self, x):44        self.x = x45        self.update_view()46    def update_y(self, y):47        self.y = y48        self.update_view()49    def update_scale(self, scale):50        self.square_size = scale51        self.update_view()52    def paintEvent(self, event):53        if self.image is None or self.source_square is None:54            return55        transformed = cv.warpPerspective(self.image, self.transform_matrix, (1000, 1000))56        self.pixmap_item.setPixmap(QtGui.QPixmap.fromImage(cv_to_qimage(transformed)))57        self.graphicsView.fitInView(self.pixmap_item, QtCore.Qt.KeepAspectRatio)58        super().paintEvent(event)59if __name__ == '__main__':60    import sys61    app = QtWidgets.QApplication(sys.argv)62    source_square = [(265.0, 461.0), (427.5, 459.5), (399.5, 628.0), (208.5, 633.0)]63    frame = cv.imread('/Users/maksim/Projects/SocialDistance/SocialDistance/social_distance/core/vid1.jpg')64    w = TopViewPreview()65    w.init(frame, source_square)...__init__.py
Source:__init__.py  
1#############################################################################2#3#4#   Production definition to the update tab to BFA v.5 standalone5#6#7#############################################################################8""" These are the production instructions for the bfa update view of the webclient.9    Dependencies:10        bfassist <- (standalone.)webclient <- update11            |                       |12            |                       |-> webclient13            |                       \-> bodies14            \                        -> headings15             -> standalone -> webclient -> update -> production @build16        note::  Author(s): Mitch last-edit: last-check: 08.07.2021 """17from bfassist.standalone.webclient.webclient import *18from bfassist.standalone.webclient.bodies import *19from bfassist.standalone.webclient.headings import *20# noinspection PyUnusedLocal21def __preload__(forClient: bool = True):22    pass23# noinspection PyUnusedLocal24def __postload__(forClient: bool = True):25    pass26UPDATE_VIEW = View("update", "Update", "Update view of the bfa webclient. Place to check for updates and installing "27                                       "them.")28def build():29    global UPDATE_VIEW30    from bfassist.standalone.webclient.update.production import injectUpdatePort, styleUpdatePort, onLoadFunction31    UPDATE_VIEW.addStyleSheetFromForeignView(ONLINE_VIEW)32    UPDATE_VIEW.addScriptFromForeignView(ONLINE_VIEW)33    UPDATE_VIEW.setTitle("BF-A Web Client Updates")34    UPDATE_VIEW += createH1("BF-A Web Client Setup")35    UPDATE_VIEW += injectUpdatePort(*createClientPort())36    UPDATE_VIEW += styleUpdatePort()37    UPDATE_VIEW.HTML_DOCUMENT.body.properties = {'onload': onLoadFunction.name + "()"}38UPDATE_VIEW.build = build39if __name__ == "__main__":40    UPDATE_VIEW.build()...hellobutton.py
Source:hellobutton.py  
...8    # my_text = "Default value"9    counter = 010    def build(self):11        Window.size = (400, 300)12        self.update_view()13        return14    def change(self, amount):15        self.counter += amount16        self.update_view()17    def set(self, amount):18        self.counter = amount19        self.update_view()20    def update_view(self):21        self.my_text = f"Counter = {self.counter}"22    ...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
