How to use register_type method in localstack

Best Python code snippet using localstack_python

param.py

Source:param.py Github

copy

Full Screen

...45 return self.default46 def argmod(self):47 return ''48 @staticmethod49 def register_type(dtype, clazz):50 Param.mapping[dtype] = clazz51 @staticmethod52 def factory(node):53 dtype = node.attrib['type']54 if dtype not in Param.mapping:55 print('ERROR: type "{}" not found in mapping; valid types are: {}'.format(dtype, ', '.join('"%s"' % k for k in Param.mapping.keys())))56 return Param.mapping[dtype](node)57 def declaration(self):58 return '{} {}'.format(self.ctype(), self.name)59 def declaration_with_default(self):60 return self.declaration() + (' = {}'.format(self.cdefault()) if self.cdefault() else '')61class ParamInt(Param):62 def __init__(self, node):63 super(ParamInt, self).__init__(node)64 def htype(self):65 return 'number'66class ParamFloat(Param):67 def __init__(self, node):68 super(ParamFloat, self).__init__(node)69 def htype(self):70 return 'number'71class ParamDouble(Param):72 def __init__(self, node):73 super(ParamDouble, self).__init__(node)74 def htype(self):75 return 'number'76class ParamString(Param):77 def __init__(self, node):78 super(ParamString, self).__init__(node)79 self.ctype_base = 'std::string'80 def cdefault(self):81 if self.default is None: return None82 return '"%s"' % self.default.replace('\\','\\\\').replace('"','\\"')83 def hdefault(self):84 if self.default is None: return None85 return "'%s'" % self.default.replace('\\','\\\\').replace('"','\\"')86 87class ParamBool(Param):88 def __init__(self, node):89 super(ParamBool, self).__init__(node)90class ParamAny(Param):91 def __init__(self, node):92 super(ParamAny, self).__init__(node)93 94class ParamTable(Param):95 def __init__(self, node):96 super(ParamTable, self).__init__(node)97 self.itype = node.attrib.get('item-type', None)98 self.minsize = int(node.attrib.get('minsize', 0))99 self.maxsize = int(node.attrib['maxsize']) if 'maxsize' in node.attrib else None100 if 'size' in node.attrib:101 self.minsize = int(node.attrib['size'])102 self.maxsize = int(node.attrib['size'])103 if self.itype is None:104 self.write_in = False105 self.write_out = False106 def item_dummy(self):107 n = type('dummyNode', (object,), dict(tag='param', attrib={'name': 'dummy', 'type': self.itype}))108 return Param.factory(n)109 def ctype(self):110 if self.itype is not None:111 return 'std::vector<%s>' % self.item_dummy().ctype()112 else:113 return 'void *'114 def ctype_normalized(self):115 return self.item_dummy().ctype().replace('::', '__')116 def htype(self):117 return 'table' + ('_%d' % self.minsize if self.minsize else '')118 def cdefault(self):119 if self.default is not None:120 d = self.default121 d = 'boost::assign::list_of{}.convert_to_container<{} >()'.format(''.join(map(lambda x: '(%s)' % x.strip(), d.strip()[1:-1].split(','))), self.ctype())122 return d123class ParamStruct(Param):124 def __init__(self, node, name):125 super(ParamStruct, self).__init__(node)126 self.structname = name127 self.xoptional = False128 if self.default is not None:129 if self.default == '{}':130 self.xoptional = True131 else:132 raise ValueError('default value not supported in <struct>')133 def mandatory(self):134 return not self.xoptional135 def optional(self):136 return self.xoptional137 def cdefault(self):138 return None139 def argmod(self):140 return '&'141 142class Pbool(Param):143 def __init__(self, node):144 super(Pbool, self).__init__(node)145 def htype(self):146 if os.getenv('remoteApiDocLang')=='lua':147 return 'boolean'148 return 'bool'149class Pint(Param):150 def __init__(self, node):151 super(Pint, self).__init__(node)152 def htype(self):153 if os.getenv('remoteApiDocLang')=='lua':154 return 'number'155 if os.getenv('remoteApiDocLang')=='matlab':156 return 'number'157 if os.getenv('remoteApiDocLang')=='python':158 return 'number'159 return 'int'160class Plong(Param):161 def __init__(self, node):162 super(Plong, self).__init__(node)163 def htype(self):164 if os.getenv('remoteApiDocLang')=='lua':165 return 'number'166 if os.getenv('remoteApiDocLang')=='matlab':167 return 'number'168 if os.getenv('remoteApiDocLang')=='python':169 return 'number'170 return 'long'171class Pfloat(Param):172 def __init__(self, node):173 super(Pfloat, self).__init__(node)174 def htype(self):175 if os.getenv('remoteApiDocLang')=='lua':176 return 'number'177 if os.getenv('remoteApiDocLang')=='matlab':178 return 'number'179 if os.getenv('remoteApiDocLang')=='python':180 return 'number'181 return 'float'182class Pdouble(Param):183 def __init__(self, node):184 super(Pdouble, self).__init__(node)185 def htype(self):186 if os.getenv('remoteApiDocLang')=='lua':187 return 'number'188 if os.getenv('remoteApiDocLang')=='matlab':189 return 'number'190 if os.getenv('remoteApiDocLang')=='python':191 return 'number'192 return 'double'193class Pstring(Param):194 def __init__(self, node):195 super(Pstring, self).__init__(node)196 def htype(self):197 if os.getenv('remoteApiDocLang')=='cpp':198 return 'const char*'199 if os.getenv('remoteApiDocLang')=='java':200 return 'final String'201 return 'string'202 203class Pint_eval(Param):204 def __init__(self, node):205 super(Pint_eval, self).__init__(node)206 def htype(self):207 if os.getenv('remoteApiDocLang')=='cpp':208 return 'int/(const char*)'209 if os.getenv('remoteApiDocLang')=='java':210 return 'int/String'211 return 'number/string'212 213class Pmap(Param):214 def __init__(self, node):215 super(Pmap, self).__init__(node)216 def htype(self):217 return 'map'218 219class Pbytea(Param):220 def __init__(self, node):221 super(Pbytea, self).__init__(node)222 def htype(self):223 if os.getenv('remoteApiDocLang')=='java':224 return 'final byte[]'225 if os.getenv('remoteApiDocLang')=='lua':226 return 'string'227 if os.getenv('remoteApiDocLang')=='matlab':228 return 'byteArray'229 if os.getenv('remoteApiDocLang')=='python':230 return 'byteArray'231 return 'byte[]'232class Pinta(Param):233 def __init__(self, node):234 super(Pinta, self).__init__(node)235 def htype(self):236 if os.getenv('remoteApiDocLang')=='java':237 return 'final int[]'238 if os.getenv('remoteApiDocLang')=='lua':239 return 'table'240 if os.getenv('remoteApiDocLang')=='matlab':241 return 'array'242 if os.getenv('remoteApiDocLang')=='python':243 return 'list'244 return 'int[]'245class Pinta2(Param):246 def __init__(self, node):247 super(Pinta2, self).__init__(node)248 def htype(self):249 if os.getenv('remoteApiDocLang')=='java':250 return 'final int[]'251 if os.getenv('remoteApiDocLang')=='lua':252 return 'table'253 if os.getenv('remoteApiDocLang')=='matlab':254 return 'array'255 if os.getenv('remoteApiDocLang')=='python':256 return 'list'257 return 'int[2]'258class Pinta3(Param):259 def __init__(self, node):260 super(Pinta3, self).__init__(node)261 def htype(self):262 if os.getenv('remoteApiDocLang')=='java':263 return 'final int[]'264 if os.getenv('remoteApiDocLang')=='lua':265 return 'table'266 if os.getenv('remoteApiDocLang')=='matlab':267 return 'array'268 if os.getenv('remoteApiDocLang')=='python':269 return 'list'270 return 'int[3]'271class Pfloata(Param):272 def __init__(self, node):273 super(Pfloata, self).__init__(node)274 def htype(self):275 if os.getenv('remoteApiDocLang')=='java':276 return 'final float[]'277 if os.getenv('remoteApiDocLang')=='lua':278 return 'table'279 if os.getenv('remoteApiDocLang')=='matlab':280 return 'array'281 if os.getenv('remoteApiDocLang')=='python':282 return 'list'283 return 'float[]'284class Pfloata2(Param):285 def __init__(self, node):286 super(Pfloata2, self).__init__(node)287 def htype(self):288 if os.getenv('remoteApiDocLang')=='java':289 return 'final float[]'290 if os.getenv('remoteApiDocLang')=='lua':291 return 'table'292 if os.getenv('remoteApiDocLang')=='matlab':293 return 'array'294 if os.getenv('remoteApiDocLang')=='python':295 return 'list'296 return 'float[2]'297 298class Pfloata3(Param):299 def __init__(self, node):300 super(Pfloata3, self).__init__(node)301 def htype(self):302 if os.getenv('remoteApiDocLang')=='java':303 return 'final float[]'304 if os.getenv('remoteApiDocLang')=='lua':305 return 'table'306 if os.getenv('remoteApiDocLang')=='matlab':307 return 'array'308 if os.getenv('remoteApiDocLang')=='python':309 return 'list'310 return 'float[3]'311 312class Pfloata4(Param):313 def __init__(self, node):314 super(Pfloata4, self).__init__(node)315 def htype(self):316 if os.getenv('remoteApiDocLang')=='java':317 return 'final float[]'318 if os.getenv('remoteApiDocLang')=='lua':319 return 'table'320 if os.getenv('remoteApiDocLang')=='matlab':321 return 'array'322 if os.getenv('remoteApiDocLang')=='python':323 return 'list'324 return 'float[4]'325 326class Pfloata7(Param):327 def __init__(self, node):328 super(Pfloata7, self).__init__(node)329 def htype(self):330 if os.getenv('remoteApiDocLang')=='java':331 return 'final float[]'332 if os.getenv('remoteApiDocLang')=='lua':333 return 'table'334 if os.getenv('remoteApiDocLang')=='matlab':335 return 'array'336 if os.getenv('remoteApiDocLang')=='python':337 return 'list'338 return 'float[7]'339class Pfloata12(Param):340 def __init__(self, node):341 super(Pfloata12, self).__init__(node)342 def htype(self):343 if os.getenv('remoteApiDocLang')=='java':344 return 'final float[]'345 if os.getenv('remoteApiDocLang')=='lua':346 return 'table'347 if os.getenv('remoteApiDocLang')=='matlab':348 return 'array'349 if os.getenv('remoteApiDocLang')=='python':350 return 'list'351 return 'float[12]'352class Pdoublea(Param):353 def __init__(self, node):354 super(Pdoublea, self).__init__(node)355 def htype(self):356 if os.getenv('remoteApiDocLang')=='java':357 return 'final double[]'358 if os.getenv('remoteApiDocLang')=='lua':359 return 'table'360 if os.getenv('remoteApiDocLang')=='matlab':361 return 'array'362 if os.getenv('remoteApiDocLang')=='python':363 return 'list'364 return 'double[]'365class Pdoublea2(Param):366 def __init__(self, node):367 super(Pdoublea2, self).__init__(node)368 def htype(self):369 if os.getenv('remoteApiDocLang')=='java':370 return 'final double[]'371 if os.getenv('remoteApiDocLang')=='lua':372 return 'table'373 if os.getenv('remoteApiDocLang')=='matlab':374 return 'array'375 if os.getenv('remoteApiDocLang')=='python':376 return 'list'377 return 'double[2]'378 379class Pdoublea3(Param):380 def __init__(self, node):381 super(Pdoublea3, self).__init__(node)382 def htype(self):383 if os.getenv('remoteApiDocLang')=='java':384 return 'final double[]'385 if os.getenv('remoteApiDocLang')=='lua':386 return 'table'387 if os.getenv('remoteApiDocLang')=='matlab':388 return 'array'389 if os.getenv('remoteApiDocLang')=='python':390 return 'list'391 return 'double[3]'392 393class Pdoublea4(Param):394 def __init__(self, node):395 super(Pdoublea4, self).__init__(node)396 def htype(self):397 if os.getenv('remoteApiDocLang')=='java':398 return 'final double[]'399 if os.getenv('remoteApiDocLang')=='lua':400 return 'table'401 if os.getenv('remoteApiDocLang')=='matlab':402 return 'array'403 if os.getenv('remoteApiDocLang')=='python':404 return 'list'405 return 'double[4]'406 407class Pdoublea7(Param):408 def __init__(self, node):409 super(Pdoublea7, self).__init__(node)410 def htype(self):411 if os.getenv('remoteApiDocLang')=='java':412 return 'final double[]'413 if os.getenv('remoteApiDocLang')=='lua':414 return 'table'415 if os.getenv('remoteApiDocLang')=='matlab':416 return 'array'417 if os.getenv('remoteApiDocLang')=='python':418 return 'list'419 return 'double[7]'420class Pdoublea12(Param):421 def __init__(self, node):422 super(Pdoublea12, self).__init__(node)423 def htype(self):424 if os.getenv('remoteApiDocLang')=='java':425 return 'final double[]'426 if os.getenv('remoteApiDocLang')=='lua':427 return 'table'428 if os.getenv('remoteApiDocLang')=='matlab':429 return 'array'430 if os.getenv('remoteApiDocLang')=='python':431 return 'list'432 return 'double[12]'433class Pcallback(Param):434 def __init__(self, node):435 super(Pcallback, self).__init__(node)436 def htype(self):437 if os.getenv('remoteApiDocLang')=='cpp':438 return 'CB_FUNC'439 if os.getenv('remoteApiDocLang')=='java':440 return 'final Consumer<MessageUnpacker>'441 if os.getenv('remoteApiDocLang')=='lua':442 return 'callback'443 if os.getenv('remoteApiDocLang')=='matlab':444 return 'callback'445 if os.getenv('remoteApiDocLang')=='python':446 return 'callback'447 return 'callback'448 449class Ppacked_unpacked(Param):450 def __init__(self, node):451 super(Ppacked_unpacked, self).__init__(node)452 def htype(self):453 if os.getenv('remoteApiDocLang')=='java':454 return 'final byte[]'455 if os.getenv('remoteApiDocLang')=='lua':456 return 'anyType'457 if os.getenv('remoteApiDocLang')=='matlab':458 return 'anyType'459 if os.getenv('remoteApiDocLang')=='python':460 return 'anyType'461 return 'packed_unpacked'462 463 464class Pany(Param):465 def __init__(self, node):466 super(Pany, self).__init__(node)467 def htype(self):468 return '?'469 470#Param.register_type('anything', Param)471#Param.register_type('int', ParamInt)472#Param.register_type('float', ParamFloat)473#Param.register_type('double', ParamDouble)474#Param.register_type('string', ParamString)475#Param.register_type('bool', ParamBool)476Param.register_type('table', ParamTable)477Param.register_type('bool', Pbool)478Param.register_type('int', Pint)479Param.register_type('long', Plong)480Param.register_type('float', Pfloat)481Param.register_type('double', Pdouble)482Param.register_type('string', Pstring)483Param.register_type('int_eval', Pint_eval)484Param.register_type('byte[]', Pbytea)485Param.register_type('int[]', Pinta)486Param.register_type('float[]', Pfloata)487Param.register_type('double[]', Pdoublea)488Param.register_type('int[2]', Pinta2)489Param.register_type('float[2]', Pfloata2)490Param.register_type('double[2]', Pdoublea2)491Param.register_type('int[3]', Pinta3)492Param.register_type('float[3]', Pfloata3)493Param.register_type('double[3]', Pdoublea3)494Param.register_type('float[4]', Pfloata4)495Param.register_type('double[4]', Pdoublea4)496Param.register_type('float[7]', Pfloata7)497Param.register_type('double[7]', Pdoublea7)498Param.register_type('float[12]', Pfloata12)499Param.register_type('double[12]', Pdoublea12)500Param.register_type('map', ParamAny)501Param.register_type('callback', Pcallback)502Param.register_type('?', Pany)...

