How to use is_arm method in testcontainers-python

Best Python code snippet using testcontainers-python_python

__init__.py

Source:__init__.py Github

copy

Full Screen

1# coding:utf-82from . import ez_webdriver3def chrome(version="auto", path=None, name="chromedriver", os_type=None, is_arm=False) -> str:4 """5 version: 三种参数 auto(匹配当前版本) latest(最新版本) x.x(指定版本,2级就够,太细的版本可能匹配不到)6 path: 可以是目录(指定放置驱动文件的目录),可以是文件(指定驱动文件的路径)7 name: 下载的驱动文件名称(下载的文件名,除非镜像源的文件改名了,否则不要改动)8 os_type: 默认自动,手动填入系统信息,e.g. "win64" , "linux32-arm", "mac64 arm"9 is_arm: 默认自动,是否ARM架构,匹配对应 arm/aarch64 驱动10 """11 return ez_webdriver.chrome(version=version, path=path, name=name, os_type=os_type, is_arm=is_arm)12def firefox(version="auto", path=None, name="geckodriver", os_type=None, is_arm=False) -> str:13 """14 version: 三种参数 auto(匹配当前版本) latest(最新版本) x.x(指定版本,2级就够,太细的版本可能匹配不到)15 path: 可以是目录(指定放置驱动文件的目录),可以是文件(指定驱动文件的路径)16 name: 下载的驱动文件名称(下载的文件名,除非镜像源的文件改名了,否则不要改动)17 os_type: 默认自动,手动填入系统信息,e.g. "win64" , "linux32-arm", "mac64 arm"18 is_arm: 默认自动,是否ARM架构,匹配对应 arm/aarch64 驱动19 """20 return ez_webdriver.firefox(version=version, path=path, name=name, os_type=os_type, is_arm=is_arm)21def edge(version="auto", path=None, name="edgedriver", os_type=None, is_arm=False) -> str:22 """23 version: 三种参数 auto(匹配当前版本) latest(最新版本) x.x(指定版本,2级就够,太细的版本可能匹配不到)24 path: 可以是目录(指定放置驱动文件的目录),可以是文件(指定驱动文件的路径)25 name: 下载的驱动文件名称(下载的文件名,除非镜像源的文件改名了,否则不要改动)26 os_type: 默认自动,手动填入系统信息,e.g. "win64" , "linux32-arm", "mac64 arm"27 is_arm: 默认自动,是否ARM架构,匹配对应 arm/aarch64 驱动28 """29 return ez_webdriver.edge(version=version, path=path, name=name, os_type=os_type, is_arm=is_arm)30def ie(version="auto", path=None, name="IEDriverServer", os_type=None, is_arm=False) -> str:31 """32 version: 三种参数 auto(匹配当前版本) latest(最新版本) x.x(指定版本,2级就够,太细的版本可能匹配不到)33 path: 可以是目录(指定放置驱动文件的目录),可以是文件(指定驱动文件的路径)34 name: 下载的驱动文件名称(下载的文件名,除非镜像源的文件改名了,否则不要改动)35 os_type: 默认自动,手动填入系统信息,e.g. "win64" , "linux32-arm", "mac64 arm"36 is_arm: 默认自动,是否ARM架构,匹配对应 arm/aarch64 驱动37 """38 return ez_webdriver.ie(version=version, path=path, name=name, os_type=os_type, is_arm=is_arm)39def clear(path=None) -> None:40 """41 path: 指定清除的目录(会删除目录下所有文件)42 清除驱动缓存,清空默认目录 _webdriver 下所有内容43 (适用驱动文件损坏情况,本模块每种浏览器仅保留一个冗余旧版本)44 """...

Full Screen

Full Screen

setup.py

Source:setup.py Github

copy

Full Screen

