partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Armv7Cpu.CBZ
Compare and Branch on Zero compares the value in a register with zero, and conditionally branches forward a constant value. It does not affect the condition flags. :param ARMv7Operand op: Specifies the register that contains the first operand. :param ARMv7Operand dest: Specifies the...
manticore/native/cpu/arm.py
def CBZ(cpu, op, dest): """ Compare and Branch on Zero compares the value in a register with zero, and conditionally branches forward a constant value. It does not affect the condition flags. :param ARMv7Operand op: Specifies the register that contains the first operand. :param ...
def CBZ(cpu, op, dest): """ Compare and Branch on Zero compares the value in a register with zero, and conditionally branches forward a constant value. It does not affect the condition flags. :param ARMv7Operand op: Specifies the register that contains the first operand. :param ...
[ "Compare", "and", "Branch", "on", "Zero", "compares", "the", "value", "in", "a", "register", "with", "zero", "and", "conditionally", "branches", "forward", "a", "constant", "value", ".", "It", "does", "not", "affect", "the", "condition", "flags", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1016-L1029
[ "def", "CBZ", "(", "cpu", ",", "op", ",", "dest", ")", ":", "cpu", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "cpu", ".", "address_bit_size", ",", "op", ".", "read", "(", ")", ",", "cpu", ".", "PC", ",", "dest", ".", "read", "(", ")", ")...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Armv7Cpu.TBH
Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base register provides a pointer to the table, and a second register supplies an index into the table. The branch length is twice the value of the halfword returned from the table. :param ARMv7...
manticore/native/cpu/arm.py
def TBH(cpu, dest): """ Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base register provides a pointer to the table, and a second register supplies an index into the table. The branch length is twice the value of the halfword return...
def TBH(cpu, dest): """ Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base register provides a pointer to the table, and a second register supplies an index into the table. The branch length is twice the value of the halfword return...
[ "Table", "Branch", "Halfword", "causes", "a", "PC", "-", "relative", "forward", "branch", "using", "a", "table", "of", "single", "halfword", "offsets", ".", "A", "base", "register", "provides", "a", "pointer", "to", "the", "table", "and", "a", "second", "r...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1100-L1121
[ "def", "TBH", "(", "cpu", ",", "dest", ")", ":", "# Capstone merges the two registers values into one operand, so we need to extract them back", "# Specifies the base register. This contains the address of the table of branch lengths. This", "# register is allowed to be the PC. If it is, the tab...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Armv7Cpu._LDM
LDM (Load Multiple) loads a non-empty subset, or possibly all, of the general-purpose registers from sequential memory locations. It is useful for block loads, stack operations and procedure exit sequences. :param int insn_id: should be one of ARM_INS_LDM, ARM_INS_LDMIB, ARM_INS_LDMDA, ARM_INS_LDMDB ...
manticore/native/cpu/arm.py
def _LDM(cpu, insn_id, base, regs): """ LDM (Load Multiple) loads a non-empty subset, or possibly all, of the general-purpose registers from sequential memory locations. It is useful for block loads, stack operations and procedure exit sequences. :param int insn_id: should be one of ARM...
def _LDM(cpu, insn_id, base, regs): """ LDM (Load Multiple) loads a non-empty subset, or possibly all, of the general-purpose registers from sequential memory locations. It is useful for block loads, stack operations and procedure exit sequences. :param int insn_id: should be one of ARM...
[ "LDM", "(", "Load", "Multiple", ")", "loads", "a", "non", "-", "empty", "subset", "or", "possibly", "all", "of", "the", "general", "-", "purpose", "registers", "from", "sequential", "memory", "locations", ".", "It", "is", "useful", "for", "block", "loads",...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1174-L1215
[ "def", "_LDM", "(", "cpu", ",", "insn_id", ",", "base", ",", "regs", ")", ":", "if", "cpu", ".", "instruction", ".", "usermode", ":", "raise", "NotImplementedError", "(", "\"Use of the S bit is not supported\"", ")", "increment", "=", "insn_id", "in", "(", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Armv7Cpu._STM
STM (Store Multiple) stores a non-empty subset (or possibly all) of the general-purpose registers to sequential memory locations. :param int insn_id: should be one of ARM_INS_STM, ARM_INS_STMIB, ARM_INS_STMDA, ARM_INS_STMDB :param Armv7Operand base: Specifies the base register. :param l...
manticore/native/cpu/arm.py
def _STM(cpu, insn_id, base, regs): """ STM (Store Multiple) stores a non-empty subset (or possibly all) of the general-purpose registers to sequential memory locations. :param int insn_id: should be one of ARM_INS_STM, ARM_INS_STMIB, ARM_INS_STMDA, ARM_INS_STMDB :param Armv7Ope...
def _STM(cpu, insn_id, base, regs): """ STM (Store Multiple) stores a non-empty subset (or possibly all) of the general-purpose registers to sequential memory locations. :param int insn_id: should be one of ARM_INS_STM, ARM_INS_STMIB, ARM_INS_STMDA, ARM_INS_STMDB :param Armv7Ope...
[ "STM", "(", "Store", "Multiple", ")", "stores", "a", "non", "-", "empty", "subset", "(", "or", "possibly", "all", ")", "of", "the", "general", "-", "purpose", "registers", "to", "sequential", "memory", "locations", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1233-L1264
[ "def", "_STM", "(", "cpu", ",", "insn_id", ",", "base", ",", "regs", ")", ":", "if", "cpu", ".", "instruction", ".", "usermode", ":", "raise", "NotImplementedError", "(", "\"Use of the S bit is not supported\"", ")", "increment", "=", "insn_id", "in", "(", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Armv7Cpu._SR
Notes on Capstone behavior: - In ARM mode, _SR reg has `rest`, but _SR imm does not, its baked into `op`. - In ARM mode, `lsr r1, r2` will have a `rest[0]` - In Thumb mode, `lsr r1, r2` will have an empty `rest` - In ARM mode, something like `lsr r1, 3` will not have `rest` and op will b...
manticore/native/cpu/arm.py
def _SR(cpu, insn_id, dest, op, *rest): """ Notes on Capstone behavior: - In ARM mode, _SR reg has `rest`, but _SR imm does not, its baked into `op`. - In ARM mode, `lsr r1, r2` will have a `rest[0]` - In Thumb mode, `lsr r1, r2` will have an empty `rest` - In ARM mode, s...
def _SR(cpu, insn_id, dest, op, *rest): """ Notes on Capstone behavior: - In ARM mode, _SR reg has `rest`, but _SR imm does not, its baked into `op`. - In ARM mode, `lsr r1, r2` will have a `rest[0]` - In Thumb mode, `lsr r1, r2` will have an empty `rest` - In ARM mode, s...
[ "Notes", "on", "Capstone", "behavior", ":", "-", "In", "ARM", "mode", "_SR", "reg", "has", "rest", "but", "_SR", "imm", "does", "not", "its", "baked", "into", "op", ".", "-", "In", "ARM", "mode", "lsr", "r1", "r2", "will", "have", "a", "rest", "[",...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/arm.py#L1343-L1383
[ "def", "_SR", "(", "cpu", ",", "insn_id", ",", "dest", ",", "op", ",", "*", "rest", ")", ":", "assert", "insn_id", "in", "(", "cs", ".", "arm", ".", "ARM_INS_ASR", ",", "cs", ".", "arm", ".", "ARM_INS_LSL", ",", "cs", ".", "arm", ".", "ARM_INS_LS...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Array._fix_index
:param slice index:
manticore/core/smtlib/expression.py
def _fix_index(self, index): """ :param slice index: """ stop, start = index.stop, index.start if start is None: start = 0 if stop is None: stop = len(self) return start, stop
def _fix_index(self, index): """ :param slice index: """ stop, start = index.stop, index.start if start is None: start = 0 if stop is None: stop = len(self) return start, stop
[ ":", "param", "slice", "index", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/expression.py#L585-L594
[ "def", "_fix_index", "(", "self", ",", "index", ")", ":", "stop", ",", "start", "=", "index", ".", "stop", ",", "index", ".", "start", "if", "start", "is", "None", ":", "start", "=", "0", "if", "stop", "is", "None", ":", "stop", "=", "len", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
_dict_diff
Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that aren't in d1. :param dict d1: First dict :param dict d2: Dict to compare with :rtype: dict
manticore/core/plugin.py
def _dict_diff(d1, d2): """ Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that aren't in d1. :param dict d1: First dict :param dict d2: Dict to compare with :rtype: dict """ d = {} for key in set(d1).intersection(set(d2)): ...
def _dict_diff(d1, d2): """ Produce a dict that includes all the keys in d2 that represent different values in d1, as well as values that aren't in d1. :param dict d1: First dict :param dict d2: Dict to compare with :rtype: dict """ d = {} for key in set(d1).intersection(set(d2)): ...
[ "Produce", "a", "dict", "that", "includes", "all", "the", "keys", "in", "d2", "that", "represent", "different", "values", "in", "d1", "as", "well", "as", "values", "that", "aren", "t", "in", "d1", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/plugin.py#L45-L60
[ "def", "_dict_diff", "(", "d1", ",", "d2", ")", ":", "d", "=", "{", "}", "for", "key", "in", "set", "(", "d1", ")", ".", "intersection", "(", "set", "(", "d2", ")", ")", ":", "if", "d2", "[", "key", "]", "!=", "d1", "[", "key", "]", ":", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Plugin.locked_context
A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed atomically, so access of shared variables should occur within.
manticore/core/plugin.py
def locked_context(self, key=None, value_type=list): """ A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed ...
def locked_context(self, key=None, value_type=list): """ A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed ...
[ "A", "context", "manager", "that", "provides", "safe", "parallel", "access", "to", "the", "global", "Manticore", "context", ".", "This", "should", "be", "used", "to", "access", "the", "global", "Manticore", "context", "when", "parallel", "analysis", "is", "act...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/plugin.py#L14-L26
[ "def", "locked_context", "(", "self", ",", "key", "=", "None", ",", "value_type", "=", "list", ")", ":", "plugin_context_name", "=", "str", "(", "type", "(", "self", ")", ")", "with", "self", ".", "manticore", ".", "locked_context", "(", "plugin_context_na...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Plugin.context
Convenient access to shared context
manticore/core/plugin.py
def context(self): """ Convenient access to shared context """ plugin_context_name = str(type(self)) if plugin_context_name not in self.manticore.context: self.manticore.context[plugin_context_name] = {} return self.manticore.context[plugin_context_name]
def context(self): """ Convenient access to shared context """ plugin_context_name = str(type(self)) if plugin_context_name not in self.manticore.context: self.manticore.context[plugin_context_name] = {} return self.manticore.context[plugin_context_name]
[ "Convenient", "access", "to", "shared", "context" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/plugin.py#L29-L34
[ "def", "context", "(", "self", ")", ":", "plugin_context_name", "=", "str", "(", "type", "(", "self", ")", ")", "if", "plugin_context_name", "not", "in", "self", ".", "manticore", ".", "context", ":", "self", ".", "manticore", ".", "context", "[", "plugi...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Detector.add_finding
Logs a finding at specified contract and assembler line. :param state: current state :param address: contract address of the finding :param pc: program counter of the finding :param at_init: true if executing the constructor :param finding: textual description of the finding ...
manticore/ethereum/detectors.py
def add_finding(self, state, address, pc, finding, at_init, constraint=True): """ Logs a finding at specified contract and assembler line. :param state: current state :param address: contract address of the finding :param pc: program counter of the finding :param at_init:...
def add_finding(self, state, address, pc, finding, at_init, constraint=True): """ Logs a finding at specified contract and assembler line. :param state: current state :param address: contract address of the finding :param pc: program counter of the finding :param at_init:...
[ "Logs", "a", "finding", "at", "specified", "contract", "and", "assembler", "line", ".", ":", "param", "state", ":", "current", "state", ":", "param", "address", ":", "contract", "address", "of", "the", "finding", ":", "param", "pc", ":", "program", "counte...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L47-L68
[ "def", "add_finding", "(", "self", ",", "state", ",", "address", ",", "pc", ",", "finding", ",", "at_init", ",", "constraint", "=", "True", ")", ":", "if", "issymbolic", "(", "pc", ")", ":", "pc", "=", "simplify", "(", "pc", ")", "if", "isinstance", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Detector.add_finding_here
Logs a finding in current contract and assembler line. :param state: current state :param finding: textual description of the finding :param constraint: finding is considered reproducible only when constraint is True
manticore/ethereum/detectors.py
def add_finding_here(self, state, finding, constraint=True): """ Logs a finding in current contract and assembler line. :param state: current state :param finding: textual description of the finding :param constraint: finding is considered reproducible only when constraint is Tru...
def add_finding_here(self, state, finding, constraint=True): """ Logs a finding in current contract and assembler line. :param state: current state :param finding: textual description of the finding :param constraint: finding is considered reproducible only when constraint is Tru...
[ "Logs", "a", "finding", "in", "current", "contract", "and", "assembler", "line", ".", ":", "param", "state", ":", "current", "state", ":", "param", "finding", ":", "textual", "description", "of", "the", "finding", ":", "param", "constraint", ":", "finding", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L70-L84
[ "def", "add_finding_here", "(", "self", ",", "state", ",", "finding", ",", "constraint", "=", "True", ")", ":", "address", "=", "state", ".", "platform", ".", "current_vm", ".", "address", "pc", "=", "state", ".", "platform", ".", "current_vm", ".", "pc"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Detector._save_current_location
Save current location in the internal locations list and returns a textual id for it. This is used to save locations that could later be promoted to a finding if other conditions hold See _get_location() :param state: current state :param finding: textual description of the finding ...
manticore/ethereum/detectors.py
def _save_current_location(self, state, finding, condition=True): """ Save current location in the internal locations list and returns a textual id for it. This is used to save locations that could later be promoted to a finding if other conditions hold See _get_location() :param...
def _save_current_location(self, state, finding, condition=True): """ Save current location in the internal locations list and returns a textual id for it. This is used to save locations that could later be promoted to a finding if other conditions hold See _get_location() :param...
[ "Save", "current", "location", "in", "the", "internal", "locations", "list", "and", "returns", "a", "textual", "id", "for", "it", ".", "This", "is", "used", "to", "save", "locations", "that", "could", "later", "be", "promoted", "to", "a", "finding", "if", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L86-L101
[ "def", "_save_current_location", "(", "self", ",", "state", ",", "finding", ",", "condition", "=", "True", ")", ":", "address", "=", "state", ".", "platform", ".", "current_vm", ".", "address", "pc", "=", "state", ".", "platform", ".", "current_vm", ".", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Detector._get_location
Get previously saved location A location is composed of: address, pc, finding, at_init, condition
manticore/ethereum/detectors.py
def _get_location(self, state, hash_id): """ Get previously saved location A location is composed of: address, pc, finding, at_init, condition """ return state.context.setdefault('{:s}.locations'.format(self.name), {})[hash_id]
def _get_location(self, state, hash_id): """ Get previously saved location A location is composed of: address, pc, finding, at_init, condition """ return state.context.setdefault('{:s}.locations'.format(self.name), {})[hash_id]
[ "Get", "previously", "saved", "location", "A", "location", "is", "composed", "of", ":", "address", "pc", "finding", "at_init", "condition" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L103-L108
[ "def", "_get_location", "(", "self", ",", "state", ",", "hash_id", ")", ":", "return", "state", ".", "context", ".", "setdefault", "(", "'{:s}.locations'", ".", "format", "(", "self", ".", "name", ")", ",", "{", "}", ")", "[", "hash_id", "]" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._signed_sub_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 False False False False True True True ...
manticore/ethereum/detectors.py
def _signed_sub_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 False ...
def _signed_sub_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 False ...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":", "a", "-", "b", "-", "80000000...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L340-L355
[ "def", "_signed_sub_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "sub", "=", "Operators", ".", "SEXTEND", "(", "a", ",", "256", ",", "512", ")", "-", "Operators", ".", "SEXTEND", "(", "b", ",", "256", ",", "512", ")", "cond", "=", "Oper...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._signed_add_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 True True True False False False False ...
manticore/ethereum/detectors.py
def _signed_add_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 True...
def _signed_add_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b -80000000 -3fffffff -00000001 +00000000 +00000001 +3fffffff +7fffffff +80000000 True...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L358-L374
[ "def", "_signed_add_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "add", "=", "Operators", ".", "SEXTEND", "(", "a", ",", "256", ",", "512", ")", "+", "Operators", ".", "SEXTEND", "(", "b", ",", "256", ",", "512", ")", "cond", "=", "Oper...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._unsigned_sub_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True True True False True True True bff...
manticore/ethereum/detectors.py
def _unsigned_sub_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True ...
def _unsigned_sub_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a - b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True ...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L377-L392
[ "def", "_unsigned_sub_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "cond", "=", "Operators", ".", "UGT", "(", "b", ",", "a", ")", "return", "cond" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._unsigned_add_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True True True False True True True bff...
manticore/ethereum/detectors.py
def _unsigned_add_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True ...
def _unsigned_add_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a + b ffffffff bfffffff 80000001 00000000 00000001 3ffffffff 7fffffff ffffffff True ...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L395-L411
[ "def", "_unsigned_add_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "add", "=", "Operators", ".", "ZEXTEND", "(", "a", ",", "512", ")", "+", "Operators", ".", "ZEXTEND", "(", "b", ",", "512", ")", "cond", "=", "Operators", ".", "UGE", "(",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._signed_mul_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +00000000080000001 +000000000bfffffff +000000000ffffffff +00000...
manticore/ethereum/detectors.py
def _signed_mul_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +00000000080...
def _signed_mul_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +00000000080...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L414-L431
[ "def", "_signed_mul_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "mul", "=", "Operators", ".", "SEXTEND", "(", "a", ",", "256", ",", "512", ")", "*", "Operators", ".", "SEXTEND", "(", "b", ",", "256", ",", "512", ")", "cond", "=", "Oper...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectIntegerOverflow._unsigned_mul_overflow
Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +00000000080000001 +000000000bfffffff +000000000ffffffff +00000...
manticore/ethereum/detectors.py
def _unsigned_mul_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +000000000...
def _unsigned_mul_overflow(state, a, b): """ Sign extend the value to 512 bits and check the result can be represented in 256. Following there is a 32 bit excerpt of this condition: a * b +00000000000000000 +00000000000000001 +0000000003fffffff +0000000007fffffff +000000000...
[ "Sign", "extend", "the", "value", "to", "512", "bits", "and", "check", "the", "result", "can", "be", "represented", "in", "256", ".", "Following", "there", "is", "a", "32", "bit", "excerpt", "of", "this", "condition", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L434-L451
[ "def", "_unsigned_mul_overflow", "(", "state", ",", "a", ",", "b", ")", ":", "mul", "=", "Operators", ".", "SEXTEND", "(", "a", ",", "256", ",", "512", ")", "*", "Operators", ".", "SEXTEND", "(", "b", ",", "256", ",", "512", ")", "cond", "=", "Op...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
DetectRaceCondition._in_user_func
:param state: current state :return: whether the current execution is in a user-defined function or not. NOTE / TODO / FIXME: As this may produce false postives, this is not in the base `Detector` class. It should be fixed at some point and moved there. See below. The first 4 bytes of ...
manticore/ethereum/detectors.py
def _in_user_func(state): """ :param state: current state :return: whether the current execution is in a user-defined function or not. NOTE / TODO / FIXME: As this may produce false postives, this is not in the base `Detector` class. It should be fixed at some point and moved th...
def _in_user_func(state): """ :param state: current state :return: whether the current execution is in a user-defined function or not. NOTE / TODO / FIXME: As this may produce false postives, this is not in the base `Detector` class. It should be fixed at some point and moved th...
[ ":", "param", "state", ":", "current", "state", ":", "return", ":", "whether", "the", "current", "execution", "is", "in", "a", "user", "-", "defined", "function", "or", "not", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/detectors.py#L675-L712
[ "def", "_in_user_func", "(", "state", ")", ":", "# If we are already in user function (we cached it) let's just return True", "in_function", "=", "state", ".", "context", ".", "get", "(", "'in_function'", ",", "False", ")", "prev_tx_count", "=", "state", ".", "context",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
CapstoneDisasm.disassemble_instruction
Get next instruction using the Capstone disassembler :param str code: binary blob to be disassembled :param long pc: program counter
manticore/native/cpu/disasm.py
def disassemble_instruction(self, code, pc): """Get next instruction using the Capstone disassembler :param str code: binary blob to be disassembled :param long pc: program counter """ return next(self.disasm.disasm(code, pc))
def disassemble_instruction(self, code, pc): """Get next instruction using the Capstone disassembler :param str code: binary blob to be disassembled :param long pc: program counter """ return next(self.disasm.disasm(code, pc))
[ "Get", "next", "instruction", "using", "the", "Capstone", "disassembler" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/disasm.py#L71-L77
[ "def", "disassemble_instruction", "(", "self", ",", "code", ",", "pc", ")", ":", "return", "next", "(", "self", ".", "disasm", ".", "disasm", "(", "code", ",", "pc", ")", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
istainted
Helper to determine whether an object if tainted. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value.
manticore/utils/helpers.py
def istainted(arg, taint=None): """ Helper to determine whether an object if tainted. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ if not issymbolic(arg): return Fa...
def istainted(arg, taint=None): """ Helper to determine whether an object if tainted. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ if not issymbolic(arg): return Fa...
[ "Helper", "to", "determine", "whether", "an", "object", "if", "tainted", ".", ":", "param", "arg", ":", "a", "value", "or", "Expression", ":", "param", "taint", ":", "a", "regular", "expression", "matching", "a", "taint", "value", "(", "eg", ".", "IMPORT...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/helpers.py#L26-L41
[ "def", "istainted", "(", "arg", ",", "taint", "=", "None", ")", ":", "if", "not", "issymbolic", "(", "arg", ")", ":", "return", "False", "if", "taint", "is", "None", ":", "return", "len", "(", "arg", ".", "taint", ")", "!=", "0", "for", "arg_taint"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
get_taints
Helper to list an object taints. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value.
manticore/utils/helpers.py
def get_taints(arg, taint=None): """ Helper to list an object taints. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ if not issymbolic(arg): return for arg_taint ...
def get_taints(arg, taint=None): """ Helper to list an object taints. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ if not issymbolic(arg): return for arg_taint ...
[ "Helper", "to", "list", "an", "object", "taints", ".", ":", "param", "arg", ":", "a", "value", "or", "Expression", ":", "param", "taint", ":", "a", "regular", "expression", "matching", "a", "taint", "value", "(", "eg", ".", "IMPORTANT", ".", "*", ")", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/helpers.py#L44-L60
[ "def", "get_taints", "(", "arg", ",", "taint", "=", "None", ")", ":", "if", "not", "issymbolic", "(", "arg", ")", ":", "return", "for", "arg_taint", "in", "arg", ".", "taint", ":", "if", "taint", "is", "not", "None", ":", "m", "=", "re", ".", "ma...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
taint_with
Helper to taint a value. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value.
manticore/utils/helpers.py
def taint_with(arg, taint, value_bits=256, index_bits=256): """ Helper to taint a value. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ from ..core.smtlib import BitVecConstan...
def taint_with(arg, taint, value_bits=256, index_bits=256): """ Helper to taint a value. :param arg: a value or Expression :param taint: a regular expression matching a taint value (eg. 'IMPORTANT.*'). If None, this function checks for any taint value. """ from ..core.smtlib import BitVecConstan...
[ "Helper", "to", "taint", "a", "value", ".", ":", "param", "arg", ":", "a", "value", "or", "Expression", ":", "param", "taint", ":", "a", "regular", "expression", "matching", "a", "taint", "value", "(", "eg", ".", "IMPORTANT", ".", "*", ")", ".", "If"...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/helpers.py#L63-L84
[ "def", "taint_with", "(", "arg", ",", "taint", ",", "value_bits", "=", "256", ",", "index_bits", "=", "256", ")", ":", "from", ".", ".", "core", ".", "smtlib", "import", "BitVecConstant", "# prevent circular imports", "tainted_fset", "=", "frozenset", "(", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
interval_intersection
Given two intervals, (min1, max1) and (min2, max2) return their intersecting interval, or None if they do not overlap.
manticore/utils/helpers.py
def interval_intersection(min1, max1, min2, max2): """ Given two intervals, (min1, max1) and (min2, max2) return their intersecting interval, or None if they do not overlap. """ left, right = max(min1, min2), min(max1, max2) if left < right: return left, right return None
def interval_intersection(min1, max1, min2, max2): """ Given two intervals, (min1, max1) and (min2, max2) return their intersecting interval, or None if they do not overlap. """ left, right = max(min1, min2), min(max1, max2) if left < right: return left, right return None
[ "Given", "two", "intervals", "(", "min1", "max1", ")", "and", "(", "min2", "max2", ")", "return", "their", "intersecting", "interval", "or", "None", "if", "they", "do", "not", "overlap", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/helpers.py#L87-L95
[ "def", "interval_intersection", "(", "min1", ",", "max1", ",", "min2", ",", "max2", ")", ":", "left", ",", "right", "=", "max", "(", "min1", ",", "min2", ")", ",", "min", "(", "max1", ",", "max2", ")", "if", "left", "<", "right", ":", "return", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.add
Add a constraint to the set :param constraint: The constraint to add to the set. :param check: Currently unused. :return:
manticore/core/smtlib/constraints.py
def add(self, constraint, check=False): """ Add a constraint to the set :param constraint: The constraint to add to the set. :param check: Currently unused. :return: """ if isinstance(constraint, bool): constraint = BoolConstant(constraint) as...
def add(self, constraint, check=False): """ Add a constraint to the set :param constraint: The constraint to add to the set. :param check: Currently unused. :return: """ if isinstance(constraint, bool): constraint = BoolConstant(constraint) as...
[ "Add", "a", "constraint", "to", "the", "set" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L46-L77
[ "def", "add", "(", "self", ",", "constraint", ",", "check", "=", "False", ")", ":", "if", "isinstance", "(", "constraint", ",", "bool", ")", ":", "constraint", "=", "BoolConstant", "(", "constraint", ")", "assert", "isinstance", "(", "constraint", ",", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet._declare
Declare the variable `var`
manticore/core/smtlib/constraints.py
def _declare(self, var): """ Declare the variable `var` """ if var.name in self._declarations: raise ValueError('Variable already declared') self._declarations[var.name] = var return var
def _declare(self, var): """ Declare the variable `var` """ if var.name in self._declarations: raise ValueError('Variable already declared') self._declarations[var.name] = var return var
[ "Declare", "the", "variable", "var" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L171-L176
[ "def", "_declare", "(", "self", ",", "var", ")", ":", "if", "var", ".", "name", "in", "self", ".", "_declarations", ":", "raise", "ValueError", "(", "'Variable already declared'", ")", "self", ".", "_declarations", "[", "var", ".", "name", "]", "=", "var...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.declarations
Returns the variable expressions of this constraint set
manticore/core/smtlib/constraints.py
def declarations(self): """ Returns the variable expressions of this constraint set """ declarations = GetDeclarations() for a in self.constraints: try: declarations.visit(a) except RuntimeError: # TODO: (defunct) move recursion management ...
def declarations(self): """ Returns the variable expressions of this constraint set """ declarations = GetDeclarations() for a in self.constraints: try: declarations.visit(a) except RuntimeError: # TODO: (defunct) move recursion management ...
[ "Returns", "the", "variable", "expressions", "of", "this", "constraint", "set" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L187-L201
[ "def", "declarations", "(", "self", ")", ":", "declarations", "=", "GetDeclarations", "(", ")", "for", "a", "in", "self", ".", "constraints", ":", "try", ":", "declarations", ".", "visit", "(", "a", ")", "except", "RuntimeError", ":", "# TODO: (defunct) move...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.constraints
:rtype tuple :return: All constraints represented by this and parent sets.
manticore/core/smtlib/constraints.py
def constraints(self): """ :rtype tuple :return: All constraints represented by this and parent sets. """ if self._parent is not None: return tuple(self._constraints) + self._parent.constraints return tuple(self._constraints)
def constraints(self): """ :rtype tuple :return: All constraints represented by this and parent sets. """ if self._parent is not None: return tuple(self._constraints) + self._parent.constraints return tuple(self._constraints)
[ ":", "rtype", "tuple", ":", "return", ":", "All", "constraints", "represented", "by", "this", "and", "parent", "sets", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L204-L211
[ "def", "constraints", "(", "self", ")", ":", "if", "self", ".", "_parent", "is", "not", "None", ":", "return", "tuple", "(", "self", ".", "_constraints", ")", "+", "self", ".", "_parent", ".", "constraints", "return", "tuple", "(", "self", ".", "_const...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.is_declared
True if expression_var is declared in this constraint set
manticore/core/smtlib/constraints.py
def is_declared(self, expression_var): """ True if expression_var is declared in this constraint set """ if not isinstance(expression_var, Variable): raise ValueError(f'Expression must be a Variable (not a {type(expression_var)})') return any(expression_var is x for x in self.get_dec...
def is_declared(self, expression_var): """ True if expression_var is declared in this constraint set """ if not isinstance(expression_var, Variable): raise ValueError(f'Expression must be a Variable (not a {type(expression_var)})') return any(expression_var is x for x in self.get_dec...
[ "True", "if", "expression_var", "is", "declared", "in", "this", "constraint", "set" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L229-L233
[ "def", "is_declared", "(", "self", ",", "expression_var", ")", ":", "if", "not", "isinstance", "(", "expression_var", ",", "Variable", ")", ":", "raise", "ValueError", "(", "f'Expression must be a Variable (not a {type(expression_var)})'", ")", "return", "any", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.migrate
Migrate an expression created for a different constraint set to self. Returns an expression that can be used with this constraintSet All the foreign variables used in the expression are replaced by variables of this constraint set. If the variable was replaced before the...
manticore/core/smtlib/constraints.py
def migrate(self, expression, name_migration_map=None): """ Migrate an expression created for a different constraint set to self. Returns an expression that can be used with this constraintSet All the foreign variables used in the expression are replaced by variables of this...
def migrate(self, expression, name_migration_map=None): """ Migrate an expression created for a different constraint set to self. Returns an expression that can be used with this constraintSet All the foreign variables used in the expression are replaced by variables of this...
[ "Migrate", "an", "expression", "created", "for", "a", "different", "constraint", "set", "to", "self", ".", "Returns", "an", "expression", "that", "can", "be", "used", "with", "this", "constraintSet" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L235-L293
[ "def", "migrate", "(", "self", ",", "expression", ",", "name_migration_map", "=", "None", ")", ":", "if", "name_migration_map", "is", "None", ":", "name_migration_map", "=", "{", "}", "# name_migration_map -> object_migration_map", "# Based on the name mapping in name_m...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.new_bool
Declares a free symbolic boolean in the constraint store :param name: try to assign name to internal variable representation, if not unique, a numeric nonce will be appended :param avoid_collisions: potentially avoid_collisions the variable to avoid name collisions if Tr...
manticore/core/smtlib/constraints.py
def new_bool(self, name=None, taint=frozenset(), avoid_collisions=False): """ Declares a free symbolic boolean in the constraint store :param name: try to assign name to internal variable representation, if not unique, a numeric nonce will be appended :param avoi...
def new_bool(self, name=None, taint=frozenset(), avoid_collisions=False): """ Declares a free symbolic boolean in the constraint store :param name: try to assign name to internal variable representation, if not unique, a numeric nonce will be appended :param avoi...
[ "Declares", "a", "free", "symbolic", "boolean", "in", "the", "constraint", "store", ":", "param", "name", ":", "try", "to", "assign", "name", "to", "internal", "variable", "representation", "if", "not", "unique", "a", "numeric", "nonce", "will", "be", "appen...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L295-L310
[ "def", "new_bool", "(", "self", ",", "name", "=", "None", ",", "taint", "=", "frozenset", "(", ")", ",", "avoid_collisions", "=", "False", ")", ":", "if", "name", "is", "None", ":", "name", "=", "'B'", "avoid_collisions", "=", "True", "if", "avoid_coll...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.new_bitvec
Declares a free symbolic bitvector in the constraint store :param size: size in bits for the bitvector :param name: try to assign name to internal variable representation, if not unique, a numeric nonce will be appended :param avoid_collisions: potentially av...
manticore/core/smtlib/constraints.py
def new_bitvec(self, size, name=None, taint=frozenset(), avoid_collisions=False): """ Declares a free symbolic bitvector in the constraint store :param size: size in bits for the bitvector :param name: try to assign name to internal variable representation, if no...
def new_bitvec(self, size, name=None, taint=frozenset(), avoid_collisions=False): """ Declares a free symbolic bitvector in the constraint store :param size: size in bits for the bitvector :param name: try to assign name to internal variable representation, if no...
[ "Declares", "a", "free", "symbolic", "bitvector", "in", "the", "constraint", "store", ":", "param", "size", ":", "size", "in", "bits", "for", "the", "bitvector", ":", "param", "name", ":", "try", "to", "assign", "name", "to", "internal", "variable", "repre...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L312-L330
[ "def", "new_bitvec", "(", "self", ",", "size", ",", "name", "=", "None", ",", "taint", "=", "frozenset", "(", ")", ",", "avoid_collisions", "=", "False", ")", ":", "if", "not", "(", "size", "==", "1", "or", "size", "%", "8", "==", "0", ")", ":", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConstraintSet.new_array
Declares a free symbolic array of value_bits long bitvectors in the constraint store. :param index_bits: size in bits for the array indexes one of [32, 64] :param value_bits: size in bits for the array values :param name: try to assign name to internal variable representation, ...
manticore/core/smtlib/constraints.py
def new_array(self, index_bits=32, name=None, index_max=None, value_bits=8, taint=frozenset(), avoid_collisions=False, default=None): """ Declares a free symbolic array of value_bits long bitvectors in the constraint store. :param index_bits: size in bits for the array indexes one of [32, 64] ...
def new_array(self, index_bits=32, name=None, index_max=None, value_bits=8, taint=frozenset(), avoid_collisions=False, default=None): """ Declares a free symbolic array of value_bits long bitvectors in the constraint store. :param index_bits: size in bits for the array indexes one of [32, 64] ...
[ "Declares", "a", "free", "symbolic", "array", "of", "value_bits", "long", "bitvectors", "in", "the", "constraint", "store", ".", ":", "param", "index_bits", ":", "size", "in", "bits", "for", "the", "array", "indexes", "one", "of", "[", "32", "64", "]", "...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/constraints.py#L332-L351
[ "def", "new_array", "(", "self", ",", "index_bits", "=", "32", ",", "name", "=", "None", ",", "index_max", "=", "None", ",", "value_bits", "=", "8", ",", "taint", "=", "frozenset", "(", ")", ",", "avoid_collisions", "=", "False", ",", "default", "=", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
train_encoder
Defines folds and performs the data preprocessing (categorical encoding, NaN imputation, normalization) Returns a list with {X_train, y_train, X_test, y_test}, average fit_encoder_time and average score_encoder_time Note: We normalize all features (not only numerical features) because otherwise SVM would ...
examples/benchmarking_large/util.py
def train_encoder(X, y, fold_count, encoder): """ Defines folds and performs the data preprocessing (categorical encoding, NaN imputation, normalization) Returns a list with {X_train, y_train, X_test, y_test}, average fit_encoder_time and average score_encoder_time Note: We normalize all features (not ...
def train_encoder(X, y, fold_count, encoder): """ Defines folds and performs the data preprocessing (categorical encoding, NaN imputation, normalization) Returns a list with {X_train, y_train, X_test, y_test}, average fit_encoder_time and average score_encoder_time Note: We normalize all features (not ...
[ "Defines", "folds", "and", "performs", "the", "data", "preprocessing", "(", "categorical", "encoding", "NaN", "imputation", "normalization", ")", "Returns", "a", "list", "with", "{", "X_train", "y_train", "X_test", "y_test", "}", "average", "fit_encoder_time", "an...
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/benchmarking_large/util.py#L13-L56
[ "def", "train_encoder", "(", "X", ",", "y", ",", "fold_count", ",", "encoder", ")", ":", "kf", "=", "StratifiedKFold", "(", "n_splits", "=", "fold_count", ",", "shuffle", "=", "True", ",", "random_state", "=", "2001", ")", "encoder", "=", "deepcopy", "("...
5e9e803c9131b377af305d5302723ba2415001da
valid
train_model
Evaluation with: Matthews correlation coefficient: represents thresholding measures AUC: represents ranking measures Brier score: represents calibration measures
examples/benchmarking_large/util.py
def train_model(folds, model): """ Evaluation with: Matthews correlation coefficient: represents thresholding measures AUC: represents ranking measures Brier score: represents calibration measures """ scores = [] fit_model_time = 0 # Sum of all the time spend on fitting the tr...
def train_model(folds, model): """ Evaluation with: Matthews correlation coefficient: represents thresholding measures AUC: represents ranking measures Brier score: represents calibration measures """ scores = [] fit_model_time = 0 # Sum of all the time spend on fitting the tr...
[ "Evaluation", "with", ":", "Matthews", "correlation", "coefficient", ":", "represents", "thresholding", "measures", "AUC", ":", "represents", "ranking", "measures", "Brier", "score", ":", "represents", "calibration", "measures" ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/benchmarking_large/util.py#L58-L96
[ "def", "train_model", "(", "folds", ",", "model", ")", ":", "scores", "=", "[", "]", "fit_model_time", "=", "0", "# Sum of all the time spend on fitting the training data, later on normalized", "score_model_time", "=", "0", "# Sum of all the time spend on scoring the testing da...
5e9e803c9131b377af305d5302723ba2415001da
valid
BinaryEncoder.fit
Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape = [n_samples] Target va...
category_encoders/binary.py
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
[ "Fit", "encoder", "according", "to", "X", "and", "y", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/binary.py#L85-L107
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "base_n_encoder", ".", "fit", "(", "X", ",", "y", ",", "*", "*", "kwargs", ")", "return", "self" ]
5e9e803c9131b377af305d5302723ba2415001da
valid
SumEncoder.fit
Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape = [n_samples] Target va...
category_encoders/sum_coding.py
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
[ "Fit", "encoder", "according", "to", "X", "and", "y", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/sum_coding.py#L100-L171
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# if the input dataset isn't already a dataframe, convert it to one (using default column names)", "# first check the type", "X", "=", "util", ".", "convert_input", "(", "X...
5e9e803c9131b377af305d5302723ba2415001da
valid
OrdinalEncoder.inverse_transform
Perform the inverse transformation to encoded data. Will attempt best case reconstruction, which means it will return nan for handle_missing and handle_unknown settings that break the bijection. We issue warnings when some of those cases occur. Parameters ---------- X_in : array...
category_encoders/ordinal.py
def inverse_transform(self, X_in): """ Perform the inverse transformation to encoded data. Will attempt best case reconstruction, which means it will return nan for handle_missing and handle_unknown settings that break the bijection. We issue warnings when some of those cases occur. ...
def inverse_transform(self, X_in): """ Perform the inverse transformation to encoded data. Will attempt best case reconstruction, which means it will return nan for handle_missing and handle_unknown settings that break the bijection. We issue warnings when some of those cases occur. ...
[ "Perform", "the", "inverse", "transformation", "to", "encoded", "data", ".", "Will", "attempt", "best", "case", "reconstruction", "which", "means", "it", "will", "return", "nan", "for", "handle_missing", "and", "handle_unknown", "settings", "that", "break", "the",...
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/ordinal.py#L217-L269
[ "def", "inverse_transform", "(", "self", ",", "X_in", ")", ":", "X", "=", "X_in", ".", "copy", "(", "deep", "=", "True", ")", "# first check the type", "X", "=", "util", ".", "convert_input", "(", "X", ")", "if", "self", ".", "_dim", "is", "None", ":...
5e9e803c9131b377af305d5302723ba2415001da
valid
OrdinalEncoder.ordinal_encoding
Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed in, in this case we use the knowledge that there is some true order to the classes themselves. Otherwise, the classes are assumed to have no true order and integers are selected at random.
category_encoders/ordinal.py
def ordinal_encoding(X_in, mapping=None, cols=None, handle_unknown='value', handle_missing='value'): """ Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed in, in this case we use the knowledge that there is some true order to the c...
def ordinal_encoding(X_in, mapping=None, cols=None, handle_unknown='value', handle_missing='value'): """ Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed in, in this case we use the knowledge that there is some true order to the c...
[ "Ordinal", "encoding", "uses", "a", "single", "column", "of", "integers", "to", "represent", "the", "classes", ".", "An", "optional", "mapping", "dict", "can", "be", "passed", "in", "in", "this", "case", "we", "use", "the", "knowledge", "that", "there", "i...
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/ordinal.py#L272-L329
[ "def", "ordinal_encoding", "(", "X_in", ",", "mapping", "=", "None", ",", "cols", "=", "None", ",", "handle_unknown", "=", "'value'", ",", "handle_missing", "=", "'value'", ")", ":", "return_nan_series", "=", "pd", ".", "Series", "(", "data", "=", "[", "...
5e9e803c9131b377af305d5302723ba2415001da
valid
OneHotEncoder.transform
Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed values with encoding applied.
category_encoders/one_hot.py
def transform(self, X, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed...
def transform(self, X, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed...
[ "Perform", "the", "transformation", "to", "new", "categorical", "data", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/one_hot.py#L225-L275
[ "def", "transform", "(", "self", ",", "X", ",", "override_return_df", "=", "False", ")", ":", "if", "self", ".", "handle_missing", "==", "'error'", ":", "if", "X", "[", "self", ".", "cols", "]", ".", "isnull", "(", ")", ".", "any", "(", ")", ".", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
OneHotEncoder.reverse_dummies
Convert dummy variable into numerical variables Parameters ---------- X : DataFrame mapping: list-like Contains mappings of column to be transformed to it's new columns and value represented Returns ------- numerical: DataFrame
category_encoders/one_hot.py
def reverse_dummies(self, X, mapping): """ Convert dummy variable into numerical variables Parameters ---------- X : DataFrame mapping: list-like Contains mappings of column to be transformed to it's new columns and value represented Returns ...
def reverse_dummies(self, X, mapping): """ Convert dummy variable into numerical variables Parameters ---------- X : DataFrame mapping: list-like Contains mappings of column to be transformed to it's new columns and value represented Returns ...
[ "Convert", "dummy", "variable", "into", "numerical", "variables" ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/one_hot.py#L359-L391
[ "def", "reverse_dummies", "(", "self", ",", "X", ",", "mapping", ")", ":", "out_cols", "=", "X", ".", "columns", ".", "values", ".", "tolist", "(", ")", "mapped_columns", "=", "[", "]", "for", "switch", "in", "mapping", ":", "col", "=", "switch", "."...
5e9e803c9131b377af305d5302723ba2415001da
valid
get_cars_data
Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column. :return:
examples/source_data/loaders.py
def get_cars_data(): """ Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column. :return: """ df = pd.read_csv('source_data/cars/car.data.txt') X = df.reindex(columns=[x for x in df.columns.values if x != 'class']) y = df.reindex(columns=['...
def get_cars_data(): """ Load the cars dataset, split it into X and y, and then call the label encoder to get an integer y column. :return: """ df = pd.read_csv('source_data/cars/car.data.txt') X = df.reindex(columns=[x for x in df.columns.values if x != 'class']) y = df.reindex(columns=['...
[ "Load", "the", "cars", "dataset", "split", "it", "into", "X", "and", "y", "and", "then", "call", "the", "label", "encoder", "to", "get", "an", "integer", "y", "column", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/source_data/loaders.py#L7-L28
[ "def", "get_cars_data", "(", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "'source_data/cars/car.data.txt'", ")", "X", "=", "df", ".", "reindex", "(", "columns", "=", "[", "x", "for", "x", "in", "df", ".", "columns", ".", "values", "if", "x", "!=...
5e9e803c9131b377af305d5302723ba2415001da
valid
get_splice_data
Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column. :return:
examples/source_data/loaders.py
def get_splice_data(): """ Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column. :return: """ df = pd.read_csv('source_data/splice/splice.csv') X = df.reindex(columns=[x for x in df.columns.values if x != 'class']) X['dna'] = X['dna']...
def get_splice_data(): """ Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column. :return: """ df = pd.read_csv('source_data/splice/splice.csv') X = df.reindex(columns=[x for x in df.columns.values if x != 'class']) X['dna'] = X['dna']...
[ "Load", "the", "mushroom", "dataset", "split", "it", "into", "X", "and", "y", "and", "then", "call", "the", "label", "encoder", "to", "get", "an", "integer", "y", "column", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/source_data/loaders.py#L49-L69
[ "def", "get_splice_data", "(", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "'source_data/splice/splice.csv'", ")", "X", "=", "df", ".", "reindex", "(", "columns", "=", "[", "x", "for", "x", "in", "df", ".", "columns", ".", "values", "if", "x", "...
5e9e803c9131b377af305d5302723ba2415001da
valid
BaseNEncoder.basen_to_integer
Convert basen code as integers. Parameters ---------- X : DataFrame encoded data cols : list-like Column names in the DataFrame that be encoded base : int The base of transform Returns ------- numerical: DataFrame
category_encoders/basen.py
def basen_to_integer(self, X, cols, base): """ Convert basen code as integers. Parameters ---------- X : DataFrame encoded data cols : list-like Column names in the DataFrame that be encoded base : int The base of transform ...
def basen_to_integer(self, X, cols, base): """ Convert basen code as integers. Parameters ---------- X : DataFrame encoded data cols : list-like Column names in the DataFrame that be encoded base : int The base of transform ...
[ "Convert", "basen", "code", "as", "integers", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/basen.py#L337-L370
[ "def", "basen_to_integer", "(", "self", ",", "X", ",", "cols", ",", "base", ")", ":", "out_cols", "=", "X", ".", "columns", ".", "values", ".", "tolist", "(", ")", "for", "col", "in", "cols", ":", "col_list", "=", "[", "col0", "for", "col0", "in", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
BaseNEncoder.col_transform
The lambda body to transform the column values
category_encoders/basen.py
def col_transform(self, col, digits): """ The lambda body to transform the column values """ if col is None or float(col) < 0.0: return None else: col = self.number_to_base(int(col), self.base, digits) if len(col) == digits: re...
def col_transform(self, col, digits): """ The lambda body to transform the column values """ if col is None or float(col) < 0.0: return None else: col = self.number_to_base(int(col), self.base, digits) if len(col) == digits: re...
[ "The", "lambda", "body", "to", "transform", "the", "column", "values" ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/basen.py#L372-L384
[ "def", "col_transform", "(", "self", ",", "col", ",", "digits", ")", ":", "if", "col", "is", "None", "or", "float", "(", "col", ")", "<", "0.0", ":", "return", "None", "else", ":", "col", "=", "self", ".", "number_to_base", "(", "int", "(", "col", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
HashingEncoder.fit
Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape = [n_samples] Target va...
category_encoders/hashing.py
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
def fit(self, X, y=None, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-...
[ "Fit", "encoder", "according", "to", "X", "and", "y", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/hashing.py#L88-L134
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# first check the type", "X", "=", "util", ".", "convert_input", "(", "X", ")", "self", ".", "_dim", "=", "X", ".", "shape", "[", "1", "]", "# if colu...
5e9e803c9131b377af305d5302723ba2415001da
valid
HashingEncoder.transform
Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed values with encoding applied.
category_encoders/hashing.py
def transform(self, X, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed...
def transform(self, X, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- p : array, shape = [n_samples, n_numeric + N] Transformed...
[ "Perform", "the", "transformation", "to", "new", "categorical", "data", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/hashing.py#L136-L174
[ "def", "transform", "(", "self", ",", "X", ",", "override_return_df", "=", "False", ")", ":", "if", "self", ".", "_dim", "is", "None", ":", "raise", "ValueError", "(", "'Must train encoder before it can be used to transform data.'", ")", "# first check the type", "X...
5e9e803c9131b377af305d5302723ba2415001da
valid
HashingEncoder.hashing_trick
A basic hashing implementation with configurable dimensionality/precision Performs the hashing trick on a pandas dataframe, `X`, using the hashing method from hashlib identified by `hashing_method`. The number of output dimensions (`N`), and columns to hash (`cols`) are also configurable. ...
category_encoders/hashing.py
def hashing_trick(X_in, hashing_method='md5', N=2, cols=None, make_copy=False): """A basic hashing implementation with configurable dimensionality/precision Performs the hashing trick on a pandas dataframe, `X`, using the hashing method from hashlib identified by `hashing_method`. The number o...
def hashing_trick(X_in, hashing_method='md5', N=2, cols=None, make_copy=False): """A basic hashing implementation with configurable dimensionality/precision Performs the hashing trick on a pandas dataframe, `X`, using the hashing method from hashlib identified by `hashing_method`. The number o...
[ "A", "basic", "hashing", "implementation", "with", "configurable", "dimensionality", "/", "precision" ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/hashing.py#L177-L255
[ "def", "hashing_trick", "(", "X_in", ",", "hashing_method", "=", "'md5'", ",", "N", "=", "2", ",", "cols", "=", "None", ",", "make_copy", "=", "False", ")", ":", "try", ":", "if", "hashing_method", "not", "in", "hashlib", ".", "algorithms_available", ":"...
5e9e803c9131b377af305d5302723ba2415001da
valid
CatBoostEncoder.transform
Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] y : array-like, shape = [n_samples] when transform by leave one out None, when transform without target information (such as transform test set) ...
category_encoders/cat_boost.py
def transform(self, X, y=None, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] y : array-like, shape = [n_samples] when transform by leave one out None, when tran...
def transform(self, X, y=None, override_return_df=False): """Perform the transformation to new categorical data. Parameters ---------- X : array-like, shape = [n_samples, n_features] y : array-like, shape = [n_samples] when transform by leave one out None, when tran...
[ "Perform", "the", "transformation", "to", "new", "categorical", "data", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/cat_boost.py#L163-L217
[ "def", "transform", "(", "self", ",", "X", ",", "y", "=", "None", ",", "override_return_df", "=", "False", ")", ":", "if", "self", ".", "handle_missing", "==", "'error'", ":", "if", "X", "[", "self", ".", "cols", "]", ".", "isnull", "(", ")", ".", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
CatBoostEncoder.transform_leave_one_out
Leave one out encoding uses a single column of floats to represent the means of the target variables.
category_encoders/cat_boost.py
def transform_leave_one_out(self, X_in, y, mapping=None): """ Leave one out encoding uses a single column of floats to represent the means of the target variables. """ X = X_in.copy(deep=True) random_state_ = check_random_state(self.random_state) # Prepare the data ...
def transform_leave_one_out(self, X_in, y, mapping=None): """ Leave one out encoding uses a single column of floats to represent the means of the target variables. """ X = X_in.copy(deep=True) random_state_ = check_random_state(self.random_state) # Prepare the data ...
[ "Leave", "one", "out", "encoding", "uses", "a", "single", "column", "of", "floats", "to", "represent", "the", "means", "of", "the", "target", "variables", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/cat_boost.py#L252-L309
[ "def", "transform_leave_one_out", "(", "self", ",", "X_in", ",", "y", ",", "mapping", "=", "None", ")", ":", "X", "=", "X_in", ".", "copy", "(", "deep", "=", "True", ")", "random_state_", "=", "check_random_state", "(", "self", ".", "random_state", ")", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
get_obj_cols
Returns names of 'object' columns in the DataFrame.
category_encoders/utils.py
def get_obj_cols(df): """ Returns names of 'object' columns in the DataFrame. """ obj_cols = [] for idx, dt in enumerate(df.dtypes): if dt == 'object' or is_category(dt): obj_cols.append(df.columns.values[idx]) return obj_cols
def get_obj_cols(df): """ Returns names of 'object' columns in the DataFrame. """ obj_cols = [] for idx, dt in enumerate(df.dtypes): if dt == 'object' or is_category(dt): obj_cols.append(df.columns.values[idx]) return obj_cols
[ "Returns", "names", "of", "object", "columns", "in", "the", "DataFrame", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/utils.py#L27-L36
[ "def", "get_obj_cols", "(", "df", ")", ":", "obj_cols", "=", "[", "]", "for", "idx", ",", "dt", "in", "enumerate", "(", "df", ".", "dtypes", ")", ":", "if", "dt", "==", "'object'", "or", "is_category", "(", "dt", ")", ":", "obj_cols", ".", "append"...
5e9e803c9131b377af305d5302723ba2415001da
valid
convert_input
Unite data into a DataFrame.
category_encoders/utils.py
def convert_input(X): """ Unite data into a DataFrame. """ if not isinstance(X, pd.DataFrame): if isinstance(X, list): X = pd.DataFrame(X) elif isinstance(X, (np.generic, np.ndarray)): X = pd.DataFrame(X) elif isinstance(X, csr_matrix): X = pd....
def convert_input(X): """ Unite data into a DataFrame. """ if not isinstance(X, pd.DataFrame): if isinstance(X, list): X = pd.DataFrame(X) elif isinstance(X, (np.generic, np.ndarray)): X = pd.DataFrame(X) elif isinstance(X, csr_matrix): X = pd....
[ "Unite", "data", "into", "a", "DataFrame", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/utils.py#L43-L61
[ "def", "convert_input", "(", "X", ")", ":", "if", "not", "isinstance", "(", "X", ",", "pd", ".", "DataFrame", ")", ":", "if", "isinstance", "(", "X", ",", "list", ")", ":", "X", "=", "pd", ".", "DataFrame", "(", "X", ")", "elif", "isinstance", "(...
5e9e803c9131b377af305d5302723ba2415001da
valid
convert_input_vector
Unite target data type into a Series. If the target is a Series or a DataFrame, we preserve its index. But if the target does not contain index attribute, we use the index from the argument.
category_encoders/utils.py
def convert_input_vector(y, index): """ Unite target data type into a Series. If the target is a Series or a DataFrame, we preserve its index. But if the target does not contain index attribute, we use the index from the argument. """ if y is None: return None if isinstance(y, pd.Ser...
def convert_input_vector(y, index): """ Unite target data type into a Series. If the target is a Series or a DataFrame, we preserve its index. But if the target does not contain index attribute, we use the index from the argument. """ if y is None: return None if isinstance(y, pd.Ser...
[ "Unite", "target", "data", "type", "into", "a", "Series", ".", "If", "the", "target", "is", "a", "Series", "or", "a", "DataFrame", "we", "preserve", "its", "index", ".", "But", "if", "the", "target", "does", "not", "contain", "index", "attribute", "we", ...
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/utils.py#L64-L103
[ "def", "convert_input_vector", "(", "y", ",", "index", ")", ":", "if", "y", "is", "None", ":", "return", "None", "if", "isinstance", "(", "y", ",", "pd", ".", "Series", ")", ":", "return", "y", "elif", "isinstance", "(", "y", ",", "np", ".", "ndarr...
5e9e803c9131b377af305d5302723ba2415001da
valid
get_generated_cols
Returns a list of the generated/transformed columns. Arguments: X_original: df the original (input) DataFrame. X_transformed: df the transformed (current) DataFrame. to_transform: [str] a list of columns that were transformed (as in the original DataFrame...
category_encoders/utils.py
def get_generated_cols(X_original, X_transformed, to_transform): """ Returns a list of the generated/transformed columns. Arguments: X_original: df the original (input) DataFrame. X_transformed: df the transformed (current) DataFrame. to_transform: [str] ...
def get_generated_cols(X_original, X_transformed, to_transform): """ Returns a list of the generated/transformed columns. Arguments: X_original: df the original (input) DataFrame. X_transformed: df the transformed (current) DataFrame. to_transform: [str] ...
[ "Returns", "a", "list", "of", "the", "generated", "/", "transformed", "columns", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/utils.py#L105-L129
[ "def", "get_generated_cols", "(", "X_original", ",", "X_transformed", ",", "to_transform", ")", ":", "original_cols", "=", "list", "(", "X_original", ".", "columns", ")", "if", "len", "(", "to_transform", ")", ">", "0", ":", "[", "original_cols", ".", "remov...
5e9e803c9131b377af305d5302723ba2415001da
valid
TargetEncoder.fit
Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape = [n_samples] Target val...
category_encoders/target_encoder.py
def fit(self, X, y, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, ...
def fit(self, X, y, **kwargs): """Fit encoder according to X and y. Parameters ---------- X : array-like, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, ...
[ "Fit", "encoder", "according", "to", "X", "and", "y", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/target_encoder.py#L95-L157
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "*", "*", "kwargs", ")", ":", "# unite the input into pandas types", "X", "=", "util", ".", "convert_input", "(", "X", ")", "y", "=", "util", ".", "convert_input_vector", "(", "y", ",", "X", ".", "i...
5e9e803c9131b377af305d5302723ba2415001da
valid
LeaveOneOutEncoder.transform_leave_one_out
Leave one out encoding uses a single column of floats to represent the means of the target variables.
category_encoders/leave_one_out.py
def transform_leave_one_out(self, X_in, y, mapping=None): """ Leave one out encoding uses a single column of floats to represent the means of the target variables. """ X = X_in.copy(deep=True) random_state_ = check_random_state(self.random_state) for col, colmap in mapp...
def transform_leave_one_out(self, X_in, y, mapping=None): """ Leave one out encoding uses a single column of floats to represent the means of the target variables. """ X = X_in.copy(deep=True) random_state_ = check_random_state(self.random_state) for col, colmap in mapp...
[ "Leave", "one", "out", "encoding", "uses", "a", "single", "column", "of", "floats", "to", "represent", "the", "means", "of", "the", "target", "variables", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/category_encoders/leave_one_out.py#L244-L287
[ "def", "transform_leave_one_out", "(", "self", ",", "X_in", ",", "y", ",", "mapping", "=", "None", ")", ":", "X", "=", "X_in", ".", "copy", "(", "deep", "=", "True", ")", "random_state_", "=", "check_random_state", "(", "self", ".", "random_state", ")", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
score_models
Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score.
examples/encoding_examples.py
def score_models(clf, X, y, encoder, runs=1): """ Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score. """ scores = [] X_test = None for _ in range(runs): X_test = encoder().fit_transform(X, y) # Some models, like...
def score_models(clf, X, y, encoder, runs=1): """ Takes in a classifier that supports multiclass classification, and X and a y, and returns a cross validation score. """ scores = [] X_test = None for _ in range(runs): X_test = encoder().fit_transform(X, y) # Some models, like...
[ "Takes", "in", "a", "classifier", "that", "supports", "multiclass", "classification", "and", "X", "and", "a", "y", "and", "returns", "a", "cross", "validation", "score", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/encoding_examples.py#L27-L49
[ "def", "score_models", "(", "clf", ",", "X", ",", "y", ",", "encoder", ",", "runs", "=", "1", ")", ":", "scores", "=", "[", "]", "X_test", "=", "None", "for", "_", "in", "range", "(", "runs", ")", ":", "X_test", "=", "encoder", "(", ")", ".", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
main
Here we iterate through the datasets and score them with a classifier using different encodings.
examples/encoding_examples.py
def main(loader, name): """ Here we iterate through the datasets and score them with a classifier using different encodings. """ scores = [] raw_scores_ds = {} # first get the dataset X, y, mapping = loader() clf = linear_model.LogisticRegression(solver='lbfgs', multi_class='auto', m...
def main(loader, name): """ Here we iterate through the datasets and score them with a classifier using different encodings. """ scores = [] raw_scores_ds = {} # first get the dataset X, y, mapping = loader() clf = linear_model.LogisticRegression(solver='lbfgs', multi_class='auto', m...
[ "Here", "we", "iterate", "through", "the", "datasets", "and", "score", "them", "with", "a", "classifier", "using", "different", "encodings", "." ]
scikit-learn-contrib/categorical-encoding
python
https://github.com/scikit-learn-contrib/categorical-encoding/blob/5e9e803c9131b377af305d5302723ba2415001da/examples/encoding_examples.py#L52-L89
[ "def", "main", "(", "loader", ",", "name", ")", ":", "scores", "=", "[", "]", "raw_scores_ds", "=", "{", "}", "# first get the dataset", "X", ",", "y", ",", "mapping", "=", "loader", "(", ")", "clf", "=", "linear_model", ".", "LogisticRegression", "(", ...
5e9e803c9131b377af305d5302723ba2415001da
valid
secho
A wrapper around click.secho that disables any coloring being used if colors have been disabled.
tower_cli/utils/__init__.py
def secho(message, **kwargs): """A wrapper around click.secho that disables any coloring being used if colors have been disabled. """ # If colors are disabled, remove any color or other style data # from keyword arguments. if not settings.color: for key in ('fg', 'bg', 'bold', 'blink'): ...
def secho(message, **kwargs): """A wrapper around click.secho that disables any coloring being used if colors have been disabled. """ # If colors are disabled, remove any color or other style data # from keyword arguments. if not settings.color: for key in ('fg', 'bg', 'bold', 'blink'): ...
[ "A", "wrapper", "around", "click", ".", "secho", "that", "disables", "any", "coloring", "being", "used", "if", "colors", "have", "been", "disabled", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/__init__.py#L25-L36
[ "def", "secho", "(", "message", ",", "*", "*", "kwargs", ")", ":", "# If colors are disabled, remove any color or other style data", "# from keyword arguments.", "if", "not", "settings", ".", "color", ":", "for", "key", "in", "(", "'fg'", ",", "'bg'", ",", "'bold'...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate_notification_template
Associate a notification template from this job template. =====API DOCS===== Associate a notification template from this job template. :param job_template: The job template to associate to. :type job_template: str :param notification_template: The notification template to be as...
tower_cli/resources/job_template.py
def associate_notification_template(self, job_template, notification_template, status): """Associate a notification template from this job template. =====API DOCS===== Associate a notification template from this job template. :param job_template:...
def associate_notification_template(self, job_template, notification_template, status): """Associate a notification template from this job template. =====API DOCS===== Associate a notification template from this job template. :param job_template:...
[ "Associate", "a", "notification", "template", "from", "this", "job", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/job_template.py#L174-L193
[ "def", "associate_notification_template", "(", "self", ",", "job_template", ",", "notification_template", ",", "status", ")", ":", "return", "self", ".", "_assoc", "(", "'notification_templates_%s'", "%", "status", ",", "job_template", ",", "notification_template", ")...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate_notification_template
Disassociate a notification template from this job template. =====API DOCS===== Disassociate a notification template from this job template. :param job_template: The job template to disassociate from. :type job_template: str :param notification_template: The notification templa...
tower_cli/resources/job_template.py
def disassociate_notification_template(self, job_template, notification_template, status): """Disassociate a notification template from this job template. =====API DOCS===== Disassociate a notification template from this job template. :param j...
def disassociate_notification_template(self, job_template, notification_template, status): """Disassociate a notification template from this job template. =====API DOCS===== Disassociate a notification template from this job template. :param j...
[ "Disassociate", "a", "notification", "template", "from", "this", "job", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/job_template.py#L202-L221
[ "def", "disassociate_notification_template", "(", "self", ",", "job_template", ",", "notification_template", ",", "status", ")", ":", "return", "self", ".", "_disassoc", "(", "'notification_templates_%s'", "%", "status", ",", "job_template", ",", "notification_template"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.callback
Contact Tower and request a configuration update using this job template. =====API DOCS===== Contact Tower and request a provisioning callback using this job template. :param pk: Primary key of the job template to run provisioning callback against. :type pk: int :param host_con...
tower_cli/resources/job_template.py
def callback(self, pk=None, host_config_key='', extra_vars=None): """Contact Tower and request a configuration update using this job template. =====API DOCS===== Contact Tower and request a provisioning callback using this job template. :param pk: Primary key of the job template to run...
def callback(self, pk=None, host_config_key='', extra_vars=None): """Contact Tower and request a configuration update using this job template. =====API DOCS===== Contact Tower and request a provisioning callback using this job template. :param pk: Primary key of the job template to run...
[ "Contact", "Tower", "and", "request", "a", "configuration", "update", "using", "this", "job", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/job_template.py#L226-L252
[ "def", "callback", "(", "self", ",", "pk", "=", "None", ",", "host_config_key", "=", "''", ",", "extra_vars", "=", "None", ")", ":", "url", "=", "self", ".", "endpoint", "+", "'%s/callback/'", "%", "pk", "if", "not", "host_config_key", ":", "host_config_...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
jt_aggregate
Decorator to aggregate unified_jt-related fields. Args: func: The CURD method to be decorated. is_create: Boolean flag showing whether this method is create. has_pk: Boolean flag showing whether this method uses pk as argument. Returns: A function with necessary click-related a...
tower_cli/resources/schedule.py
def jt_aggregate(func, is_create=False, has_pk=False): """Decorator to aggregate unified_jt-related fields. Args: func: The CURD method to be decorated. is_create: Boolean flag showing whether this method is create. has_pk: Boolean flag showing whether this method uses pk as argument. ...
def jt_aggregate(func, is_create=False, has_pk=False): """Decorator to aggregate unified_jt-related fields. Args: func: The CURD method to be decorated. is_create: Boolean flag showing whether this method is create. has_pk: Boolean flag showing whether this method uses pk as argument. ...
[ "Decorator", "to", "aggregate", "unified_jt", "-", "related", "fields", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/schedule.py#L31-L94
[ "def", "jt_aggregate", "(", "func", ",", "is_create", "=", "False", ",", "has_pk", "=", "False", ")", ":", "def", "helper", "(", "kwargs", ",", "obj", ")", ":", "\"\"\"The helper function preceding actual function that aggregates\n unified jt fields.\n \"\"\...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.lookup_stdout
Internal method that lies to our `monitor` method by returning a scorecard for the workflow job where the standard out would have been expected.
tower_cli/resources/workflow_job.py
def lookup_stdout(self, pk=None, start_line=None, end_line=None, full=True): """ Internal method that lies to our `monitor` method by returning a scorecard for the workflow job where the standard out would have been expected. """ uj_res = get_resourc...
def lookup_stdout(self, pk=None, start_line=None, end_line=None, full=True): """ Internal method that lies to our `monitor` method by returning a scorecard for the workflow job where the standard out would have been expected. """ uj_res = get_resourc...
[ "Internal", "method", "that", "lies", "to", "our", "monitor", "method", "by", "returning", "a", "scorecard", "for", "the", "workflow", "job", "where", "the", "standard", "out", "would", "have", "been", "expected", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow_job.py#L50-L90
[ "def", "lookup_stdout", "(", "self", ",", "pk", "=", "None", ",", "start_line", "=", "None", ",", "end_line", "=", "None", ",", "full", "=", "True", ")", ":", "uj_res", "=", "get_resource", "(", "'unified_job'", ")", "# Filters", "# - limit search to jobs s...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.launch
Launch a new workflow job based on a workflow job template. Creates a new workflow job in Ansible Tower, starts it, and returns back an ID in order for its status to be monitored. =====API DOCS===== Launch a new workflow job based on a workflow job template. :param workflow_jo...
tower_cli/resources/workflow_job.py
def launch(self, workflow_job_template=None, monitor=False, wait=False, timeout=None, extra_vars=None, **kwargs): """Launch a new workflow job based on a workflow job template. Creates a new workflow job in Ansible Tower, starts it, and returns back an ID in order for its status ...
def launch(self, workflow_job_template=None, monitor=False, wait=False, timeout=None, extra_vars=None, **kwargs): """Launch a new workflow job based on a workflow job template. Creates a new workflow job in Ansible Tower, starts it, and returns back an ID in order for its status ...
[ "Launch", "a", "new", "workflow", "job", "based", "on", "a", "workflow", "job", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow_job.py#L115-L161
[ "def", "launch", "(", "self", ",", "workflow_job_template", "=", "None", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "extra_vars", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "extra_vars", "is", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ActionSubcommand.parse_args
Parse arguments sent to this command. The code for this method is taken from MultiCommand: https://github.com/mitsuhiko/click/blob/master/click/core.py It is Copyright (c) 2014 by Armin Ronacher. See the license: https://github.com/mitsuhiko/click/blob/master/LICENSE
tower_cli/cli/action.py
def parse_args(self, ctx, args): """Parse arguments sent to this command. The code for this method is taken from MultiCommand: https://github.com/mitsuhiko/click/blob/master/click/core.py It is Copyright (c) 2014 by Armin Ronacher. See the license: https://github.com/mi...
def parse_args(self, ctx, args): """Parse arguments sent to this command. The code for this method is taken from MultiCommand: https://github.com/mitsuhiko/click/blob/master/click/core.py It is Copyright (c) 2014 by Armin Ronacher. See the license: https://github.com/mi...
[ "Parse", "arguments", "sent", "to", "this", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/action.py#L33-L46
[ "def", "parse_args", "(", "self", ",", "ctx", ",", "args", ")", ":", "if", "not", "args", "and", "self", ".", "no_args_is_help", "and", "not", "ctx", ".", "resilient_parsing", ":", "click", ".", "echo", "(", "ctx", ".", "get_help", "(", ")", ")", "ct...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ActionSubcommand.format_options
Monkey-patch click's format_options method to support option categorization.
tower_cli/cli/action.py
def format_options(self, ctx, formatter): """Monkey-patch click's format_options method to support option categorization. """ field_opts = [] global_opts = [] local_opts = [] other_opts = [] for param in self.params: if param.name in SETTINGS_PARMS: ...
def format_options(self, ctx, formatter): """Monkey-patch click's format_options method to support option categorization. """ field_opts = [] global_opts = [] local_opts = [] other_opts = [] for param in self.params: if param.name in SETTINGS_PARMS: ...
[ "Monkey", "-", "patch", "click", "s", "format_options", "method", "to", "support", "option", "categorization", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/action.py#L48-L85
[ "def", "format_options", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "field_opts", "=", "[", "]", "global_opts", "=", "[", "]", "local_opts", "=", "[", "]", "other_opts", "=", "[", "]", "for", "param", "in", "self", ".", "params", ":", "if",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list
Return a list of objects. =====API DOCS===== Retrieve a list of Tower settings. :param category: The category slug in which to look up indevidual settings. :type category: str :param `**kwargs`: Keyword arguments list of available fields used for searching resource objects. ...
tower_cli/resources/setting.py
def list(self, **kwargs): """Return a list of objects. =====API DOCS===== Retrieve a list of Tower settings. :param category: The category slug in which to look up indevidual settings. :type category: str :param `**kwargs`: Keyword arguments list of available fields use...
def list(self, **kwargs): """Return a list of objects. =====API DOCS===== Retrieve a list of Tower settings. :param category: The category slug in which to look up indevidual settings. :type category: str :param `**kwargs`: Keyword arguments list of available fields use...
[ "Return", "a", "list", "of", "objects", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/setting.py#L40-L71
[ "def", "list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "custom_category", "=", "kwargs", ".", "get", "(", "'category'", ",", "'all'", ")", "try", ":", "result", "=", "super", "(", "Resource", ",", "self", ")", ".", "list", "(",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.get
Return one and exactly one object =====API DOCS===== Return one and exactly one Tower setting. :param pk: Primary key of the Tower setting to retrieve :type pk: int :returns: loaded JSON of the retrieved Tower setting object. :rtype: dict :raises tower_cli.excep...
tower_cli/resources/setting.py
def get(self, pk): """Return one and exactly one object =====API DOCS===== Return one and exactly one Tower setting. :param pk: Primary key of the Tower setting to retrieve :type pk: int :returns: loaded JSON of the retrieved Tower setting object. :rtype: dict ...
def get(self, pk): """Return one and exactly one object =====API DOCS===== Return one and exactly one Tower setting. :param pk: Primary key of the Tower setting to retrieve :type pk: int :returns: loaded JSON of the retrieved Tower setting object. :rtype: dict ...
[ "Return", "one", "and", "exactly", "one", "object" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/setting.py#L74-L93
[ "def", "get", "(", "self", ",", "pk", ")", ":", "# The Tower API doesn't provide a mechanism for retrieving a single", "# setting value at a time, so fetch them all and filter", "try", ":", "return", "next", "(", "s", "for", "s", "in", "self", ".", "list", "(", ")", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.modify
Modify an already existing object. Positional argument SETTING is the setting name and VALUE is its value, which can be provided directly or obtained from a file name if prefixed with '@'. =====API DOCS===== Modify an already existing Tower setting. :param setting: The name of...
tower_cli/resources/setting.py
def modify(self, setting, value): """Modify an already existing object. Positional argument SETTING is the setting name and VALUE is its value, which can be provided directly or obtained from a file name if prefixed with '@'. =====API DOCS===== Modify an already existing Tower ...
def modify(self, setting, value): """Modify an already existing object. Positional argument SETTING is the setting name and VALUE is its value, which can be provided directly or obtained from a file name if prefixed with '@'. =====API DOCS===== Modify an already existing Tower ...
[ "Modify", "an", "already", "existing", "object", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/setting.py#L99-L143
[ "def", "modify", "(", "self", ",", "setting", ",", "value", ")", ":", "prev_value", "=", "new_value", "=", "self", ".", "get", "(", "setting", ")", "[", "'value'", "]", "answer", "=", "OrderedDict", "(", ")", "encrypted", "=", "'$encrypted$'", "in", "s...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource._pop_none
Remove default values (anything where the value is None). click is unfortunately bad at the way it sends through unspecified defaults.
tower_cli/models/base.py
def _pop_none(self, kwargs): """Remove default values (anything where the value is None). click is unfortunately bad at the way it sends through unspecified defaults.""" for key, value in copy(kwargs).items(): # options with multiple=True return a tuple if value is None o...
def _pop_none(self, kwargs): """Remove default values (anything where the value is None). click is unfortunately bad at the way it sends through unspecified defaults.""" for key, value in copy(kwargs).items(): # options with multiple=True return a tuple if value is None o...
[ "Remove", "default", "values", "(", "anything", "where", "the", "value", "is", "None", ")", ".", "click", "is", "unfortunately", "bad", "at", "the", "way", "it", "sends", "through", "unspecified", "defaults", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L179-L187
[ "def", "_pop_none", "(", "self", ",", "kwargs", ")", ":", "for", "key", ",", "value", "in", "copy", "(", "kwargs", ")", ".", "items", "(", ")", ":", "# options with multiple=True return a tuple", "if", "value", "is", "None", "or", "value", "==", "(", ")"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource._lookup
=====API DOCS===== Attempt to perform a lookup that is expected to return a single result, and return the record. This method is a wrapper around `get` that strips out non-unique keys, and is used internally by `write` and `delete`. :param fail_on_missing: Flag that raise exception if ...
tower_cli/models/base.py
def _lookup(self, fail_on_missing=False, fail_on_found=False, include_debug_header=True, **kwargs): """ =====API DOCS===== Attempt to perform a lookup that is expected to return a single result, and return the record. This method is a wrapper around `get` that strips out non-unique keys...
def _lookup(self, fail_on_missing=False, fail_on_found=False, include_debug_header=True, **kwargs): """ =====API DOCS===== Attempt to perform a lookup that is expected to return a single result, and return the record. This method is a wrapper around `get` that strips out non-unique keys...
[ "=====", "API", "DOCS", "=====", "Attempt", "to", "perform", "a", "lookup", "that", "is", "expected", "to", "return", "a", "single", "result", "and", "return", "the", "record", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L189-L233
[ "def", "_lookup", "(", "self", ",", "fail_on_missing", "=", "False", ",", "fail_on_found", "=", "False", ",", "include_debug_header", "=", "True", ",", "*", "*", "kwargs", ")", ":", "read_params", "=", "{", "}", "for", "field_name", "in", "self", ".", "i...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource._convert_pagenum
Convert next and previous from URLs to integers
tower_cli/models/base.py
def _convert_pagenum(self, kwargs): """ Convert next and previous from URLs to integers """ for key in ('next', 'previous'): if not kwargs.get(key): continue match = re.search(r'page=(?P<num>[\d]+)', kwargs[key]) if match is None and ke...
def _convert_pagenum(self, kwargs): """ Convert next and previous from URLs to integers """ for key in ('next', 'previous'): if not kwargs.get(key): continue match = re.search(r'page=(?P<num>[\d]+)', kwargs[key]) if match is None and ke...
[ "Convert", "next", "and", "previous", "from", "URLs", "to", "integers" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L235-L246
[ "def", "_convert_pagenum", "(", "self", ",", "kwargs", ")", ":", "for", "key", "in", "(", "'next'", ",", "'previous'", ")", ":", "if", "not", "kwargs", ".", "get", "(", "key", ")", ":", "continue", "match", "=", "re", ".", "search", "(", "r'page=(?P<...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource.read
=====API DOCS===== Retrieve and return objects from the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object if ``pk`` is provided (not ``None``). :type pk: int :param fail_on_no_results: Flag that if se...
tower_cli/models/base.py
def read(self, pk=None, fail_on_no_results=False, fail_on_multiple_results=False, **kwargs): """ =====API DOCS===== Retrieve and return objects from the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object ...
def read(self, pk=None, fail_on_no_results=False, fail_on_multiple_results=False, **kwargs): """ =====API DOCS===== Retrieve and return objects from the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object ...
[ "=====", "API", "DOCS", "=====", "Retrieve", "and", "return", "objects", "from", "the", "Ansible", "Tower", "API", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L248-L328
[ "def", "read", "(", "self", ",", "pk", "=", "None", ",", "fail_on_no_results", "=", "False", ",", "fail_on_multiple_results", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Piece together the URL we will be hitting.", "url", "=", "self", ".", "endpoint", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource.write
=====API DOCS===== Modify the given object using the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object if ``pk`` is provided (not ``None``). :type pk: int :param create_on_missing: Flag that if set, a...
tower_cli/models/base.py
def write(self, pk=None, create_on_missing=False, fail_on_found=False, force_on_exists=True, **kwargs): """ =====API DOCS===== Modify the given object using the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object ...
def write(self, pk=None, create_on_missing=False, fail_on_found=False, force_on_exists=True, **kwargs): """ =====API DOCS===== Modify the given object using the Ansible Tower API. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read that object ...
[ "=====", "API", "DOCS", "=====", "Modify", "the", "given", "object", "using", "the", "Ansible", "Tower", "API", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L334-L429
[ "def", "write", "(", "self", ",", "pk", "=", "None", ",", "create_on_missing", "=", "False", ",", "fail_on_found", "=", "False", ",", "force_on_exists", "=", "True", ",", "*", "*", "kwargs", ")", ":", "existing_data", "=", "{", "}", "# Remove default value...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource.delete
Remove the given object. If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise, a success with no change is reported. =====API DOCS===== Remove the given object. :param pk: Primary key of the resource to be deleted. :type pk...
tower_cli/models/base.py
def delete(self, pk=None, fail_on_missing=False, **kwargs): """Remove the given object. If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise, a success with no change is reported. =====API DOCS===== Remove the given object. ...
def delete(self, pk=None, fail_on_missing=False, **kwargs): """Remove the given object. If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise, a success with no change is reported. =====API DOCS===== Remove the given object. ...
[ "Remove", "the", "given", "object", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L432-L470
[ "def", "delete", "(", "self", ",", "pk", "=", "None", ",", "fail_on_missing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# If we weren't given a primary key, determine which record we're deleting.", "if", "not", "pk", ":", "existing_data", "=", "self", ".",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource.get
Return one and exactly one object. Lookups may be through a primary key, specified as a positional argument, and/or through filters specified through keyword arguments. If the number of results does not equal one, raise an exception. =====API DOCS===== Retrieve one and exactly...
tower_cli/models/base.py
def get(self, pk=None, **kwargs): """Return one and exactly one object. Lookups may be through a primary key, specified as a positional argument, and/or through filters specified through keyword arguments. If the number of results does not equal one, raise an exception. =====A...
def get(self, pk=None, **kwargs): """Return one and exactly one object. Lookups may be through a primary key, specified as a positional argument, and/or through filters specified through keyword arguments. If the number of results does not equal one, raise an exception. =====A...
[ "Return", "one", "and", "exactly", "one", "object", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L477-L500
[ "def", "get", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'include_debug_header'", ",", "True", ")", ":", "debug", ".", "log", "(", "'Getting the record.'", ",", "header", "=", "'details'", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource.list
Return a list of objects. If one or more filters are provided through keyword arguments, filter the results accordingly. If no filters are provided, return all results. =====API DOCS===== Retrieve a list of objects. :param all_pages: Flag that if set, collect all pages of con...
tower_cli/models/base.py
def list(self, all_pages=False, **kwargs): """Return a list of objects. If one or more filters are provided through keyword arguments, filter the results accordingly. If no filters are provided, return all results. =====API DOCS===== Retrieve a list of objects. :param...
def list(self, all_pages=False, **kwargs): """Return a list of objects. If one or more filters are provided through keyword arguments, filter the results accordingly. If no filters are provided, return all results. =====API DOCS===== Retrieve a list of objects. :param...
[ "Return", "a", "list", "of", "objects", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L513-L570
[ "def", "list", "(", "self", ",", "all_pages", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# TODO: Move to a field callback method to make it generic", "# If multiple statuses where given, add OR queries for each of them", "if", "kwargs", ".", "get", "(", "'status'", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
BaseResource._disassoc
Disassociate the `other` record from the `me` record.
tower_cli/models/base.py
def _disassoc(self, url_fragment, me, other): """Disassociate the `other` record from the `me` record.""" # Get the endpoint for foreign records within this object. url = self.endpoint + '%d/%s/' % (me, url_fragment) # Attempt to determine whether the other record already is absent, fo...
def _disassoc(self, url_fragment, me, other): """Disassociate the `other` record from the `me` record.""" # Get the endpoint for foreign records within this object. url = self.endpoint + '%d/%s/' % (me, url_fragment) # Attempt to determine whether the other record already is absent, fo...
[ "Disassociate", "the", "other", "record", "from", "the", "me", "record", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L587-L600
[ "def", "_disassoc", "(", "self", ",", "url_fragment", ",", "me", ",", "other", ")", ":", "# Get the endpoint for foreign records within this object.", "url", "=", "self", ".", "endpoint", "+", "'%d/%s/'", "%", "(", "me", ",", "url_fragment", ")", "# Attempt to det...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.copy
Copy an object. Only the ID is used for the lookup. All provided fields are used to override the old data from the copied resource. =====API DOCS===== Copy an object. :param pk: Primary key of the resource object to be copied :param new_name: The new name to give the r...
tower_cli/models/base.py
def copy(self, pk=None, new_name=None, **kwargs): """Copy an object. Only the ID is used for the lookup. All provided fields are used to override the old data from the copied resource. =====API DOCS===== Copy an object. :param pk: Primary key of the resource object to ...
def copy(self, pk=None, new_name=None, **kwargs): """Copy an object. Only the ID is used for the lookup. All provided fields are used to override the old data from the copied resource. =====API DOCS===== Copy an object. :param pk: Primary key of the resource object to ...
[ "Copy", "an", "object", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L644-L688
[ "def", "copy", "(", "self", ",", "pk", "=", "None", ",", "new_name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "orig", "=", "self", ".", "read", "(", "pk", ",", "fail_on_no_results", "=", "True", ",", "fail_on_multiple_results", "=", "True", ")...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.modify
Modify an already existing object. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are written. To modify unique fields, you must use the primary key for the lookup. =====API DOCS===== Modify an alr...
tower_cli/models/base.py
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an already existing object. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are written. To modify unique fields, you must use the prim...
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an already existing object. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are written. To modify unique fields, you must use the prim...
[ "Modify", "an", "already", "existing", "object", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L694-L720
[ "def", "modify", "(", "self", ",", "pk", "=", "None", ",", "create_on_missing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "write", "(", "pk", ",", "create_on_missing", "=", "create_on_missing", ",", "force_on_exists", "=", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MonitorableResource.last_job_data
Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT
tower_cli/models/base.py
def last_job_data(self, pk=None, **kwargs): """ Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT """ ujt = self.get(pk, include_debug_header=True, **kwargs) # Determine the appropriate inventory source update. if 'c...
def last_job_data(self, pk=None, **kwargs): """ Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT """ ujt = self.get(pk, include_debug_header=True, **kwargs) # Determine the appropriate inventory source update. if 'c...
[ "Internal", "utility", "function", "for", "Unified", "Job", "Templates", ".", "Returns", "data", "about", "the", "last", "job", "run", "off", "of", "that", "UJT" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L742-L756
[ "def", "last_job_data", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ujt", "=", "self", ".", "get", "(", "pk", ",", "include_debug_header", "=", "True", ",", "*", "*", "kwargs", ")", "# Determine the appropriate inventory source...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MonitorableResource.lookup_stdout
Internal utility function to return standard out. Requires the pk of a unified job.
tower_cli/models/base.py
def lookup_stdout(self, pk=None, start_line=None, end_line=None, full=True): """ Internal utility function to return standard out. Requires the pk of a unified job. """ stdout_url = '%s%s/stdout/' % (self.unified_job_type, pk) payload = {'format': 'json', 'content_encoding': 'bas...
def lookup_stdout(self, pk=None, start_line=None, end_line=None, full=True): """ Internal utility function to return standard out. Requires the pk of a unified job. """ stdout_url = '%s%s/stdout/' % (self.unified_job_type, pk) payload = {'format': 'json', 'content_encoding': 'bas...
[ "Internal", "utility", "function", "to", "return", "standard", "out", ".", "Requires", "the", "pk", "of", "a", "unified", "job", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L758-L771
[ "def", "lookup_stdout", "(", "self", ",", "pk", "=", "None", ",", "start_line", "=", "None", ",", "end_line", "=", "None", ",", "full", "=", "True", ")", ":", "stdout_url", "=", "'%s%s/stdout/'", "%", "(", "self", ".", "unified_job_type", ",", "pk", ")...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MonitorableResource.stdout
Print out the standard out of a unified job to the command line or output file. For Projects, print the standard out of most recent update. For Inventory Sources, print standard out of most recent sync. For Jobs, print the job's standard out. For Workflow Jobs, print a status table of it...
tower_cli/models/base.py
def stdout(self, pk, start_line=None, end_line=None, outfile=sys.stdout, **kwargs): """ Print out the standard out of a unified job to the command line or output file. For Projects, print the standard out of most recent update. For Inventory Sources, print standard out of most recent syn...
def stdout(self, pk, start_line=None, end_line=None, outfile=sys.stdout, **kwargs): """ Print out the standard out of a unified job to the command line or output file. For Projects, print the standard out of most recent update. For Inventory Sources, print standard out of most recent syn...
[ "Print", "out", "the", "standard", "out", "of", "a", "unified", "job", "to", "the", "command", "line", "or", "output", "file", ".", "For", "Projects", "print", "the", "standard", "out", "of", "most", "recent", "update", ".", "For", "Inventory", "Sources", ...
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L777-L825
[ "def", "stdout", "(", "self", ",", "pk", ",", "start_line", "=", "None", ",", "end_line", "=", "None", ",", "outfile", "=", "sys", ".", "stdout", ",", "*", "*", "kwargs", ")", ":", "# resource is Unified Job Template", "if", "self", ".", "unified_job_type"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MonitorableResource.monitor
Stream the standard output from a job, project update, or inventory udpate. =====API DOCS===== Stream the standard output from a job run to stdout. :param pk: Primary key of the job resource object to be monitored. :type pk: int :param parent_pk: Primary key of the unified job ...
tower_cli/models/base.py
def monitor(self, pk, parent_pk=None, timeout=None, interval=0.5, outfile=sys.stdout, **kwargs): """ Stream the standard output from a job, project update, or inventory udpate. =====API DOCS===== Stream the standard output from a job run to stdout. :param pk: Primary key of the...
def monitor(self, pk, parent_pk=None, timeout=None, interval=0.5, outfile=sys.stdout, **kwargs): """ Stream the standard output from a job, project update, or inventory udpate. =====API DOCS===== Stream the standard output from a job run to stdout. :param pk: Primary key of the...
[ "Stream", "the", "standard", "output", "from", "a", "job", "project", "update", "or", "inventory", "udpate", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L831-L915
[ "def", "monitor", "(", "self", ",", "pk", ",", "parent_pk", "=", "None", ",", "timeout", "=", "None", ",", "interval", "=", "0.5", ",", "outfile", "=", "sys", ".", "stdout", ",", "*", "*", "kwargs", ")", ":", "# If we do not have the unified job info, infe...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MonitorableResource.wait
Wait for a running job to finish. Blocks further input until the job completes (whether successfully or unsuccessfully) and a final status can be given. =====API DOCS===== Wait for a job resource object to enter certain status. :param pk: Primary key of the job resource object to wait....
tower_cli/models/base.py
def wait(self, pk, parent_pk=None, min_interval=1, max_interval=30, timeout=None, outfile=sys.stdout, exit_on=['successful'], **kwargs): """ Wait for a running job to finish. Blocks further input until the job completes (whether successfully or unsuccessfully) and a final status can...
def wait(self, pk, parent_pk=None, min_interval=1, max_interval=30, timeout=None, outfile=sys.stdout, exit_on=['successful'], **kwargs): """ Wait for a running job to finish. Blocks further input until the job completes (whether successfully or unsuccessfully) and a final status can...
[ "Wait", "for", "a", "running", "job", "to", "finish", ".", "Blocks", "further", "input", "until", "the", "job", "completes", "(", "whether", "successfully", "or", "unsuccessfully", ")", "and", "a", "final", "status", "can", "be", "given", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L922-L1039
[ "def", "wait", "(", "self", ",", "pk", ",", "parent_pk", "=", "None", ",", "min_interval", "=", "1", ",", "max_interval", "=", "30", ",", "timeout", "=", "None", ",", "outfile", "=", "sys", ".", "stdout", ",", "exit_on", "=", "[", "'successful'", "]"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ExeResource.status
Print the current job status. This is used to check a running job. You can look up the job with the same parameters used for a get request. =====API DOCS===== Retrieve the current job status. :param pk: Primary key of the resource to retrieve status from. :type pk: int ...
tower_cli/models/base.py
def status(self, pk=None, detail=False, **kwargs): """Print the current job status. This is used to check a running job. You can look up the job with the same parameters used for a get request. =====API DOCS===== Retrieve the current job status. :param pk: Primary key of the re...
def status(self, pk=None, detail=False, **kwargs): """Print the current job status. This is used to check a running job. You can look up the job with the same parameters used for a get request. =====API DOCS===== Retrieve the current job status. :param pk: Primary key of the re...
[ "Print", "the", "current", "job", "status", ".", "This", "is", "used", "to", "check", "a", "running", "job", ".", "You", "can", "look", "up", "the", "job", "with", "the", "same", "parameters", "used", "for", "a", "get", "request", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L1048-L1089
[ "def", "status", "(", "self", ",", "pk", "=", "None", ",", "detail", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Remove default values (anything where the value is None).", "self", ".", "_pop_none", "(", "kwargs", ")", "# Search for the record if pk not give...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ExeResource.cancel
Cancel a currently running job. Fails with a non-zero exit status if the job cannot be canceled. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Cancel a currently running job. :param pk: Primary key of the job resource to restart. ...
tower_cli/models/base.py
def cancel(self, pk=None, fail_if_not_running=False, **kwargs): """Cancel a currently running job. Fails with a non-zero exit status if the job cannot be canceled. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Cancel a currently running jo...
def cancel(self, pk=None, fail_if_not_running=False, **kwargs): """Cancel a currently running job. Fails with a non-zero exit status if the job cannot be canceled. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Cancel a currently running jo...
[ "Cancel", "a", "currently", "running", "job", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L1094-L1132
[ "def", "cancel", "(", "self", ",", "pk", "=", "None", ",", "fail_if_not_running", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Search for the record if pk not given", "if", "not", "pk", ":", "existing_data", "=", "self", ".", "get", "(", "*", "*", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ExeResource.relaunch
Relaunch a stopped job. Fails with a non-zero exit status if the job cannot be relaunched. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Relaunch a stopped job resource. :param pk: Primary key of the job resource to relaunch. :typ...
tower_cli/models/base.py
def relaunch(self, pk=None, **kwargs): """Relaunch a stopped job. Fails with a non-zero exit status if the job cannot be relaunched. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Relaunch a stopped job resource. :param pk: Primary...
def relaunch(self, pk=None, **kwargs): """Relaunch a stopped job. Fails with a non-zero exit status if the job cannot be relaunched. You must provide either a pk or parameters in the job's identity. =====API DOCS===== Relaunch a stopped job resource. :param pk: Primary...
[ "Relaunch", "a", "stopped", "job", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L1135-L1173
[ "def", "relaunch", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Search for the record if pk not given", "if", "not", "pk", ":", "existing_data", "=", "self", ".", "get", "(", "*", "*", "kwargs", ")", "pk", "=", "existing_dat...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
SurveyResource.survey
Get the survey_spec for the job template. To write a survey, use the modify command with the --survey-spec parameter. =====API DOCS===== Get the survey specification of a resource object. :param pk: Primary key of the resource to retrieve survey from. Tower CLI will only attempt to ...
tower_cli/models/base.py
def survey(self, pk=None, **kwargs): """Get the survey_spec for the job template. To write a survey, use the modify command with the --survey-spec parameter. =====API DOCS===== Get the survey specification of a resource object. :param pk: Primary key of the resource to retrieve...
def survey(self, pk=None, **kwargs): """Get the survey_spec for the job template. To write a survey, use the modify command with the --survey-spec parameter. =====API DOCS===== Get the survey specification of a resource object. :param pk: Primary key of the resource to retrieve...
[ "Get", "the", "survey_spec", "for", "the", "job", "template", ".", "To", "write", "a", "survey", "use", "the", "modify", "command", "with", "the", "--", "survey", "-", "spec", "parameter", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/base.py#L1205-L1224
[ "def", "survey", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "job_template", "=", "self", ".", "get", "(", "pk", "=", "pk", ",", "*", "*", "kwargs", ")", "if", "settings", ".", "format", "==", "'human'", ":", "settings...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.batch_update
Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the given inventory. :param pk: Primary key of the given inventory. ...
tower_cli/resources/inventory.py
def batch_update(self, pk=None, **kwargs): """Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the given inventory. ...
def batch_update(self, pk=None, **kwargs): """Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the given inventory. ...
[ "Update", "all", "related", "inventory", "sources", "of", "the", "given", "inventory", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/inventory.py#L45-L62
[ "def", "batch_update", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "res", "=", "self", ".", "get", "(", "pk", "=", "pk", ",", "*", "*", "kwargs", ")", "url", "=", "self", ".", "endpoint", "+", "'%d/%s/'", "%", "(", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.read
Do extra processing so we can display the actor field as a top-level field
tower_cli/resources/activity_stream.py
def read(self, *args, **kwargs): ''' Do extra processing so we can display the actor field as a top-level field ''' if 'actor' in kwargs: kwargs['actor'] = kwargs.pop('actor') r = super(Resource, self).read(*args, **kwargs) if 'results' in r: ...
def read(self, *args, **kwargs): ''' Do extra processing so we can display the actor field as a top-level field ''' if 'actor' in kwargs: kwargs['actor'] = kwargs.pop('actor') r = super(Resource, self).read(*args, **kwargs) if 'results' in r: ...
[ "Do", "extra", "processing", "so", "we", "can", "display", "the", "actor", "field", "as", "a", "top", "-", "level", "field" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/activity_stream.py#L55-L68
[ "def", "read", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'actor'", "in", "kwargs", ":", "kwargs", "[", "'actor'", "]", "=", "kwargs", ".", "pop", "(", "'actor'", ")", "r", "=", "super", "(", "Resource", ",", "self",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
log
Log the given output to stderr if and only if we are in verbose mode. If we are not in verbose mode, this is a no-op.
tower_cli/utils/debug.py
def log(s, header='', file=sys.stderr, nl=1, **kwargs): """Log the given output to stderr if and only if we are in verbose mode. If we are not in verbose mode, this is a no-op. """ # Sanity check: If we are not in verbose mode, this is a no-op. if not settings.verbose: return # Con...
def log(s, header='', file=sys.stderr, nl=1, **kwargs): """Log the given output to stderr if and only if we are in verbose mode. If we are not in verbose mode, this is a no-op. """ # Sanity check: If we are not in verbose mode, this is a no-op. if not settings.verbose: return # Con...
[ "Log", "the", "given", "output", "to", "stderr", "if", "and", "only", "if", "we", "are", "in", "verbose", "mode", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/debug.py#L22-L67
[ "def", "log", "(", "s", ",", "header", "=", "''", ",", "file", "=", "sys", ".", "stderr", ",", "nl", "=", "1", ",", "*", "*", "kwargs", ")", ":", "# Sanity check: If we are not in verbose mode, this is a no-op.", "if", "not", "settings", ".", "verbose", ":...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ManyToManyField.configure_model
Hook for ResourceMeta class to call when initializing model class. Saves fields obtained from resource class backlinks
tower_cli/models/fields.py
def configure_model(self, attrs, field_name): ''' Hook for ResourceMeta class to call when initializing model class. Saves fields obtained from resource class backlinks ''' self.relationship = field_name self._set_method_names(relationship=field_name) if self.res_...
def configure_model(self, attrs, field_name): ''' Hook for ResourceMeta class to call when initializing model class. Saves fields obtained from resource class backlinks ''' self.relationship = field_name self._set_method_names(relationship=field_name) if self.res_...
[ "Hook", "for", "ResourceMeta", "class", "to", "call", "when", "initializing", "model", "class", ".", "Saves", "fields", "obtained", "from", "resource", "class", "backlinks" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/fields.py#L152-L160
[ "def", "configure_model", "(", "self", ",", "attrs", ",", "field_name", ")", ":", "self", ".", "relationship", "=", "field_name", "self", ".", "_set_method_names", "(", "relationship", "=", "field_name", ")", "if", "self", ".", "res_name", "is", "None", ":",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ManyToManyField._produce_raw_method
Returns a callable which becomes the associate or disassociate method for the related field. Method can be overridden to add additional functionality, but `_produce_method` may also need to be subclassed to decorate it appropriately.
tower_cli/models/fields.py
def _produce_raw_method(self): ''' Returns a callable which becomes the associate or disassociate method for the related field. Method can be overridden to add additional functionality, but `_produce_method` may also need to be subclassed to decorate it appropriately. ...
def _produce_raw_method(self): ''' Returns a callable which becomes the associate or disassociate method for the related field. Method can be overridden to add additional functionality, but `_produce_method` may also need to be subclassed to decorate it appropriately. ...
[ "Returns", "a", "callable", "which", "becomes", "the", "associate", "or", "disassociate", "method", "for", "the", "related", "field", ".", "Method", "can", "be", "overridden", "to", "add", "additional", "functionality", "but", "_produce_method", "may", "also", "...
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/models/fields.py#L185-L200
[ "def", "_produce_raw_method", "(", "self", ")", ":", "def", "method", "(", "res_self", ",", "*", "*", "kwargs", ")", ":", "obj_pk", "=", "kwargs", ".", "get", "(", "method", ".", "_res_name", ")", "other_obj_pk", "=", "kwargs", ".", "get", "(", "method...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.create
Create a new label. There are two types of label creation: isolatedly creating a new label and creating a new label under a job template. Here the two types are discriminated by whether to provide --job-template option. Fields in the resource's `identity` tuple are used for a lookup; if a matc...
tower_cli/resources/label.py
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a new label. There are two types of label creation: isolatedly creating a new label and creating a new label under a job template. Here the two types are discriminated by whether to provide --job-template option. ...
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a new label. There are two types of label creation: isolatedly creating a new label and creating a new label under a job template. Here the two types are discriminated by whether to provide --job-template option. ...
[ "Create", "a", "new", "label", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/label.py#L43-L93
[ "def", "create", "(", "self", ",", "fail_on_found", "=", "False", ",", "force_on_exists", "=", "False", ",", "*", "*", "kwargs", ")", ":", "jt_id", "=", "kwargs", ".", "pop", "(", "'job_template'", ",", "None", ")", "old_endpoint", "=", "self", ".", "e...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
version
Display full version information.
tower_cli/cli/misc.py
def version(): """Display full version information.""" # Print out the current version of Tower CLI. click.echo('Tower CLI %s' % __version__) # Print out the current API version of the current code base. click.echo('API %s' % CUR_API_VERSION) # Attempt to connect to the Ansible Tower server. ...
def version(): """Display full version information.""" # Print out the current version of Tower CLI. click.echo('Tower CLI %s' % __version__) # Print out the current API version of the current code base. click.echo('API %s' % CUR_API_VERSION) # Attempt to connect to the Ansible Tower server. ...
[ "Display", "full", "version", "information", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L39-L64
[ "def", "version", "(", ")", ":", "# Print out the current version of Tower CLI.", "click", ".", "echo", "(", "'Tower CLI %s'", "%", "__version__", ")", "# Print out the current API version of the current code base.", "click", ".", "echo", "(", "'API %s'", "%", "CUR_API_VERS...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
_echo_setting
Echo a setting to the CLI.
tower_cli/cli/misc.py
def _echo_setting(key): """Echo a setting to the CLI.""" value = getattr(settings, key) secho('%s: ' % key, fg='magenta', bold=True, nl=False) secho( six.text_type(value), bold=True, fg='white' if isinstance(value, six.text_type) else 'cyan', )
def _echo_setting(key): """Echo a setting to the CLI.""" value = getattr(settings, key) secho('%s: ' % key, fg='magenta', bold=True, nl=False) secho( six.text_type(value), bold=True, fg='white' if isinstance(value, six.text_type) else 'cyan', )
[ "Echo", "a", "setting", "to", "the", "CLI", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L67-L75
[ "def", "_echo_setting", "(", "key", ")", ":", "value", "=", "getattr", "(", "settings", ",", "key", ")", "secho", "(", "'%s: '", "%", "key", ",", "fg", "=", "'magenta'", ",", "bold", "=", "True", ",", "nl", "=", "False", ")", "secho", "(", "six", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
config
Read or write tower-cli configuration. `tower config` saves the given setting to the appropriate Tower CLI; either the user's ~/.tower_cli.cfg file, or the /etc/tower/tower_cli.cfg file if --global is used. Writing to /etc/tower/tower_cli.cfg is likely to require heightened permissions (in other w...
tower_cli/cli/misc.py
def config(key=None, value=None, scope='user', global_=False, unset=False): """Read or write tower-cli configuration. `tower config` saves the given setting to the appropriate Tower CLI; either the user's ~/.tower_cli.cfg file, or the /etc/tower/tower_cli.cfg file if --global is used. Writing to /...
def config(key=None, value=None, scope='user', global_=False, unset=False): """Read or write tower-cli configuration. `tower config` saves the given setting to the appropriate Tower CLI; either the user's ~/.tower_cli.cfg file, or the /etc/tower/tower_cli.cfg file if --global is used. Writing to /...
[ "Read", "or", "write", "tower", "-", "cli", "configuration", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L97-L210
[ "def", "config", "(", "key", "=", "None", ",", "value", "=", "None", ",", "scope", "=", "'user'", ",", "global_", "=", "False", ",", "unset", "=", "False", ")", ":", "# If the old-style `global_` option is set, issue a deprecation notice.", "if", "global_", ":",...
a2b151fed93c47725018d3034848cb3a1814bed7