Full Screen

Full Screen

0f38d8.py

Source:0f38d8.py Github

copy

Full Screen

1#!/usr/bin/python2# -*- coding: utf-8 -*-3# This program is free software: you can redistribute it and/or modify4# it under the terms of the GNU General Public License as published by5# the Free Software Foundation, either version 3 of the License, or6# (at your option) any later version.7#8# This program is distributed in the hope that it will be useful,9# but WITHOUT ANY WARRANTY; without even the implied warranty of10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11# GNU General Public License for more details.12#13# You should have received a copy of the GNU General Public License14# along with this program. If not, see <http://www.gnu.org/licenses/>15#16# @author : beaengine@gmail.com17from headers.BeaEnginePython import *18from nose.tools import *19class TestSuite:20 """21 Variable Blend Packed22 """23 def test(self):24 # F3 0F 38 D8 !(11):000:bbb25 # AESENCWIDE128KL m384, <XMM0-7>26 Buffer = bytes.fromhex('f30f38d800')27 myDisasm = Disasm(Buffer)28 length = myDisasm.read()29 assert_equal(myDisasm.length, len(Buffer))30 assert_equal(myDisasm.infos.Instruction.Opcode, 0xf38d8)31 assert_equal(myDisasm.infos.Instruction.Category, KL_INSTRUCTION)32 assert_equal(myDisasm.infos.Instruction.Mnemonic, b'aesencwide128kl')33 assert_equal(myDisasm.infos.Operand1.OpType, MEMORY_TYPE)34 assert_equal(myDisasm.infos.Operand1.OpSize, 384)35 assert_equal(myDisasm.infos.Operand1.AccessMode, READ)36 assert_equal(myDisasm.infos.Operand2.OpType, REGISTER_TYPE)37 assert_equal(myDisasm.infos.Operand2.Registers.xmm, REG0)38 assert_equal(myDisasm.infos.Operand2.OpSize, 128)39 assert_equal(myDisasm.infos.Operand2.AccessMode, WRITE)40 assert_equal(myDisasm.infos.Operand3.OpType, REGISTER_TYPE)41 assert_equal(myDisasm.infos.Operand3.Registers.xmm, REG1)42 assert_equal(myDisasm.infos.Operand3.OpSize, 128)43 assert_equal(myDisasm.infos.Operand3.AccessMode, WRITE)44 assert_equal(myDisasm.infos.Operand4.OpType, REGISTER_TYPE)45 assert_equal(myDisasm.infos.Operand4.Registers.xmm, REG2)46 assert_equal(myDisasm.infos.Operand4.OpSize, 128)47 assert_equal(myDisasm.infos.Operand4.AccessMode, WRITE)48 assert_equal(myDisasm.infos.Operand5.OpType, REGISTER_TYPE)49 assert_equal(myDisasm.infos.Operand5.Registers.xmm, REG3)50 assert_equal(myDisasm.infos.Operand5.OpSize, 128)51 assert_equal(myDisasm.infos.Operand5.AccessMode, WRITE)52 assert_equal(myDisasm.infos.Operand6.OpType, REGISTER_TYPE)53 assert_equal(myDisasm.infos.Operand6.Registers.xmm, REG4)54 assert_equal(myDisasm.infos.Operand6.OpSize, 128)55 assert_equal(myDisasm.infos.Operand6.AccessMode, WRITE)56 assert_equal(myDisasm.infos.Operand7.OpType, REGISTER_TYPE)57 assert_equal(myDisasm.infos.Operand7.Registers.xmm, REG5)58 assert_equal(myDisasm.infos.Operand7.OpSize, 128)59 assert_equal(myDisasm.infos.Operand7.AccessMode, WRITE)60 assert_equal(myDisasm.infos.Operand8.OpType, REGISTER_TYPE)61 assert_equal(myDisasm.infos.Operand8.Registers.xmm, REG6)62 assert_equal(myDisasm.infos.Operand8.OpSize, 128)63 assert_equal(myDisasm.infos.Operand8.AccessMode, WRITE)64 assert_equal(myDisasm.infos.Operand9.OpType, REGISTER_TYPE)65 assert_equal(myDisasm.infos.Operand9.Registers.xmm, REG7)66 assert_equal(myDisasm.infos.Operand9.OpSize, 128)67 assert_equal(myDisasm.infos.Operand9.AccessMode, WRITE)68 assert_equal(myDisasm.repr(), 'aesencwide128kl [rax]')69 # F3 0F 38 D8 !(11):001:bbb70 # AESDECWIDE128KL m384, <XMM0-7>71 Buffer = bytes.fromhex('f30f38d808')72 myDisasm = Disasm(Buffer)73 length = myDisasm.read()74 assert_equal(myDisasm.length, len(Buffer))75 assert_equal(myDisasm.infos.Instruction.Opcode, 0xf38d8)76 assert_equal(myDisasm.infos.Instruction.Category, KL_INSTRUCTION)77 assert_equal(myDisasm.infos.Instruction.Mnemonic, b'aesdecwide128kl')78 assert_equal(myDisasm.infos.Operand1.OpType, MEMORY_TYPE)79 assert_equal(myDisasm.infos.Operand1.OpSize, 384)80 assert_equal(myDisasm.infos.Operand1.AccessMode, READ)81 assert_equal(myDisasm.infos.Operand2.OpType, REGISTER_TYPE)82 assert_equal(myDisasm.infos.Operand2.Registers.xmm, REG0)83 assert_equal(myDisasm.infos.Operand2.OpSize, 128)84 assert_equal(myDisasm.infos.Operand2.AccessMode, WRITE)85 assert_equal(myDisasm.infos.Operand3.OpType, REGISTER_TYPE)86 assert_equal(myDisasm.infos.Operand3.Registers.xmm, REG1)87 assert_equal(myDisasm.infos.Operand3.OpSize, 128)88 assert_equal(myDisasm.infos.Operand3.AccessMode, WRITE)89 assert_equal(myDisasm.infos.Operand4.OpType, REGISTER_TYPE)90 assert_equal(myDisasm.infos.Operand4.Registers.xmm, REG2)91 assert_equal(myDisasm.infos.Operand4.OpSize, 128)92 assert_equal(myDisasm.infos.Operand4.AccessMode, WRITE)93 assert_equal(myDisasm.infos.Operand5.OpType, REGISTER_TYPE)94 assert_equal(myDisasm.infos.Operand5.Registers.xmm, REG3)95 assert_equal(myDisasm.infos.Operand5.OpSize, 128)96 assert_equal(myDisasm.infos.Operand5.AccessMode, WRITE)97 assert_equal(myDisasm.infos.Operand6.OpType, REGISTER_TYPE)98 assert_equal(myDisasm.infos.Operand6.Registers.xmm, REG4)99 assert_equal(myDisasm.infos.Operand6.OpSize, 128)100 assert_equal(myDisasm.infos.Operand6.AccessMode, WRITE)101 assert_equal(myDisasm.infos.Operand7.OpType, REGISTER_TYPE)102 assert_equal(myDisasm.infos.Operand7.Registers.xmm, REG5)103 assert_equal(myDisasm.infos.Operand7.OpSize, 128)104 assert_equal(myDisasm.infos.Operand7.AccessMode, WRITE)105 assert_equal(myDisasm.infos.Operand8.OpType, REGISTER_TYPE)106 assert_equal(myDisasm.infos.Operand8.Registers.xmm, REG6)107 assert_equal(myDisasm.infos.Operand8.OpSize, 128)108 assert_equal(myDisasm.infos.Operand8.AccessMode, WRITE)109 assert_equal(myDisasm.infos.Operand9.OpType, REGISTER_TYPE)110 assert_equal(myDisasm.infos.Operand9.Registers.xmm, REG7)111 assert_equal(myDisasm.infos.Operand9.OpSize, 128)112 assert_equal(myDisasm.infos.Operand9.AccessMode, WRITE)113 assert_equal(myDisasm.repr(), 'aesdecwide128kl [rax]')114 # F3 0F 38 D8 !(11):010:bbb115 # AESENCWIDE256KL m512, <XMM0-7>116 Buffer = bytes.fromhex('f30f38d810')117 myDisasm = Disasm(Buffer)118 length = myDisasm.read()119 assert_equal(myDisasm.length, len(Buffer))120 assert_equal(myDisasm.infos.Instruction.Opcode, 0xf38d8)121 assert_equal(myDisasm.infos.Instruction.Category, KL_INSTRUCTION)122 assert_equal(myDisasm.infos.Instruction.Mnemonic, b'aesencwide256kl')123 assert_equal(myDisasm.infos.Operand1.OpType, MEMORY_TYPE)124 assert_equal(myDisasm.infos.Operand1.OpSize, 512)125 assert_equal(myDisasm.infos.Operand1.AccessMode, READ)126 assert_equal(myDisasm.infos.Operand2.OpType, REGISTER_TYPE)127 assert_equal(myDisasm.infos.Operand2.Registers.xmm, REG0)128 assert_equal(myDisasm.infos.Operand2.OpSize, 128)129 assert_equal(myDisasm.infos.Operand2.AccessMode, WRITE)130 assert_equal(myDisasm.infos.Operand3.OpType, REGISTER_TYPE)131 assert_equal(myDisasm.infos.Operand3.Registers.xmm, REG1)132 assert_equal(myDisasm.infos.Operand3.OpSize, 128)133 assert_equal(myDisasm.infos.Operand3.AccessMode, WRITE)134 assert_equal(myDisasm.infos.Operand4.OpType, REGISTER_TYPE)135 assert_equal(myDisasm.infos.Operand4.Registers.xmm, REG2)136 assert_equal(myDisasm.infos.Operand4.OpSize, 128)137 assert_equal(myDisasm.infos.Operand4.AccessMode, WRITE)138 assert_equal(myDisasm.infos.Operand5.OpType, REGISTER_TYPE)139 assert_equal(myDisasm.infos.Operand5.Registers.xmm, REG3)140 assert_equal(myDisasm.infos.Operand5.OpSize, 128)141 assert_equal(myDisasm.infos.Operand5.AccessMode, WRITE)142 assert_equal(myDisasm.infos.Operand6.OpType, REGISTER_TYPE)143 assert_equal(myDisasm.infos.Operand6.Registers.xmm, REG4)144 assert_equal(myDisasm.infos.Operand6.OpSize, 128)145 assert_equal(myDisasm.infos.Operand6.AccessMode, WRITE)146 assert_equal(myDisasm.infos.Operand7.OpType, REGISTER_TYPE)147 assert_equal(myDisasm.infos.Operand7.Registers.xmm, REG5)148 assert_equal(myDisasm.infos.Operand7.OpSize, 128)149 assert_equal(myDisasm.infos.Operand7.AccessMode, WRITE)150 assert_equal(myDisasm.infos.Operand8.OpType, REGISTER_TYPE)151 assert_equal(myDisasm.infos.Operand8.Registers.xmm, REG6)152 assert_equal(myDisasm.infos.Operand8.OpSize, 128)153 assert_equal(myDisasm.infos.Operand8.AccessMode, WRITE)154 assert_equal(myDisasm.infos.Operand9.OpType, REGISTER_TYPE)155 assert_equal(myDisasm.infos.Operand9.Registers.xmm, REG7)156 assert_equal(myDisasm.infos.Operand9.OpSize, 128)157 assert_equal(myDisasm.infos.Operand9.AccessMode, WRITE)158 assert_equal(myDisasm.repr(), 'aesencwide256kl [rax]')159 # F3 0F 38 D8 !(11):011:bbb160 # AESDECWIDE256KL m512, <XMM0-7>161 Buffer = bytes.fromhex('f30f38d818')162 myDisasm = Disasm(Buffer)163 length = myDisasm.read()164 assert_equal(myDisasm.length, len(Buffer))165 assert_equal(myDisasm.infos.Instruction.Opcode, 0xf38d8)166 assert_equal(myDisasm.infos.Instruction.Category, KL_INSTRUCTION)167 assert_equal(myDisasm.infos.Instruction.Mnemonic, b'aesdecwide256kl')168 assert_equal(myDisasm.infos.Operand1.OpType, MEMORY_TYPE)169 assert_equal(myDisasm.infos.Operand1.OpSize, 512)170 assert_equal(myDisasm.infos.Operand1.AccessMode, READ)171 assert_equal(myDisasm.infos.Operand2.OpType, REGISTER_TYPE)172 assert_equal(myDisasm.infos.Operand2.Registers.xmm, REG0)173 assert_equal(myDisasm.infos.Operand2.OpSize, 128)174 assert_equal(myDisasm.infos.Operand2.AccessMode, WRITE)175 assert_equal(myDisasm.infos.Operand3.OpType, REGISTER_TYPE)176 assert_equal(myDisasm.infos.Operand3.Registers.xmm, REG1)177 assert_equal(myDisasm.infos.Operand3.OpSize, 128)178 assert_equal(myDisasm.infos.Operand3.AccessMode, WRITE)179 assert_equal(myDisasm.infos.Operand4.OpType, REGISTER_TYPE)180 assert_equal(myDisasm.infos.Operand4.Registers.xmm, REG2)181 assert_equal(myDisasm.infos.Operand4.OpSize, 128)182 assert_equal(myDisasm.infos.Operand4.AccessMode, WRITE)183 assert_equal(myDisasm.infos.Operand5.OpType, REGISTER_TYPE)184 assert_equal(myDisasm.infos.Operand5.Registers.xmm, REG3)185 assert_equal(myDisasm.infos.Operand5.OpSize, 128)186 assert_equal(myDisasm.infos.Operand5.AccessMode, WRITE)187 assert_equal(myDisasm.infos.Operand6.OpType, REGISTER_TYPE)188 assert_equal(myDisasm.infos.Operand6.Registers.xmm, REG4)189 assert_equal(myDisasm.infos.Operand6.OpSize, 128)190 assert_equal(myDisasm.infos.Operand6.AccessMode, WRITE)191 assert_equal(myDisasm.infos.Operand7.OpType, REGISTER_TYPE)192 assert_equal(myDisasm.infos.Operand7.Registers.xmm, REG5)193 assert_equal(myDisasm.infos.Operand7.OpSize, 128)194 assert_equal(myDisasm.infos.Operand7.AccessMode, WRITE)195 assert_equal(myDisasm.infos.Operand8.OpType, REGISTER_TYPE)196 assert_equal(myDisasm.infos.Operand8.Registers.xmm, REG6)197 assert_equal(myDisasm.infos.Operand8.OpSize, 128)198 assert_equal(myDisasm.infos.Operand8.AccessMode, WRITE)199 assert_equal(myDisasm.infos.Operand9.OpType, REGISTER_TYPE)200 assert_equal(myDisasm.infos.Operand9.Registers.xmm, REG7)201 assert_equal(myDisasm.infos.Operand9.OpSize, 128)202 assert_equal(myDisasm.infos.Operand9.AccessMode, WRITE)...

