Best Python code snippet using fMBT_python
__init__.py
Source: __init__.py
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3"""4Views for WPS-XML endpoint implemented with :mod:`pywps`.5"""6import logging7from cornice.service import Service8from pyramid.settings import asbool9from weaver.formats import ContentType, OutputFormat10from weaver.utils import get_settings11from weaver.wps.utils import get_wps_path12def includeme(config):13 from weaver.wps.app import pywps_view14 from weaver.wps_restapi import swagger_definitions as sd15 settings = get_settings(config)16 logger = logging.getLogger(__name__)17 if not asbool(settings.get("weaver.wps", True)):18 logger.debug("Weaver WPS disable. WPS KVP/XML endpoint will not be available.")19 else:20 logger.debug("Weaver WPS enabled.")21 wps_path = get_wps_path(settings)22 wps_service = Service(name="wps", path=wps_path, content_type=ContentType.TEXT_XML)23 logger.debug("Adding WPS KVP/XML schemas.")24 wps_tags = [sd.TAG_GETCAPABILITIES, sd.TAG_DESCRIBEPROCESS, sd.TAG_EXECUTE, sd.TAG_WPS]25 wps_service.add_view("GET", pywps_view, tags=wps_tags, renderer=OutputFormat.XML,26 schema=sd.WPSEndpointGet(), response_schemas=sd.wps_responses)27 wps_service.add_view("POST", pywps_view, tags=wps_tags, renderer=OutputFormat.XML,28 schema=sd.WPSEndpointPost(), response_schemas=sd.wps_responses)29 logger.debug("Adding WPS KVP/XML view.")30 config.add_route(**sd.service_api_route_info(wps_service, settings))...
OracleDBConnection.py
Source: OracleDBConnection.py
1# Script to Connect to Oracle Database for Python ( Valid for Oracle 11 Version with additional client install Oracle net2# For Error Cannot locate a 64-bit Oracle Client library download below according to you system Windows 32 or 64 bit or other system3# download client https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html4import cx_Oracle5import sys6import os7try:8 if sys.platform.startswith("darwin"):9 lib_dir = os.path.join(os.environ.get("HOME"), "Downloads",10 "instantclient_19_8")11 cx_Oracle.init_oracle_client(lib_dir=lib_dir)12 elif sys.platform.startswith("win32"):13 print("You are on win32 platform !")14 lib_dir=r"C:\oraclexe\instantclient_19_11"15 cx_Oracle.init_oracle_client(lib_dir=lib_dir)16 v_tag = " Tag_Connect "17 con = cx_Oracle.connect("CDI", "CDI", "localhost/xe")18 print("Connected!")19 v_tag = " Tag_execute "20 cursor = con.cursor()21 query = cursor.execute(" select * from CUSTOMER ")22 results = cursor.fetchall()23 v_tag = " Tag_results "24 if results:25 for result in results:26 print(result)27 print("Results Completed")28 else:29 print("No Word found")30 con.close()31except Exception as err:32 print("Error Occured at step : % s" % v_tag)33 print(err);...
asm_signature_consts.py
Source: asm_signature_consts.py
1FLAG_OS_TYPE = 'os'2ATTR_NAME = 'name'3TAG_APPLICATION = 'Application'4ATTR_PRODUCT_NAME = 'productName'5ATTR_CIT = 'cit'6TAG_COMMAND_LINE = 'CommandLine'7FLAG_INCLUDE_PARENT_PROCESSES = 'includeParentProcesses'8TAG_PATH = 'Path'9FLAG_INCLUDE_SUB = 'includeSub'10TAG_EXECUTE = 'Execute'11TAG_FILE = 'File'12FLAG_COLLECT = 'collect'13TAG_FILE_LOCATIONS = 'FileLocations'14TAG_REGEX = 'Regex'15ATTR_REGEX_FLAG = 'flag'16FLAG_IGNORE_CASE = 'ignoreCase'17TAG_VARIABLE = 'Variable'18ATTR_DEFAULT_VALUE = 'defaultValue'19TAG_XPATH = 'XPath'20TAG_XPATH_VARIABLE = 'XPathVariable'21ATTR_XPATH = 'xpath'22ATTR_RELATIVE_PATH = 'relativePath'23TAG_PROPERTY = 'Property'24TAG_PROPERTY_VARIABLE = 'PropertyVariable'25ATTR_KEY = 'key'26TAG_PYTHON_VARIABLE = 'PythonVariable'27TAG_SYSTEM_VARIABLE = 'SystemVariable'28TAG_OUTPUT = 'Output'29TAG_SCP = 'SCP'30TAG_CI = 'CI'31ATTR_RELATION = 'relation'32class OSType:33 Both = 'both'34 Win = 'win'35 Unix = 'unix'36 Unknown = 'unknown'37 @classmethod38 def fromShell(cls, shell):39 isWinOs = shell.isWinOs()40 if isWinOs is None:41 return cls.Unknown42 return cls.Win if isWinOs else cls.Unix43 @classmethod44 def match(cls, condition, shell):45 shellValue = cls.fromShell(shell)46 if condition == cls.Both:47 return True...
Check out the latest blogs from LambdaTest on this topic:
Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
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!!