Best Python code snippet using fMBT_python
patch-setup-osx.py
Source:patch-setup-osx.py
1--- setup-osx.py 2006-04-25 00:34:28.000000000 +02002+++ setup-osx.py.new 2007-04-15 21:49:20.000000000 +02003@@ -1,6 +1,9 @@4 from distutils.core import setup5 from distutils.extension import Extension6 from Pyrex.Distutils import build_ext7+8+glew_include_dirs=['/opt/local/include']9+10 setup(11 name = "glewpy",12 version = '0.7.4',13@@ -16,31 +19,31 @@14 'examples/oneshot.py',15 'examples/logo2.jpg']},16 ext_modules=[17- Extension('glew', ['src/glew.pyx'], extra_link_args = ['-framework', 'OpenGL']),18- Extension('gl.threedfx', ['src/gl/threedfx.pyx'], extra_link_args = ['-framework', 'OpenGL']),19- Extension('gl.apple', ['src/gl/apple.pyx'], extra_link_args = ['-framework', 'OpenGL']),20- Extension('gl.arb', ['src/gl/arb.pyx'], extra_link_args = ['-framework', 'OpenGL']),21- Extension('gl.ati', ['src/gl/ati.pyx'], extra_link_args = ['-framework', 'OpenGL']),22- Extension('gl.atix', ['src/gl/atix.pyx'], extra_link_args = ['-framework', 'OpenGL']),23- Extension('gl.ext', ['src/gl/ext.pyx'], extra_link_args = ['-framework', 'OpenGL']),24- Extension('gl.gl', ['src/gl/gl.pyx'], extra_link_args = ['-framework', 'OpenGL']),25- Extension('gl.hp', ['src/gl/hp.pyx'], extra_link_args = ['-framework', 'OpenGL']),26- Extension('gl.ibm', ['src/gl/ibm.pyx'], extra_link_args = ['-framework', 'OpenGL']),27- Extension('gl.ingr', ['src/gl/ingr.pyx'], extra_link_args = ['-framework', 'OpenGL']),28- Extension('gl.intel', ['src/gl/intel.pyx'], extra_link_args = ['-framework', 'OpenGL']),29- Extension('gl.ktx', ['src/gl/ktx.pyx'], extra_link_args = ['-framework', 'OpenGL']),30- Extension('gl.mesa', ['src/gl/mesa.pyx'], extra_link_args = ['-framework', 'OpenGL']),31- Extension('gl.nv', ['src/gl/nv.pyx'], extra_link_args = ['-framework', 'OpenGL']),32- Extension('gl.oml', ['src/gl/oml.pyx'], extra_link_args = ['-framework', 'OpenGL']),33- Extension('gl.pgi', ['src/gl/pgi.pyx'], extra_link_args = ['-framework', 'OpenGL']),34- Extension('gl.rend', ['src/gl/rend.pyx'], extra_link_args = ['-framework', 'OpenGL']),35- Extension('gl.s3', ['src/gl/s3.pyx'], extra_link_args = ['-framework', 'OpenGL']),36- Extension('gl.sgis', ['src/gl/sgis.pyx'], extra_link_args = ['-framework', 'OpenGL']),37- Extension('gl.sgix', ['src/gl/sgix.pyx'], extra_link_args = ['-framework', 'OpenGL']),38- Extension('gl.sgi', ['src/gl/sgi.pyx'], extra_link_args = ['-framework', 'OpenGL']),39- Extension('gl.sunx', ['src/gl/sunx.pyx'], extra_link_args = ['-framework', 'OpenGL']),40- Extension('gl.sun', ['src/gl/sun.pyx'], extra_link_args = ['-framework', 'OpenGL']),41- Extension('gl.win', ['src/gl/win.pyx'], extra_link_args = ['-framework', 'OpenGL'])42+ Extension('glew', ['src/glew.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),43+ Extension('gl.threedfx', ['src/gl/threedfx.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),44+ Extension('gl.apple', ['src/gl/apple.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),45+ Extension('gl.arb', ['src/gl/arb.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),46+ Extension('gl.ati', ['src/gl/ati.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),47+ Extension('gl.atix', ['src/gl/atix.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),48+ Extension('gl.ext', ['src/gl/ext.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),49+ Extension('gl.gl', ['src/gl/gl.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),50+ Extension('gl.hp', ['src/gl/hp.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),51+ Extension('gl.ibm', ['src/gl/ibm.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),52+ Extension('gl.ingr', ['src/gl/ingr.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),53+ Extension('gl.intel', ['src/gl/intel.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),54+ Extension('gl.ktx', ['src/gl/ktx.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),55+ Extension('gl.mesa', ['src/gl/mesa.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),56+ Extension('gl.nv', ['src/gl/nv.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),57+ Extension('gl.oml', ['src/gl/oml.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),58+ Extension('gl.pgi', ['src/gl/pgi.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),59+ Extension('gl.rend', ['src/gl/rend.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),60+ Extension('gl.s3', ['src/gl/s3.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),61+ Extension('gl.sgis', ['src/gl/sgis.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),62+ Extension('gl.sgix', ['src/gl/sgix.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),63+ Extension('gl.sgi', ['src/gl/sgi.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),64+ Extension('gl.sunx', ['src/gl/sunx.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),65+ Extension('gl.sun', ['src/gl/sun.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL']),66+ Extension('gl.win', ['src/gl/win.pyx'], include_dirs=glew_include_dirs, extra_link_args = ['-framework', 'OpenGL'])67 ],68 cmdclass = {'build_ext': build_ext}...
pyx_backend.py
Source:pyx_backend.py
1import layout2import networkx3import pyx4accepted_formats = ("pdf", "eps", "ps", "png", "jpg")5pyx.unit.set(xscale = 25)6# from https://github.com/wjrl/BioFabric/blob/master/src/org/systemsbiology/biotapestry/db/ColorGenerator.java7__BIOTAPESTRY_COLORS = (8 pyx.color.hsb(0.0, 1.0, 1.0),9 pyx.color.hsb(0.033, 0.4, 0.9),10 pyx.color.hsb(0.067, 1.0, 1.0),11 pyx.color.hsb(0.1, 1.0, 1.0),12 pyx.color.hsb(0.12, 0.5, 0.8),13 pyx.color.hsb(0.133, 1.0, 1.0),14 pyx.color.hsb(0.183, 0.4, 0.9),15 pyx.color.hsb(0.233, 1.0, 1.0),16 pyx.color.hsb(0.283, 0.5, 0.8),17 pyx.color.hsb(0.333, 1.0, 1.0),18 pyx.color.hsb(0.413, 0.4, 0.9),19 pyx.color.hsb(0.5, 1.0, 1.0),20 pyx.color.hsb(0.534, 0.5, 0.8),21 pyx.color.hsb(0.567, 1.0, 1.0),22 pyx.color.hsb(0.634, 0.35, 0.9),23 pyx.color.hsb(0.667, 1.0, 1.0),24 pyx.color.hsb(0.708, 0.8, 1.0),25 pyx.color.hsb(0.738, 0.5, 0.8),26 pyx.color.hsb(0.767, 1.0, 1.0),27 pyx.color.hsb(0.80, 0.4, 0.9),28 pyx.color.hsb(0.833, 1.0, 1.0),29 pyx.color.hsb(0.917, 0.5, 0.8),30 pyx.color.hsb(0.0, 0.6, 0.55),31 pyx.color.hsb(0.1, 0.5, 0.65),32 pyx.color.hsb(0.12, 1.0, 0.5),33 pyx.color.hsb(0.183, 1.0, 0.5),34 pyx.color.hsb(0.283, 1.0, 0.5),35 pyx.color.hsb(0.534, 1.0, 0.5),36 pyx.color.hsb(0.634, 1.0, 0.5),37 pyx.color.hsb(0.708, 0.6, 0.55),38 pyx.color.hsb(0.80, 1.0, 0.5),39 pyx.color.hsb(0.833, 0.5, 0.65),40)41__palettes = {42 "bw": lambda i: pyx.color.gradient.ReverseGray.getcolor((i % 33) / 40.0),43 "hue": lambda i: pyx.color.gradient.Hue.getcolor((i % 33) / 32.0),44 "rainbow": lambda i: pyx.color.gradient.Rainbow.getcolor((i % 33) / 32.0),45 "default": lambda i: __BIOTAPESTRY_COLORS[i % 32],46}47def draw (graph, filename, format, kwargs):48 (row_to_node, node_to_row), (col_to_edge, edge_to_col), min_col, max_col = layout.process(graph)49 canvas = pyx.canvas.canvas()50 palette = __palettes[kwargs.get("palette", "default")]51 invert = lambda v: len(row_to_node) - v52 # rows53 for i, node in enumerate(row_to_node):54 x1, x2 = min_col[node] * 10, max_col[node] * 1055 y = invert(i) * 1056 canvas.stroke(57 pyx.path.line(x1, y, x2, y),58 [59 pyx.style.linewidth(2),60 palette(i),61 pyx.color.transparency(0.7)62 ])63 # columns64 for i, (node_a, node_b) in enumerate(col_to_edge):65 y1 = invert(node_to_row[node_a]) * 1066 y2 = invert(node_to_row[node_b]) * 1067 x = i * 1068 # draw the edge line69 canvas.stroke(70 pyx.path.line(x, y1, x, y2),71 [72 pyx.style.linewidth(2),73 palette(i),74 ])75 # draw the end caps76 for y in (y1, y2):77 edge_cap = pyx.path.rect(x - 2.5, y - 2.5, 5, 5)78 canvas.fill(edge_cap, [palette(i)])79 canvas.stroke(edge_cap, [pyx.style.linewidth(1.75)])80 # node labels81 for i, node in enumerate(row_to_node):82 x1, x2 = min_col[node] * 10, max_col[node] * 1083 y = invert(i) * 1084 label = pyx.text.escapestring(str(node))85 canvas.text(x1 - 5, y + 0.5, label,86 [87 pyx.text.halign.boxright,88 pyx.text.valign.middle89 ])90 if (x2 - x1) > 500:91 canvas.text(x2 + 5, y + 0.5, label,92 [93 pyx.text.halign.boxleft,94 pyx.text.valign.middle95 ])96 if (format == "pdf"):97 canvas.writePDFfile(filename)98 elif (format == "eps"):99 canvas.writeEPSfile(filename)100 elif (format == "ps"):101 canvas.writePSfile(filename)102 else:...
setup_cython.py
Source:setup_cython.py
1from distutils.core import setup2from distutils.extension import Extension3from distutils.command.install_lib import install_lib as _install4from Cython.Distutils import build_ext5VERSION = '3.0.4'6compile_args = ['-O3', '-fomit-frame-pointer']7ext_modules = [8 Extension("capstone.ccapstone", ["pyx/ccapstone.pyx"], libraries=["capstone"], extra_compile_args=compile_args),9 Extension("capstone.arm", ["pyx/arm.pyx"], extra_compile_args=compile_args),10 Extension("capstone.arm_const", ["pyx/arm_const.pyx"], extra_compile_args=compile_args),11 Extension("capstone.arm64", ["pyx/arm64.pyx"], extra_compile_args=compile_args),12 Extension("capstone.arm64_const", ["pyx/arm64_const.pyx"], extra_compile_args=compile_args),13 Extension("capstone.mips", ["pyx/mips.pyx"], extra_compile_args=compile_args),14 Extension("capstone.mips_const", ["pyx/mips_const.pyx"], extra_compile_args=compile_args),15 Extension("capstone.ppc", ["pyx/ppc.pyx"], extra_compile_args=compile_args),16 Extension("capstone.ppc_const", ["pyx/ppc_const.pyx"], extra_compile_args=compile_args),17 Extension("capstone.x86", ["pyx/x86.pyx"], extra_compile_args=compile_args),18 Extension("capstone.x86_const", ["pyx/x86_const.pyx"], extra_compile_args=compile_args),19 Extension("capstone.sparc", ["pyx/sparc.pyx"], extra_compile_args=compile_args),20 Extension("capstone.sparc_const", ["pyx/sparc_const.pyx"], extra_compile_args=compile_args),21 Extension("capstone.systemz", ["pyx/systemz.pyx"], extra_compile_args=compile_args),22 Extension("capstone.sysz_const", ["pyx/sysz_const.pyx"], extra_compile_args=compile_args),23 Extension("capstone.xcore", ["pyx/xcore.pyx"], extra_compile_args=compile_args),24 Extension("capstone.xcore_const", ["pyx/xcore_const.pyx"], extra_compile_args=compile_args)25]26# clean package directory first27#import os.path, shutil, sys28#for f in sys.path:29# if f.endswith('packages'):30# pkgdir = os.path.join(f, 'capstone')31# #print(pkgdir)32# try:33# shutil.rmtree(pkgdir)34# except:35# pass36setup(37 provides = ['capstone'],38 package_dir = {'capstone' : 'pyx'},39 packages = ['capstone'],40 name = 'capstone',41 version = VERSION,42 cmdclass = {'build_ext': build_ext},43 ext_modules = ext_modules,44 author = 'Nguyen Anh Quynh',45 author_email = 'aquynh@gmail.com',46 description = 'Capstone disassembly engine',47 url = 'http://www.capstone-engine.org',48 classifiers = [49 'License :: OSI Approved :: BSD License',50 'Programming Language :: Python :: 2',51 ],...
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!!