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
train
Scope.get_type
Get the names for the typename (created by typedef) :name: The typedef'd name to resolve :returns: An array of resolved names associated with the typedef'd name
pfp/interp.py
def get_type(self, name, recurse=True): """Get the names for the typename (created by typedef) :name: The typedef'd name to resolve :returns: An array of resolved names associated with the typedef'd name """ self._dlog("getting type '{}'".format(name)) return self._sear...
def get_type(self, name, recurse=True): """Get the names for the typename (created by typedef) :name: The typedef'd name to resolve :returns: An array of resolved names associated with the typedef'd name """ self._dlog("getting type '{}'".format(name)) return self._sear...
[ "Get", "the", "names", "for", "the", "typename", "(", "created", "by", "typedef", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L409-L417
[ "def", "get_type", "(", "self", ",", "name", ",", "recurse", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"getting type '{}'\"", ".", "format", "(", "name", ")", ")", "return", "self", ".", "_search", "(", "\"types\"", ",", "name", ",", "recurse...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
Scope.get_id
Get the first id matching ``name``. Will either be a local or a var. :name: TODO :returns: TODO
pfp/interp.py
def get_id(self, name, recurse=True): """Get the first id matching ``name``. Will either be a local or a var. :name: TODO :returns: TODO """ self._dlog("getting id '{}'".format(name)) var = self._search("vars", name, recurse) return var
def get_id(self, name, recurse=True): """Get the first id matching ``name``. Will either be a local or a var. :name: TODO :returns: TODO """ self._dlog("getting id '{}'".format(name)) var = self._search("vars", name, recurse) return var
[ "Get", "the", "first", "id", "matching", "name", ".", "Will", "either", "be", "a", "local", "or", "a", "var", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L419-L429
[ "def", "get_id", "(", "self", ",", "name", ",", "recurse", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"getting id '{}'\"", ".", "format", "(", "name", ")", ")", "var", "=", "self", ".", "_search", "(", "\"vars\"", ",", "name", ",", "recurse"...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
Scope._resolve_name
TODO: Docstring for _resolve_names. :name: TODO :returns: TODO
pfp/interp.py
def _resolve_name(self, name): """TODO: Docstring for _resolve_names. :name: TODO :returns: TODO """ res = [name] while True: orig_names = self._search("types", name) if orig_names is not None: name = orig_names[-1] ...
def _resolve_name(self, name): """TODO: Docstring for _resolve_names. :name: TODO :returns: TODO """ res = [name] while True: orig_names = self._search("types", name) if orig_names is not None: name = orig_names[-1] ...
[ "TODO", ":", "Docstring", "for", "_resolve_names", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L438-L457
[ "def", "_resolve_name", "(", "self", ",", "name", ")", ":", "res", "=", "[", "name", "]", "while", "True", ":", "orig_names", "=", "self", ".", "_search", "(", "\"types\"", ",", "name", ")", "if", "orig_names", "is", "not", "None", ":", "name", "=", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
Scope._search
Search the scope stack for the name in the specified category (types/locals/vars). :category: the category to search in (locals/types/vars) :name: name to search for :returns: None if not found, the result of the found local/type/id
pfp/interp.py
def _search(self, category, name, recurse=True): """Search the scope stack for the name in the specified category (types/locals/vars). :category: the category to search in (locals/types/vars) :name: name to search for :returns: None if not found, the result of the found local/ty...
def _search(self, category, name, recurse=True): """Search the scope stack for the name in the specified category (types/locals/vars). :category: the category to search in (locals/types/vars) :name: name to search for :returns: None if not found, the result of the found local/ty...
[ "Search", "the", "scope", "stack", "for", "the", "name", "in", "the", "specified", "category", "(", "types", "/", "locals", "/", "vars", ")", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L459-L477
[ "def", "_search", "(", "self", ",", "category", ",", "name", ",", "recurse", "=", "True", ")", ":", "idx", "=", "len", "(", "self", ".", "_scope_stack", ")", "-", "1", "curr", "=", "self", ".", "_curr_scope", "for", "scope", "in", "reversed", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.add_native
Add the native python function ``func`` into the pfp interpreter with the name ``name`` and return value ``ret`` so that it can be called from within a template script. .. note:: The :any:`@native <pfp.native.native>` decorator exists to simplify this. All native functions ...
pfp/interp.py
def add_native(cls, name, func, ret, interp=None, send_interp=False): """Add the native python function ``func`` into the pfp interpreter with the name ``name`` and return value ``ret`` so that it can be called from within a template script. .. note:: The :any:`@native <pfp....
def add_native(cls, name, func, ret, interp=None, send_interp=False): """Add the native python function ``func`` into the pfp interpreter with the name ``name`` and return value ``ret`` so that it can be called from within a template script. .. note:: The :any:`@native <pfp....
[ "Add", "the", "native", "python", "function", "func", "into", "the", "pfp", "interpreter", "with", "the", "name", "name", "and", "return", "value", "ret", "so", "that", "it", "can", "be", "called", "from", "within", "a", "template", "script", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L501-L538
[ "def", "add_native", "(", "cls", ",", "name", ",", "func", ",", "ret", ",", "interp", "=", "None", ",", "send_interp", "=", "False", ")", ":", "if", "interp", "is", "None", ":", "natives", "=", "cls", ".", "_natives", "else", ":", "# the instance's nat...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.define_natives
Define the native functions for PFP
pfp/interp.py
def define_natives(cls): """Define the native functions for PFP """ if len(cls._natives) > 0: return glob_pattern = os.path.join(os.path.dirname(__file__), "native", "*.py") for filename in glob.glob(glob_pattern): basename = os.path.basename(filename).re...
def define_natives(cls): """Define the native functions for PFP """ if len(cls._natives) > 0: return glob_pattern = os.path.join(os.path.dirname(__file__), "native", "*.py") for filename in glob.glob(glob_pattern): basename = os.path.basename(filename).re...
[ "Define", "the", "native", "functions", "for", "PFP" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L550-L571
[ "def", "define_natives", "(", "cls", ")", ":", "if", "len", "(", "cls", ".", "_natives", ")", ">", "0", ":", "return", "glob_pattern", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"native...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._dlog
log the message to the log
pfp/interp.py
def _dlog(self, msg, indent_increase=0): """log the message to the log""" self._log.debug("interp", msg, indent_increase, filename=self._orig_filename, coord=self._coord)
def _dlog(self, msg, indent_increase=0): """log the message to the log""" self._log.debug("interp", msg, indent_increase, filename=self._orig_filename, coord=self._coord)
[ "log", "the", "message", "to", "the", "log" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L651-L653
[ "def", "_dlog", "(", "self", ",", "msg", ",", "indent_increase", "=", "0", ")", ":", "self", ".", "_log", ".", "debug", "(", "\"interp\"", ",", "msg", ",", "indent_increase", ",", "filename", "=", "self", ".", "_orig_filename", ",", "coord", "=", "self...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.parse
Parse the data stream using the template (e.g. parse the 010 template and interpret the template using the stream as the data source). :stream: The input data stream :template: The template to parse the stream with :keep_successful: Return whatever was successfully parsed before an erro...
pfp/interp.py
def parse(self, stream, template, predefines=True, orig_filename=None, keep_successful=False, printf=True): """Parse the data stream using the template (e.g. parse the 010 template and interpret the template using the stream as the data source). :stream: The input data stream :template:...
def parse(self, stream, template, predefines=True, orig_filename=None, keep_successful=False, printf=True): """Parse the data stream using the template (e.g. parse the 010 template and interpret the template using the stream as the data source). :stream: The input data stream :template:...
[ "Parse", "the", "data", "stream", "using", "the", "template", "(", "e", ".", "g", ".", "parse", "the", "010", "template", "and", "interpret", "the", "template", "using", "the", "stream", "as", "the", "data", "source", ")", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L659-L681
[ "def", "parse", "(", "self", ",", "stream", ",", "template", ",", "predefines", "=", "True", ",", "orig_filename", "=", "None", ",", "keep_successful", "=", "False", ",", "printf", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"parsing\"", ")", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.eval
Eval a single statement (something returnable)
pfp/interp.py
def eval(self, statement, ctxt=None): """Eval a single statement (something returnable) """ self._no_debug = True statement = statement.strip() if not statement.endswith(";"): statement += ";" ast = self._parse_string(statement, predefines=False) s...
def eval(self, statement, ctxt=None): """Eval a single statement (something returnable) """ self._no_debug = True statement = statement.strip() if not statement.endswith(";"): statement += ";" ast = self._parse_string(statement, predefines=False) s...
[ "Eval", "a", "single", "statement", "(", "something", "returnable", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L698-L720
[ "def", "eval", "(", "self", ",", "statement", ",", "ctxt", "=", "None", ")", ":", "self", ".", "_no_debug", "=", "True", "statement", "=", "statement", ".", "strip", "(", ")", "if", "not", "statement", ".", "endswith", "(", "\";\"", ")", ":", "statem...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.set_break
Set if the interpreter should break. :returns: TODO
pfp/interp.py
def set_break(self, break_type): """Set if the interpreter should break. :returns: TODO """ self._break_type = break_type self._break_level = self._scope.level()
def set_break(self, break_type): """Set if the interpreter should break. :returns: TODO """ self._break_type = break_type self._break_level = self._scope.level()
[ "Set", "if", "the", "interpreter", "should", "break", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L722-L728
[ "def", "set_break", "(", "self", ",", "break_type", ")", ":", "self", ".", "_break_type", "=", "break_type", "self", ".", "_break_level", "=", "self", ".", "_scope", ".", "level", "(", ")" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.get_curr_lines
Return the current line number in the template, as well as the surrounding source lines
pfp/interp.py
def get_curr_lines(self): """Return the current line number in the template, as well as the surrounding source lines """ start = max(0, self._coord.line - 5) end = min(len(self._template_lines), self._coord.line + 4) lines = [(x, self._template_lines[x]) for x in six.mov...
def get_curr_lines(self): """Return the current line number in the template, as well as the surrounding source lines """ start = max(0, self._coord.line - 5) end = min(len(self._template_lines), self._coord.line + 4) lines = [(x, self._template_lines[x]) for x in six.mov...
[ "Return", "the", "current", "line", "number", "in", "the", "template", "as", "well", "as", "the", "surrounding", "source", "lines" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L730-L738
[ "def", "get_curr_lines", "(", "self", ")", ":", "start", "=", "max", "(", "0", ",", "self", ".", "_coord", ".", "line", "-", "5", ")", "end", "=", "min", "(", "len", "(", "self", ".", "_template_lines", ")", ",", "self", ".", "_coord", ".", "line...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp.set_bitfield_padded
Set if the bitfield input/output stream should be padded :val: True/False :returns: None
pfp/interp.py
def set_bitfield_padded(self, val): """Set if the bitfield input/output stream should be padded :val: True/False :returns: None """ self._padded_bitfield = val self._stream.padded = val self._ctxt._pfp__padded_bitfield = val
def set_bitfield_padded(self, val): """Set if the bitfield input/output stream should be padded :val: True/False :returns: None """ self._padded_bitfield = val self._stream.padded = val self._ctxt._pfp__padded_bitfield = val
[ "Set", "if", "the", "bitfield", "input", "/", "output", "stream", "should", "be", "padded" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L740-L748
[ "def", "set_bitfield_padded", "(", "self", ",", "val", ")", ":", "self", ".", "_padded_bitfield", "=", "val", "self", ".", "_stream", ".", "padded", "=", "val", "self", ".", "_ctxt", ".", "_pfp__padded_bitfield", "=", "val" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._run
Interpret the parsed 010 AST :returns: PfpDom
pfp/interp.py
def _run(self, keep_successfull): """Interpret the parsed 010 AST :returns: PfpDom """ # example self._ast.show(): # FileAST: # Decl: data, [], [], [] # TypeDecl: data, [] # Struct: DATA # Decl: a, [], [], [] ...
def _run(self, keep_successfull): """Interpret the parsed 010 AST :returns: PfpDom """ # example self._ast.show(): # FileAST: # Decl: data, [], [], [] # TypeDecl: data, [] # Struct: DATA # Decl: a, [], [], [] ...
[ "Interpret", "the", "parsed", "010", "AST", ":", "returns", ":", "PfpDom" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L823-L883
[ "def", "_run", "(", "self", ",", "keep_successfull", ")", ":", "# example self._ast.show():", "# FileAST:", "# Decl: data, [], [], []", "# TypeDecl: data, []", "# Struct: DATA", "# Decl: a, [], [], []", "# TypeDecl: a, []", "# ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_node
Recursively handle nodes in the 010 AST :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_node(self, node, scope=None, ctxt=None, stream=None): """Recursively handle nodes in the 010 AST :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ if scope is None: if self._scope is None: self._...
def _handle_node(self, node, scope=None, ctxt=None, stream=None): """Recursively handle nodes in the 010 AST :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ if scope is None: if self._scope is None: self._...
[ "Recursively", "handle", "nodes", "in", "the", "010", "AST" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L885-L949
[ "def", "_handle_node", "(", "self", ",", "node", ",", "scope", "=", "None", ",", "ctxt", "=", "None", ",", "stream", "=", "None", ")", ":", "if", "scope", "is", "None", ":", "if", "self", ".", "_scope", "is", "None", ":", "self", ".", "_scope", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_file_ast
TODO: Docstring for _handle_file_ast. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_file_ast(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_file_ast. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._root = ctxt = fields.Dom(stream) ctxt._pfp__scope = scope self._ro...
def _handle_file_ast(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_file_ast. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._root = ctxt = fields.Dom(stream) ctxt._pfp__scope = scope self._ro...
[ "TODO", ":", "Docstring", "for", "_handle_file_ast", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L951-L972
[ "def", "_handle_file_ast", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_root", "=", "ctxt", "=", "fields", ".", "Dom", "(", "stream", ")", "ctxt", ".", "_pfp__scope", "=", "scope", "self", ".", "_root",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_cast
Handle cast nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_cast(self, node, scope, ctxt, stream): """Handle cast nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling cast") to_type = self._handle_node(node.to_type, scope, ctxt, stream) val_t...
def _handle_cast(self, node, scope, ctxt, stream): """Handle cast nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling cast") to_type = self._handle_node(node.to_type, scope, ctxt, stream) val_t...
[ "Handle", "cast", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L986-L1002
[ "def", "_handle_cast", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling cast\"", ")", "to_type", "=", "self", ".", "_handle_node", "(", "node", ".", "to_type", ",", "scope", ",", "ctxt...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_typename
TODO: Docstring for _handle_typename :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_typename(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_typename :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling typename") return self._handle_node(node.type, scope, ctxt,...
def _handle_typename(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_typename :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling typename") return self._handle_node(node.type, scope, ctxt,...
[ "TODO", ":", "Docstring", "for", "_handle_typename" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1004-L1016
[ "def", "_handle_typename", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling typename\"", ")", "return", "self", ".", "_handle_node", "(", "node", ".", "type", ",", "scope", ",", "ctxt", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._get_node_name
Get the name of the node - check for node.name and node.type.declname. Not sure why the second one occurs exactly - it happens with declaring a new struct field with parameters
pfp/interp.py
def _get_node_name(self, node): """Get the name of the node - check for node.name and node.type.declname. Not sure why the second one occurs exactly - it happens with declaring a new struct field with parameters""" res = getattr(node, "name", None) if res is None: ...
def _get_node_name(self, node): """Get the name of the node - check for node.name and node.type.declname. Not sure why the second one occurs exactly - it happens with declaring a new struct field with parameters""" res = getattr(node, "name", None) if res is None: ...
[ "Get", "the", "name", "of", "the", "node", "-", "check", "for", "node", ".", "name", "and", "node", ".", "type", ".", "declname", ".", "Not", "sure", "why", "the", "second", "one", "occurs", "exactly", "-", "it", "happens", "with", "declaring", "a", ...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1018-L1030
[ "def", "_get_node_name", "(", "self", ",", "node", ")", ":", "res", "=", "getattr", "(", "node", ",", "\"name\"", ",", "None", ")", "if", "res", "is", "None", ":", "return", "res", "if", "isinstance", "(", "res", ",", "AST", ".", "TypeDecl", ")", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_decl
TODO: Docstring for _handle_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling decl") metadata_processor = None if node.metadata is not N...
def _handle_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling decl") metadata_processor = None if node.metadata is not N...
[ "TODO", ":", "Docstring", "for", "_handle_decl", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1032-L1189
[ "def", "_handle_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling decl\"", ")", "metadata_processor", "=", "None", "if", "node", ".", "metadata", "is", "not", "None", ":", "#metada...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_metadata
Handle metadata for the node
pfp/interp.py
def _handle_metadata(self, node, scope, ctxt, stream): """Handle metadata for the node """ self._dlog("handling node metadata {}".format(node.metadata.keyvals)) keyvals = node.metadata.keyvals metadata_info = [] if "watch" in node.metadata.keyvals or "update" in keyval...
def _handle_metadata(self, node, scope, ctxt, stream): """Handle metadata for the node """ self._dlog("handling node metadata {}".format(node.metadata.keyvals)) keyvals = node.metadata.keyvals metadata_info = [] if "watch" in node.metadata.keyvals or "update" in keyval...
[ "Handle", "metadata", "for", "the", "node" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1191-L1210
[ "def", "_handle_metadata", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling node metadata {}\"", ".", "format", "(", "node", ".", "metadata", ".", "keyvals", ")", ")", "keyvals", "=", "n...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_watch_metadata
Handle watch vars for fields
pfp/interp.py
def _handle_watch_metadata(self, node, scope, ctxt, stream): """Handle watch vars for fields """ keyvals = node.metadata.keyvals if "watch" not in keyvals: raise errors.PfpError("Packed fields require a packer function set") if "update" not in keyvals: rai...
def _handle_watch_metadata(self, node, scope, ctxt, stream): """Handle watch vars for fields """ keyvals = node.metadata.keyvals if "watch" not in keyvals: raise errors.PfpError("Packed fields require a packer function set") if "update" not in keyvals: rai...
[ "Handle", "watch", "vars", "for", "fields" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1216-L1236
[ "def", "_handle_watch_metadata", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "keyvals", "=", "node", ".", "metadata", ".", "keyvals", "if", "\"watch\"", "not", "in", "keyvals", ":", "raise", "errors", ".", "PfpError", "(...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_packed_metadata
Handle packed metadata
pfp/interp.py
def _handle_packed_metadata(self, node, scope, ctxt, stream): """Handle packed metadata """ keyvals = node.metadata.keyvals if "packer" not in keyvals and ("pack" not in keyvals or "unpack" not in keyvals): raise errors.PfpError("Packed fields require a packer function to be ...
def _handle_packed_metadata(self, node, scope, ctxt, stream): """Handle packed metadata """ keyvals = node.metadata.keyvals if "packer" not in keyvals and ("pack" not in keyvals or "unpack" not in keyvals): raise errors.PfpError("Packed fields require a packer function to be ...
[ "Handle", "packed", "metadata" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1238-L1264
[ "def", "_handle_packed_metadata", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "keyvals", "=", "node", ".", "metadata", ".", "keyvals", "if", "\"packer\"", "not", "in", "keyvals", "and", "(", "\"pack\"", "not", "in", "key...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_byref_decl
TODO: Docstring for _handle_byref_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_byref_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_byref_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling byref decl") field = self._handle_node(node.type.type, ...
def _handle_byref_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_byref_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling byref decl") field = self._handle_node(node.type.type, ...
[ "TODO", ":", "Docstring", "for", "_handle_byref_decl", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1266-L1285
[ "def", "_handle_byref_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling byref decl\"", ")", "field", "=", "self", ".", "_handle_node", "(", "node", ".", "type", ".", "type", ",", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_type_decl
TODO: Docstring for _handle_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_type_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling type decl") decl = self._handle_node(node.type, scope, ct...
def _handle_type_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling type decl") decl = self._handle_node(node.type, scope, ct...
[ "TODO", ":", "Docstring", "for", "_handle_type_decl", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1287-L1299
[ "def", "_handle_type_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling type decl\"", ")", "decl", "=", "self", ".", "_handle_node", "(", "node", ".", "type", ",", "scope", ",", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_struct_ref
TODO: Docstring for _handle_struct_ref. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_struct_ref(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct_ref. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct ref") # name # field struct = s...
def _handle_struct_ref(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct_ref. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct ref") # name # field struct = s...
[ "TODO", ":", "Docstring", "for", "_handle_struct_ref", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1301-L1336
[ "def", "_handle_struct_ref", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling struct ref\"", ")", "# name", "# field", "struct", "=", "self", ".", "_handle_node", "(", "node", ".", "name",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_union
TODO: Docstring for _handle_union. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_union(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_union. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling union") union_cls = StructUnionDef("union", self, node) ...
def _handle_union(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_union. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling union") union_cls = StructUnionDef("union", self, node) ...
[ "TODO", ":", "Docstring", "for", "_handle_union", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1338-L1351
[ "def", "_handle_union", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling union\"", ")", "union_cls", "=", "StructUnionDef", "(", "\"union\"", ",", "self", ",", "node", ")", "return", "un...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_init_list
Handle InitList nodes (e.g. when initializing a struct) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_init_list(self, node, scope, ctxt, stream): """Handle InitList nodes (e.g. when initializing a struct) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling init list") res = [] for _,init_...
def _handle_init_list(self, node, scope, ctxt, stream): """Handle InitList nodes (e.g. when initializing a struct) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling init list") res = [] for _,init_...
[ "Handle", "InitList", "nodes", "(", "e", ".", "g", ".", "when", "initializing", "a", "struct", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1369-L1384
[ "def", "_handle_init_list", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling init list\"", ")", "res", "=", "[", "]", "for", "_", ",", "init_child", "in", "node", ".", "children", "(",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_struct_call_type_decl
TODO: Docstring for _handle_struct_call_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_struct_call_type_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct_call_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct with parameters") struct_...
def _handle_struct_call_type_decl(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct_call_type_decl. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct with parameters") struct_...
[ "TODO", ":", "Docstring", "for", "_handle_struct_call_type_decl", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1386-L1402
[ "def", "_handle_struct_call_type_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling struct with parameters\"", ")", "struct_cls", "=", "self", ".", "_handle_node", "(", "node", ".", "type...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_struct
TODO: Docstring for _handle_struct. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_struct(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct") if node.args is not None: for param in no...
def _handle_struct(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_struct. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling struct") if node.args is not None: for param in no...
[ "TODO", ":", "Docstring", "for", "_handle_struct", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1404-L1432
[ "def", "_handle_struct", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling struct\"", ")", "if", "node", ".", "args", "is", "not", "None", ":", "for", "param", "in", "node", ".", "arg...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_identifier_type
TODO: Docstring for _handle_identifier_type. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_identifier_type(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_identifier_type. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling identifier") cls = self._resolve_to_field_cl...
def _handle_identifier_type(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_identifier_type. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling identifier") cls = self._resolve_to_field_cl...
[ "TODO", ":", "Docstring", "for", "_handle_identifier_type", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1454-L1467
[ "def", "_handle_identifier_type", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling identifier\"", ")", "cls", "=", "self", ".", "_resolve_to_field_class", "(", "node", ".", "names", ",", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_typedef
TODO: Docstring for _handle_typedef. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_typedef(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_typedef. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ is_union_or_struct = (node.type.type.__class__ in [AST.Union, AST.Struct]) is_enum...
def _handle_typedef(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_typedef. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ is_union_or_struct = (node.type.type.__class__ in [AST.Union, AST.Struct]) is_enum...
[ "TODO", ":", "Docstring", "for", "_handle_typedef", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1469-L1503
[ "def", "_handle_typedef", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "is_union_or_struct", "=", "(", "node", ".", "type", ".", "type", ".", "__class__", "in", "[", "AST", ".", "Union", ",", "AST", ".", "Struct", "]"...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._str_to_int
Check for the hex
pfp/interp.py
def _str_to_int(self, string): """Check for the hex """ string = string.lower() if string.endswith("l"): string = string[:-1] if string.lower().startswith("0x"): # should always match match = re.match(r'0[xX]([a-fA-F0-9]+)', string) ...
def _str_to_int(self, string): """Check for the hex """ string = string.lower() if string.endswith("l"): string = string[:-1] if string.lower().startswith("0x"): # should always match match = re.match(r'0[xX]([a-fA-F0-9]+)', string) ...
[ "Check", "for", "the", "hex" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1505-L1516
[ "def", "_str_to_int", "(", "self", ",", "string", ")", ":", "string", "=", "string", ".", "lower", "(", ")", "if", "string", ".", "endswith", "(", "\"l\"", ")", ":", "string", "=", "string", "[", ":", "-", "1", "]", "if", "string", ".", "lower", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_constant
TODO: Docstring for _handle_constant. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_constant(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_constant. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling constant type {}".format(node.type)) switch = { ...
def _handle_constant(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_constant. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling constant type {}".format(node.type)) switch = { ...
[ "TODO", ":", "Docstring", "for", "_handle_constant", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1528-L1567
[ "def", "_handle_constant", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling constant type {}\"", ".", "format", "(", "node", ".", "type", ")", ")", "switch", "=", "{", "\"int\"", ":", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_binary_op
TODO: Docstring for _handle_binary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_binary_op(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_binary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling binary operation {}".format(node.op)) switch = { ...
def _handle_binary_op(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_binary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling binary operation {}".format(node.op)) switch = { ...
[ "TODO", ":", "Docstring", "for", "_handle_binary_op", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1569-L1617
[ "def", "_handle_binary_op", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling binary operation {}\"", ".", "format", "(", "node", ".", "op", ")", ")", "switch", "=", "{", "\"+\"", ":", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_unary_op
TODO: Docstring for _handle_unary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_unary_op(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_unary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling unary op {}".format(node.op)) special_switch = { ...
def _handle_unary_op(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_unary_op. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling unary op {}".format(node.op)) special_switch = { ...
[ "TODO", ":", "Docstring", "for", "_handle_unary_op", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1619-L1665
[ "def", "_handle_unary_op", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling unary op {}\"", ".", "format", "(", "node", ".", "op", ")", ")", "special_switch", "=", "{", "\"parentof\"", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_parentof
Handle the parentof unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_parentof(self, node, scope, ctxt, stream): """Handle the parentof unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ # if someone does something like parentof(this).blah, # we'll end up with a StructR...
def _handle_parentof(self, node, scope, ctxt, stream): """Handle the parentof unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ # if someone does something like parentof(this).blah, # we'll end up with a StructR...
[ "Handle", "the", "parentof", "unary", "operator" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1681-L1703
[ "def", "_handle_parentof", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "# if someone does something like parentof(this).blah,", "# we'll end up with a StructRef instead of an ID ref", "# for node.expr, but we'll also end up with a structref", "# if...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_exists
Handle the exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_exists(self, node, scope, ctxt, stream): """Handle the exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ res = fields.Int() try: self._handle_node(node.expr, scope, ctxt, stream) ...
def _handle_exists(self, node, scope, ctxt, stream): """Handle the exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ res = fields.Int() try: self._handle_node(node.expr, scope, ctxt, stream) ...
[ "Handle", "the", "exists", "unary", "operator" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1705-L1721
[ "def", "_handle_exists", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "res", "=", "fields", ".", "Int", "(", ")", "try", ":", "self", ".", "_handle_node", "(", "node", ".", "expr", ",", "scope", ",", "ctxt", ",", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_function_exists
Handle the function_exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_function_exists(self, node, scope, ctxt, stream): """Handle the function_exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ res = fields.Int() try: func = self._handle_node(node.exp...
def _handle_function_exists(self, node, scope, ctxt, stream): """Handle the function_exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ res = fields.Int() try: func = self._handle_node(node.exp...
[ "Handle", "the", "function_exists", "unary", "operator" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1723-L1742
[ "def", "_handle_function_exists", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "res", "=", "fields", ".", "Int", "(", ")", "try", ":", "func", "=", "self", ".", "_handle_node", "(", "node", ".", "expr", ",", "scope", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_id
Handle an ID node (return a field object for the ID) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_id(self, node, scope, ctxt, stream): """Handle an ID node (return a field object for the ID) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ if node.name == "__root": return self._root if node.name ==...
def _handle_id(self, node, scope, ctxt, stream): """Handle an ID node (return a field object for the ID) :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ if node.name == "__root": return self._root if node.name ==...
[ "Handle", "an", "ID", "node", "(", "return", "a", "field", "object", "for", "the", "ID", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1744-L1769
[ "def", "_handle_id", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "if", "node", ".", "name", "==", "\"__root\"", ":", "return", "self", ".", "_root", "if", "node", ".", "name", "==", "\"__this\"", "or", "node", ".", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_assignment
Handle assignment nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_assignment(self, node, scope, ctxt, stream): """Handle assignment nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ def add_op(x,y): x += y def sub_op(x,y): x -= y def div_op(x,y): x /= y def ...
def _handle_assignment(self, node, scope, ctxt, stream): """Handle assignment nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ def add_op(x,y): x += y def sub_op(x,y): x -= y def div_op(x,y): x /= y def ...
[ "Handle", "assignment", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1771-L1819
[ "def", "_handle_assignment", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "def", "add_op", "(", "x", ",", "y", ")", ":", "x", "+=", "y", "def", "sub_op", "(", "x", ",", "y", ")", ":", "x", "-=", "y", "def", "d...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_func_def
Handle FuncDef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_func_def(self, node, scope, ctxt, stream): """Handle FuncDef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling function definition") func = self._handle_node(node.decl, scope, ctxt, strea...
def _handle_func_def(self, node, scope, ctxt, stream): """Handle FuncDef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling function definition") func = self._handle_node(node.decl, scope, ctxt, strea...
[ "Handle", "FuncDef", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1821-L1833
[ "def", "_handle_func_def", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling function definition\"", ")", "func", "=", "self", ".", "_handle_node", "(", "node", ".", "decl", ",", "scope", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_param_list
Handle ParamList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_param_list(self, node, scope, ctxt, stream): """Handle ParamList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling param list") # params should be a list of tuples: # [(<name>, <f...
def _handle_param_list(self, node, scope, ctxt, stream): """Handle ParamList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling param list") # params should be a list of tuples: # [(<name>, <f...
[ "Handle", "ParamList", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1835-L1855
[ "def", "_handle_param_list", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling param list\"", ")", "# params should be a list of tuples:", "# [(<name>, <field_class>), ...]", "params", "=", "[", "]",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_func_decl
Handle FuncDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_func_decl(self, node, scope, ctxt, stream): """Handle FuncDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling func decl") if node.args is not None: # could just call _hand...
def _handle_func_decl(self, node, scope, ctxt, stream): """Handle FuncDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling func decl") if node.args is not None: # could just call _hand...
[ "Handle", "FuncDecl", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1857-L1883
[ "def", "_handle_func_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling func decl\"", ")", "if", "node", ".", "args", "is", "not", "None", ":", "# could just call _handle_param_list direc...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_func_call
Handle FuncCall nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_func_call(self, node, scope, ctxt, stream): """Handle FuncCall nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling function call to '{}'".format(node.name.name)) if node.args is None: ...
def _handle_func_call(self, node, scope, ctxt, stream): """Handle FuncCall nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling function call to '{}'".format(node.name.name)) if node.args is None: ...
[ "Handle", "FuncCall", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1885-L1901
[ "def", "_handle_func_call", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling function call to '{}'\"", ".", "format", "(", "node", ".", "name", ".", "name", ")", ")", "if", "node", ".", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_expr_list
Handle ExprList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_expr_list(self, node, scope, ctxt, stream): """Handle ExprList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling expression list") exprs = [ self._handle_node(expr, scope, ctx...
def _handle_expr_list(self, node, scope, ctxt, stream): """Handle ExprList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling expression list") exprs = [ self._handle_node(expr, scope, ctx...
[ "Handle", "ExprList", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1903-L1917
[ "def", "_handle_expr_list", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling expression list\"", ")", "exprs", "=", "[", "self", ".", "_handle_node", "(", "expr", ",", "scope", ",", "ctx...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_compound
Handle Compound nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_compound(self, node, scope, ctxt, stream): """Handle Compound nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling compound statement") #scope.push() try: for child in n...
def _handle_compound(self, node, scope, ctxt, stream): """Handle Compound nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling compound statement") #scope.push() try: for child in n...
[ "Handle", "Compound", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1919-L1940
[ "def", "_handle_compound", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling compound statement\"", ")", "#scope.push()", "try", ":", "for", "child", "in", "node", ".", "children", "(", ")"...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_return
Handle Return nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_return(self, node, scope, ctxt, stream): """Handle Return nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling return") if node.expr is None: ret_val = None else: ...
def _handle_return(self, node, scope, ctxt, stream): """Handle Return nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling return") if node.expr is None: ret_val = None else: ...
[ "Handle", "Return", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1942-L1958
[ "def", "_handle_return", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling return\"", ")", "if", "node", ".", "expr", "is", "None", ":", "ret_val", "=", "None", "else", ":", "ret_val", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_enum
Handle enum nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_enum(self, node, scope, ctxt, stream): """Handle enum nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling enum") if node.type is None: enum_cls = fields.Int else: ...
def _handle_enum(self, node, scope, ctxt, stream): """Handle enum nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling enum") if node.type is None: enum_cls = fields.Int else: ...
[ "Handle", "enum", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1960-L1997
[ "def", "_handle_enum", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling enum\"", ")", "if", "node", ".", "type", "is", "None", ":", "enum_cls", "=", "fields", ".", "Int", "else", ":"...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_array_decl
Handle ArrayDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_array_decl(self, node, scope, ctxt, stream): """Handle ArrayDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling array declaration '{}'".format(node.type.declname)) if node.dim is None...
def _handle_array_decl(self, node, scope, ctxt, stream): """Handle ArrayDecl nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling array declaration '{}'".format(node.type.declname)) if node.dim is None...
[ "Handle", "ArrayDecl", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1999-L2025
[ "def", "_handle_array_decl", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling array declaration '{}'\"", ".", "format", "(", "node", ".", "type", ".", "declname", ")", ")", "if", "node", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_array_ref
Handle ArrayRef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_array_ref(self, node, scope, ctxt, stream): """Handle ArrayRef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ ary = self._handle_node(node.name, scope, ctxt, stream) subscript = self._handle_node(node.subs...
def _handle_array_ref(self, node, scope, ctxt, stream): """Handle ArrayRef nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ ary = self._handle_node(node.name, scope, ctxt, stream) subscript = self._handle_node(node.subs...
[ "Handle", "ArrayRef", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2027-L2039
[ "def", "_handle_array_ref", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "ary", "=", "self", ".", "_handle_node", "(", "node", ".", "name", ",", "scope", ",", "ctxt", ",", "stream", ")", "subscript", "=", "self", ".",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_if
Handle If nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_if(self, node, scope, ctxt, stream): """Handle If nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling if/ternary_op") cond = self._handle_node(node.cond, scope, ctxt, stream) if con...
def _handle_if(self, node, scope, ctxt, stream): """Handle If nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling if/ternary_op") cond = self._handle_node(node.cond, scope, ctxt, stream) if con...
[ "Handle", "If", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2041-L2058
[ "def", "_handle_if", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling if/ternary_op\"", ")", "cond", "=", "self", ".", "_handle_node", "(", "node", ".", "cond", ",", "scope", ",", "ctx...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_for
Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_for(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling for") if node.init is not None: # perform the init self._hand...
def _handle_for(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling for") if node.init is not None: # perform the init self._hand...
[ "Handle", "For", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2060-L2090
[ "def", "_handle_for", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling for\"", ")", "if", "node", ".", "init", "is", "not", "None", ":", "# perform the init", "self", ".", "_handle_node"...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_while
Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_while(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling while") while node.cond is None or self._handle_node(node.cond, scope, ctxt, strea...
def _handle_while(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling while") while node.cond is None or self._handle_node(node.cond, scope, ctxt, strea...
[ "Handle", "break", "node" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2092-L2110
[ "def", "_handle_while", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling while\"", ")", "while", "node", ".", "cond", "is", "None", "or", "self", ".", "_handle_node", "(", "node", ".",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_switch
Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_switch(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ def exec_case(idx, cases): # keep executing cases until a break is found, # or they've...
def _handle_switch(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ def exec_case(idx, cases): # keep executing cases until a break is found, # or they've...
[ "Handle", "break", "node" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2143-L2215
[ "def", "_handle_switch", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "def", "exec_case", "(", "idx", ",", "cases", ")", ":", "# keep executing cases until a break is found,", "# or they've all been executed", "for", "case", "in", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_break
Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_break(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling break") raise errors.InterpBreak()
def _handle_break(self, node, scope, ctxt, stream): """Handle break node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling break") raise errors.InterpBreak()
[ "Handle", "break", "node" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2217-L2228
[ "def", "_handle_break", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling break\"", ")", "raise", "errors", ".", "InterpBreak", "(", ")" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_continue
Handle continue node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_continue(self, node, scope, ctxt, stream): """Handle continue node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling continue") raise errors.InterpContinue()
def _handle_continue(self, node, scope, ctxt, stream): """Handle continue node :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling continue") raise errors.InterpContinue()
[ "Handle", "continue", "node" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2230-L2241
[ "def", "_handle_continue", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling continue\"", ")", "raise", "errors", ".", "InterpContinue", "(", ")" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._handle_decl_list
Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
pfp/interp.py
def _handle_decl_list(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling decl list") # just handle each declaration for decl in node.decls: ...
def _handle_decl_list(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling decl list") # just handle each declaration for decl in node.decls: ...
[ "Handle", "For", "nodes" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2243-L2256
[ "def", "_handle_decl_list", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling decl list\"", ")", "# just handle each declaration", "for", "decl", "in", "node", ".", "decls", ":", "self", ".",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._create_scope
TODO: Docstring for _create_scope. :returns: TODO
pfp/interp.py
def _create_scope(self): """TODO: Docstring for _create_scope. :returns: TODO """ res = Scope(self._log) for func_name,native_func in six.iteritems(self._natives): res.add_local(func_name, native_func) return res
def _create_scope(self): """TODO: Docstring for _create_scope. :returns: TODO """ res = Scope(self._log) for func_name,native_func in six.iteritems(self._natives): res.add_local(func_name, native_func) return res
[ "TODO", ":", "Docstring", "for", "_create_scope", ".", ":", "returns", ":", "TODO" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2306-L2316
[ "def", "_create_scope", "(", "self", ")", ":", "res", "=", "Scope", "(", "self", ".", "_log", ")", "for", "func_name", ",", "native_func", "in", "six", ".", "iteritems", "(", "self", ".", "_natives", ")", ":", "res", ".", "add_local", "(", "func_name",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._get_value
Return the value of the node. It is expected to be either an AST.ID instance or a constant :node: TODO :returns: TODO
pfp/interp.py
def _get_value(self, node, scope, ctxt, stream): """Return the value of the node. It is expected to be either an AST.ID instance or a constant :node: TODO :returns: TODO """ res = self._handle_node(node, scope, ctxt, stream) if isinstance(res, fields.Field): ...
def _get_value(self, node, scope, ctxt, stream): """Return the value of the node. It is expected to be either an AST.ID instance or a constant :node: TODO :returns: TODO """ res = self._handle_node(node, scope, ctxt, stream) if isinstance(res, fields.Field): ...
[ "Return", "the", "value", "of", "the", "node", ".", "It", "is", "expected", "to", "be", "either", "an", "AST", ".", "ID", "instance", "or", "a", "constant" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2318-L2334
[ "def", "_get_value", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "res", "=", "self", ".", "_handle_node", "(", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", "if", "isinstance", "(", "res", ",", "fields", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
PfpInterp._resolve_to_field_class
Resolve the names to a class in fields.py, resolving past typedefs, etc :names: TODO :scope: TODO :ctxt: TODO :returns: TODO
pfp/interp.py
def _resolve_to_field_class(self, names, scope): """Resolve the names to a class in fields.py, resolving past typedefs, etc :names: TODO :scope: TODO :ctxt: TODO :returns: TODO """ switch = { "char" : "Char", "int" : "Int",...
def _resolve_to_field_class(self, names, scope): """Resolve the names to a class in fields.py, resolving past typedefs, etc :names: TODO :scope: TODO :ctxt: TODO :returns: TODO """ switch = { "char" : "Char", "int" : "Int",...
[ "Resolve", "the", "names", "to", "a", "class", "in", "fields", ".", "py", "resolving", "past", "typedefs", "etc" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2336-L2385
[ "def", "_resolve_to_field_class", "(", "self", ",", "names", ",", "scope", ")", ":", "switch", "=", "{", "\"char\"", ":", "\"Char\"", ",", "\"int\"", ":", "\"Int\"", ",", "\"long\"", ":", "\"Int\"", ",", "\"int64\"", ":", "\"Int64\"", ",", "\"uint64\"", ":...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
bits_to_bytes
Convert the bit list into bytes. (Assumes bits is a list whose length is a multiple of 8)
pfp/bitwrap.py
def bits_to_bytes(bits): """Convert the bit list into bytes. (Assumes bits is a list whose length is a multiple of 8) """ if len(bits) % 8 != 0: raise Exception("num bits must be multiple of 8") res = "" for x in six.moves.range(0, len(bits), 8): byte_bits = bits[x:x+8] ...
def bits_to_bytes(bits): """Convert the bit list into bytes. (Assumes bits is a list whose length is a multiple of 8) """ if len(bits) % 8 != 0: raise Exception("num bits must be multiple of 8") res = "" for x in six.moves.range(0, len(bits), 8): byte_bits = bits[x:x+8] ...
[ "Convert", "the", "bit", "list", "into", "bytes", ".", "(", "Assumes", "bits", "is", "a", "list", "whose", "length", "is", "a", "multiple", "of", "8", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L15-L29
[ "def", "bits_to_bytes", "(", "bits", ")", ":", "if", "len", "(", "bits", ")", "%", "8", "!=", "0", ":", "raise", "Exception", "(", "\"num bits must be multiple of 8\"", ")", "res", "=", "\"\"", "for", "x", "in", "six", ".", "moves", ".", "range", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
bytes_to_bits
Convert bytes to a list of bits
pfp/bitwrap.py
def bytes_to_bits(bytes_): """Convert bytes to a list of bits """ res = [] for x in bytes_: if not isinstance(x, int): x = ord(x) res += byte_to_bits(x) return res
def bytes_to_bits(bytes_): """Convert bytes to a list of bits """ res = [] for x in bytes_: if not isinstance(x, int): x = ord(x) res += byte_to_bits(x) return res
[ "Convert", "bytes", "to", "a", "list", "of", "bits" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L31-L39
[ "def", "bytes_to_bits", "(", "bytes_", ")", ":", "res", "=", "[", "]", "for", "x", "in", "bytes_", ":", "if", "not", "isinstance", "(", "x", ",", "int", ")", ":", "x", "=", "ord", "(", "x", ")", "res", "+=", "byte_to_bits", "(", "x", ")", "retu...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.is_eof
Return if the stream has reached EOF or not without discarding any unflushed bits :returns: True/False
pfp/bitwrap.py
def is_eof(self): """Return if the stream has reached EOF or not without discarding any unflushed bits :returns: True/False """ pos = self._stream.tell() byte = self._stream.read(1) self._stream.seek(pos, 0) return utils.binary(byte) == utils.binary("")
def is_eof(self): """Return if the stream has reached EOF or not without discarding any unflushed bits :returns: True/False """ pos = self._stream.tell() byte = self._stream.read(1) self._stream.seek(pos, 0) return utils.binary(byte) == utils.binary("")
[ "Return", "if", "the", "stream", "has", "reached", "EOF", "or", "not", "without", "discarding", "any", "unflushed", "bits" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L70-L80
[ "def", "is_eof", "(", "self", ")", ":", "pos", "=", "self", ".", "_stream", ".", "tell", "(", ")", "byte", "=", "self", ".", "_stream", ".", "read", "(", "1", ")", "self", ".", "_stream", ".", "seek", "(", "pos", ",", "0", ")", "return", "utils...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.close
Close the stream
pfp/bitwrap.py
def close(self): """Close the stream """ self.closed = True self._flush_bits_to_stream() self._stream.close()
def close(self): """Close the stream """ self.closed = True self._flush_bits_to_stream() self._stream.close()
[ "Close", "the", "stream" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L82-L87
[ "def", "close", "(", "self", ")", ":", "self", ".", "closed", "=", "True", "self", ".", "_flush_bits_to_stream", "(", ")", "self", ".", "_stream", ".", "close", "(", ")" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.read
Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. :num: number of bytes to read...
pfp/bitwrap.py
def read(self, num): """Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. ...
def read(self, num): """Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. ...
[ "Read", "num", "number", "of", "bytes", "from", "the", "stream", ".", "Note", "that", "this", "will", "automatically", "resets", "/", "ends", "the", "current", "bit", "-", "reading", "if", "it", "does", "not", "end", "on", "an", "even", "byte", "AND", ...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L100-L123
[ "def", "read", "(", "self", ",", "num", ")", ":", "start_pos", "=", "self", ".", "tell", "(", ")", "if", "self", ".", "padded", ":", "# we toss out any uneven bytes", "self", ".", "_bits", ".", "clear", "(", ")", "res", "=", "utils", ".", "binary", "...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.read_bits
Read ``num`` number of bits from the stream :num: number of bits to read :returns: a list of ``num`` bits, or an empty list if EOF has been reached
pfp/bitwrap.py
def read_bits(self, num): """Read ``num`` number of bits from the stream :num: number of bits to read :returns: a list of ``num`` bits, or an empty list if EOF has been reached """ if num > len(self._bits): needed = num - len(self._bits) num_bytes = int(m...
def read_bits(self, num): """Read ``num`` number of bits from the stream :num: number of bits to read :returns: a list of ``num`` bits, or an empty list if EOF has been reached """ if num > len(self._bits): needed = num - len(self._bits) num_bytes = int(m...
[ "Read", "num", "number", "of", "bits", "from", "the", "stream" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L125-L143
[ "def", "read_bits", "(", "self", ",", "num", ")", ":", "if", "num", ">", "len", "(", "self", ".", "_bits", ")", ":", "needed", "=", "num", "-", "len", "(", "self", ".", "_bits", ")", "num_bytes", "=", "int", "(", "math", ".", "ceil", "(", "need...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.write
Write data to the stream :data: the data to write to the stream :returns: None
pfp/bitwrap.py
def write(self, data): """Write data to the stream :data: the data to write to the stream :returns: None """ if self.padded: # flush out any remaining bits first if len(self._bits) > 0: self._flush_bits_to_stream() self._stream...
def write(self, data): """Write data to the stream :data: the data to write to the stream :returns: None """ if self.padded: # flush out any remaining bits first if len(self._bits) > 0: self._flush_bits_to_stream() self._stream...
[ "Write", "data", "to", "the", "stream" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L145-L162
[ "def", "write", "(", "self", ",", "data", ")", ":", "if", "self", ".", "padded", ":", "# flush out any remaining bits first", "if", "len", "(", "self", ".", "_bits", ")", ">", "0", ":", "self", ".", "_flush_bits_to_stream", "(", ")", "self", ".", "_strea...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.write_bits
Write the bits to the stream. Add the bits to the existing unflushed bits and write complete bytes to the stream.
pfp/bitwrap.py
def write_bits(self, bits): """Write the bits to the stream. Add the bits to the existing unflushed bits and write complete bytes to the stream. """ for bit in bits: self._bits.append(bit) while len(self._bits) >= 8: byte_bits = [self._bits.pople...
def write_bits(self, bits): """Write the bits to the stream. Add the bits to the existing unflushed bits and write complete bytes to the stream. """ for bit in bits: self._bits.append(bit) while len(self._bits) >= 8: byte_bits = [self._bits.pople...
[ "Write", "the", "bits", "to", "the", "stream", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L164-L176
[ "def", "write_bits", "(", "self", ",", "bits", ")", ":", "for", "bit", "in", "bits", ":", "self", ".", "_bits", ".", "append", "(", "bit", ")", "while", "len", "(", "self", ".", "_bits", ")", ">=", "8", ":", "byte_bits", "=", "[", "self", ".", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.tell
Return the current position in the stream (ignoring bit position) :returns: int for the position in the stream
pfp/bitwrap.py
def tell(self): """Return the current position in the stream (ignoring bit position) :returns: int for the position in the stream """ res = self._stream.tell() if len(self._bits) > 0: res -= 1 return res
def tell(self): """Return the current position in the stream (ignoring bit position) :returns: int for the position in the stream """ res = self._stream.tell() if len(self._bits) > 0: res -= 1 return res
[ "Return", "the", "current", "position", "in", "the", "stream", "(", "ignoring", "bit", "position", ")" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L180-L189
[ "def", "tell", "(", "self", ")", ":", "res", "=", "self", ".", "_stream", ".", "tell", "(", ")", "if", "len", "(", "self", ".", "_bits", ")", ">", "0", ":", "res", "-=", "1", "return", "res" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.seek
Seek to the specified position in the stream with seek_type. Unflushed bits will be discarded in the case of a seek. The stream will also keep track of which bytes have and have not been consumed so that the dom will capture all of the bytes in the stream. :pos: offset ...
pfp/bitwrap.py
def seek(self, pos, seek_type=0): """Seek to the specified position in the stream with seek_type. Unflushed bits will be discarded in the case of a seek. The stream will also keep track of which bytes have and have not been consumed so that the dom will capture all of the bytes ...
def seek(self, pos, seek_type=0): """Seek to the specified position in the stream with seek_type. Unflushed bits will be discarded in the case of a seek. The stream will also keep track of which bytes have and have not been consumed so that the dom will capture all of the bytes ...
[ "Seek", "to", "the", "specified", "position", "in", "the", "stream", "with", "seek_type", ".", "Unflushed", "bits", "will", "be", "discarded", "in", "the", "case", "of", "a", "seek", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L191-L205
[ "def", "seek", "(", "self", ",", "pos", ",", "seek_type", "=", "0", ")", ":", "self", ".", "_bits", ".", "clear", "(", ")", "return", "self", ".", "_stream", ".", "seek", "(", "pos", ",", "seek_type", ")" ]
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.size
Return the size of the stream, or -1 if it cannot be determined.
pfp/bitwrap.py
def size(self): """Return the size of the stream, or -1 if it cannot be determined. """ pos = self._stream.tell() # seek to the end of the stream self._stream.seek(0,2) size = self._stream.tell() self._stream.seek(pos, 0) return size
def size(self): """Return the size of the stream, or -1 if it cannot be determined. """ pos = self._stream.tell() # seek to the end of the stream self._stream.seek(0,2) size = self._stream.tell() self._stream.seek(pos, 0) return size
[ "Return", "the", "size", "of", "the", "stream", "or", "-", "1", "if", "it", "cannot", "be", "determined", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L207-L217
[ "def", "size", "(", "self", ")", ":", "pos", "=", "self", ".", "_stream", ".", "tell", "(", ")", "# seek to the end of the stream", "self", ".", "_stream", ".", "seek", "(", "0", ",", "2", ")", "size", "=", "self", ".", "_stream", ".", "tell", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream.unconsumed_ranges
Return an IntervalTree of unconsumed ranges, of the format (start, end] with the end value not being included
pfp/bitwrap.py
def unconsumed_ranges(self): """Return an IntervalTree of unconsumed ranges, of the format (start, end] with the end value not being included """ res = IntervalTree() prev = None # normal iteration is not in a predictable order ranges = sorted([x for x in self.r...
def unconsumed_ranges(self): """Return an IntervalTree of unconsumed ranges, of the format (start, end] with the end value not being included """ res = IntervalTree() prev = None # normal iteration is not in a predictable order ranges = sorted([x for x in self.r...
[ "Return", "an", "IntervalTree", "of", "unconsumed", "ranges", "of", "the", "format", "(", "start", "end", "]", "with", "the", "end", "value", "not", "being", "included" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L219-L241
[ "def", "unconsumed_ranges", "(", "self", ")", ":", "res", "=", "IntervalTree", "(", ")", "prev", "=", "None", "# normal iteration is not in a predictable order", "ranges", "=", "sorted", "(", "[", "x", "for", "x", "in", "self", ".", "range_set", "]", ",", "k...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream._update_consumed_ranges
Update the ``self.consumed_ranges`` array with which byte ranges have been consecutively consumed.
pfp/bitwrap.py
def _update_consumed_ranges(self, start_pos, end_pos): """Update the ``self.consumed_ranges`` array with which byte ranges have been consecutively consumed. """ self.range_set.add(Interval(start_pos, end_pos+1)) self.range_set.merge_overlaps()
def _update_consumed_ranges(self, start_pos, end_pos): """Update the ``self.consumed_ranges`` array with which byte ranges have been consecutively consumed. """ self.range_set.add(Interval(start_pos, end_pos+1)) self.range_set.merge_overlaps()
[ "Update", "the", "self", ".", "consumed_ranges", "array", "with", "which", "byte", "ranges", "have", "been", "consecutively", "consumed", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L247-L252
[ "def", "_update_consumed_ranges", "(", "self", ",", "start_pos", ",", "end_pos", ")", ":", "self", ".", "range_set", ".", "add", "(", "Interval", "(", "start_pos", ",", "end_pos", "+", "1", ")", ")", "self", ".", "range_set", ".", "merge_overlaps", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
BitwrappedStream._flush_bits_to_stream
Flush the bits to the stream. This is used when a few bits have been read and ``self._bits`` contains unconsumed/ flushed bits when data is to be written to the stream
pfp/bitwrap.py
def _flush_bits_to_stream(self): """Flush the bits to the stream. This is used when a few bits have been read and ``self._bits`` contains unconsumed/ flushed bits when data is to be written to the stream """ if len(self._bits) == 0: return 0 bits = list(self....
def _flush_bits_to_stream(self): """Flush the bits to the stream. This is used when a few bits have been read and ``self._bits`` contains unconsumed/ flushed bits when data is to be written to the stream """ if len(self._bits) == 0: return 0 bits = list(self....
[ "Flush", "the", "bits", "to", "the", "stream", ".", "This", "is", "used", "when", "a", "few", "bits", "have", "been", "read", "and", "self", ".", "_bits", "contains", "unconsumed", "/", "flushed", "bits", "when", "data", "is", "to", "be", "written", "t...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L254-L271
[ "def", "_flush_bits_to_stream", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_bits", ")", "==", "0", ":", "return", "0", "bits", "=", "list", "(", "self", ".", "_bits", ")", "diff", "=", "8", "-", "(", "len", "(", "bits", ")", "%", "8...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
LibraryValidator._validate_markdown
ensure that fields are present in markdown file
expfactory/validator/library.py
def _validate_markdown(self, expfile): '''ensure that fields are present in markdown file''' try: import yaml except: bot.error('Python yaml is required for testing yml/markdown files.') sys.exit(1) self.metadata = {} uid = os.path.basename(e...
def _validate_markdown(self, expfile): '''ensure that fields are present in markdown file''' try: import yaml except: bot.error('Python yaml is required for testing yml/markdown files.') sys.exit(1) self.metadata = {} uid = os.path.basename(e...
[ "ensure", "that", "fields", "are", "present", "in", "markdown", "file" ]
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/library.py#L62-L101
[ "def", "_validate_markdown", "(", "self", ",", "expfile", ")", ":", "try", ":", "import", "yaml", "except", ":", "bot", ".", "error", "(", "'Python yaml is required for testing yml/markdown files.'", ")", "sys", ".", "exit", "(", "1", ")", "self", ".", "metada...
27ce6cc93e17231df8a8024f18e631336afd3501
train
perform_checks
return all checks for required variables before returning to desired view Parameters ========== template: the html template to render do_redirect: if True, perform a redirect and not render context: dictionary of context variables to pass to render_template next: a pre...
expfactory/views/utils.py
def perform_checks(template, do_redirect=False, context=None, next=None, quiet=False): '''return all checks for required variables before returning to desired view Parameters ========== template: the html temp...
def perform_checks(template, do_redirect=False, context=None, next=None, quiet=False): '''return all checks for required variables before returning to desired view Parameters ========== template: the html temp...
[ "return", "all", "checks", "for", "required", "variables", "before", "returning", "to", "desired", "view" ]
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/views/utils.py#L45-L105
[ "def", "perform_checks", "(", "template", ",", "do_redirect", "=", "False", ",", "context", "=", "None", ",", "next", "=", "None", ",", "quiet", "=", "False", ")", ":", "from", "expfactory", ".", "server", "import", "app", "username", "=", "session", "."...
27ce6cc93e17231df8a8024f18e631336afd3501
train
FSeek
Returns 0 if successful or -1 if the address is out of range
pfp/native/compat_io.py
def FSeek(params, ctxt, scope, stream, coord): """Returns 0 if successful or -1 if the address is out of range """ if len(params) != 1: raise errors.InvalidArguments(coord, "{} args".format(len(params)), "FSeek accepts only one argument") pos = PYVAL(params[0]) curr_pos = stream.tell() ...
def FSeek(params, ctxt, scope, stream, coord): """Returns 0 if successful or -1 if the address is out of range """ if len(params) != 1: raise errors.InvalidArguments(coord, "{} args".format(len(params)), "FSeek accepts only one argument") pos = PYVAL(params[0]) curr_pos = stream.tell() ...
[ "Returns", "0", "if", "successful", "or", "-", "1", "if", "the", "address", "is", "out", "of", "range" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/compat_io.py#L117-L158
[ "def", "FSeek", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "!=", "1", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", "len",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
FSkip
Returns 0 if successful or -1 if the address is out of range
pfp/native/compat_io.py
def FSkip(params, ctxt, scope, stream, coord): """Returns 0 if successful or -1 if the address is out of range """ if len(params) != 1: raise errors.InvalidArguments(coord, "{} args".format(len(params)), "FSkip accepts only one argument") skip_amt = PYVAL(params[0]) pos = skip_amt + stream....
def FSkip(params, ctxt, scope, stream, coord): """Returns 0 if successful or -1 if the address is out of range """ if len(params) != 1: raise errors.InvalidArguments(coord, "{} args".format(len(params)), "FSkip accepts only one argument") skip_amt = PYVAL(params[0]) pos = skip_amt + stream....
[ "Returns", "0", "if", "successful", "or", "-", "1", "if", "the", "address", "is", "out", "of", "range" ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/compat_io.py#L162-L170
[ "def", "FSkip", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "!=", "1", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", "len",...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
packer_gzip
``PackerGZip`` - implements both unpacking and packing. Can be used as the ``packer`` for a field. When packing, concats the build output of all params and gzip-compresses the result. When unpacking, concats the build output of all params and gzip-decompresses the result. Example: The code...
pfp/native/packers.py
def packer_gzip(params, ctxt, scope, stream, coord): """``PackerGZip`` - implements both unpacking and packing. Can be used as the ``packer`` for a field. When packing, concats the build output of all params and gzip-compresses the result. When unpacking, concats the build output of all params and gzip-...
def packer_gzip(params, ctxt, scope, stream, coord): """``PackerGZip`` - implements both unpacking and packing. Can be used as the ``packer`` for a field. When packing, concats the build output of all params and gzip-compresses the result. When unpacking, concats the build output of all params and gzip-...
[ "PackerGZip", "-", "implements", "both", "unpacking", "and", "packing", ".", "Can", "be", "used", "as", "the", "packer", "for", "a", "field", ".", "When", "packing", "concats", "the", "build", "output", "of", "all", "params", "and", "gzip", "-", "compresse...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/packers.py#L14-L40
[ "def", "packer_gzip", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "<=", "1", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
pack_gzip
``PackGZip`` - Concats the build output of all params and gzips the resulting data, returning a char array. Example: :: char data[0x100]<pack=PackGZip, ...>;
pfp/native/packers.py
def pack_gzip(params, ctxt, scope, stream, coord): """``PackGZip`` - Concats the build output of all params and gzips the resulting data, returning a char array. Example: :: char data[0x100]<pack=PackGZip, ...>; """ if len(params) == 0: raise errors.InvalidArguments(coord, "{} args...
def pack_gzip(params, ctxt, scope, stream, coord): """``PackGZip`` - Concats the build output of all params and gzips the resulting data, returning a char array. Example: :: char data[0x100]<pack=PackGZip, ...>; """ if len(params) == 0: raise errors.InvalidArguments(coord, "{} args...
[ "PackGZip", "-", "Concats", "the", "build", "output", "of", "all", "params", "and", "gzips", "the", "resulting", "data", "returning", "a", "char", "array", "." ]
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/packers.py#L43-L61
[ "def", "pack_gzip", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "==", "0", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", "l...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
watch_length
WatchLength - Watch the total length of each of the params. Example: The code below uses the ``WatchLength`` update function to update the ``length`` field to the length of the ``data`` field :: int length<watch=data, update=WatchLength>; char data[length];
pfp/native/watchers.py
def watch_length(params, ctxt, scope, stream, coord): """WatchLength - Watch the total length of each of the params. Example: The code below uses the ``WatchLength`` update function to update the ``length`` field to the length of the ``data`` field :: int length<watch=data, upd...
def watch_length(params, ctxt, scope, stream, coord): """WatchLength - Watch the total length of each of the params. Example: The code below uses the ``WatchLength`` update function to update the ``length`` field to the length of the ``data`` field :: int length<watch=data, upd...
[ "WatchLength", "-", "Watch", "the", "total", "length", "of", "each", "of", "the", "params", ".", "Example", ":", "The", "code", "below", "uses", "the", "WatchLength", "update", "function", "to", "update", "the", "length", "field", "to", "the", "length", "o...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/watchers.py#L15-L34
[ "def", "watch_length", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "<=", "1", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", ...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
watch_crc
WatchCrc32 - Watch the total crc32 of the params. Example: The code below uses the ``WatchCrc32`` update function to update the ``crc`` field to the crc of the ``length`` and ``data`` fields :: char length; char data[length]; int crc<watch=length;data, updat...
pfp/native/watchers.py
def watch_crc(params, ctxt, scope, stream, coord): """WatchCrc32 - Watch the total crc32 of the params. Example: The code below uses the ``WatchCrc32`` update function to update the ``crc`` field to the crc of the ``length`` and ``data`` fields :: char length; char ...
def watch_crc(params, ctxt, scope, stream, coord): """WatchCrc32 - Watch the total crc32 of the params. Example: The code below uses the ``WatchCrc32`` update function to update the ``crc`` field to the crc of the ``length`` and ``data`` fields :: char length; char ...
[ "WatchCrc32", "-", "Watch", "the", "total", "crc32", "of", "the", "params", ".", "Example", ":", "The", "code", "below", "uses", "the", "WatchCrc32", "update", "function", "to", "update", "the", "crc", "field", "to", "the", "crc", "of", "the", "length", ...
d0c-s4vage/pfp
python
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/native/watchers.py#L37-L57
[ "def", "watch_crc", "(", "params", ",", "ctxt", ",", "scope", ",", "stream", ",", "coord", ")", ":", "if", "len", "(", "params", ")", "<=", "1", ":", "raise", "errors", ".", "InvalidArguments", "(", "coord", ",", "\"{} args\"", ".", "format", "(", "l...
32f2d34fdec1c70019fa83c7006d5e3be0f92fcd
train
ExperimentValidator._validate_folder
validate folder takes a cloned github repo, ensures the existence of the config.json, and validates it.
expfactory/validator/experiments.py
def _validate_folder(self, folder=None): ''' validate folder takes a cloned github repo, ensures the existence of the config.json, and validates it. ''' from expfactory.experiment import load_experiment if folder is None: folder=os.path.abspath(os.getcwd()) ...
def _validate_folder(self, folder=None): ''' validate folder takes a cloned github repo, ensures the existence of the config.json, and validates it. ''' from expfactory.experiment import load_experiment if folder is None: folder=os.path.abspath(os.getcwd()) ...
[ "validate", "folder", "takes", "a", "cloned", "github", "repo", "ensures", "the", "existence", "of", "the", "config", ".", "json", "and", "validates", "it", "." ]
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/experiments.py#L52-L66
[ "def", "_validate_folder", "(", "self", ",", "folder", "=", "None", ")", ":", "from", "expfactory", ".", "experiment", "import", "load_experiment", "if", "folder", "is", "None", ":", "folder", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "getc...
27ce6cc93e17231df8a8024f18e631336afd3501
train
ExperimentValidator.validate
validate is the entrypoint to all validation, for a folder, config, or url. If a URL is found, it is cloned and cleaned up. :param validate_folder: ensures the folder name (github repo) matches.
expfactory/validator/experiments.py
def validate(self, folder, cleanup=False, validate_folder=True): ''' validate is the entrypoint to all validation, for a folder, config, or url. If a URL is found, it is cloned and cleaned up. :param validate_folder: ensures the folder name (github repo) ...
def validate(self, folder, cleanup=False, validate_folder=True): ''' validate is the entrypoint to all validation, for a folder, config, or url. If a URL is found, it is cloned and cleaned up. :param validate_folder: ensures the folder name (github repo) ...
[ "validate", "is", "the", "entrypoint", "to", "all", "validation", "for", "a", "folder", "config", "or", "url", ".", "If", "a", "URL", "is", "found", "it", "is", "cloned", "and", "cleaned", "up", ".", ":", "param", "validate_folder", ":", "ensures", "the"...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/experiments.py#L69-L90
[ "def", "validate", "(", "self", ",", "folder", ",", "cleanup", "=", "False", ",", "validate_folder", "=", "True", ")", ":", "# Obtain any repository URL provided", "if", "folder", ".", "startswith", "(", "'http'", ")", "or", "'github'", "in", "folder", ":", ...
27ce6cc93e17231df8a8024f18e631336afd3501
train
ExperimentValidator._validate_config
validate config is the primary validation function that checks for presence and format of required fields. Parameters ========== :folder: full path to folder with config.json :name: if provided, the folder name to check against exp_id
expfactory/validator/experiments.py
def _validate_config(self, folder, validate_folder=True): ''' validate config is the primary validation function that checks for presence and format of required fields. Parameters ========== :folder: full path to folder with config.json :name: if provided, the folder...
def _validate_config(self, folder, validate_folder=True): ''' validate config is the primary validation function that checks for presence and format of required fields. Parameters ========== :folder: full path to folder with config.json :name: if provided, the folder...
[ "validate", "config", "is", "the", "primary", "validation", "function", "that", "checks", "for", "presence", "and", "format", "of", "required", "fields", "." ]
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/experiments.py#L93-L146
[ "def", "_validate_config", "(", "self", ",", "folder", ",", "validate_folder", "=", "True", ")", ":", "config", "=", "\"%s/config.json\"", "%", "folder", "name", "=", "os", ".", "path", ".", "basename", "(", "folder", ")", "if", "not", "os", ".", "path",...
27ce6cc93e17231df8a8024f18e631336afd3501
train
ExperimentValidator.get_validation_fields
get_validation_fields returns a list of tuples (each a field) we only require the exp_id to coincide with the folder name, for the sake of reproducibility (given that all are served from sample image or Github organization). All other fields are optional. To specify runtime v...
expfactory/validator/experiments.py
def get_validation_fields(self): '''get_validation_fields returns a list of tuples (each a field) we only require the exp_id to coincide with the folder name, for the sake of reproducibility (given that all are served from sample image or Github organization). All other fields a...
def get_validation_fields(self): '''get_validation_fields returns a list of tuples (each a field) we only require the exp_id to coincide with the folder name, for the sake of reproducibility (given that all are served from sample image or Github organization). All other fields a...
[ "get_validation_fields", "returns", "a", "list", "of", "tuples", "(", "each", "a", "field", ")", "we", "only", "require", "the", "exp_id", "to", "coincide", "with", "the", "folder", "name", "for", "the", "sake", "of", "reproducibility", "(", "given", "that",...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/experiments.py#L149-L172
[ "def", "get_validation_fields", "(", "self", ")", ":", "return", "[", "(", "\"name\"", ",", "1", ",", "str", ")", ",", "# required", "(", "\"time\"", ",", "1", ",", "int", ")", ",", "(", "\"url\"", ",", "1", ",", "str", ")", ",", "(", "\"descriptio...
27ce6cc93e17231df8a8024f18e631336afd3501
train
get_runtime_vars
get_runtime_vars will return the urlparsed string of one or more runtime variables. If None are present, None is returned. Parameters ========== varset: the variable set, a dictionary lookup with exp_id, token, vars experiment: the exp_id to look up token: the participant id...
expfactory/variables.py
def get_runtime_vars(varset, experiment, token): '''get_runtime_vars will return the urlparsed string of one or more runtime variables. If None are present, None is returned. Parameters ========== varset: the variable set, a dictionary lookup with exp_id, token, vars experiment...
def get_runtime_vars(varset, experiment, token): '''get_runtime_vars will return the urlparsed string of one or more runtime variables. If None are present, None is returned. Parameters ========== varset: the variable set, a dictionary lookup with exp_id, token, vars experiment...
[ "get_runtime_vars", "will", "return", "the", "urlparsed", "string", "of", "one", "or", "more", "runtime", "variables", ".", "If", "None", "are", "present", "None", "is", "returned", ".", "Parameters", "==========", "varset", ":", "the", "variable", "set", "a",...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L45-L85
[ "def", "get_runtime_vars", "(", "varset", ",", "experiment", ",", "token", ")", ":", "url", "=", "''", "if", "experiment", "in", "varset", ":", "variables", "=", "dict", "(", ")", "# Participant set variables", "if", "token", "in", "varset", "[", "experiment...
27ce6cc93e17231df8a8024f18e631336afd3501
train
generate_runtime_vars
generate a lookup data structure from a delimited file. We typically obtain the file name and delimiter from the environment by way of EXPFACTORY_RUNTIME_VARS, and EXPFACTORY_RUNTIME_DELIM, respectively, but the user can also parse from a custom variable file by way of specifying it to the ...
expfactory/variables.py
def generate_runtime_vars(variable_file=None, sep=','): '''generate a lookup data structure from a delimited file. We typically obtain the file name and delimiter from the environment by way of EXPFACTORY_RUNTIME_VARS, and EXPFACTORY_RUNTIME_DELIM, respectively, but the user can also parse ...
def generate_runtime_vars(variable_file=None, sep=','): '''generate a lookup data structure from a delimited file. We typically obtain the file name and delimiter from the environment by way of EXPFACTORY_RUNTIME_VARS, and EXPFACTORY_RUNTIME_DELIM, respectively, but the user can also parse ...
[ "generate", "a", "lookup", "data", "structure", "from", "a", "delimited", "file", ".", "We", "typically", "obtain", "the", "file", "name", "and", "delimiter", "from", "the", "environment", "by", "way", "of", "EXPFACTORY_RUNTIME_VARS", "and", "EXPFACTORY_RUNTIME_DE...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L88-L180
[ "def", "generate_runtime_vars", "(", "variable_file", "=", "None", ",", "sep", "=", "','", ")", ":", "# First preference goes to runtime, then environment, then unset", "if", "variable_file", "is", "None", ":", "if", "EXPFACTORY_RUNTIME_VARS", "is", "not", "None", ":", ...
27ce6cc93e17231df8a8024f18e631336afd3501
train
_read_runtime_vars
read the entire runtime variable file, and return a list of lists, each corresponding to a row. We also check the header, and exit if anything is missing or malformed. Parameters ========== variable_file: full path to the tabular file with token, exp_id, etc. sep: the default...
expfactory/variables.py
def _read_runtime_vars(variable_file, sep=','): '''read the entire runtime variable file, and return a list of lists, each corresponding to a row. We also check the header, and exit if anything is missing or malformed. Parameters ========== variable_file: full path to the tabula...
def _read_runtime_vars(variable_file, sep=','): '''read the entire runtime variable file, and return a list of lists, each corresponding to a row. We also check the header, and exit if anything is missing or malformed. Parameters ========== variable_file: full path to the tabula...
[ "read", "the", "entire", "runtime", "variable", "file", "and", "return", "a", "list", "of", "lists", "each", "corresponding", "to", "a", "row", ".", "We", "also", "check", "the", "header", "and", "exit", "if", "anything", "is", "missing", "or", "malformed"...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L183-L224
[ "def", "_read_runtime_vars", "(", "variable_file", ",", "sep", "=", "','", ")", ":", "rows", "=", "[", "x", "for", "x", "in", "read_file", "(", "variable_file", ")", ".", "split", "(", "'\\n'", ")", "if", "x", ".", "strip", "(", ")", "]", "valid_rows...
27ce6cc93e17231df8a8024f18e631336afd3501
train
_validate_row
validate_row will ensure that a row has the proper length, and is not empty and cleaned of extra spaces. Parameters ========== row: a single row, not yet parsed. Returns a valid row, or None if not valid
expfactory/variables.py
def _validate_row(row, sep=',', required_length=None): '''validate_row will ensure that a row has the proper length, and is not empty and cleaned of extra spaces. Parameters ========== row: a single row, not yet parsed. Returns a valid row, or None if not valid ''' if ...
def _validate_row(row, sep=',', required_length=None): '''validate_row will ensure that a row has the proper length, and is not empty and cleaned of extra spaces. Parameters ========== row: a single row, not yet parsed. Returns a valid row, or None if not valid ''' if ...
[ "validate_row", "will", "ensure", "that", "a", "row", "has", "the", "proper", "length", "and", "is", "not", "empty", "and", "cleaned", "of", "extra", "spaces", ".", "Parameters", "==========", "row", ":", "a", "single", "row", "not", "yet", "parsed", "." ]
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L227-L249
[ "def", "_validate_row", "(", "row", ",", "sep", "=", "','", ",", "required_length", "=", "None", ")", ":", "if", "not", "isinstance", "(", "row", ",", "list", ")", ":", "row", "=", "_parse_row", "(", "row", ",", "sep", ")", "if", "required_length", "...
27ce6cc93e17231df8a8024f18e631336afd3501
train
_parse_row
parse row is a helper function to simply clean up a string, and parse into a row based on a delimiter. If a required length is provided, we check for this too.
expfactory/variables.py
def _parse_row(row, sep=','): '''parse row is a helper function to simply clean up a string, and parse into a row based on a delimiter. If a required length is provided, we check for this too. ''' parsed = row.split(sep) parsed = [x for x in parsed if x.strip()] return parsed
def _parse_row(row, sep=','): '''parse row is a helper function to simply clean up a string, and parse into a row based on a delimiter. If a required length is provided, we check for this too. ''' parsed = row.split(sep) parsed = [x for x in parsed if x.strip()] return parsed
[ "parse", "row", "is", "a", "helper", "function", "to", "simply", "clean", "up", "a", "string", "and", "parse", "into", "a", "row", "based", "on", "a", "delimiter", ".", "If", "a", "required", "length", "is", "provided", "we", "check", "for", "this", "t...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L252-L260
[ "def", "_parse_row", "(", "row", ",", "sep", "=", "','", ")", ":", "parsed", "=", "row", ".", "split", "(", "sep", ")", "parsed", "=", "[", "x", "for", "x", "in", "parsed", "if", "x", ".", "strip", "(", ")", "]", "return", "parsed" ]
27ce6cc93e17231df8a8024f18e631336afd3501
train
validate_header
validate_header ensures that the first row contains the exp_id, var_name, var_value, and token. Capitalization isn't important, but ordering is. This criteria is very strict, but it's reasonable to require. Parameters ========== header: the header row, as a list requir...
expfactory/variables.py
def validate_header(header, required_fields=None): '''validate_header ensures that the first row contains the exp_id, var_name, var_value, and token. Capitalization isn't important, but ordering is. This criteria is very strict, but it's reasonable to require. Parameters =======...
def validate_header(header, required_fields=None): '''validate_header ensures that the first row contains the exp_id, var_name, var_value, and token. Capitalization isn't important, but ordering is. This criteria is very strict, but it's reasonable to require. Parameters =======...
[ "validate_header", "ensures", "that", "the", "first", "row", "contains", "the", "exp_id", "var_name", "var_value", "and", "token", ".", "Capitalization", "isn", "t", "important", "but", "ordering", "is", ".", "This", "criteria", "is", "very", "strict", "but", ...
expfactory/expfactory
python
https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/variables.py#L263-L294
[ "def", "validate_header", "(", "header", ",", "required_fields", "=", "None", ")", ":", "if", "required_fields", "is", "None", ":", "required_fields", "=", "[", "'exp_id'", ",", "'var_name'", ",", "'var_value'", ",", "'token'", "]", "# The required length of the h...
27ce6cc93e17231df8a8024f18e631336afd3501
train
superuser_required
Decorator for views that checks that the user is logged in and is a staff member, displaying the login page if necessary.
docs/views.py
def superuser_required(view_func): """ Decorator for views that checks that the user is logged in and is a staff member, displaying the login page if necessary. """ @wraps(view_func) def _checklogin(request, *args, **kwargs): if request.user.is_active and request.user.is_superuser: ...
def superuser_required(view_func): """ Decorator for views that checks that the user is logged in and is a staff member, displaying the login page if necessary. """ @wraps(view_func) def _checklogin(request, *args, **kwargs): if request.user.is_active and request.user.is_superuser: ...
[ "Decorator", "for", "views", "that", "checks", "that", "the", "user", "is", "logged", "in", "and", "is", "a", "staff", "member", "displaying", "the", "login", "page", "if", "necessary", "." ]
littlepea/django-docs
python
https://github.com/littlepea/django-docs/blob/8e6c867dab51746c6482bd52c4f1270684af3870/docs/views.py#L18-L40
[ "def", "superuser_required", "(", "view_func", ")", ":", "@", "wraps", "(", "view_func", ")", "def", "_checklogin", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "request", ".", "user", ".", "is_active", "and", "request", "...
8e6c867dab51746c6482bd52c4f1270684af3870
train
PathSpec.from_lines
Compiles the pattern lines. *pattern_factory* can be either the name of a registered pattern factory (:class:`str`), or a :class:`~collections.abc.Callable` used to compile patterns. It must accept an uncompiled pattern (:class:`str`) and return the compiled pattern (:class:`.Pattern`). *lines* (:class:`~co...
pathspec/pathspec.py
def from_lines(cls, pattern_factory, lines): """ Compiles the pattern lines. *pattern_factory* can be either the name of a registered pattern factory (:class:`str`), or a :class:`~collections.abc.Callable` used to compile patterns. It must accept an uncompiled pattern (:class:`str`) and return the compiled...
def from_lines(cls, pattern_factory, lines): """ Compiles the pattern lines. *pattern_factory* can be either the name of a registered pattern factory (:class:`str`), or a :class:`~collections.abc.Callable` used to compile patterns. It must accept an uncompiled pattern (:class:`str`) and return the compiled...
[ "Compiles", "the", "pattern", "lines", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/pathspec.py#L50-L75
[ "def", "from_lines", "(", "cls", ",", "pattern_factory", ",", "lines", ")", ":", "if", "isinstance", "(", "pattern_factory", ",", "string_types", ")", ":", "pattern_factory", "=", "util", ".", "lookup_pattern", "(", "pattern_factory", ")", "if", "not", "callab...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
PathSpec.match_file
Matches the file to this path-spec. *file* (:class:`str`) is the file path to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`) optionally contains the path separators to normalize. See :func:`~pathspec.util.normalize_file` for ...
pathspec/pathspec.py
def match_file(self, file, separators=None): """ Matches the file to this path-spec. *file* (:class:`str`) is the file path to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`) optionally contains the path separators to normal...
def match_file(self, file, separators=None): """ Matches the file to this path-spec. *file* (:class:`str`) is the file path to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`) optionally contains the path separators to normal...
[ "Matches", "the", "file", "to", "this", "path", "-", "spec", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/pathspec.py#L77-L91
[ "def", "match_file", "(", "self", ",", "file", ",", "separators", "=", "None", ")", ":", "norm_file", "=", "util", ".", "normalize_file", "(", "file", ",", "separators", "=", "separators", ")", "return", "util", ".", "match_file", "(", "self", ".", "patt...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
PathSpec.match_files
Matches the files to this path-spec. *files* (:class:`~collections.abc.Iterable` of :class:`str`) contains the file paths to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`; or :data:`None`) optionally contains the path separat...
pathspec/pathspec.py
def match_files(self, files, separators=None): """ Matches the files to this path-spec. *files* (:class:`~collections.abc.Iterable` of :class:`str`) contains the file paths to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`; ...
def match_files(self, files, separators=None): """ Matches the files to this path-spec. *files* (:class:`~collections.abc.Iterable` of :class:`str`) contains the file paths to be matched against :attr:`self.patterns <PathSpec.patterns>`. *separators* (:class:`~collections.abc.Collection` of :class:`str`; ...
[ "Matches", "the", "files", "to", "this", "path", "-", "spec", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/pathspec.py#L93-L115
[ "def", "match_files", "(", "self", ",", "files", ",", "separators", "=", "None", ")", ":", "if", "isinstance", "(", "files", ",", "(", "bytes", ",", "unicode", ")", ")", ":", "raise", "TypeError", "(", "\"files:{!r} is not an iterable.\"", ".", "format", "...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
PathSpec.match_tree
Walks the specified root path for all files and matches them to this path-spec. *root* (:class:`str`) is the root directory to search for files. *on_error* (:class:`~collections.abc.Callable` or :data:`None`) optionally is the error handler for file-system exceptions. See :func:`~pathspec.util.iter_tree` fo...
pathspec/pathspec.py
def match_tree(self, root, on_error=None, follow_links=None): """ Walks the specified root path for all files and matches them to this path-spec. *root* (:class:`str`) is the root directory to search for files. *on_error* (:class:`~collections.abc.Callable` or :data:`None`) optionally is the error handler...
def match_tree(self, root, on_error=None, follow_links=None): """ Walks the specified root path for all files and matches them to this path-spec. *root* (:class:`str`) is the root directory to search for files. *on_error* (:class:`~collections.abc.Callable` or :data:`None`) optionally is the error handler...
[ "Walks", "the", "specified", "root", "path", "for", "all", "files", "and", "matches", "them", "to", "this", "path", "-", "spec", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/pathspec.py#L117-L137
[ "def", "match_tree", "(", "self", ",", "root", ",", "on_error", "=", "None", ",", "follow_links", "=", "None", ")", ":", "files", "=", "util", ".", "iter_tree", "(", "root", ",", "on_error", "=", "on_error", ",", "follow_links", "=", "follow_links", ")",...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
GitWildMatchPattern.pattern_to_regex
Convert the pattern into a regular expression. *pattern* (:class:`unicode` or :class:`bytes`) is the pattern to convert into a regular expression. Returns the uncompiled regular expression (:class:`unicode`, :class:`bytes`, or :data:`None`), and whether matched files should be included (:data:`True`), exclu...
pathspec/patterns/gitwildmatch.py
def pattern_to_regex(cls, pattern): """ Convert the pattern into a regular expression. *pattern* (:class:`unicode` or :class:`bytes`) is the pattern to convert into a regular expression. Returns the uncompiled regular expression (:class:`unicode`, :class:`bytes`, or :data:`None`), and whether matched file...
def pattern_to_regex(cls, pattern): """ Convert the pattern into a regular expression. *pattern* (:class:`unicode` or :class:`bytes`) is the pattern to convert into a regular expression. Returns the uncompiled regular expression (:class:`unicode`, :class:`bytes`, or :data:`None`), and whether matched file...
[ "Convert", "the", "pattern", "into", "a", "regular", "expression", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/patterns/gitwildmatch.py#L30-L174
[ "def", "pattern_to_regex", "(", "cls", ",", "pattern", ")", ":", "if", "isinstance", "(", "pattern", ",", "unicode", ")", ":", "return_type", "=", "unicode", "elif", "isinstance", "(", "pattern", ",", "bytes", ")", ":", "return_type", "=", "bytes", "patter...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
GitWildMatchPattern._translate_segment_glob
Translates the glob pattern to a regular expression. This is used in the constructor to translate a path segment glob pattern to its corresponding regular expression. *pattern* (:class:`str`) is the glob pattern. Returns the regular expression (:class:`str`).
pathspec/patterns/gitwildmatch.py
def _translate_segment_glob(pattern): """ Translates the glob pattern to a regular expression. This is used in the constructor to translate a path segment glob pattern to its corresponding regular expression. *pattern* (:class:`str`) is the glob pattern. Returns the regular expression (:class:`str`). ""...
def _translate_segment_glob(pattern): """ Translates the glob pattern to a regular expression. This is used in the constructor to translate a path segment glob pattern to its corresponding regular expression. *pattern* (:class:`str`) is the glob pattern. Returns the regular expression (:class:`str`). ""...
[ "Translates", "the", "glob", "pattern", "to", "a", "regular", "expression", ".", "This", "is", "used", "in", "the", "constructor", "to", "translate", "a", "path", "segment", "glob", "pattern", "to", "its", "corresponding", "regular", "expression", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/patterns/gitwildmatch.py#L177-L280
[ "def", "_translate_segment_glob", "(", "pattern", ")", ":", "# NOTE: This is derived from `fnmatch.translate()` and is similar to", "# the POSIX function `fnmatch()` with the `FNM_PATHNAME` flag set.", "escape", "=", "False", "regex", "=", "''", "i", ",", "end", "=", "0", ",", ...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017
train
GitIgnorePattern.pattern_to_regex
Warn about deprecation.
pathspec/patterns/gitwildmatch.py
def pattern_to_regex(cls, *args, **kw): """ Warn about deprecation. """ cls._deprecated() return super(GitIgnorePattern, cls).pattern_to_regex(*args, **kw)
def pattern_to_regex(cls, *args, **kw): """ Warn about deprecation. """ cls._deprecated() return super(GitIgnorePattern, cls).pattern_to_regex(*args, **kw)
[ "Warn", "about", "deprecation", "." ]
cpburnz/python-path-specification
python
https://github.com/cpburnz/python-path-specification/blob/6fc7567a58cb68ec7d72cc287e7fb97dbe22c017/pathspec/patterns/gitwildmatch.py#L306-L311
[ "def", "pattern_to_regex", "(", "cls", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "cls", ".", "_deprecated", "(", ")", "return", "super", "(", "GitIgnorePattern", ",", "cls", ")", ".", "pattern_to_regex", "(", "*", "args", ",", "*", "*", "kw", ...
6fc7567a58cb68ec7d72cc287e7fb97dbe22c017