Full Screen

Full Screen

hb_sts_events.py

Source:hb_sts_events.py Github

copy

Full Screen

...251 self.hid = hid252 self.packet = packet253 self.out_port = out_port254 255JsonEvent.register_type(TraceAsyncSwitchFlowExpiryBegin)256JsonEvent.register_type(TraceAsyncSwitchFlowExpiryEnd)257JsonEvent.register_type(TraceSwitchPacketHandleBegin)258JsonEvent.register_type(TraceSwitchPacketHandleEnd)259JsonEvent.register_type(TraceSwitchMessageRx)260JsonEvent.register_type(TraceSwitchMessageTx)261JsonEvent.register_type(TraceSwitchMessageHandleBegin)262JsonEvent.register_type(TraceSwitchMessageHandleEnd)263JsonEvent.register_type(TraceSwitchMessageSend)264JsonEvent.register_type(TraceSwitchPacketSend)265JsonEvent.register_type(TraceSwitchFlowTableRead)266JsonEvent.register_type(TraceSwitchFlowTableWrite)267JsonEvent.register_type(TraceSwitchFlowTableEntryExpiry)268JsonEvent.register_type(TraceSwitchBufferPut)269JsonEvent.register_type(TraceSwitchBufferGet)270JsonEvent.register_type(TraceSwitchPacketUpdateBegin)271JsonEvent.register_type(TraceSwitchPacketUpdateEnd)272JsonEvent.register_type(TraceHostEvent)273JsonEvent.register_type(TraceHostPacketHandleBegin)274JsonEvent.register_type(TraceHostPacketHandleEnd)275JsonEvent.register_type(TraceHostPacketSend)276JsonEvent.register_type(TraceSwitchBarrier)277JsonEvent.register_type(TraceSwitchPacketDrop)...

Full Screen

Full Screen

events.py

Source:events.py Github

copy

Full Screen

...10 cls = types.get(type_id, Event)11 return cls(data, client)12# Event subclasses by type_id13types = {}14def register_type(event_type):15 """16 Registers an Event subclass for use with events.make().17 """18 type_id = event_type.type_id19 assert type_id not in types20 types.setdefault(type_id, event_type)21 return event_type22class Event(object):23 def __init__(self, data, client):24 self.logger = logger.getChild(type(self).__name__)25 assert data, "empty data passed to Event constructor"26 self.client = client27 self.data = data28 if hasattr(self, 'type_id'):...

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 localstack 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