Best Python code snippet using pandera_python
setup.py
Source:setup.py
1# Copyright 2015, Google Inc.2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are6# met:7#8# * Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer.10# * Redistributions in binary form must reproduce the above11# copyright notice, this list of conditions and the following disclaimer12# in the documentation and/or other materials provided with the13# distribution.14# * Neither the name of Google Inc. nor the names of its15# contributors may be used to endorse or promote products derived from16# this software without specific prior written permission.17#18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29"""A setup module for the GRPC Python package."""30from distutils import core as _core31_EXTENSION_SOURCES = (32 'grpc/_adapter/_c.c',33 'grpc/_adapter/_call.c',34 'grpc/_adapter/_channel.c',35 'grpc/_adapter/_completion_queue.c',36 'grpc/_adapter/_error.c',37 'grpc/_adapter/_server.c',38 'grpc/_adapter/_client_credentials.c',39 'grpc/_adapter/_server_credentials.c',40)41_EXTENSION_INCLUDE_DIRECTORIES = (42 '.',43)44_EXTENSION_LIBRARIES = (45 'grpc',46 'gpr',47 'rt',48)49_EXTENSION_MODULE = _core.Extension(50 'grpc._adapter._c', sources=list(_EXTENSION_SOURCES),51 include_dirs=list(_EXTENSION_INCLUDE_DIRECTORIES),52 libraries=list(_EXTENSION_LIBRARIES),53 )54_PACKAGES = (55 'grpc',56 'grpc._adapter',57 'grpc._junkdrawer',58 'grpc.early_adopter',59 'grpc.framework',60 'grpc.framework.alpha',61 'grpc.framework.base',62 'grpc.framework.common',63 'grpc.framework.face',64 'grpc.framework.face.testing',65 'grpc.framework.foundation',66)67_PACKAGE_DIRECTORIES = {68 'grpc': 'grpc',69 'grpc._adapter': 'grpc/_adapter',70 'grpc._junkdrawer': 'grpc/_junkdrawer',71 'grpc.early_adopter': 'grpc/early_adopter',72 'grpc.framework': 'grpc/framework',73}74_core.setup(75 name='grpc-2015', version='0.4.0',76 ext_modules=[_EXTENSION_MODULE], packages=list(_PACKAGES),...
test_util.py
Source:test_util.py
1from unittest import IsolatedAsyncioTestCase2from tests.util import *3from bluez_peripheral.util import *4class TestUtil(IsolatedAsyncioTestCase):5 async def asyncSetUp(self) -> None:6 self._bus = await get_message_bus()7 await bluez_available_or_skip(self._bus)8 self._adapter = await get_first_adapter_or_skip(self._bus)9 async def asyncTearDown(self) -> None:10 self._bus.disconnect()11 async def test_get_first(self):12 if not len(await Adapter.get_all(self._bus)) > 0:13 with self.assertRaises(ValueError):14 Adapter.get_first(self._bus)15 else:16 assert type(await Adapter.get_first(self._bus)) == Adapter17 async def test_alias_set(self):18 await self._adapter.set_alias("Some test name")19 assert await self._adapter.get_alias() == "Some test name"20 async def test_alias_clear(self):21 await self._adapter.set_alias("")22 assert await self._adapter.get_alias() == await self._adapter.get_name()23 async def test_powered(self):24 initial_powered = await self._adapter.get_powered()25 await self._adapter.set_powered(False)26 assert await self._adapter.get_powered() == False27 await self._adapter.set_powered(True)28 assert await self._adapter.get_powered() == True...
adapter.py
Source:adapter.py
1import dbus2ADAPTER_INTERFACE = "org.bluez.Adapter1"3class Adapter:4 def __init__(self, bus: dbus.SystemBus, adapter_name: str = "hci0"):5 self._dbus = bus6 self._adapter = dbus.Interface(7 self._dbus.get_object("org.bluez", f"/org/bluez/{adapter_name}"),8 "org.freedesktop.DBus.Properties",9 )10 @property11 def alias(self) -> str:12 return self._adapter.Get(ADAPTER_INTERFACE, "Alias")13 @alias.setter14 def alias(self, value: str):15 self._adapter.Set(ADAPTER_INTERFACE, "Alias", dbus.String(value))16 @property17 def powered(self) -> bool:18 return self._adapter.Get(ADAPTER_INTERFACE, "Powered")19 @powered.setter20 def powered(self, value: bool):21 self._adapter.Set(ADAPTER_INTERFACE, "Powered", value)22 @property23 def discoverable(self) -> bool:24 return self._adapter.Get(ADAPTER_INTERFACE, "Discoverable")25 @discoverable.setter26 def discoverable(self, value: bool):27 self._adapter.Set(ADAPTER_INTERFACE, "Discoverable", value)28 @property29 def discoverable_timeout(self) -> int:30 return self._adapter.Get(ADAPTER_INTERFACE, "DiscoverableTimeout")31 @discoverable_timeout.setter32 def discoverable_timeout(self, value: int):...
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!!