Best Python code snippet using slash
CardSchema.py
Source:CardSchema.py  
...34    def set_assignee(self, assignee):35        self.__assignee = assignee36    def get_assignee(self):37        return self.__assignee38    def set_reporter(self, reporter):39        self.__reporter = reporter40    def get_reporter(self):41        return self.__reporter42    def set_workLog(self, workLog):43        self.__workLog = workLog44    def get_workLog(self):45        return self.__workLog46    def set_comments(self, comments):47        self.__comments = comments48    def get_comments(self):49        return self.__comments50    def create(self):51        try:52            conn = bd_connect()53            cursor = conn.cursore()54            cursor.execute(f"""INSERT INTO public."Card" (id, title, description, status, type, priority, assignee, reporter, workLog, comments) 55                            VALUES ({self.__id}, '{self.__title}', '{self.__description}'56                            {self.__status}, {self.__type}, {self.__priority}, {self.__assignee}57                            {self.__reporter}, {self.__workLog}, {self.__comments})""")58            conn.commit()59            close_connect_cursor(conn, cursor)60            return True61        except:62            return None63    def update(self):64        try:65            conn = bd_connect()66            cursor = conn.cursore()67            cursor.execute(f"""UPDATE public."Card" 68                            SET title='{self.__title}', description='{self.__description}', 69                            status={self.__status}, type={self.__type}, 70                            priority={self.__priority}, assignee={self.__assignee}, 71                            reporter={self.__reporter}, workLog={self.__workLog}, 72                            comments={self.__comments}73                            WHERE id={self.__id}""")74            conn.commit()75            close_connect_cursor(conn, cursor)76            return True77        except:78            return None79    def remove(self):80        try:81            conn = bd_connect()82            cursor = conn.cursore()83            cursor.execute(f"""DELETE FROM public."Card" 84                            WHERE id={self.__id}""")85            conn.commit()86            close_connect_cursor(conn, cursor)87            return True88        except:89            return None90def getCards(filters, order):91    conn = bd_connect()92    cursor = conn.cursore()93    if filters == '' & order == '':94        cursor.execute('SELECT id, title, description, status, type, priority, assignee, reporter, workLog, comments FROM public."Card"')95        dict_like_arr = []96        for row in cursor.fetchall():97            if row != []:98                new_dict = {'id': row[0], 'title': row[1], 'description': row[2], 'type': row[3], 'priority': row[4],99                            'assignee': row[5], 'reporter': row[6], 'workLog': row[7], 'comments': row[8]}100                dict_like_arr.append(new_dict)101        close_connect_cursor(conn, cursor)102        return dict_like_arr103def createCard(creation_fields):104    conn = bd_connect()105    cursor = conn.cursore()106    id = 123107    card = Card(id)108    cursor.execute('''SELECT id FROM public."Statuses"'109                   WHEN id=1''')110    origin_status = cursor.fetch()111    card.set_status(origin_status[0])112    card.set_title(creation_fields['title'])113    card.set_type(creation_fields['type'])114    card.set_assignee(creation_fields['assignee'])115    card.set_reporter(creation_fields['reporter'])116    card.set_description(creation_fields['description'])117    card.set_priority(creation_fields['priority'])118    close_connect_cursor(conn, cursor)119    return card.create()120def updateCard(fields):121    card = Card(fields['id'])122    card.set_title(fields['title'])123    card.set_type(fields['type'])124    card.set_status(fields['status'])125    card.set_assignee(fields['assignee'])126    card.set_reporter(fields['reporter'])127    card.set_comments(fields['comments'])128    card.set_description(fields['description'])129    card.set_priority(fields['priority'])130    card.set_workLog(fields['workLog'])131    return card.update()132def removeCard(id):133    prop = Card(id)...mediator_pattern.py
Source:mediator_pattern.py  
...59        rvalue = self._db.insert()60        if rvalue == -1:61            self._tc.set_problem(1)62            self._reporter.prepare()63    def set_reporter(self, reporter):64        self._reporter = reporter65    def set_db(self, db):66        self._db = db67    def publish_reporting(self):68        self._db.update()69        self._reporter.report()70    def set_tc(self, tc):71        self._tc = tc72def main():73    reporter = Reporter()74    db = DB()75    tm = TestManager()76    tm.set_reporter(reporter)77    tm.set_db(db)78    reporter.set_tm(tm)79    db.set_tm(tm)80    for i in range(3):81        tc = TC()82        tc.set_tm(tm)83        tm.set_tc(tc)84        tc.setup()85        tc.execute()86        tc.tear_down()87if __name__ == '__main__':...__init__.py
Source:__init__.py  
1#!/usr/bin/python2#3# Copyright 2020 Google LLC4#5# Licensed under the Apache License, Version 2.0 (the "License");6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9#      http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16from uv.reporter.base import AbstractReporter17from uv.reporter.state import (active_reporter, get_reporter, report,18                               report_all, report_param, report_params,19                               set_reporter, start_run)20from uv.reporter.store import LoggingReporter, MemoryReporter21from ._version import get_versions22__version__ = get_versions()['version']23del get_versions24__all__ = [25    "active_reporter",26    "get_reporter",27    "set_reporter",28    "report",29    "report_all",30    "report_param",31    "report_params",32    "start_run",33    "AbstractReporter",34    "LoggingReporter",35    "MemoryReporter",...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!!
