_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253500 | _CppLintState.SetVerboseLevel | validation | def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the | python | {
"resource": ""
} |
q253501 | _CppLintState.AddFilters | validation | def AddFilters(self, filters):
""" Adds more filters to the existing list of error-message filters. """
for filt in filters.split(','):
clean_filt = filt.strip()
if clean_filt:
self.filters.append(clean_filt)
for filt in | python | {
"resource": ""
} |
q253502 | _CppLintState.IncrementErrorCount | validation | def IncrementErrorCount(self, category):
"""Bumps the module's error statistic."""
self.error_count += 1
if self.counting in ('toplevel', 'detailed'):
| python | {
"resource": ""
} |
q253503 | _CppLintState.PrintErrorCounts | validation | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in sorted(iteritems(self.errors_by_category)):
| python | {
"resource": ""
} |
q253504 | _FunctionState.Begin | validation | def Begin(self, function_name):
"""Start analyzing function body.
Args:
function_name: The name of the function being tracked.
"""
self.in_a_function = | python | {
"resource": ""
} |
q253505 | FileInfo.RepositoryName | validation | def RepositoryName(self):
r"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things li... | python | {
"resource": ""
} |
q253506 | FileInfo.Split | validation | def Split(self):
"""Splits the file into the directory, basename, and extension.
For 'chrome/browser/browser.cc', Split() would
return ('chrome/browser', 'browser', '.cc') | python | {
"resource": ""
} |
q253507 | CleansedLines._CollapseStrings | validation | def _CollapseStrings(elided):
"""Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
Returns:
The line with collapsed strings.
"""
if _RE_PATTERN_INCLUDE.match(el... | python | {
"resource": ""
} |
q253508 | _NamespaceInfo.CheckEnd | validation | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Check end of namespace comments."""
line = clean_lines.raw_lines[linenum]
# Check how many lines is enclosed in this namespace. Don't issue
# warning for missing namespace comments if there aren't enough
# lines. However, do apply chec... | python | {
"resource": ""
} |
q253509 | NestingState.InTemplateArgumentList | validation | def InTemplateArgumentList(self, clean_lines, linenum, pos):
"""Check if current position is inside template argument list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
pos: position just after the suspected template argument.
... | python | {
"resource": ""
} |
q253510 | NestingState.UpdatePreprocessor | validation | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | python | {
"resource": ""
} |
q253511 | NestingState.InnermostClass | validation | def InnermostClass(self):
"""Get class info on the top of the stack.
Returns:
A _ClassInfo object if we are inside a class, or None otherwise.
"""
for i in range(len(self.stack), 0, -1): | python | {
"resource": ""
} |
q253512 | NestingState.CheckCompletedBlocks | validation | def CheckCompletedBlocks(self, filename, error):
"""Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
# Note: Th... | python | {
"resource": ""
} |
q253513 | Streamlet.map | validation | def map(self, map_function):
"""Return a new Streamlet by applying map_function to each element of this Streamlet.
"""
from heronpy.streamlet.impl.mapbolt import MapStreamlet
map_streamlet = | python | {
"resource": ""
} |
q253514 | Streamlet.flat_map | validation | def flat_map(self, flatmap_function):
"""Return a new Streamlet by applying map_function to each element of this Streamlet
and flattening the result
"""
from heronpy.streamlet.impl.flatmapbolt import FlatMapStreamlet
| python | {
"resource": ""
} |
q253515 | Streamlet.filter | validation | def filter(self, filter_function):
"""Return a new Streamlet containing only the elements that satisfy filter_function
"""
from heronpy.streamlet.impl.filterbolt import FilterStreamlet
| python | {
"resource": ""
} |
q253516 | Streamlet.clone | validation | def clone(self, num_clones):
"""Return num_clones number of streamlets each containing all elements
of the current streamlet
"""
retval = []
| python | {
"resource": ""
} |
q253517 | Streamlet.reduce_by_window | validation | def reduce_by_window(self, window_config, reduce_function):
"""Return a new Streamlet in which each element of this Streamlet are collected
over a window defined by window_config and then reduced using the reduce_function
reduce_function takes two element at one time and reduces them to one element that... | python | {
"resource": ""
} |
q253518 | Streamlet.union | validation | def union(self, other_streamlet):
"""Returns a new Streamlet that consists of elements of both this and other_streamlet
"""
from heronpy.streamlet.impl.unionbolt import UnionStreamlet
union_streamlet = UnionStreamlet(self, | python | {
"resource": ""
} |
q253519 | Streamlet.log | validation | def log(self):
"""Logs all elements of this streamlet. This returns nothing
"""
from | python | {
"resource": ""
} |
q253520 | Streamlet.consume | validation | def consume(self, consume_function):
"""Calls consume_function for each element of this streamlet. This function returns nothing
| python | {
"resource": ""
} |
q253521 | Streamlet.join | validation | def join(self, join_streamlet, window_config, join_function):
"""Return a new Streamlet by joining join_streamlet with this streamlet
"""
from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt
join_streamlet_result = JoinStreamlet(JoinBolt.INNER, window_config,
| python | {
"resource": ""
} |
q253522 | Streamlet.outer_right_join | validation | def outer_right_join(self, join_streamlet, window_config, join_function):
"""Return a new Streamlet by outer right join_streamlet with this streamlet
"""
from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt
join_streamlet_result = JoinStreamlet(JoinBolt.OUTER_RIGHT, window_config,
... | python | {
"resource": ""
} |
q253523 | Streamlet.outer_left_join | validation | def outer_left_join(self, join_streamlet, window_config, join_function):
"""Return a new Streamlet by left join_streamlet with this streamlet
"""
from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt
join_streamlet_result = JoinStreamlet(JoinBolt.OUTER_LEFT, window_config,
... | python | {
"resource": ""
} |
q253524 | Streamlet.outer_join | validation | def outer_join(self, join_streamlet, window_config, join_function):
"""Return a new Streamlet by outer join_streamlet with this streamlet
"""
from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt
join_streamlet_result = JoinStreamlet(JoinBolt.OUTER, window_config,
... | python | {
"resource": ""
} |
q253525 | extract_common_args | validation | def extract_common_args(command, parser, cl_args):
""" extract common args """
try:
# do not pop like cli because ``topologies`` subcommand still needs it
cluster_role_env = cl_args['cluster/[role]/[env]']
config_path = cl_args['config_path']
except KeyError:
# if some of the arguments are not fou... | python | {
"resource": ""
} |
q253526 | expand_args | validation | def expand_args(command):
"""Parses command strings and returns a Popen-ready list."""
# Prepare arguments.
if isinstance(command, (str, unicode)):
splitter = shlex.shlex(command.encode('utf-8'))
| python | {
"resource": ""
} |
q253527 | run | validation | def run(command, data=None, timeout=None, kill_timeout=None, env=None, cwd=None):
"""Executes a given commmand and returns Response.
Blocks until process is complete, or timeout is reached.
"""
command = expand_args(command)
history = []
for c in command:
if len(history):
... | python | {
"resource": ""
} |
q253528 | connect | validation | def connect(command, data=None, env=None, cwd=None):
"""Spawns a new process from the given command."""
# TODO: support piped commands
command_str = expand_args(command).pop()
environ = dict(os.environ)
environ.update(env or {})
process = subprocess.Popen(command_str,
universal_newline... | python | {
"resource": ""
} |
q253529 | ConnectedCommand.send | validation | def send(self, str, end='\n'):
"""Sends a line to std_in."""
| python | {
"resource": ""
} |
q253530 | Js | validation | def Js(val, Clamped=False):
'''Converts Py type to PyJs type'''
if isinstance(val, PyJs):
return val
elif val is None:
return undefined
elif isinstance(val, basestring):
return PyJsString(val, StringPrototype)
elif isinstance(val, bool):
return true if val else false
... | python | {
"resource": ""
} |
q253531 | PyJsFunction._set_name | validation | def _set_name(self, name):
'''name is py type'''
if self.own.get('name'):
| python | {
"resource": ""
} |
q253532 | Space.ConstructArray | validation | def ConstructArray(self, py_arr):
''' note py_arr elems are NOT converted to PyJs types!'''
| python | {
"resource": ""
} |
q253533 | Space.ConstructObject | validation | def ConstructObject(self, py_obj):
''' note py_obj items are NOT converted to PyJs types! '''
obj = self.NewObject()
| python | {
"resource": ""
} |
q253534 | Code.emit | validation | def emit(self, op_code, *args):
''' Adds op_code with specified args to tape '''
| python | {
"resource": ""
} |
q253535 | Code.compile | validation | def compile(self, start_loc=0):
''' Records locations of labels and compiles the code '''
self.label_locs = {} if self.label_locs is None else self.label_locs
loc = start_loc
while loc < len(self.tape):
if type(self.tape[loc]) == LABEL:
| python | {
"resource": ""
} |
q253536 | pad | validation | def pad(num, n=2, sign=False):
'''returns n digit string representation of the num'''
s = unicode(abs(num))
if len(s) < n:
s = '0' * (n - len(s)) + s
if not sign:
| python | {
"resource": ""
} |
q253537 | replacement_template | validation | def replacement_template(rep, source, span, npar):
"""Takes the replacement template and some info about the match and returns filled template
"""
n = 0
res = ''
while n < len(rep) - 1:
char = rep[n]
if char == '$':
if rep[n + 1] == '$':
res += '$'
... | python | {
"resource": ""
} |
q253538 | fix_js_args | validation | def fix_js_args(func):
'''Use this function when unsure whether func takes this and arguments as its last 2 args.
It will append 2 args if it does not.'''
fcode = six.get_function_code(func)
fargs = fcode.co_varnames[fcode.co_argcount - 2:fcode.co_argcount] | python | {
"resource": ""
} |
q253539 | ByteCodeGenerator.emit | validation | def emit(self, what, *args):
''' what can be either name of the op, or node, or a list of statements.'''
if isinstance(what, basestring):
| python | {
"resource": ""
} |
q253540 | trans | validation | def trans(ele, standard=False):
"""Translates esprima syntax tree to python by delegating to appropriate translating node"""
try:
node = globals().get(ele['type'])
if not node:
raise NotImplementedError('%s is not supported!' % ele['type'])
if standard:
| python | {
"resource": ""
} |
q253541 | limited | validation | def limited(func):
'''Decorator limiting resulting line length in order to avoid python parser stack overflow -
If expression longer than LINE_LEN_LIMIT characters then it will be moved to upper line
USE ONLY ON EXPRESSIONS!!! '''
def f(standard=False, **args):
insert_pos = len(
... | python | {
"resource": ""
} |
q253542 | is_lval | validation | def is_lval(t):
"""Does not chceck whether t is not resticted or internal"""
if not t:
return False
i = iter(t)
| python | {
"resource": ""
} |
q253543 | translate_file | validation | def translate_file(input_path, output_path):
'''
Translates input JS file to python and saves the it to the output path.
It appends some convenience code at the end so that it is easy to import JS objects.
For example we have a file 'example.js' with: var a = function(x) {return x}
translate_file... | python | {
"resource": ""
} |
q253544 | EvalJs.execute | validation | def execute(self, js=None, use_compilation_plan=False):
"""executes javascript js in current context
During initial execute() the converted js is cached for re-use. That means next time you
run the same javascript snippet you save many instructions needed to parse and convert the
js cod... | python | {
"resource": ""
} |
q253545 | EvalJs.eval | validation | def eval(self, expression, use_compilation_plan=False):
"""evaluates expression in current context and returns its value"""
code = 'PyJsEvalResult = eval(%s)' % json.dumps(expression)
| python | {
"resource": ""
} |
q253546 | except_token | validation | def except_token(source, start, token, throw=True):
"""Token can be only a single char. Returns position after token if found. Otherwise raises syntax error if throw
otherwise returns None"""
start = pass_white(source, start)
| python | {
"resource": ""
} |
q253547 | parse_identifier | validation | def parse_identifier(source, start, throw=True):
"""passes white space from start and returns first identifier,
if identifier invalid and throw raises SyntaxError otherwise returns None"""
start = pass_white(source, start)
end = start
if not end < len(source):
if throw:
raise ... | python | {
"resource": ""
} |
q253548 | to_arr | validation | def to_arr(this):
"""Returns Python array from | python | {
"resource": ""
} |
q253549 | do_statement | validation | def do_statement(source, start):
"""returns none if not found other functions that begin with 'do_' raise
also this do_ type function passes white space"""
start = pass_white(source, start)
# start is the fist position after initial start that is not a white space or \n
if not start < len(source): ... | python | {
"resource": ""
} |
q253550 | PyJsRegExp.match | validation | def match(self, string, pos):
'''string is of course a py string'''
| python | {
"resource": ""
} |
q253551 | PyJsFunction.call | validation | def call(self, this, args=()):
''' Dont use this method from inside bytecode to call other bytecode. '''
if self.is_native:
_args = SpaceTuple(
args
) # we have to do that unfortunately to pass all the necessary info to the funcs
_args.space = self.sp... | python | {
"resource": ""
} |
q253552 | is_empty_object | validation | def is_empty_object(n, last):
"""n may be the inside of block or object"""
if n.strip():
return False
# seems to | python | {
"resource": ""
} |
q253553 | is_object | validation | def is_object(n, last):
"""n may be the inside of block or object.
last is the code before object"""
if is_empty_object(n, last):
return True
if not n.strip():
return False
#Object contains lines of code so it cant be an object
if len(argsplit(n, ';')) > 1:
return Fals... | python | {
"resource": ""
} |
q253554 | remove_objects | validation | def remove_objects(code, count=1):
""" This function replaces objects with OBJECTS_LVALS, returns new code, replacement dict and count.
count arg is the number that should be added to the LVAL of the first replaced object
"""
replacements = {} #replacement dict
br = bracket_split(code, ['{}', '... | python | {
"resource": ""
} |
q253555 | _ensure_regexp | validation | def _ensure_regexp(source, n): #<- this function has to be improved
'''returns True if regexp starts at n else returns False
checks whether it is not a division '''
markers = '(+~"\'=[%:?!*^|&-,;/\\'
| python | {
"resource": ""
} |
q253556 | parse_num | validation | def parse_num(source, start, charset):
"""Returns a first index>=start of chat not in charset"""
while start | python | {
"resource": ""
} |
q253557 | parse_exponent | validation | def parse_exponent(source, start):
"""returns end of exponential, raises SyntaxError if failed"""
if not source[start] in {'e', 'E'}:
if source[start] in IDENTIFIER_PART:
raise SyntaxError('Invalid number literal!')
return start
start += 1
if source[start] in {'-', '+'}:
... | python | {
"resource": ""
} |
q253558 | unify_string_literals | validation | def unify_string_literals(js_string):
"""this function parses the string just like javascript
for example literal '\d' in JavaScript would be interpreted
as 'd' - backslash would be ignored and in Pyhon this
would be interpreted as '\\d' This function fixes this problem."""
n = 0
res = ... | python | {
"resource": ""
} |
q253559 | in_op | validation | def in_op(self, other):
'''checks if self is in other'''
if not is_object(other):
raise MakeError(
'TypeError',
| python | {
"resource": ""
} |
q253560 | maybe_download_and_extract | validation | def maybe_download_and_extract():
"""Download and extract processed data and embeddings."""
dest_directory = '.'
filename = DATA_URL.split('/')[-1]
filepath = os.path.join(dest_directory, filename)
if not os.path.exists(filepath):
def _progress(count, block_size, total_size):
sys.stdout.write('\r>> ... | python | {
"resource": ""
} |
q253561 | StackedRNNState.add_inputs | validation | def add_inputs(self, xs):
"""
returns the list of states obtained by adding the given inputs
to the current state, one by one.
"""
states = []
cur = self
| python | {
"resource": ""
} |
q253562 | make_grid | validation | def make_grid(tensor, nrow=8, padding=2, pad_value=0):
"""Make a grid of images, via numpy.
Args:
tensor (Tensor or list): 4D mini-batch Tensor of shape (B x C x H x W)
or a list of images all of the same size.
nrow (int, optional): Number of images displayed in each row of the grid... | python | {
"resource": ""
} |
q253563 | save_image | validation | def save_image(tensor, filename, nrow=8, padding=2, pad_value=0):
"""Save a given Tensor into an image file.
Args:
tensor (Tensor or list): Image to be saved. If given a mini-batch tensor,
saves the tensor as a grid of images by calling ``make_grid``.
**kwargs: Other arguments are d... | python | {
"resource": ""
} |
q253564 | pythonize_arguments | validation | def pythonize_arguments(arg_str):
"""
Remove types from function arguments in cython
"""
out_args = []
# If there aren't any arguments return the empty string
if arg_str is None:
return out_str
args = arg_str.split(',')
for arg in args:
components = arg.split('=')
... | python | {
"resource": ""
} |
q253565 | Map._set_perms | validation | def _set_perms(self, perms):
"""
Sets the access permissions of the map.
:param perms: the new permissions.
"""
assert | python | {
"resource": ""
} |
q253566 | Map.access_ok | validation | def access_ok(self, access):
""" Check if there is enough permissions for access """
for c in access:
| python | {
"resource": ""
} |
q253567 | Map._in_range | validation | def _in_range(self, index):
""" Returns True if index is in range """
if isinstance(index, slice):
in_range = index.start < index.stop and \
index.start >= self.start and \
| python | {
"resource": ""
} |
q253568 | Map._get_offset | validation | def _get_offset(self, index):
"""
Translates the index to the internal offsets.
self.start -> 0
self.start+1 -> 1
...
self.end -> len(self)
"""
if not self._in_range(index):
raise IndexError('Map index out | python | {
"resource": ""
} |
q253569 | Memory.mmap | validation | def mmap(self, addr, size, perms, data_init=None, name=None):
"""
Creates a new mapping in the memory address space.
:param addr: the starting address (took as hint). If C{addr} is C{0} the first big enough
chunk of memory will be selected as starting address.
:para... | python | {
"resource": ""
} |
q253570 | Memory.mappings | validation | def mappings(self):
"""
Returns a sorted list of all the mappings for this memory.
:return: a list of mappings.
:rtype: list
"""
result = []
for m in self.maps:
if isinstance(m, AnonMap):
result.append((m.start, m.end, m.perms, 0, ''))... | python | {
"resource": ""
} |
q253571 | LazySMemory.scan_mem | validation | def scan_mem(self, data_to_find):
"""
Scan for concrete bytes in all mapped memory. Successively yield addresses of all matches.
:param bytes data_to_find: String to locate
:return:
"""
# TODO: for the moment we just treat symbolic bytes as bytes that don't match.
... | python | {
"resource": ""
} |
q253572 | Operand._reg_name | validation | def _reg_name(self, reg_id):
"""
Translates a register ID from the disassembler object into the
register name based on manticore's alias in the register file
:param int reg_id: Register ID
"""
if reg_id >= X86_REG_ENDING:
logger.warning("Trying to get registe... | python | {
"resource": ""
} |
q253573 | Abi.get_argument_values | validation | def get_argument_values(self, model, prefix_args):
"""
Extract arguments for model from the environment and return as a tuple that
is ready to be passed to the model.
:param callable model: Python model of the function
:param tuple prefix_args: Parameters to pass to model before... | python | {
"resource": ""
} |
q253574 | Cpu.write_register | validation | def write_register(self, register, value):
"""
Dynamic interface for writing cpu registers
:param str register: register name (as listed in `self.all_registers`)
:param value: register value
:type value: int or long or Expression
"""
| python | {
"resource": ""
} |
q253575 | Cpu.read_register | validation | def read_register(self, register):
"""
Dynamic interface for reading cpu registers
:param str register: register name (as listed in `self.all_registers`)
:return: register value
:rtype: int or long or Expression
"""
| python | {
"resource": ""
} |
q253576 | Cpu.emulate_until | validation | def emulate_until(self, target: int):
"""
Tells the CPU to set up a concrete unicorn emulator and use it to execute instructions
until target is reached.
| python | {
"resource": ""
} |
q253577 | Cpu.write_int | validation | def write_int(self, where, expression, size=None, force=False):
"""
Writes int to memory
:param int where: address to write to
:param expr: value to write
:type expr: int or BitVec
:param size: bit size of `expr`
:param force: whether to ignore memory permissions | python | {
"resource": ""
} |
q253578 | Cpu._raw_read | validation | def _raw_read(self, where: int, size=1) -> bytes:
"""
Selects bytes from memory. Attempts to do so faster than via read_bytes.
:param where: address to read from
:param size: number of bytes to read
:return: the bytes in memory
"""
map = self.memory.map_containin... | python | {
"resource": ""
} |
q253579 | Cpu.read_int | validation | def read_int(self, where, size=None, force=False):
"""
Reads int from memory
:param int where: address to read from
:param size: number of bits to read
:return: the value read
:rtype: int or BitVec
:param force: whether to ignore memory permissions
| python | {
"resource": ""
} |
q253580 | Cpu.read_bytes | validation | def read_bytes(self, where, size, force=False):
"""
Read from memory.
:param int where: address to read data from
:param int size: number of bytes
:param force: whether to ignore memory permissions
:return: data
:rtype: list[int or Expression]
| python | {
"resource": ""
} |
q253581 | Cpu.read_string | validation | def read_string(self, where, max_length=None, force=False):
"""
Read a NUL-terminated concrete buffer from memory. Stops reading at first symbolic byte.
:param int where: Address to read string from
:param int max_length:
The size in bytes to cap the string at, or None [defa... | python | {
"resource": ""
} |
q253582 | Cpu.push_bytes | validation | def push_bytes(self, data, force=False):
"""
Write `data` to the stack and decrement the stack pointer accordingly.
:param str | python | {
"resource": ""
} |
q253583 | Cpu.pop_bytes | validation | def pop_bytes(self, nbytes, force=False):
"""
Read `nbytes` from the stack, increment the stack pointer, and return
data.
:param int nbytes: How many | python | {
"resource": ""
} |
q253584 | Cpu.push_int | validation | def push_int(self, value, force=False):
"""
Decrement the stack pointer and write `value` to the stack.
:param int value: The value to write
:param force: whether to ignore memory permissions
:return: New stack pointer
""" | python | {
"resource": ""
} |
q253585 | Cpu.pop_int | validation | def pop_int(self, force=False):
"""
Read a value from the stack and increment the stack pointer.
:param force: whether to | python | {
"resource": ""
} |
q253586 | Cpu.decode_instruction | validation | def decode_instruction(self, pc):
"""
This will decode an instruction from memory pointed by `pc`
:param int pc: address of the instruction
"""
# No dynamic code!!! #TODO!
# Check if instruction was already decoded
if pc in self._instruction_cache:
re... | python | {
"resource": ""
} |
q253587 | Cpu.execute | validation | def execute(self):
"""
Decode, and execute one instruction pointed by register PC
"""
if issymbolic(self.PC):
raise ConcretizeRegister(self, 'PC', policy='ALL')
if not self.memory.access_ok(self.PC, 'x'):
raise InvalidMemoryAccess(self.PC, 'x')
s... | python | {
"resource": ""
} |
q253588 | Cpu._publish_instruction_as_executed | validation | def _publish_instruction_as_executed(self, insn):
"""
Notify listeners that an instruction has been executed.
"""
| python | {
"resource": ""
} |
q253589 | Cpu.concrete_emulate | validation | def concrete_emulate(self, insn):
"""
Start executing in Unicorn from this point until we hit a syscall or reach break_unicorn_at
:param capstone.CsInsn insn: The instruction object to emulate
"""
if not self.emu:
self.emu = ConcreteUnicornEmulator(self)
... | python | {
"resource": ""
} |
q253590 | Cpu.backup_emulate | validation | def backup_emulate(self, insn):
"""
If we could not handle emulating an instruction, use Unicorn to emulate
it.
:param capstone.CsInsn instruction: The instruction object to emulate
"""
if not hasattr(self, 'backup_emu'):
self.backup_emu = UnicornEmulator(se... | python | {
"resource": ""
} |
q253591 | TraceVisualizer.visualize | validation | def visualize(self):
"""
Given a Manticore workspace, or trace file, highlight the basic blocks.
"""
if os.path.isfile(self.workspace):
t = threading.Thread(target=self.highlight_from_file,
args=(self.workspace,))
| python | {
"resource": ""
} |
q253592 | X86Cpu.push | validation | def push(cpu, value, size):
"""
Writes a value in the stack.
:param value: the value to put in the stack.
:param size: the size of the value.
"""
assert size in (8, 16, cpu.address_bit_size)
cpu.STACK = cpu.STACK - size | python | {
"resource": ""
} |
q253593 | X86Cpu.pop | validation | def pop(cpu, size):
"""
Gets a value from the stack.
:rtype: int
:param size: the size of the value to consume from the stack.
:return: the value from the stack.
"""
assert size in (16, cpu.address_bit_size)
base, _, _ | python | {
"resource": ""
} |
q253594 | X86Cpu.invalidate_cache | validation | def invalidate_cache(cpu, address, size):
""" remove decoded instruction from instruction cache """
cache = cpu.instruction_cache
| python | {
"resource": ""
} |
q253595 | X86Cpu.CPUID | validation | def CPUID(cpu):
"""
CPUID instruction.
The ID flag (bit 21) in the EFLAGS register indicates support for the
CPUID instruction. If a software procedure can set and clear this
flag, the processor executing the procedure supports the CPUID
instruction. This instruction op... | python | {
"resource": ""
} |
q253596 | X86Cpu.AND | validation | def AND(cpu, dest, src):
"""
Logical AND.
Performs a bitwise AND operation on the destination (first) and source
(second) operands and stores the result in the destination operand location.
Each bit of the result is set to 1 if both corresponding bits of the first and
se... | python | {
"resource": ""
} |
q253597 | X86Cpu.TEST | validation | def TEST(cpu, src1, src2):
"""
Logical compare.
Computes the bit-wise logical AND of first operand (source 1 operand)
and the second operand (source 2 operand) and sets the SF, ZF, and PF
status flags according to the result. The result is then discarded::
TEMP = ... | python | {
"resource": ""
} |
q253598 | X86Cpu.OR | validation | def OR(cpu, dest, src):
"""
Logical inclusive OR.
Performs a bitwise inclusive OR operation between the destination (first)
and source (second) operands and stores the result in the destination operand location.
Each bit of the result of the OR instruction is set to 0 if both c... | python | {
"resource": ""
} |
q253599 | X86Cpu.AAA | validation | def AAA(cpu):
"""
ASCII adjust after addition.
Adjusts the sum of two unpacked BCD values to create an unpacked BCD
result. The AL register is the implied source and destination operand
for this instruction. The AAA instruction is only useful when it follows
an ADD instr... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.