1#2# ICRAR - International Centre for Radio Astronomy Research3# (c) UWA - The University of Western Australia, 20144# Copyright by UWA (in the framework of the ICRAR)5# All rights reserved6#7# This library is free software; you can redistribute it and/or8# modify it under the terms of the GNU Lesser General Public9# License as published by the Free Software Foundation; either10# version 2.1 of the License, or (at your option) any later version.11#12# This library is distributed in the hope that it will be useful,13# but WITHOUT ANY WARRANTY; without even the implied warranty of14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15# Lesser General Public License for more details.16#17# You should have received a copy of the GNU Lesser General Public18# License along with this library; if not, write to the Free Software19# Foundation, Inc., 59 Temple Place, Suite 330, Boston,20# MA 02111-1307 USA21#22import glob23import platform24import distutils.ccompiler25from setuptools import setup, Extension26from setuptools.command.build_ext import build_ext27crcmod_ext = Extension('crc32c',28 define_macros=[('NDEBUG', None)],29 depends=glob.glob('*.h'),30 language='c',31 sources=['_crc32c.c', 'checkarm.c', 'checksse42.c', 'crc32c_adler.c', 'crc32c_arm64.c', 'crc32c_sw.c'],32 include_dirs=['.'])33def get_extra_compile_args(is_intel, is_arm):34 # msvc is treated specially; otherwise we assume it's a unix compiler35 comp = distutils.ccompiler.get_default_compiler()36 if comp == 'msvc':37 return ['/O2']38 elif is_intel:39 return ['-O3', '-msse4.2', '-mpclmul']40 elif is_arm:41 return ['-O3', '-march=armv8-a+crc+crypto']42 else:43 return ['-O3']44class _build_ext(build_ext):45 """Custom build_ext command that includes extra compilation arguments"""46 user_options = build_ext.user_options + [47 ('platform=', None, 'The target platform name')]48 def initialize_options(self):49 build_ext.initialize_options(self)50 self.platform = platform.machine()51 def run(self):52 assert(len(self.distribution.ext_modules) == 1)53 platform = self.platform.lower()54 is_intel = platform in ['x86_64', 'amd64', 'i386', 'i686']55 is_arm = platform in ['aarch64_be', 'aarch64', 'armv8b', 'armv8l']56 distutils.log.info("platform: %s, is_intel: %d, is_arm: %d", platform, is_intel, is_arm)57 self.distribution.ext_modules[0].extra_compile_args = get_extra_compile_args(is_intel, is_arm)58 if is_intel:59 self.distribution.ext_modules[0].define_macros += [('IS_INTEL', None)]60 elif is_arm:61 self.distribution.ext_modules[0].define_macros += [('IS_ARM', None)]62 build_ext.run(self)63classifiers = [64 # There's no more specific classifier for LGPLv2.1+65 "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",66 "Operating System :: OS Independent",67 "Programming Language :: C",68 "Programming Language :: Python :: 2.7",69 "Programming Language :: Python :: 3.2",70 "Programming Language :: Python :: 3.3",71 "Programming Language :: Python :: 3.4",72 "Programming Language :: Python :: 3.5",73 "Programming Language :: Python :: 3.6",74 "Programming Language :: Python :: 3.7",75 "Programming Language :: Python :: 3.8",76 "Programming Language :: Python :: 3.9",77]78with open('README.rst', 'rt') as f:79 long_description = f.read()80setup(name='crc32c',81 author='The ICRAR DIA Team',82 url='https://github.com/ICRAR/crc32c',83 author_email='rtobar@icrar.org',84 version='2.2',85 license="LGPLv2.1+",86 description=('A python package implementing the crc32c algorithm'87 'in hardware and software'),88 long_description=long_description,89 long_description_content_type='text/x-rst',90 classifiers=classifiers,91 ext_modules=[crcmod_ext],92 cmdclass = {'build_ext': _build_ext},...

Full Screen

Full Screen

mobile.py

Source:mobile.py Github

copy

Full Screen

1def mobile(left, right):2 """Construct a mobile from a left arm and a right arm."""3 assert is_arm(left), "left must be a arm"4 assert is_arm(right), "right must be a arm"5 return ['mobile', left, right]6def is_mobile(m):7 """Return whether m is a mobile."""8 return type(m) == list and len(m) == 3 and m[0] == 'mobile'9def left(m):10 """Select the left arm of a mobile."""11 assert is_mobile(m), "must call left on a mobile"12 return m[1]13def right(m):14 """Select the right arm of a mobile."""15 assert is_mobile(m), "must call right on a mobile"16 return m[2]17# The constructor and selectors of the arm18def arm(length, mobile_or_planet):19 """Construct a arm: a length of rod with a mobile or planet at the end."""20 assert is_mobile(mobile_or_planet) or is_planet(mobile_or_planet)21 return ['arm', length, mobile_or_planet]22def is_arm(s):23 """Return whether s is a arm."""24 return type(s) == list and len(s) == 3 and s[0] == 'arm'25def length(s):26 """Select the length of a arm."""27 assert is_arm(s), "must call length on a arm"28 return s[1]29def end(s):30 """Select the mobile or planet hanging at the end of a arm."""31 assert is_arm(s), "must call end on a arm"32 return s[2]33# The constructor and selectors of the planet34def planet(size):35 """Construct a planet of some size."""36 assert size > 037 return ['planet', size]38def size(w):39 """Select the size of a planet."""40 assert is_planet(w), 'must call size on a planet'41 return w[1]42def is_planet(w):43 """Whether w is a planet."""44 return type(w) == list and len(w) == 2 and w[0] == 'planet'45def examples():46 t = mobile(arm(1, planet(2)), arm(2, planet(1)))47 u = mobile(arm(5, planet(1)),48 arm(1, mobile(arm(2, planet(3)),49 arm(3, planet(2)))))50 v = mobile(arm(4, t), arm(2, u))51 return (t, u, v)52def total_weight(m):53 """Return the total weight of m, a planet or mobile.54 >>> t, u, v = examples()55 >>> total_weight(t)56 357 >>> total_weight(u)58 659 >>> total_weight(v)60 961 """62 if is_planet(m):63 return size(m)64 else:65 assert is_mobile(m), "must get total weight of a mobile or a planet"66 return total_weight(end(left(m))) + total_weight(end(right(m)))67def balanced(m):68 """Return whether m is balanced.69 >>> t, u, v = examples()70 >>> balanced(t)71 True72 >>> balanced(v)73 True74 >>> w = mobile(arm(3, t), arm(2, u))75 >>> balanced(w)76 False77 >>> balanced(mobile(arm(1, v), arm(1, w)))78 False79 >>> balanced(mobile(arm(1, w), arm(1, v)))80 False81 """82 def torque(arm):83 return total_weight(end(arm)) * length(arm)84 if is_planet(m):85 return True86 return balanced(end(left(m))) and balanced(end(right(m))) and \87 torque(left(m)) == torque(right(m))88def show_mobile(m) -> str:89 if is_mobile(m):90 return 'mobile({}, {})'.format(show_mobile(left(m)), show_mobile(right(m)))91 elif is_arm(m):92 return 'arm({}, {})'.format(length(m), show_mobile(end(m)))93 elif is_planet(m):94 return 'planet({})'.format(size(m))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run testcontainers-python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful