repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
crackinglandia/pype32 | pype32/utils.py | ReadData.readString | def readString(self):
"""
Reads an ASCII string from the L{ReadData} stream object.
@rtype: str
@return: An ASCII string read form the stream.
"""
resultStr = ""
while self.data[self.offset] != "\x00":
resultStr += self.data[self.offset]
... | python | def readString(self):
"""
Reads an ASCII string from the L{ReadData} stream object.
@rtype: str
@return: An ASCII string read form the stream.
"""
resultStr = ""
while self.data[self.offset] != "\x00":
resultStr += self.data[self.offset]
... | [
"def",
"readString",
"(",
"self",
")",
":",
"resultStr",
"=",
"\"\"",
"while",
"self",
".",
"data",
"[",
"self",
".",
"offset",
"]",
"!=",
"\"\\x00\"",
":",
"resultStr",
"+=",
"self",
".",
"data",
"[",
"self",
".",
"offset",
"]",
"self",
".",
"offset... | Reads an ASCII string from the L{ReadData} stream object.
@rtype: str
@return: An ASCII string read form the stream. | [
"Reads",
"an",
"ASCII",
"string",
"from",
"the",
"L",
"{",
"ReadData",
"}",
"stream",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L253-L264 | train |
crackinglandia/pype32 | pype32/utils.py | ReadData.readAlignedString | def readAlignedString(self, align = 4):
"""
Reads an ASCII string aligned to the next align-bytes boundary.
@type align: int
@param align: (Optional) The value we want the ASCII string to be aligned.
@rtype: str
@return: A 4-bytes aligned (default) ASCI... | python | def readAlignedString(self, align = 4):
"""
Reads an ASCII string aligned to the next align-bytes boundary.
@type align: int
@param align: (Optional) The value we want the ASCII string to be aligned.
@rtype: str
@return: A 4-bytes aligned (default) ASCI... | [
"def",
"readAlignedString",
"(",
"self",
",",
"align",
"=",
"4",
")",
":",
"s",
"=",
"self",
".",
"readString",
"(",
")",
"r",
"=",
"align",
"-",
"len",
"(",
"s",
")",
"%",
"align",
"while",
"r",
":",
"s",
"+=",
"self",
".",
"data",
"[",
"self"... | Reads an ASCII string aligned to the next align-bytes boundary.
@type align: int
@param align: (Optional) The value we want the ASCII string to be aligned.
@rtype: str
@return: A 4-bytes aligned (default) ASCII string. | [
"Reads",
"an",
"ASCII",
"string",
"aligned",
"to",
"the",
"next",
"align",
"-",
"bytes",
"boundary",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L266-L282 | train |
crackinglandia/pype32 | pype32/utils.py | ReadData.read | def read(self, nroBytes):
"""
Reads data from the L{ReadData} stream object.
@type nroBytes: int
@param nroBytes: The number of bytes to read.
@rtype: str
@return: A string containing the read data from the L{ReadData} stream object.
@ra... | python | def read(self, nroBytes):
"""
Reads data from the L{ReadData} stream object.
@type nroBytes: int
@param nroBytes: The number of bytes to read.
@rtype: str
@return: A string containing the read data from the L{ReadData} stream object.
@ra... | [
"def",
"read",
"(",
"self",
",",
"nroBytes",
")",
":",
"if",
"nroBytes",
">",
"self",
".",
"length",
"-",
"self",
".",
"offset",
":",
"if",
"self",
".",
"log",
":",
"print",
"\"Warning: Trying to read: %d bytes - only %d bytes left\"",
"%",
"(",
"nroBytes",
... | Reads data from the L{ReadData} stream object.
@type nroBytes: int
@param nroBytes: The number of bytes to read.
@rtype: str
@return: A string containing the read data from the L{ReadData} stream object.
@raise DataLengthException: The number of bytes t... | [
"Reads",
"data",
"from",
"the",
"L",
"{",
"ReadData",
"}",
"stream",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L284-L303 | train |
crackinglandia/pype32 | pype32/utils.py | ReadData.readAt | def readAt(self, offset, size):
"""
Reads as many bytes indicated in the size parameter at the specific offset.
@type offset: int
@param offset: Offset of the value to be read.
@type size: int
@param size: This parameter indicates how many bytes are going to be read fro... | python | def readAt(self, offset, size):
"""
Reads as many bytes indicated in the size parameter at the specific offset.
@type offset: int
@param offset: Offset of the value to be read.
@type size: int
@param size: This parameter indicates how many bytes are going to be read fro... | [
"def",
"readAt",
"(",
"self",
",",
"offset",
",",
"size",
")",
":",
"if",
"offset",
">",
"self",
".",
"length",
":",
"if",
"self",
".",
"log",
":",
"print",
"\"Warning: Trying to read: %d bytes - only %d bytes left\"",
"%",
"(",
"nroBytes",
",",
"self",
".",... | Reads as many bytes indicated in the size parameter at the specific offset.
@type offset: int
@param offset: Offset of the value to be read.
@type size: int
@param size: This parameter indicates how many bytes are going to be read from a given offset.
@rtype: str
@retu... | [
"Reads",
"as",
"many",
"bytes",
"indicated",
"in",
"the",
"size",
"parameter",
"at",
"the",
"specific",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L327-L348 | train |
ymyzk/kawasemi | kawasemi/kawasemi.py | Kawasemi.send | def send(self, message, channel_name=None, fail_silently=False,
options=None):
# type: (Text, Optional[str], bool, Optional[SendOptions]) -> None
"""Send a notification to channels
:param message: A message
"""
if channel_name is None:
channels = self.se... | python | def send(self, message, channel_name=None, fail_silently=False,
options=None):
# type: (Text, Optional[str], bool, Optional[SendOptions]) -> None
"""Send a notification to channels
:param message: A message
"""
if channel_name is None:
channels = self.se... | [
"def",
"send",
"(",
"self",
",",
"message",
",",
"channel_name",
"=",
"None",
",",
"fail_silently",
"=",
"False",
",",
"options",
"=",
"None",
")",
":",
"# type: (Text, Optional[str], bool, Optional[SendOptions]) -> None",
"if",
"channel_name",
"is",
"None",
":",
... | Send a notification to channels
:param message: A message | [
"Send",
"a",
"notification",
"to",
"channels"
] | a9f62f38ee7c10bf4cd353285db1f477d3d372d1 | https://github.com/ymyzk/kawasemi/blob/a9f62f38ee7c10bf4cd353285db1f477d3d372d1/kawasemi/kawasemi.py#L35-L61 | train |
Blazemeter/apiritif | apiritif/http.py | HTTPTarget.request | def request(self, method, path,
params=None, headers=None, cookies=None, data=None, json=None, allow_redirects=None, timeout=None):
"""
Prepares and sends an HTTP request. Returns the HTTPResponse object.
:param method: str
:param path: str
:return: response
... | python | def request(self, method, path,
params=None, headers=None, cookies=None, data=None, json=None, allow_redirects=None, timeout=None):
"""
Prepares and sends an HTTP request. Returns the HTTPResponse object.
:param method: str
:param path: str
:return: response
... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"path",
",",
"params",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"cookies",
"=",
"None",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"allow_redirects",
"=",
"None",
",",
"timeout",
... | Prepares and sends an HTTP request. Returns the HTTPResponse object.
:param method: str
:param path: str
:return: response
:rtype: HTTPResponse | [
"Prepares",
"and",
"sends",
"an",
"HTTP",
"request",
".",
"Returns",
"the",
"HTTPResponse",
"object",
"."
] | 27b48a68425949998c2254e5e1e0226882d9eee8 | https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/http.py#L392-L421 | train |
zsethna/OLGA | olga/load_model.py | load_genomic_CDR3_anchor_pos_and_functionality | def load_genomic_CDR3_anchor_pos_and_functionality(anchor_pos_file_name):
"""Read anchor position and functionality from file.
Parameters
----------
anchor_pos_file_name : str
File name for the functionality and position of a conserved residue
that defines the CDR3 region for each V or... | python | def load_genomic_CDR3_anchor_pos_and_functionality(anchor_pos_file_name):
"""Read anchor position and functionality from file.
Parameters
----------
anchor_pos_file_name : str
File name for the functionality and position of a conserved residue
that defines the CDR3 region for each V or... | [
"def",
"load_genomic_CDR3_anchor_pos_and_functionality",
"(",
"anchor_pos_file_name",
")",
":",
"anchor_pos_and_functionality",
"=",
"{",
"}",
"anchor_pos_file",
"=",
"open",
"(",
"anchor_pos_file_name",
",",
"'r'",
")",
"first_line",
"=",
"True",
"for",
"line",
"in",
... | Read anchor position and functionality from file.
Parameters
----------
anchor_pos_file_name : str
File name for the functionality and position of a conserved residue
that defines the CDR3 region for each V or J germline sequence.
Returns
-------
anchor_pos_and_functio... | [
"Read",
"anchor",
"position",
"and",
"functionality",
"from",
"file",
"."
] | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L468-L497 | train |
zsethna/OLGA | olga/load_model.py | read_igor_V_gene_parameters | def read_igor_V_gene_parameters(params_file_name):
"""Load raw genV from file.
genV is a list of genomic V information. Each element is a list of three
elements. The first is the name of the V allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the ... | python | def read_igor_V_gene_parameters(params_file_name):
"""Load raw genV from file.
genV is a list of genomic V information. Each element is a list of three
elements. The first is the name of the V allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the ... | [
"def",
"read_igor_V_gene_parameters",
"(",
"params_file_name",
")",
":",
"params_file",
"=",
"open",
"(",
"params_file_name",
",",
"'r'",
")",
"V_gene_info",
"=",
"{",
"}",
"in_V_gene_sec",
"=",
"False",
"for",
"line",
"in",
"params_file",
":",
"if",
"line",
"... | Load raw genV from file.
genV is a list of genomic V information. Each element is a list of three
elements. The first is the name of the V allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the last
is the full germline sequence. For this 'raw gen... | [
"Load",
"raw",
"genV",
"from",
"file",
".",
"genV",
"is",
"a",
"list",
"of",
"genomic",
"V",
"information",
".",
"Each",
"element",
"is",
"a",
"list",
"of",
"three",
"elements",
".",
"The",
"first",
"is",
"the",
"name",
"of",
"the",
"V",
"allele",
"t... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L499-L540 | train |
zsethna/OLGA | olga/load_model.py | read_igor_D_gene_parameters | def read_igor_D_gene_parameters(params_file_name):
"""Load genD from file.
genD is a list of genomic D information. Each element is a list of the name
of the D allele and the germline sequence.
Parameters
----------
params_file_name : str
File name for a IGOR parameter file.
R... | python | def read_igor_D_gene_parameters(params_file_name):
"""Load genD from file.
genD is a list of genomic D information. Each element is a list of the name
of the D allele and the germline sequence.
Parameters
----------
params_file_name : str
File name for a IGOR parameter file.
R... | [
"def",
"read_igor_D_gene_parameters",
"(",
"params_file_name",
")",
":",
"params_file",
"=",
"open",
"(",
"params_file_name",
",",
"'r'",
")",
"D_gene_info",
"=",
"{",
"}",
"in_D_gene_sec",
"=",
"False",
"for",
"line",
"in",
"params_file",
":",
"if",
"line",
"... | Load genD from file.
genD is a list of genomic D information. Each element is a list of the name
of the D allele and the germline sequence.
Parameters
----------
params_file_name : str
File name for a IGOR parameter file.
Returns
-------
genD : list
List of genomic... | [
"Load",
"genD",
"from",
"file",
".",
"genD",
"is",
"a",
"list",
"of",
"genomic",
"D",
"information",
".",
"Each",
"element",
"is",
"a",
"list",
"of",
"the",
"name",
"of",
"the",
"D",
"allele",
"and",
"the",
"germline",
"sequence",
"."
] | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L542-L580 | train |
zsethna/OLGA | olga/load_model.py | read_igor_J_gene_parameters | def read_igor_J_gene_parameters(params_file_name):
"""Load raw genJ from file.
genJ is a list of genomic J information. Each element is a list of three
elements. The first is the name of the J allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the ... | python | def read_igor_J_gene_parameters(params_file_name):
"""Load raw genJ from file.
genJ is a list of genomic J information. Each element is a list of three
elements. The first is the name of the J allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the ... | [
"def",
"read_igor_J_gene_parameters",
"(",
"params_file_name",
")",
":",
"params_file",
"=",
"open",
"(",
"params_file_name",
",",
"'r'",
")",
"J_gene_info",
"=",
"{",
"}",
"in_J_gene_sec",
"=",
"False",
"for",
"line",
"in",
"params_file",
":",
"if",
"line",
"... | Load raw genJ from file.
genJ is a list of genomic J information. Each element is a list of three
elements. The first is the name of the J allele, the second is the genomic
sequence trimmed to the CDR3 region for productive sequences, and the last
is the full germline sequence. For this 'raw gen... | [
"Load",
"raw",
"genJ",
"from",
"file",
".",
"genJ",
"is",
"a",
"list",
"of",
"genomic",
"J",
"information",
".",
"Each",
"element",
"is",
"a",
"list",
"of",
"three",
"elements",
".",
"The",
"first",
"is",
"the",
"name",
"of",
"the",
"J",
"allele",
"t... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L582-L623 | train |
zsethna/OLGA | olga/load_model.py | read_igor_marginals_txt | def read_igor_marginals_txt(marginals_file_name , dim_names=False):
"""Load raw IGoR model marginals.
Parameters
----------
marginals_file_name : str
File name for a IGOR model marginals file.
Returns
-------
model_dict : dict
Dictionary with model marginals.
dimens... | python | def read_igor_marginals_txt(marginals_file_name , dim_names=False):
"""Load raw IGoR model marginals.
Parameters
----------
marginals_file_name : str
File name for a IGOR model marginals file.
Returns
-------
model_dict : dict
Dictionary with model marginals.
dimens... | [
"def",
"read_igor_marginals_txt",
"(",
"marginals_file_name",
",",
"dim_names",
"=",
"False",
")",
":",
"with",
"open",
"(",
"marginals_file_name",
",",
"'r'",
")",
"as",
"file",
":",
"#Model parameters are stored inside a dictionary of ndarrays",
"model_dict",
"=",
"{"... | Load raw IGoR model marginals.
Parameters
----------
marginals_file_name : str
File name for a IGOR model marginals file.
Returns
-------
model_dict : dict
Dictionary with model marginals.
dimension_names_dict : dict
Dictionary that defines IGoR model dependecie... | [
"Load",
"raw",
"IGoR",
"model",
"marginals",
".",
"Parameters",
"----------",
"marginals_file_name",
":",
"str",
"File",
"name",
"for",
"a",
"IGOR",
"model",
"marginals",
"file",
"."
] | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L790-L892 | train |
zsethna/OLGA | olga/load_model.py | GenomicData.anchor_and_curate_genV_and_genJ | def anchor_and_curate_genV_and_genJ(self, V_anchor_pos_file, J_anchor_pos_file):
"""Trim V and J germline sequences to the CDR3 region.
Unproductive sequences have an empty string '' for the CDR3 region
sequence.
Edits the attributes genV and genJ
Param... | python | def anchor_and_curate_genV_and_genJ(self, V_anchor_pos_file, J_anchor_pos_file):
"""Trim V and J germline sequences to the CDR3 region.
Unproductive sequences have an empty string '' for the CDR3 region
sequence.
Edits the attributes genV and genJ
Param... | [
"def",
"anchor_and_curate_genV_and_genJ",
"(",
"self",
",",
"V_anchor_pos_file",
",",
"J_anchor_pos_file",
")",
":",
"V_anchor_pos",
"=",
"load_genomic_CDR3_anchor_pos_and_functionality",
"(",
"V_anchor_pos_file",
")",
"J_anchor_pos",
"=",
"load_genomic_CDR3_anchor_pos_and_functi... | Trim V and J germline sequences to the CDR3 region.
Unproductive sequences have an empty string '' for the CDR3 region
sequence.
Edits the attributes genV and genJ
Parameters
----------
V_anchor_pos_file_name : str
File name for the ... | [
"Trim",
"V",
"and",
"J",
"germline",
"sequences",
"to",
"the",
"CDR3",
"region",
".",
"Unproductive",
"sequences",
"have",
"an",
"empty",
"string",
"for",
"the",
"CDR3",
"region",
"sequence",
".",
"Edits",
"the",
"attributes",
"genV",
"and",
"genJ",
"Paramet... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L129-L167 | train |
zsethna/OLGA | olga/load_model.py | GenomicData.generate_cutV_genomic_CDR3_segs | def generate_cutV_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete from a segment.
... | python | def generate_cutV_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete from a segment.
... | [
"def",
"generate_cutV_genomic_CDR3_segs",
"(",
"self",
")",
":",
"max_palindrome",
"=",
"self",
".",
"max_delV_palindrome",
"self",
".",
"cutV_genomic_CDR3_segs",
"=",
"[",
"]",
"for",
"CDR3_V_seg",
"in",
"[",
"x",
"[",
"1",
"]",
"for",
"x",
"in",
"self",
".... | Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline V segments so that delV can index directly for number of
nucleotides to delete from a segment.
Sets the attribute cutV_genomic_CDR3_se... | [
"Add",
"palindromic",
"inserted",
"nucleotides",
"to",
"germline",
"V",
"sequences",
".",
"The",
"maximum",
"number",
"of",
"palindromic",
"insertions",
"are",
"appended",
"to",
"the",
"germline",
"V",
"segments",
"so",
"that",
"delV",
"can",
"index",
"directly"... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L169-L187 | train |
zsethna/OLGA | olga/load_model.py | GenomicData.generate_cutJ_genomic_CDR3_segs | def generate_cutJ_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline J sequences.
The maximum number of palindromic insertions are appended to the
germline J segments so that delJ can index directly for number of
nucleotides to delete from a segment.
... | python | def generate_cutJ_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline J sequences.
The maximum number of palindromic insertions are appended to the
germline J segments so that delJ can index directly for number of
nucleotides to delete from a segment.
... | [
"def",
"generate_cutJ_genomic_CDR3_segs",
"(",
"self",
")",
":",
"max_palindrome",
"=",
"self",
".",
"max_delJ_palindrome",
"self",
".",
"cutJ_genomic_CDR3_segs",
"=",
"[",
"]",
"for",
"CDR3_J_seg",
"in",
"[",
"x",
"[",
"1",
"]",
"for",
"x",
"in",
"self",
".... | Add palindromic inserted nucleotides to germline J sequences.
The maximum number of palindromic insertions are appended to the
germline J segments so that delJ can index directly for number of
nucleotides to delete from a segment.
Sets the attribute cutJ_genomic_CDR3_se... | [
"Add",
"palindromic",
"inserted",
"nucleotides",
"to",
"germline",
"J",
"sequences",
".",
"The",
"maximum",
"number",
"of",
"palindromic",
"insertions",
"are",
"appended",
"to",
"the",
"germline",
"J",
"segments",
"so",
"that",
"delJ",
"can",
"index",
"directly"... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L189-L206 | train |
zsethna/OLGA | olga/load_model.py | GenomicDataVDJ.load_igor_genomic_data | def load_igor_genomic_data(self, params_file_name, V_anchor_pos_file, J_anchor_pos_file):
"""Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, max_delV_palindrome, cutV_genomic_CDR3_segs,
genD, max_delDl_palindrome, max_delDr_palindrome,
... | python | def load_igor_genomic_data(self, params_file_name, V_anchor_pos_file, J_anchor_pos_file):
"""Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, max_delV_palindrome, cutV_genomic_CDR3_segs,
genD, max_delDl_palindrome, max_delDr_palindrome,
... | [
"def",
"load_igor_genomic_data",
"(",
"self",
",",
"params_file_name",
",",
"V_anchor_pos_file",
",",
"J_anchor_pos_file",
")",
":",
"self",
".",
"genV",
"=",
"read_igor_V_gene_parameters",
"(",
"params_file_name",
")",
"self",
".",
"genD",
"=",
"read_igor_D_gene_para... | Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, max_delV_palindrome, cutV_genomic_CDR3_segs,
genD, max_delDl_palindrome, max_delDr_palindrome,
cutD_genomic_CDR3_segs, genJ, max_delJ_palindrome, and
cutJ_genomic_CDR3_segs.
... | [
"Set",
"attributes",
"by",
"loading",
"in",
"genomic",
"data",
"from",
"IGoR",
"parameter",
"file",
".",
"Sets",
"attributes",
"genV",
"max_delV_palindrome",
"cutV_genomic_CDR3_segs",
"genD",
"max_delDl_palindrome",
"max_delDr_palindrome",
"cutD_genomic_CDR3_segs",
"genJ",
... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L258-L289 | train |
zsethna/OLGA | olga/load_model.py | GenomicDataVDJ.generate_cutD_genomic_CDR3_segs | def generate_cutD_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline D segments so that delDl and delDr can index directly for number
of nucleotides to delete from a... | python | def generate_cutD_genomic_CDR3_segs(self):
"""Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline D segments so that delDl and delDr can index directly for number
of nucleotides to delete from a... | [
"def",
"generate_cutD_genomic_CDR3_segs",
"(",
"self",
")",
":",
"max_palindrome_L",
"=",
"self",
".",
"max_delDl_palindrome",
"max_palindrome_R",
"=",
"self",
".",
"max_delDr_palindrome",
"self",
".",
"cutD_genomic_CDR3_segs",
"=",
"[",
"]",
"for",
"CDR3_D_seg",
"in"... | Add palindromic inserted nucleotides to germline V sequences.
The maximum number of palindromic insertions are appended to the
germline D segments so that delDl and delDr can index directly for number
of nucleotides to delete from a segment.
Sets the attribute cutV_gen... | [
"Add",
"palindromic",
"inserted",
"nucleotides",
"to",
"germline",
"V",
"sequences",
".",
"The",
"maximum",
"number",
"of",
"palindromic",
"insertions",
"are",
"appended",
"to",
"the",
"germline",
"D",
"segments",
"so",
"that",
"delDl",
"and",
"delDr",
"can",
... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L291-L309 | train |
zsethna/OLGA | olga/load_model.py | GenomicDataVDJ.read_VDJ_palindrome_parameters | def read_VDJ_palindrome_parameters(self, params_file_name):
"""Read V, D, and J palindrome parameters from file.
Sets the attributes max_delV_palindrome, max_delDl_palindrome,
max_delDr_palindrome, and max_delJ_palindrome.
Parameters
----------
params_file_n... | python | def read_VDJ_palindrome_parameters(self, params_file_name):
"""Read V, D, and J palindrome parameters from file.
Sets the attributes max_delV_palindrome, max_delDl_palindrome,
max_delDr_palindrome, and max_delJ_palindrome.
Parameters
----------
params_file_n... | [
"def",
"read_VDJ_palindrome_parameters",
"(",
"self",
",",
"params_file_name",
")",
":",
"params_file",
"=",
"open",
"(",
"params_file_name",
",",
"'r'",
")",
"in_delV",
"=",
"False",
"in_delDl",
"=",
"False",
"in_delDr",
"=",
"False",
"in_delJ",
"=",
"False",
... | Read V, D, and J palindrome parameters from file.
Sets the attributes max_delV_palindrome, max_delDl_palindrome,
max_delDr_palindrome, and max_delJ_palindrome.
Parameters
----------
params_file_name : str
File name for an IGoR parameter file of a VDJ gen... | [
"Read",
"V",
"D",
"and",
"J",
"palindrome",
"parameters",
"from",
"file",
".",
"Sets",
"the",
"attributes",
"max_delV_palindrome",
"max_delDl_palindrome",
"max_delDr_palindrome",
"and",
"max_delJ_palindrome",
".",
"Parameters",
"----------",
"params_file_name",
":",
"st... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L311-L368 | train |
zsethna/OLGA | olga/load_model.py | GenomicDataVJ.load_igor_genomic_data | def load_igor_genomic_data(self, params_file_name, V_anchor_pos_file, J_anchor_pos_file):
"""Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, genJ, max_delV_palindrome, max_delJ_palindrome,
cutV_genomic_CDR3_segs, and cutJ_genomic_CDR3_segs.
... | python | def load_igor_genomic_data(self, params_file_name, V_anchor_pos_file, J_anchor_pos_file):
"""Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, genJ, max_delV_palindrome, max_delJ_palindrome,
cutV_genomic_CDR3_segs, and cutJ_genomic_CDR3_segs.
... | [
"def",
"load_igor_genomic_data",
"(",
"self",
",",
"params_file_name",
",",
"V_anchor_pos_file",
",",
"J_anchor_pos_file",
")",
":",
"self",
".",
"genV",
"=",
"read_igor_V_gene_parameters",
"(",
"params_file_name",
")",
"self",
".",
"genJ",
"=",
"read_igor_J_gene_para... | Set attributes by loading in genomic data from IGoR parameter file.
Sets attributes genV, genJ, max_delV_palindrome, max_delJ_palindrome,
cutV_genomic_CDR3_segs, and cutJ_genomic_CDR3_segs.
Parameters
----------
params_file_name : str
File name for a... | [
"Set",
"attributes",
"by",
"loading",
"in",
"genomic",
"data",
"from",
"IGoR",
"parameter",
"file",
".",
"Sets",
"attributes",
"genV",
"genJ",
"max_delV_palindrome",
"max_delJ_palindrome",
"cutV_genomic_CDR3_segs",
"and",
"cutJ_genomic_CDR3_segs",
".",
"Parameters",
"--... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L401-L428 | train |
zsethna/OLGA | olga/load_model.py | GenomicDataVJ.read_igor_VJ_palindrome_parameters | def read_igor_VJ_palindrome_parameters(self, params_file_name):
"""Read V and J palindrome parameters from file.
Sets the attributes max_delV_palindrome and max_delJ_palindrome.
Parameters
----------
params_file_name : str
File name for an IGoR parameter... | python | def read_igor_VJ_palindrome_parameters(self, params_file_name):
"""Read V and J palindrome parameters from file.
Sets the attributes max_delV_palindrome and max_delJ_palindrome.
Parameters
----------
params_file_name : str
File name for an IGoR parameter... | [
"def",
"read_igor_VJ_palindrome_parameters",
"(",
"self",
",",
"params_file_name",
")",
":",
"params_file",
"=",
"open",
"(",
"params_file_name",
",",
"'r'",
")",
"in_delV",
"=",
"False",
"in_delJ",
"=",
"False",
"for",
"line",
"in",
"params_file",
":",
"if",
... | Read V and J palindrome parameters from file.
Sets the attributes max_delV_palindrome and max_delJ_palindrome.
Parameters
----------
params_file_name : str
File name for an IGoR parameter file of a VJ generative model. | [
"Read",
"V",
"and",
"J",
"palindrome",
"parameters",
"from",
"file",
".",
"Sets",
"the",
"attributes",
"max_delV_palindrome",
"and",
"max_delJ_palindrome",
".",
"Parameters",
"----------",
"params_file_name",
":",
"str",
"File",
"name",
"for",
"an",
"IGoR",
"param... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L431-L464 | train |
zsethna/OLGA | olga/load_model.py | GenerativeModelVDJ.load_and_process_igor_model | def load_and_process_igor_model(self, marginals_file_name):
"""Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J,
PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj.
Parameters
----------
... | python | def load_and_process_igor_model(self, marginals_file_name):
"""Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J,
PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj.
Parameters
----------
... | [
"def",
"load_and_process_igor_model",
"(",
"self",
",",
"marginals_file_name",
")",
":",
"raw_model",
"=",
"read_igor_marginals_txt",
"(",
"marginals_file_name",
")",
"self",
".",
"PV",
"=",
"raw_model",
"[",
"0",
"]",
"[",
"'v_choice'",
"]",
"self",
".",
"PinsV... | Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J,
PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj.
Parameters
----------
marginals_file_name : str
File name for a IGoR mode... | [
"Set",
"attributes",
"by",
"reading",
"a",
"generative",
"model",
"from",
"IGoR",
"marginal",
"file",
".",
"Sets",
"attributes",
"PV",
"PdelV_given_V",
"PDJ",
"PdelJ_given_J",
"PdelDldelDr_given_D",
"PinsVD",
"PinsDJ",
"Rvd",
"and",
"Rdj",
".",
"Parameters",
"----... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L681-L731 | train |
zsethna/OLGA | olga/load_model.py | GenerativeModelVJ.load_and_process_igor_model | def load_and_process_igor_model(self, marginals_file_name):
"""Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PVJ, PdelV_given_V, PdelJ_given_J, PinsVJ, and Rvj.
Parameters
----------
marginals_file_name : str
F... | python | def load_and_process_igor_model(self, marginals_file_name):
"""Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PVJ, PdelV_given_V, PdelJ_given_J, PinsVJ, and Rvj.
Parameters
----------
marginals_file_name : str
F... | [
"def",
"load_and_process_igor_model",
"(",
"self",
",",
"marginals_file_name",
")",
":",
"raw_model",
"=",
"read_igor_marginals_txt",
"(",
"marginals_file_name",
")",
"self",
".",
"PinsVJ",
"=",
"raw_model",
"[",
"0",
"]",
"[",
"'vj_ins'",
"]",
"self",
".",
"Pde... | Set attributes by reading a generative model from IGoR marginal file.
Sets attributes PVJ, PdelV_given_V, PdelJ_given_J, PinsVJ, and Rvj.
Parameters
----------
marginals_file_name : str
File name for a IGoR model marginals file. | [
"Set",
"attributes",
"by",
"reading",
"a",
"generative",
"model",
"from",
"IGoR",
"marginal",
"file",
".",
"Sets",
"attributes",
"PVJ",
"PdelV_given_V",
"PdelJ_given_J",
"PinsVJ",
"and",
"Rvj",
".",
"Parameters",
"----------",
"marginals_file_name",
":",
"str",
"F... | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L768-L787 | train |
crackinglandia/pype32 | pype32/directories.py | ImageBoundForwarderRefEntry.parse | def parse(readDataInstance):
"""
Returns a new L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRefEntry} object.
@rtype: L... | python | def parse(readDataInstance):
"""
Returns a new L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRefEntry} object.
@rtype: L... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"boundForwarderEntry",
"=",
"ImageBoundForwarderRefEntry",
"(",
")",
"boundForwarderEntry",
".",
"timeDateStamp",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"boundForwarderEntry",
".",
"offsetM... | Returns a new L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRefEntry} object.
@rtype: L{ImageBoundForwarderRefEntry}
@return: A ... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageBoundForwarderRefEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L75-L89 | train |
crackinglandia/pype32 | pype32/directories.py | ImageBoundForwarderRef.parse | def parse(readDataInstance, numberOfEntries):
"""
Returns a L{ImageBoundForwarderRef} array where every element is a L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate ... | python | def parse(readDataInstance, numberOfEntries):
"""
Returns a L{ImageBoundForwarderRef} array where every element is a L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate ... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"numberOfEntries",
")",
":",
"imageBoundForwarderRefsList",
"=",
"ImageBoundForwarderRef",
"(",
")",
"dLength",
"=",
"len",
"(",
"readDataInstance",
")",
"entryLength",
"=",
"ImageBoundForwarderRefEntry",
"(",
")",
".",
... | Returns a L{ImageBoundForwarderRef} array where every element is a L{ImageBoundForwarderRefEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRef} object.
@type numb... | [
"Returns",
"a",
"L",
"{",
"ImageBoundForwarderRef",
"}",
"array",
"where",
"every",
"element",
"is",
"a",
"L",
"{",
"ImageBoundForwarderRefEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L107-L135 | train |
crackinglandia/pype32 | pype32/directories.py | ImageBoundImportDescriptor.parse | def parse(readDataInstance):
"""
Returns a new L{ImageBoundImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing the data to create a new L{ImageBoundImportDescriptor} object.
@rtype: L{ImageBoundI... | python | def parse(readDataInstance):
"""
Returns a new L{ImageBoundImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing the data to create a new L{ImageBoundImportDescriptor} object.
@rtype: L{ImageBoundI... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"ibd",
"=",
"ImageBoundImportDescriptor",
"(",
")",
"entryData",
"=",
"readDataInstance",
".",
"read",
"(",
"consts",
".",
"SIZEOF_IMAGE_BOUND_IMPORT_ENTRY32",
")",
"readDataInstance",
".",
"offset",
"=",
"0",
"wh... | Returns a new L{ImageBoundImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing the data to create a new L{ImageBoundImportDescriptor} object.
@rtype: L{ImageBoundImportDescriptor}
@return: A new {ImageBou... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageBoundImportDescriptor",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L153-L182 | train |
crackinglandia/pype32 | pype32/directories.py | ImageBoundImportDescriptorEntry.parse | def parse(readDataInstance):
"""
Returns a new L{ImageBoundImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageBoundImportDescriptorEntry}.
@rtype: L{ImageBoundIm... | python | def parse(readDataInstance):
"""
Returns a new L{ImageBoundImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageBoundImportDescriptorEntry}.
@rtype: L{ImageBoundIm... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"boundEntry",
"=",
"ImageBoundImportDescriptorEntry",
"(",
")",
"boundEntry",
".",
"timeDateStamp",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"boundEntry",
".",
"offsetModuleName",
".",
"v... | Returns a new L{ImageBoundImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageBoundImportDescriptorEntry}.
@rtype: L{ImageBoundImportDescriptorEntry}
@return: A new {Imag... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageBoundImportDescriptorEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L215-L236 | train |
crackinglandia/pype32 | pype32/directories.py | TLSDirectory.parse | def parse(readDataInstance):
"""
Returns a new L{TLSDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory} object.
@rtype: L{TLSDirectory}
@return: A new {TLSDi... | python | def parse(readDataInstance):
"""
Returns a new L{TLSDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory} object.
@rtype: L{TLSDirectory}
@return: A new {TLSDi... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"tlsDir",
"=",
"TLSDirectory",
"(",
")",
"tlsDir",
".",
"startAddressOfRawData",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"tlsDir",
".",
"endAddressOfRawData",
".",
"value",
"=",
"rea... | Returns a new L{TLSDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory} object.
@rtype: L{TLSDirectory}
@return: A new {TLSDirectory} object. | [
"Returns",
"a",
"new",
"L",
"{",
"TLSDirectory",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L266-L284 | train |
crackinglandia/pype32 | pype32/directories.py | TLSDirectory64.parse | def parse(readDataInstance):
"""
Returns a new L{TLSDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory64} object.
@rtype: L{TLSDirectory64}
@return: A new ... | python | def parse(readDataInstance):
"""
Returns a new L{TLSDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory64} object.
@rtype: L{TLSDirectory64}
@return: A new ... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"tlsDir",
"=",
"TLSDirectory64",
"(",
")",
"tlsDir",
".",
"startAddressOfRawData",
".",
"value",
"=",
"readDataInstance",
".",
"readQword",
"(",
")",
"tlsDir",
".",
"endAddressOfRawData",
".",
"value",
"=",
"r... | Returns a new L{TLSDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory64} object.
@rtype: L{TLSDirectory64}
@return: A new L{TLSDirectory64} object. | [
"Returns",
"a",
"new",
"L",
"{",
"TLSDirectory64",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L312-L330 | train |
crackinglandia/pype32 | pype32/directories.py | ImageLoadConfigDirectory64.parse | def parse(readDataInstance):
"""
Returns a new L{ImageLoadConfigDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageLoadConfigDirectory64} object.
@rtype: L{ImageLoadConfig... | python | def parse(readDataInstance):
"""
Returns a new L{ImageLoadConfigDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageLoadConfigDirectory64} object.
@rtype: L{ImageLoadConfig... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"configDir",
"=",
"ImageLoadConfigDirectory64",
"(",
")",
"configDir",
".",
"size",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"configDir",
".",
"timeDateStamp",
".",
"value",
"=",
"rea... | Returns a new L{ImageLoadConfigDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{ImageLoadConfigDirectory64} object.
@rtype: L{ImageLoadConfigDirectory64}
@return: A new L{ImageLoadCo... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageLoadConfigDirectory64",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L473-L512 | train |
crackinglandia/pype32 | pype32/directories.py | ImageBaseRelocationEntry.parse | def parse(readDataInstance):
"""
Returns a new L{ImageBaseRelocationEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to parse as a L{ImageBaseRelocationEntry} object.
@rtype: L{ImageBaseRelocationEntry}
... | python | def parse(readDataInstance):
"""
Returns a new L{ImageBaseRelocationEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to parse as a L{ImageBaseRelocationEntry} object.
@rtype: L{ImageBaseRelocationEntry}
... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"reloc",
"=",
"ImageBaseRelocationEntry",
"(",
")",
"reloc",
".",
"virtualAddress",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"reloc",
".",
"sizeOfBlock",
".",
"value",
"=",
"readDataI... | Returns a new L{ImageBaseRelocationEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to parse as a L{ImageBaseRelocationEntry} object.
@rtype: L{ImageBaseRelocationEntry}
@return: A new L{ImageBaseRelocationEntry}... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageBaseRelocationEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L537-L552 | train |
crackinglandia/pype32 | pype32/directories.py | ImageDebugDirectory.parse | def parse(readDataInstance):
"""
Returns a new L{ImageDebugDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A new L{ReadData} object with data to be parsed as a L{ImageDebugDirectory} object.
@rtype: L{ImageDebugDirectory}
... | python | def parse(readDataInstance):
"""
Returns a new L{ImageDebugDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A new L{ReadData} object with data to be parsed as a L{ImageDebugDirectory} object.
@rtype: L{ImageDebugDirectory}
... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"dbgDir",
"=",
"ImageDebugDirectory",
"(",
")",
"dbgDir",
".",
"characteristics",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"dbgDir",
".",
"timeDateStamp",
".",
"value",
"=",
"readData... | Returns a new L{ImageDebugDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A new L{ReadData} object with data to be parsed as a L{ImageDebugDirectory} object.
@rtype: L{ImageDebugDirectory}
@return: A new L{ImageDebugDirectory} object. | [
"Returns",
"a",
"new",
"L",
"{",
"ImageDebugDirectory",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L587-L608 | train |
crackinglandia/pype32 | pype32/directories.py | ImageDebugDirectories.parse | def parse(readDataInstance, nDebugEntries):
"""
Returns a new L{ImageDebugDirectories} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageDebugDirectories} object.
@type nDebugEntries: in... | python | def parse(readDataInstance, nDebugEntries):
"""
Returns a new L{ImageDebugDirectories} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageDebugDirectories} object.
@type nDebugEntries: in... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"nDebugEntries",
")",
":",
"dbgEntries",
"=",
"ImageDebugDirectories",
"(",
")",
"dataLength",
"=",
"len",
"(",
"readDataInstance",
")",
"toRead",
"=",
"nDebugEntries",
"*",
"consts",
".",
"SIZEOF_IMAGE_DEBUG_ENTRY32",
... | Returns a new L{ImageDebugDirectories} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageDebugDirectories} object.
@type nDebugEntries: int
@param nDebugEntries: Number of L{ImageDebugDirectory} ... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageDebugDirectories",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L629-L655 | train |
crackinglandia/pype32 | pype32/directories.py | ImageImportDescriptorEntry.parse | def parse(readDataInstance):
"""
Returns a new L{ImageImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptorEntry}.
@rtype: L{ImageImportDescriptorEntry... | python | def parse(readDataInstance):
"""
Returns a new L{ImageImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptorEntry}.
@rtype: L{ImageImportDescriptorEntry... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"iid",
"=",
"ImageImportDescriptorEntry",
"(",
")",
"iid",
".",
"originalFirstThunk",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"iid",
".",
"timeDateStamp",
".",
"value",
"=",
"readDat... | Returns a new L{ImageImportDescriptorEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptorEntry}.
@rtype: L{ImageImportDescriptorEntry}
@return: A new L{ImageImportDescriptorE... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageImportDescriptorEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L702-L718 | train |
crackinglandia/pype32 | pype32/directories.py | ImageImportDescriptor.parse | def parse(readDataInstance, nEntries):
"""
Returns a new L{ImageImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptor} object.
@type nEntries: int
... | python | def parse(readDataInstance, nEntries):
"""
Returns a new L{ImageImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptor} object.
@type nEntries: int
... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"nEntries",
")",
":",
"importEntries",
"=",
"ImageImportDescriptor",
"(",
")",
"dataLength",
"=",
"len",
"(",
"readDataInstance",
")",
"toRead",
"=",
"nEntries",
"*",
"consts",
".",
"SIZEOF_IMAGE_IMPORT_ENTRY32",
"if",... | Returns a new L{ImageImportDescriptor} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageImportDescriptor} object.
@type nEntries: int
@param nEntries: The number of L{ImageImportDescriptorEntry}... | [
"Returns",
"a",
"new",
"L",
"{",
"ImageImportDescriptor",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L743-L769 | train |
crackinglandia/pype32 | pype32/directories.py | ExportTableEntry.parse | def parse(readDataInstance):
"""
Returns a new L{ExportTableEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ExportTableEntry} object.
@rtype: L{ExportTableEntry}
@return: A ne... | python | def parse(readDataInstance):
"""
Returns a new L{ExportTableEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ExportTableEntry} object.
@rtype: L{ExportTableEntry}
@return: A ne... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"exportEntry",
"=",
"ExportTableEntry",
"(",
")",
"exportEntry",
".",
"functionRva",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"exportEntry",
".",
"nameOrdinal",
".",
"value",
"=",
"re... | Returns a new L{ExportTableEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ExportTableEntry} object.
@rtype: L{ExportTableEntry}
@return: A new L{ExportTableEntry} object. | [
"Returns",
"a",
"new",
"L",
"{",
"ExportTableEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L850-L866 | train |
crackinglandia/pype32 | pype32/directories.py | ImageExportTable.parse | def parse(readDataInstance):
"""
Returns a new L{ImageExportTable} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageExportTable} object.
@rtype: L{ImageExportTable}
@return: A ne... | python | def parse(readDataInstance):
"""
Returns a new L{ImageExportTable} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageExportTable} object.
@rtype: L{ImageExportTable}
@return: A ne... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"et",
"=",
"ImageExportTable",
"(",
")",
"et",
".",
"characteristics",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"et",
".",
"timeDateStamp",
".",
"value",
"=",
"readDataInstance",
".... | Returns a new L{ImageExportTable} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{ImageExportTable} object.
@rtype: L{ImageExportTable}
@return: A new L{ImageExportTable} object. | [
"Returns",
"a",
"new",
"L",
"{",
"ImageExportTable",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L902-L925 | train |
crackinglandia/pype32 | pype32/directories.py | NETDirectory.parse | def parse(readDataInstance):
"""
Returns a new L{NETDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object.
@rtype: L{NETDirectory}
@return: A new L{NETDirec... | python | def parse(readDataInstance):
"""
Returns a new L{NETDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object.
@rtype: L{NETDirectory}
@return: A new L{NETDirec... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"nd",
"=",
"NETDirectory",
"(",
")",
"nd",
".",
"directory",
"=",
"NetDirectory",
".",
"parse",
"(",
"readDataInstance",
")",
"nd",
".",
"netMetaDataHeader",
"=",
"NetMetaDataHeader",
".",
"parse",
"(",
"rea... | Returns a new L{NETDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object.
@rtype: L{NETDirectory}
@return: A new L{NETDirectory} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NETDirectory",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L945-L960 | train |
crackinglandia/pype32 | pype32/directories.py | NetDirectory.parse | def parse(readDataInstance):
"""
Returns a new L{NetDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetDirectory} object.
@rtype: L{NetDirectory}
@return: A new L{NetDirec... | python | def parse(readDataInstance):
"""
Returns a new L{NetDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetDirectory} object.
@rtype: L{NetDirectory}
@return: A new L{NetDirec... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"nd",
"=",
"NetDirectory",
"(",
")",
"nd",
".",
"cb",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"nd",
".",
"majorRuntimeVersion",
".",
"value",
"=",
"readDataInstance",
".",
"readW... | Returns a new L{NetDirectory} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetDirectory} object.
@rtype: L{NetDirectory}
@return: A new L{NetDirectory} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NetDirectory",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1001-L1048 | train |
crackinglandia/pype32 | pype32/directories.py | NetMetaDataHeader.parse | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataHeader} object.
@rtype: L{NetMetaDataHeader}
@return: A... | python | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataHeader} object.
@rtype: L{NetMetaDataHeader}
@return: A... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"nmh",
"=",
"NetMetaDataHeader",
"(",
")",
"nmh",
".",
"signature",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"nmh",
".",
"majorVersion",
".",
"value",
"=",
"readDataInstance",
".",
... | Returns a new L{NetMetaDataHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataHeader} object.
@rtype: L{NetMetaDataHeader}
@return: A new L{NetMetaDataHeader} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NetMetaDataHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1071-L1091 | train |
crackinglandia/pype32 | pype32/directories.py | NetMetaDataStreamEntry.parse | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataStreamEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreamEntry}.
@rtype: L{NetMetaDataStreamEntry}
@r... | python | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataStreamEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreamEntry}.
@rtype: L{NetMetaDataStreamEntry}
@r... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"n",
"=",
"NetMetaDataStreamEntry",
"(",
")",
"n",
".",
"offset",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"n",
".",
"size",
".",
"value",
"=",
"readDataInstance",
".",
"readDword... | Returns a new L{NetMetaDataStreamEntry} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreamEntry}.
@rtype: L{NetMetaDataStreamEntry}
@return: A new L{NetMetaDataStreamEntry} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NetMetaDataStreamEntry",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1113-L1127 | train |
crackinglandia/pype32 | pype32/directories.py | NetMetaDataStreams.parse | def parse(readDataInstance, nStreams):
"""
Returns a new L{NetMetaDataStreams} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreams} object.
@type nStreams: int
@param... | python | def parse(readDataInstance, nStreams):
"""
Returns a new L{NetMetaDataStreams} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreams} object.
@type nStreams: int
@param... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"nStreams",
")",
":",
"streams",
"=",
"NetMetaDataStreams",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"nStreams",
")",
":",
"streamEntry",
"=",
"NetMetaDataStreamEntry",
"(",
")",
"streamEntry",
".",
"offset",
".... | Returns a new L{NetMetaDataStreams} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataStreams} object.
@type nStreams: int
@param nStreams: The number of L{NetMetaDataStreamEntry} objects i... | [
"Returns",
"a",
"new",
"L",
"{",
"NetMetaDataStreams",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1148-L1173 | train |
crackinglandia/pype32 | pype32/directories.py | NetMetaDataTableHeader.parse | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataTableHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTableHeader} object.
@rtype: L{NetMetaDataTableHeader}
... | python | def parse(readDataInstance):
"""
Returns a new L{NetMetaDataTableHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTableHeader} object.
@rtype: L{NetMetaDataTableHeader}
... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"th",
"=",
"NetMetaDataTableHeader",
"(",
")",
"th",
".",
"reserved_1",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"th",
".",
"majorVersion",
".",
"value",
"=",
"readDataInstance",
".... | Returns a new L{NetMetaDataTableHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTableHeader} object.
@rtype: L{NetMetaDataTableHeader}
@return: A new L{NetMetaDataTableHeader} obj... | [
"Returns",
"a",
"new",
"L",
"{",
"NetMetaDataTableHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1195-L1215 | train |
crackinglandia/pype32 | pype32/directories.py | NetMetaDataTables.parse | def parse(readDataInstance, netMetaDataStreams):
"""
Returns a new L{NetMetaDataTables} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTables} object.
@rtype: L{NetMetaDataTables... | python | def parse(readDataInstance, netMetaDataStreams):
"""
Returns a new L{NetMetaDataTables} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTables} object.
@rtype: L{NetMetaDataTables... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"netMetaDataStreams",
")",
":",
"dt",
"=",
"NetMetaDataTables",
"(",
")",
"dt",
".",
"netMetaDataTableHeader",
"=",
"NetMetaDataTableHeader",
".",
"parse",
"(",
"readDataInstance",
")",
"dt",
".",
"tables",
"=",
"{",... | Returns a new L{NetMetaDataTables} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetMetaDataTables} object.
@rtype: L{NetMetaDataTables}
@return: A new L{NetMetaDataTables} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NetMetaDataTables",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1237-L1273 | train |
crackinglandia/pype32 | pype32/directories.py | NetResources.parse | def parse(readDataInstance):
"""
Returns a new L{NetResources} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetResources} object.
@rtype: L{NetResources}
@return: A new L{NetResources} object.
... | python | def parse(readDataInstance):
"""
Returns a new L{NetResources} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetResources} object.
@rtype: L{NetResources}
@return: A new L{NetResources} object.
... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"r",
"=",
"NetResources",
"(",
")",
"r",
".",
"signature",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"if",
"r",
".",
"signature",
"!=",
"0xbeefcace",
":",
"return",
"r",
"r",
".",
"readerCount... | Returns a new L{NetResources} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NetResources} object.
@rtype: L{NetResources}
@return: A new L{NetResources} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NetResources",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L1312-L1366 | train |
blockcypher/bcwallet | bcwallet/bc_utils.py | verify_and_fill_address_paths_from_bip32key | def verify_and_fill_address_paths_from_bip32key(address_paths, master_key, network):
'''
Take address paths and verifies their accuracy client-side.
Also fills in all the available metadata (WIF, public key, etc)
'''
assert network, network
wallet_obj = Wallet.deserialize(master_key, network=... | python | def verify_and_fill_address_paths_from_bip32key(address_paths, master_key, network):
'''
Take address paths and verifies their accuracy client-side.
Also fills in all the available metadata (WIF, public key, etc)
'''
assert network, network
wallet_obj = Wallet.deserialize(master_key, network=... | [
"def",
"verify_and_fill_address_paths_from_bip32key",
"(",
"address_paths",
",",
"master_key",
",",
"network",
")",
":",
"assert",
"network",
",",
"network",
"wallet_obj",
"=",
"Wallet",
".",
"deserialize",
"(",
"master_key",
",",
"network",
"=",
"network",
")",
"... | Take address paths and verifies their accuracy client-side.
Also fills in all the available metadata (WIF, public key, etc) | [
"Take",
"address",
"paths",
"and",
"verifies",
"their",
"accuracy",
"client",
"-",
"side",
"."
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bc_utils.py#L33-L84 | train |
tansey/gfl | pygfl/density.py | GraphFusedDensity.solution_path | def solution_path(self):
'''Follows the solution path of the generalized lasso to find the best lambda value.'''
lambda_grid = np.exp(np.linspace(np.log(self.max_lambda), np.log(self.min_lambda), self.lambda_bins))
aic_trace = np.zeros((len(self.bins),lambda_grid.shape[0])) # The AIC score for e... | python | def solution_path(self):
'''Follows the solution path of the generalized lasso to find the best lambda value.'''
lambda_grid = np.exp(np.linspace(np.log(self.max_lambda), np.log(self.min_lambda), self.lambda_bins))
aic_trace = np.zeros((len(self.bins),lambda_grid.shape[0])) # The AIC score for e... | [
"def",
"solution_path",
"(",
"self",
")",
":",
"lambda_grid",
"=",
"np",
".",
"exp",
"(",
"np",
".",
"linspace",
"(",
"np",
".",
"log",
"(",
"self",
".",
"max_lambda",
")",
",",
"np",
".",
"log",
"(",
"self",
".",
"min_lambda",
")",
",",
"self",
... | Follows the solution path of the generalized lasso to find the best lambda value. | [
"Follows",
"the",
"solution",
"path",
"of",
"the",
"generalized",
"lasso",
"to",
"find",
"the",
"best",
"lambda",
"value",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/density.py#L123-L240 | train |
tansey/gfl | pygfl/density.py | GraphFusedDensity.run | def run(self, lam, initial_values=None):
'''Run the graph-fused logit lasso with a fixed lambda penalty.'''
if initial_values is not None:
if self.k == 0 and self.trails is not None:
betas, zs, us = initial_values
else:
betas, us = initial_values
... | python | def run(self, lam, initial_values=None):
'''Run the graph-fused logit lasso with a fixed lambda penalty.'''
if initial_values is not None:
if self.k == 0 and self.trails is not None:
betas, zs, us = initial_values
else:
betas, us = initial_values
... | [
"def",
"run",
"(",
"self",
",",
"lam",
",",
"initial_values",
"=",
"None",
")",
":",
"if",
"initial_values",
"is",
"not",
"None",
":",
"if",
"self",
".",
"k",
"==",
"0",
"and",
"self",
".",
"trails",
"is",
"not",
"None",
":",
"betas",
",",
"zs",
... | Run the graph-fused logit lasso with a fixed lambda penalty. | [
"Run",
"the",
"graph",
"-",
"fused",
"logit",
"lasso",
"with",
"a",
"fixed",
"lambda",
"penalty",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/density.py#L343-L391 | train |
tansey/gfl | pygfl/density.py | GraphFusedDensity.data_log_likelihood | def data_log_likelihood(self, successes, trials, beta):
'''Calculates the log-likelihood of a Polya tree bin given the beta values.'''
return binom.logpmf(successes, trials, 1.0 / (1 + np.exp(-beta))).sum() | python | def data_log_likelihood(self, successes, trials, beta):
'''Calculates the log-likelihood of a Polya tree bin given the beta values.'''
return binom.logpmf(successes, trials, 1.0 / (1 + np.exp(-beta))).sum() | [
"def",
"data_log_likelihood",
"(",
"self",
",",
"successes",
",",
"trials",
",",
"beta",
")",
":",
"return",
"binom",
".",
"logpmf",
"(",
"successes",
",",
"trials",
",",
"1.0",
"/",
"(",
"1",
"+",
"np",
".",
"exp",
"(",
"-",
"beta",
")",
")",
")",... | Calculates the log-likelihood of a Polya tree bin given the beta values. | [
"Calculates",
"the",
"log",
"-",
"likelihood",
"of",
"a",
"Polya",
"tree",
"bin",
"given",
"the",
"beta",
"values",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/density.py#L393-L395 | train |
Blazemeter/apiritif | apiritif/loadgen.py | spawn_worker | def spawn_worker(params):
"""
This method has to be module level function
:type params: Params
"""
setup_logging(params)
log.info("Adding worker: idx=%s\tconcurrency=%s\tresults=%s", params.worker_index, params.concurrency,
params.report)
worker = Worker(params)
worker.star... | python | def spawn_worker(params):
"""
This method has to be module level function
:type params: Params
"""
setup_logging(params)
log.info("Adding worker: idx=%s\tconcurrency=%s\tresults=%s", params.worker_index, params.concurrency,
params.report)
worker = Worker(params)
worker.star... | [
"def",
"spawn_worker",
"(",
"params",
")",
":",
"setup_logging",
"(",
"params",
")",
"log",
".",
"info",
"(",
"\"Adding worker: idx=%s\\tconcurrency=%s\\tresults=%s\"",
",",
"params",
".",
"worker_index",
",",
"params",
".",
"concurrency",
",",
"params",
".",
"rep... | This method has to be module level function
:type params: Params | [
"This",
"method",
"has",
"to",
"be",
"module",
"level",
"function"
] | 27b48a68425949998c2254e5e1e0226882d9eee8 | https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/loadgen.py#L48-L59 | train |
Blazemeter/apiritif | apiritif/loadgen.py | Worker.run_nose | def run_nose(self, params):
"""
:type params: Params
"""
thread.set_index(params.thread_index)
log.debug("[%s] Starting nose iterations: %s", params.worker_index, params)
assert isinstance(params.tests, list)
# argv.extend(['--with-apiritif', '--nocapture', '--exe... | python | def run_nose(self, params):
"""
:type params: Params
"""
thread.set_index(params.thread_index)
log.debug("[%s] Starting nose iterations: %s", params.worker_index, params)
assert isinstance(params.tests, list)
# argv.extend(['--with-apiritif', '--nocapture', '--exe... | [
"def",
"run_nose",
"(",
"self",
",",
"params",
")",
":",
"thread",
".",
"set_index",
"(",
"params",
".",
"thread_index",
")",
"log",
".",
"debug",
"(",
"\"[%s] Starting nose iterations: %s\"",
",",
"params",
".",
"worker_index",
",",
"params",
")",
"assert",
... | :type params: Params | [
":",
"type",
"params",
":",
"Params"
] | 27b48a68425949998c2254e5e1e0226882d9eee8 | https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/loadgen.py#L161-L209 | train |
Blazemeter/apiritif | apiritif/loadgen.py | JTLSampleWriter._write_single_sample | def _write_single_sample(self, sample):
"""
:type sample: Sample
"""
bytes = sample.extras.get("responseHeadersSize", 0) + 2 + sample.extras.get("responseBodySize", 0)
message = sample.error_msg
if not message:
message = sample.extras.get("responseMessage")
... | python | def _write_single_sample(self, sample):
"""
:type sample: Sample
"""
bytes = sample.extras.get("responseHeadersSize", 0) + 2 + sample.extras.get("responseBodySize", 0)
message = sample.error_msg
if not message:
message = sample.extras.get("responseMessage")
... | [
"def",
"_write_single_sample",
"(",
"self",
",",
"sample",
")",
":",
"bytes",
"=",
"sample",
".",
"extras",
".",
"get",
"(",
"\"responseHeadersSize\"",
",",
"0",
")",
"+",
"2",
"+",
"sample",
".",
"extras",
".",
"get",
"(",
"\"responseBodySize\"",
",",
"... | :type sample: Sample | [
":",
"type",
"sample",
":",
"Sample"
] | 27b48a68425949998c2254e5e1e0226882d9eee8 | https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/loadgen.py#L346-L376 | train |
Blazemeter/apiritif | apiritif/loadgen.py | ApiritifPlugin.addError | def addError(self, test, error):
"""
when a test raises an uncaught exception
:param test:
:param error:
:return:
"""
# test_dict will be None if startTest wasn't called (i.e. exception in setUp/setUpClass)
# status=BROKEN
if self.current_sample is... | python | def addError(self, test, error):
"""
when a test raises an uncaught exception
:param test:
:param error:
:return:
"""
# test_dict will be None if startTest wasn't called (i.e. exception in setUp/setUpClass)
# status=BROKEN
if self.current_sample is... | [
"def",
"addError",
"(",
"self",
",",
"test",
",",
"error",
")",
":",
"# test_dict will be None if startTest wasn't called (i.e. exception in setUp/setUpClass)",
"# status=BROKEN",
"if",
"self",
".",
"current_sample",
"is",
"not",
"None",
":",
"assertion_name",
"=",
"error... | when a test raises an uncaught exception
:param test:
:param error:
:return: | [
"when",
"a",
"test",
"raises",
"an",
"uncaught",
"exception",
":",
"param",
"test",
":",
":",
"param",
"error",
":",
":",
"return",
":"
] | 27b48a68425949998c2254e5e1e0226882d9eee8 | https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/loadgen.py#L490-L504 | train |
crackinglandia/pype32 | pype32/datadirs.py | Directory.parse | def parse(readDataInstance):
"""
Returns a L{Directory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{Directory}
@return: L{Directory} object.
"""
d = Directory()
... | python | def parse(readDataInstance):
"""
Returns a L{Directory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{Directory}
@return: L{Directory} object.
"""
d = Directory()
... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"d",
"=",
"Directory",
"(",
")",
"d",
".",
"rva",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"d",
".",
"size",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",... | Returns a L{Directory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{Directory}
@return: L{Directory} object. | [
"Returns",
"a",
"L",
"{",
"Directory",
"}",
"-",
"like",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/datadirs.py#L79-L92 | train |
crackinglandia/pype32 | pype32/datadirs.py | DataDirectory.parse | def parse(readDataInstance):
"""Returns a L{DataDirectory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{DataDirectory}
@return: The L{DataDirectory} object containing L{consts.IMAGE_NUMBEROF... | python | def parse(readDataInstance):
"""Returns a L{DataDirectory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{DataDirectory}
@return: The L{DataDirectory} object containing L{consts.IMAGE_NUMBEROF... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"if",
"len",
"(",
"readDataInstance",
")",
"==",
"consts",
".",
"IMAGE_NUMBEROF_DIRECTORY_ENTRIES",
"*",
"8",
":",
"newDataDirectory",
"=",
"DataDirectory",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"consts",
... | Returns a L{DataDirectory}-like object.
@type readDataInstance: L{ReadData}
@param readDataInstance: L{ReadData} object to read from.
@rtype: L{DataDirectory}
@return: The L{DataDirectory} object containing L{consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES} L{Directory} objects... | [
"Returns",
"a",
"L",
"{",
"DataDirectory",
"}",
"-",
"like",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/datadirs.py#L121-L140 | train |
zsethna/OLGA | olga/compute_pgen.py | main | def main():
"""Compute Pgens from a file and output to another file."""
parser = OptionParser(conflict_handler="resolve")
parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)')
parser.add_option('... | python | def main():
"""Compute Pgens from a file and output to another file."""
parser = OptionParser(conflict_handler="resolve")
parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)')
parser.add_option('... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"OptionParser",
"(",
"conflict_handler",
"=",
"\"resolve\"",
")",
"parser",
".",
"add_option",
"(",
"'--humanTRA'",
",",
"'--human_T_alpha'",
",",
"action",
"=",
"'store_true'",
",",
"dest",
"=",
"'humanTRA'",
",",
... | Compute Pgens from a file and output to another file. | [
"Compute",
"Pgens",
"from",
"a",
"file",
"and",
"output",
"to",
"another",
"file",
"."
] | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/compute_pgen.py#L270-L780 | train |
tansey/gfl | pygfl/utils.py | create_plateaus | def create_plateaus(data, edges, plateau_size, plateau_vals, plateaus=None):
'''Creates plateaus of constant value in the data.'''
nodes = set(edges.keys())
if plateaus is None:
plateaus = []
for i in range(len(plateau_vals)):
if len(nodes) == 0:
break
... | python | def create_plateaus(data, edges, plateau_size, plateau_vals, plateaus=None):
'''Creates plateaus of constant value in the data.'''
nodes = set(edges.keys())
if plateaus is None:
plateaus = []
for i in range(len(plateau_vals)):
if len(nodes) == 0:
break
... | [
"def",
"create_plateaus",
"(",
"data",
",",
"edges",
",",
"plateau_size",
",",
"plateau_vals",
",",
"plateaus",
"=",
"None",
")",
":",
"nodes",
"=",
"set",
"(",
"edges",
".",
"keys",
"(",
")",
")",
"if",
"plateaus",
"is",
"None",
":",
"plateaus",
"=",
... | Creates plateaus of constant value in the data. | [
"Creates",
"plateaus",
"of",
"constant",
"value",
"in",
"the",
"data",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L29-L50 | train |
tansey/gfl | pygfl/utils.py | pretty_str | def pretty_str(p, decimal_places=2, print_zero=True, label_columns=False):
'''Pretty-print a matrix or vector.'''
if len(p.shape) == 1:
return vector_str(p, decimal_places, print_zero)
if len(p.shape) == 2:
return matrix_str(p, decimal_places, print_zero, label_columns)
raise Exception('... | python | def pretty_str(p, decimal_places=2, print_zero=True, label_columns=False):
'''Pretty-print a matrix or vector.'''
if len(p.shape) == 1:
return vector_str(p, decimal_places, print_zero)
if len(p.shape) == 2:
return matrix_str(p, decimal_places, print_zero, label_columns)
raise Exception('... | [
"def",
"pretty_str",
"(",
"p",
",",
"decimal_places",
"=",
"2",
",",
"print_zero",
"=",
"True",
",",
"label_columns",
"=",
"False",
")",
":",
"if",
"len",
"(",
"p",
".",
"shape",
")",
"==",
"1",
":",
"return",
"vector_str",
"(",
"p",
",",
"decimal_pl... | Pretty-print a matrix or vector. | [
"Pretty",
"-",
"print",
"a",
"matrix",
"or",
"vector",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L148-L154 | train |
tansey/gfl | pygfl/utils.py | matrix_str | def matrix_str(p, decimal_places=2, print_zero=True, label_columns=False):
'''Pretty-print the matrix.'''
return '[{0}]'.format("\n ".join([(str(i) if label_columns else '') + vector_str(a, decimal_places, print_zero) for i, a in enumerate(p)])) | python | def matrix_str(p, decimal_places=2, print_zero=True, label_columns=False):
'''Pretty-print the matrix.'''
return '[{0}]'.format("\n ".join([(str(i) if label_columns else '') + vector_str(a, decimal_places, print_zero) for i, a in enumerate(p)])) | [
"def",
"matrix_str",
"(",
"p",
",",
"decimal_places",
"=",
"2",
",",
"print_zero",
"=",
"True",
",",
"label_columns",
"=",
"False",
")",
":",
"return",
"'[{0}]'",
".",
"format",
"(",
"\"\\n \"",
".",
"join",
"(",
"[",
"(",
"str",
"(",
"i",
")",
"if"... | Pretty-print the matrix. | [
"Pretty",
"-",
"print",
"the",
"matrix",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L156-L158 | train |
tansey/gfl | pygfl/utils.py | vector_str | def vector_str(p, decimal_places=2, print_zero=True):
'''Pretty-print the vector values.'''
style = '{0:.' + str(decimal_places) + 'f}'
return '[{0}]'.format(", ".join([' ' if not print_zero and a == 0 else style.format(a) for a in p])) | python | def vector_str(p, decimal_places=2, print_zero=True):
'''Pretty-print the vector values.'''
style = '{0:.' + str(decimal_places) + 'f}'
return '[{0}]'.format(", ".join([' ' if not print_zero and a == 0 else style.format(a) for a in p])) | [
"def",
"vector_str",
"(",
"p",
",",
"decimal_places",
"=",
"2",
",",
"print_zero",
"=",
"True",
")",
":",
"style",
"=",
"'{0:.'",
"+",
"str",
"(",
"decimal_places",
")",
"+",
"'f}'",
"return",
"'[{0}]'",
".",
"format",
"(",
"\", \"",
".",
"join",
"(",
... | Pretty-print the vector values. | [
"Pretty",
"-",
"print",
"the",
"vector",
"values",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L160-L163 | train |
tansey/gfl | pygfl/utils.py | calc_plateaus | def calc_plateaus(beta, edges, rel_tol=1e-4, verbose=0):
'''Calculate the plateaus (degrees of freedom) of a graph of beta values in linear time.'''
if not isinstance(edges, dict):
raise Exception('Edges must be a map from each node to a list of neighbors.')
to_check = deque(range(len(beta)))
ch... | python | def calc_plateaus(beta, edges, rel_tol=1e-4, verbose=0):
'''Calculate the plateaus (degrees of freedom) of a graph of beta values in linear time.'''
if not isinstance(edges, dict):
raise Exception('Edges must be a map from each node to a list of neighbors.')
to_check = deque(range(len(beta)))
ch... | [
"def",
"calc_plateaus",
"(",
"beta",
",",
"edges",
",",
"rel_tol",
"=",
"1e-4",
",",
"verbose",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"edges",
",",
"dict",
")",
":",
"raise",
"Exception",
"(",
"'Edges must be a map from each node to a list of nei... | Calculate the plateaus (degrees of freedom) of a graph of beta values in linear time. | [
"Calculate",
"the",
"plateaus",
"(",
"degrees",
"of",
"freedom",
")",
"of",
"a",
"graph",
"of",
"beta",
"values",
"in",
"linear",
"time",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L176-L243 | train |
tansey/gfl | pygfl/utils.py | nearly_unique | def nearly_unique(arr, rel_tol=1e-4, verbose=0):
'''Heuristic method to return the uniques within some precision in a numpy array'''
results = np.array([arr[0]])
for x in arr:
if np.abs(results - x).min() > rel_tol:
results = np.append(results, x)
return results | python | def nearly_unique(arr, rel_tol=1e-4, verbose=0):
'''Heuristic method to return the uniques within some precision in a numpy array'''
results = np.array([arr[0]])
for x in arr:
if np.abs(results - x).min() > rel_tol:
results = np.append(results, x)
return results | [
"def",
"nearly_unique",
"(",
"arr",
",",
"rel_tol",
"=",
"1e-4",
",",
"verbose",
"=",
"0",
")",
":",
"results",
"=",
"np",
".",
"array",
"(",
"[",
"arr",
"[",
"0",
"]",
"]",
")",
"for",
"x",
"in",
"arr",
":",
"if",
"np",
".",
"abs",
"(",
"res... | Heuristic method to return the uniques within some precision in a numpy array | [
"Heuristic",
"method",
"to",
"return",
"the",
"uniques",
"within",
"some",
"precision",
"in",
"a",
"numpy",
"array"
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L245-L251 | train |
tansey/gfl | pygfl/utils.py | hypercube_edges | def hypercube_edges(dims, use_map=False):
'''Create edge lists for an arbitrary hypercube. TODO: this is probably not the fastest way.'''
edges = []
nodes = np.arange(np.product(dims)).reshape(dims)
for i,d in enumerate(dims):
for j in range(d-1):
for n1, n2 in zip(np.take(nodes, [j]... | python | def hypercube_edges(dims, use_map=False):
'''Create edge lists for an arbitrary hypercube. TODO: this is probably not the fastest way.'''
edges = []
nodes = np.arange(np.product(dims)).reshape(dims)
for i,d in enumerate(dims):
for j in range(d-1):
for n1, n2 in zip(np.take(nodes, [j]... | [
"def",
"hypercube_edges",
"(",
"dims",
",",
"use_map",
"=",
"False",
")",
":",
"edges",
"=",
"[",
"]",
"nodes",
"=",
"np",
".",
"arange",
"(",
"np",
".",
"product",
"(",
"dims",
")",
")",
".",
"reshape",
"(",
"dims",
")",
"for",
"i",
",",
"d",
... | Create edge lists for an arbitrary hypercube. TODO: this is probably not the fastest way. | [
"Create",
"edge",
"lists",
"for",
"an",
"arbitrary",
"hypercube",
".",
"TODO",
":",
"this",
"is",
"probably",
"not",
"the",
"fastest",
"way",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L299-L309 | train |
tansey/gfl | pygfl/utils.py | get_delta | def get_delta(D, k):
'''Calculate the k-th order trend filtering matrix given the oriented edge
incidence matrix and the value of k.'''
if k < 0:
raise Exception('k must be at least 0th order.')
result = D
for i in range(k):
result = D.T.dot(result) if i % 2 == 0 else D.dot(result)
... | python | def get_delta(D, k):
'''Calculate the k-th order trend filtering matrix given the oriented edge
incidence matrix and the value of k.'''
if k < 0:
raise Exception('k must be at least 0th order.')
result = D
for i in range(k):
result = D.T.dot(result) if i % 2 == 0 else D.dot(result)
... | [
"def",
"get_delta",
"(",
"D",
",",
"k",
")",
":",
"if",
"k",
"<",
"0",
":",
"raise",
"Exception",
"(",
"'k must be at least 0th order.'",
")",
"result",
"=",
"D",
"for",
"i",
"in",
"range",
"(",
"k",
")",
":",
"result",
"=",
"D",
".",
"T",
".",
"... | Calculate the k-th order trend filtering matrix given the oriented edge
incidence matrix and the value of k. | [
"Calculate",
"the",
"k",
"-",
"th",
"order",
"trend",
"filtering",
"matrix",
"given",
"the",
"oriented",
"edge",
"incidence",
"matrix",
"and",
"the",
"value",
"of",
"k",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L390-L398 | train |
tansey/gfl | pygfl/utils.py | decompose_delta | def decompose_delta(deltak):
'''Decomposes the k-th order trend filtering matrix into a c-compatible set
of arrays.'''
if not isspmatrix_coo(deltak):
deltak = coo_matrix(deltak)
dk_rows = deltak.shape[0]
dk_rowbreaks = np.cumsum(deltak.getnnz(1), dtype="int32")
dk_cols = deltak.col.astyp... | python | def decompose_delta(deltak):
'''Decomposes the k-th order trend filtering matrix into a c-compatible set
of arrays.'''
if not isspmatrix_coo(deltak):
deltak = coo_matrix(deltak)
dk_rows = deltak.shape[0]
dk_rowbreaks = np.cumsum(deltak.getnnz(1), dtype="int32")
dk_cols = deltak.col.astyp... | [
"def",
"decompose_delta",
"(",
"deltak",
")",
":",
"if",
"not",
"isspmatrix_coo",
"(",
"deltak",
")",
":",
"deltak",
"=",
"coo_matrix",
"(",
"deltak",
")",
"dk_rows",
"=",
"deltak",
".",
"shape",
"[",
"0",
"]",
"dk_rowbreaks",
"=",
"np",
".",
"cumsum",
... | Decomposes the k-th order trend filtering matrix into a c-compatible set
of arrays. | [
"Decomposes",
"the",
"k",
"-",
"th",
"order",
"trend",
"filtering",
"matrix",
"into",
"a",
"c",
"-",
"compatible",
"set",
"of",
"arrays",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L400-L409 | train |
tansey/gfl | pygfl/utils.py | matrix_from_edges | def matrix_from_edges(edges):
'''Returns a sparse penalty matrix (D) from a list of edge pairs. Each edge
can have an optional weight associated with it.'''
max_col = 0
cols = []
rows = []
vals = []
if type(edges) is defaultdict:
edge_list = []
for i, neighbors in edges.items... | python | def matrix_from_edges(edges):
'''Returns a sparse penalty matrix (D) from a list of edge pairs. Each edge
can have an optional weight associated with it.'''
max_col = 0
cols = []
rows = []
vals = []
if type(edges) is defaultdict:
edge_list = []
for i, neighbors in edges.items... | [
"def",
"matrix_from_edges",
"(",
"edges",
")",
":",
"max_col",
"=",
"0",
"cols",
"=",
"[",
"]",
"rows",
"=",
"[",
"]",
"vals",
"=",
"[",
"]",
"if",
"type",
"(",
"edges",
")",
"is",
"defaultdict",
":",
"edge_list",
"=",
"[",
"]",
"for",
"i",
",",
... | Returns a sparse penalty matrix (D) from a list of edge pairs. Each edge
can have an optional weight associated with it. | [
"Returns",
"a",
"sparse",
"penalty",
"matrix",
"(",
"D",
")",
"from",
"a",
"list",
"of",
"edge",
"pairs",
".",
"Each",
"edge",
"can",
"have",
"an",
"optional",
"weight",
"associated",
"with",
"it",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L411-L436 | train |
tansey/gfl | pygfl/utils.py | ks_distance | def ks_distance(a, b):
'''Get the Kolmogorov-Smirnov (KS) distance between two densities a and b.'''
if len(a.shape) == 1:
return np.max(np.abs(a.cumsum() - b.cumsum()))
return np.max(np.abs(a.cumsum(axis=1) - b.cumsum(axis=1)), axis=1) | python | def ks_distance(a, b):
'''Get the Kolmogorov-Smirnov (KS) distance between two densities a and b.'''
if len(a.shape) == 1:
return np.max(np.abs(a.cumsum() - b.cumsum()))
return np.max(np.abs(a.cumsum(axis=1) - b.cumsum(axis=1)), axis=1) | [
"def",
"ks_distance",
"(",
"a",
",",
"b",
")",
":",
"if",
"len",
"(",
"a",
".",
"shape",
")",
"==",
"1",
":",
"return",
"np",
".",
"max",
"(",
"np",
".",
"abs",
"(",
"a",
".",
"cumsum",
"(",
")",
"-",
"b",
".",
"cumsum",
"(",
")",
")",
")... | Get the Kolmogorov-Smirnov (KS) distance between two densities a and b. | [
"Get",
"the",
"Kolmogorov",
"-",
"Smirnov",
"(",
"KS",
")",
"distance",
"between",
"two",
"densities",
"a",
"and",
"b",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L438-L442 | train |
tansey/gfl | pygfl/utils.py | tv_distance | def tv_distance(a, b):
'''Get the Total Variation (TV) distance between two densities a and b.'''
if len(a.shape) == 1:
return np.sum(np.abs(a - b))
return np.sum(np.abs(a - b), axis=1) | python | def tv_distance(a, b):
'''Get the Total Variation (TV) distance between two densities a and b.'''
if len(a.shape) == 1:
return np.sum(np.abs(a - b))
return np.sum(np.abs(a - b), axis=1) | [
"def",
"tv_distance",
"(",
"a",
",",
"b",
")",
":",
"if",
"len",
"(",
"a",
".",
"shape",
")",
"==",
"1",
":",
"return",
"np",
".",
"sum",
"(",
"np",
".",
"abs",
"(",
"a",
"-",
"b",
")",
")",
"return",
"np",
".",
"sum",
"(",
"np",
".",
"ab... | Get the Total Variation (TV) distance between two densities a and b. | [
"Get",
"the",
"Total",
"Variation",
"(",
"TV",
")",
"distance",
"between",
"two",
"densities",
"a",
"and",
"b",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/utils.py#L444-L448 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | jdFromDate | def jdFromDate(dd, mm, yy):
'''def jdFromDate(dd, mm, yy): Compute the (integral) Julian day number of
day dd/mm/yyyy, i.e., the number of days between 1/1/4713 BC
(Julian calendar) and dd/mm/yyyy.'''
a = int((14 - mm) / 12.)
y = yy + 4800 - a
m = mm + 12 * a - 3
jd = dd + int((153 * m + 2) ... | python | def jdFromDate(dd, mm, yy):
'''def jdFromDate(dd, mm, yy): Compute the (integral) Julian day number of
day dd/mm/yyyy, i.e., the number of days between 1/1/4713 BC
(Julian calendar) and dd/mm/yyyy.'''
a = int((14 - mm) / 12.)
y = yy + 4800 - a
m = mm + 12 * a - 3
jd = dd + int((153 * m + 2) ... | [
"def",
"jdFromDate",
"(",
"dd",
",",
"mm",
",",
"yy",
")",
":",
"a",
"=",
"int",
"(",
"(",
"14",
"-",
"mm",
")",
"/",
"12.",
")",
"y",
"=",
"yy",
"+",
"4800",
"-",
"a",
"m",
"=",
"mm",
"+",
"12",
"*",
"a",
"-",
"3",
"jd",
"=",
"dd",
"... | def jdFromDate(dd, mm, yy): Compute the (integral) Julian day number of
day dd/mm/yyyy, i.e., the number of days between 1/1/4713 BC
(Julian calendar) and dd/mm/yyyy. | [
"def",
"jdFromDate",
"(",
"dd",
"mm",
"yy",
")",
":",
"Compute",
"the",
"(",
"integral",
")",
"Julian",
"day",
"number",
"of",
"day",
"dd",
"/",
"mm",
"/",
"yyyy",
"i",
".",
"e",
".",
"the",
"number",
"of",
"days",
"between",
"1",
"/",
"1",
"/",
... | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L10-L23 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | jdToDate | def jdToDate(jd):
'''def jdToDate(jd): Convert a Julian day number to day/month/year.
jd is an integer.'''
if (jd > 2299160):
# After 5/10/1582, Gregorian calendar
a = jd + 32044
b = int((4 * a + 3) / 146097.)
c = a - int((b * 146097) / 4.)
else:
... | python | def jdToDate(jd):
'''def jdToDate(jd): Convert a Julian day number to day/month/year.
jd is an integer.'''
if (jd > 2299160):
# After 5/10/1582, Gregorian calendar
a = jd + 32044
b = int((4 * a + 3) / 146097.)
c = a - int((b * 146097) / 4.)
else:
... | [
"def",
"jdToDate",
"(",
"jd",
")",
":",
"if",
"(",
"jd",
">",
"2299160",
")",
":",
"# After 5/10/1582, Gregorian calendar",
"a",
"=",
"jd",
"+",
"32044",
"b",
"=",
"int",
"(",
"(",
"4",
"*",
"a",
"+",
"3",
")",
"/",
"146097.",
")",
"c",
"=",
"a",... | def jdToDate(jd): Convert a Julian day number to day/month/year.
jd is an integer. | [
"def",
"jdToDate",
"(",
"jd",
")",
":",
"Convert",
"a",
"Julian",
"day",
"number",
"to",
"day",
"/",
"month",
"/",
"year",
".",
"jd",
"is",
"an",
"integer",
"."
] | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L26-L43 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | NewMoon | def NewMoon(k):
'''def NewMoon(k): Compute the time of the k-th new moon after
the new moon of 1/1/1900 13:52 UCT (measured as the number of
days since 1/1/4713 BC noon UCT, e.g., 2451545.125 is 1/1/2000 15:00 UTC.
Returns a floating number, e.g., 2415079.9758617813 for k=2 or
2414961.935157746 for ... | python | def NewMoon(k):
'''def NewMoon(k): Compute the time of the k-th new moon after
the new moon of 1/1/1900 13:52 UCT (measured as the number of
days since 1/1/4713 BC noon UCT, e.g., 2451545.125 is 1/1/2000 15:00 UTC.
Returns a floating number, e.g., 2415079.9758617813 for k=2 or
2414961.935157746 for ... | [
"def",
"NewMoon",
"(",
"k",
")",
":",
"# Time in Julian centuries from 1900 January 0.5",
"T",
"=",
"k",
"/",
"1236.85",
"T2",
"=",
"T",
"*",
"T",
"T3",
"=",
"T2",
"*",
"T",
"dr",
"=",
"math",
".",
"pi",
"/",
"180.",
"Jd1",
"=",
"2415020.75933",
"+",
... | def NewMoon(k): Compute the time of the k-th new moon after
the new moon of 1/1/1900 13:52 UCT (measured as the number of
days since 1/1/4713 BC noon UCT, e.g., 2451545.125 is 1/1/2000 15:00 UTC.
Returns a floating number, e.g., 2415079.9758617813 for k=2 or
2414961.935157746 for k=-2. | [
"def",
"NewMoon",
"(",
"k",
")",
":",
"Compute",
"the",
"time",
"of",
"the",
"k",
"-",
"th",
"new",
"moon",
"after",
"the",
"new",
"moon",
"of",
"1",
"/",
"1",
"/",
"1900",
"13",
":",
"52",
"UCT",
"(",
"measured",
"as",
"the",
"number",
"of",
"... | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L46-L90 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | SunLongitude | def SunLongitude(jdn):
'''def SunLongitude(jdn): Compute the longitude of the sun at any time.
Parameter: floating number jdn, the number of days since 1/1/4713 BC noon.
'''
T = (jdn - 2451545.0) / 36525.
# Time in Julian centuries
# from 2000-01-01 12:00:00 GMT
T2 = T * T
dr = math.pi /... | python | def SunLongitude(jdn):
'''def SunLongitude(jdn): Compute the longitude of the sun at any time.
Parameter: floating number jdn, the number of days since 1/1/4713 BC noon.
'''
T = (jdn - 2451545.0) / 36525.
# Time in Julian centuries
# from 2000-01-01 12:00:00 GMT
T2 = T * T
dr = math.pi /... | [
"def",
"SunLongitude",
"(",
"jdn",
")",
":",
"T",
"=",
"(",
"jdn",
"-",
"2451545.0",
")",
"/",
"36525.",
"# Time in Julian centuries",
"# from 2000-01-01 12:00:00 GMT",
"T2",
"=",
"T",
"*",
"T",
"dr",
"=",
"math",
".",
"pi",
"/",
"180.",
"# degree to radian"... | def SunLongitude(jdn): Compute the longitude of the sun at any time.
Parameter: floating number jdn, the number of days since 1/1/4713 BC noon. | [
"def",
"SunLongitude",
"(",
"jdn",
")",
":",
"Compute",
"the",
"longitude",
"of",
"the",
"sun",
"at",
"any",
"time",
".",
"Parameter",
":",
"floating",
"number",
"jdn",
"the",
"number",
"of",
"days",
"since",
"1",
"/",
"1",
"/",
"4713",
"BC",
"noon",
... | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L93-L115 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | getLunarMonth11 | def getLunarMonth11(yy, timeZone):
'''def getLunarMonth11(yy, timeZone): Find the day that starts the luner month
11of the given year for the given time zone.'''
# off = jdFromDate(31, 12, yy) \
# - 2415021.076998695
off = jdFromDate(31, 12, yy) - 2415021.
k = int(off / 29.530588853)... | python | def getLunarMonth11(yy, timeZone):
'''def getLunarMonth11(yy, timeZone): Find the day that starts the luner month
11of the given year for the given time zone.'''
# off = jdFromDate(31, 12, yy) \
# - 2415021.076998695
off = jdFromDate(31, 12, yy) - 2415021.
k = int(off / 29.530588853)... | [
"def",
"getLunarMonth11",
"(",
"yy",
",",
"timeZone",
")",
":",
"# off = jdFromDate(31, 12, yy) \\",
"# - 2415021.076998695",
"off",
"=",
"jdFromDate",
"(",
"31",
",",
"12",
",",
"yy",
")",
"-",
"2415021.",
"k",
"=",
"int",
"(",
"off",
"/",
"29.5305... | def getLunarMonth11(yy, timeZone): Find the day that starts the luner month
11of the given year for the given time zone. | [
"def",
"getLunarMonth11",
"(",
"yy",
"timeZone",
")",
":",
"Find",
"the",
"day",
"that",
"starts",
"the",
"luner",
"month",
"11of",
"the",
"given",
"year",
"for",
"the",
"given",
"time",
"zone",
"."
] | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L153-L165 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | getLeapMonthOffset | def getLeapMonthOffset(a11, timeZone):
'''def getLeapMonthOffset(a11, timeZone): Find the index of the leap month
after the month starting on the day a11.'''
k = int((a11 - 2415021.076998695) / 29.530588853 + 0.5)
last = 0
i = 1 # start with month following lunar month 11
arc = getSunLongitude(... | python | def getLeapMonthOffset(a11, timeZone):
'''def getLeapMonthOffset(a11, timeZone): Find the index of the leap month
after the month starting on the day a11.'''
k = int((a11 - 2415021.076998695) / 29.530588853 + 0.5)
last = 0
i = 1 # start with month following lunar month 11
arc = getSunLongitude(... | [
"def",
"getLeapMonthOffset",
"(",
"a11",
",",
"timeZone",
")",
":",
"k",
"=",
"int",
"(",
"(",
"a11",
"-",
"2415021.076998695",
")",
"/",
"29.530588853",
"+",
"0.5",
")",
"last",
"=",
"0",
"i",
"=",
"1",
"# start with month following lunar month 11",
"arc",
... | def getLeapMonthOffset(a11, timeZone): Find the index of the leap month
after the month starting on the day a11. | [
"def",
"getLeapMonthOffset",
"(",
"a11",
"timeZone",
")",
":",
"Find",
"the",
"index",
"of",
"the",
"leap",
"month",
"after",
"the",
"month",
"starting",
"on",
"the",
"day",
"a11",
"."
] | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L168-L184 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | S2L | def S2L(dd, mm, yy, timeZone=7):
'''def S2L(dd, mm, yy, timeZone = 7): Convert solar date dd/mm/yyyy to
the corresponding lunar date.'''
dayNumber = jdFromDate(dd, mm, yy)
k = int((dayNumber - 2415021.076998695) / 29.530588853)
monthStart = getNewMoonDay(k + 1, timeZone)
if (monthStart > dayNumb... | python | def S2L(dd, mm, yy, timeZone=7):
'''def S2L(dd, mm, yy, timeZone = 7): Convert solar date dd/mm/yyyy to
the corresponding lunar date.'''
dayNumber = jdFromDate(dd, mm, yy)
k = int((dayNumber - 2415021.076998695) / 29.530588853)
monthStart = getNewMoonDay(k + 1, timeZone)
if (monthStart > dayNumb... | [
"def",
"S2L",
"(",
"dd",
",",
"mm",
",",
"yy",
",",
"timeZone",
"=",
"7",
")",
":",
"dayNumber",
"=",
"jdFromDate",
"(",
"dd",
",",
"mm",
",",
"yy",
")",
"k",
"=",
"int",
"(",
"(",
"dayNumber",
"-",
"2415021.076998695",
")",
"/",
"29.530588853",
... | def S2L(dd, mm, yy, timeZone = 7): Convert solar date dd/mm/yyyy to
the corresponding lunar date. | [
"def",
"S2L",
"(",
"dd",
"mm",
"yy",
"timeZone",
"=",
"7",
")",
":",
"Convert",
"solar",
"date",
"dd",
"/",
"mm",
"/",
"yyyy",
"to",
"the",
"corresponding",
"lunar",
"date",
"."
] | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L187-L223 | train |
doanguyen/lasotuvi | lasotuvi/Lich_HND.py | L2S | def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ=7):
'''def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ = 7): Convert a lunar date
to the corresponding solar date.'''
if (lunarM < 11):
a11 = getLunarMonth11(lunarY - 1, tZ)
b11 = getLunarMonth11(lunarY, tZ)
else:
a11 = getLunarMonth11(... | python | def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ=7):
'''def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ = 7): Convert a lunar date
to the corresponding solar date.'''
if (lunarM < 11):
a11 = getLunarMonth11(lunarY - 1, tZ)
b11 = getLunarMonth11(lunarY, tZ)
else:
a11 = getLunarMonth11(... | [
"def",
"L2S",
"(",
"lunarD",
",",
"lunarM",
",",
"lunarY",
",",
"lunarLeap",
",",
"tZ",
"=",
"7",
")",
":",
"if",
"(",
"lunarM",
"<",
"11",
")",
":",
"a11",
"=",
"getLunarMonth11",
"(",
"lunarY",
"-",
"1",
",",
"tZ",
")",
"b11",
"=",
"getLunarMon... | def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ = 7): Convert a lunar date
to the corresponding solar date. | [
"def",
"L2S",
"(",
"lunarD",
"lunarM",
"lunarY",
"lunarLeap",
"tZ",
"=",
"7",
")",
":",
"Convert",
"a",
"lunar",
"date",
"to",
"the",
"corresponding",
"solar",
"date",
"."
] | 98383a3056f0a0633d6937d364c37eb788661c0d | https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/Lich_HND.py#L226-L250 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.hasMZSignature | def hasMZSignature(self, rd):
"""
Check for MZ signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the MZ signature. Otherwise, False.
"""
rd.setOffset(0)
sign = rd.rea... | python | def hasMZSignature(self, rd):
"""
Check for MZ signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the MZ signature. Otherwise, False.
"""
rd.setOffset(0)
sign = rd.rea... | [
"def",
"hasMZSignature",
"(",
"self",
",",
"rd",
")",
":",
"rd",
".",
"setOffset",
"(",
"0",
")",
"sign",
"=",
"rd",
".",
"read",
"(",
"2",
")",
"if",
"sign",
"==",
"\"MZ\"",
":",
"return",
"True",
"return",
"False"
] | Check for MZ signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the MZ signature. Otherwise, False. | [
"Check",
"for",
"MZ",
"signature",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L134-L148 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.hasPESignature | def hasPESignature(self, rd):
"""
Check for PE signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the PE signature. Otherwise, False.
"""
rd.setOffset(0)
e_lfanew_offse... | python | def hasPESignature(self, rd):
"""
Check for PE signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the PE signature. Otherwise, False.
"""
rd.setOffset(0)
e_lfanew_offse... | [
"def",
"hasPESignature",
"(",
"self",
",",
"rd",
")",
":",
"rd",
".",
"setOffset",
"(",
"0",
")",
"e_lfanew_offset",
"=",
"unpack",
"(",
"\"<L\"",
",",
"rd",
".",
"readAt",
"(",
"0x3c",
",",
"4",
")",
")",
"[",
"0",
"]",
"sign",
"=",
"rd",
".",
... | Check for PE signature.
@type rd: L{ReadData}
@param rd: A L{ReadData} object.
@rtype: bool
@return: True is the given L{ReadData} stream has the PE signature. Otherwise, False. | [
"Check",
"for",
"PE",
"signature",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L150-L165 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.validate | def validate(self):
"""
Performs validations over some fields of the PE structure to determine if the loaded file has a valid PE format.
@raise PEException: If an invalid value is found into the PE instance.
"""
# Ange Albertini (@angie4771) can kill me for this! :)
... | python | def validate(self):
"""
Performs validations over some fields of the PE structure to determine if the loaded file has a valid PE format.
@raise PEException: If an invalid value is found into the PE instance.
"""
# Ange Albertini (@angie4771) can kill me for this! :)
... | [
"def",
"validate",
"(",
"self",
")",
":",
"# Ange Albertini (@angie4771) can kill me for this! :)",
"if",
"self",
".",
"dosHeader",
".",
"e_magic",
".",
"value",
"!=",
"consts",
".",
"MZ_SIGNATURE",
":",
"raise",
"excep",
".",
"PEException",
"(",
"\"Invalid MZ signa... | Performs validations over some fields of the PE structure to determine if the loaded file has a valid PE format.
@raise PEException: If an invalid value is found into the PE instance. | [
"Performs",
"validations",
"over",
"some",
"fields",
"of",
"the",
"PE",
"structure",
"to",
"determine",
"if",
"the",
"loaded",
"file",
"has",
"a",
"valid",
"PE",
"format",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L167-L184 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.readFile | def readFile(self, pathToFile):
"""
Returns data from a file.
@type pathToFile: str
@param pathToFile: Path to the file.
@rtype: str
@return: The data from file.
"""
fd = open(pathToFile, "rb")
data = fd.read()
fd.close()... | python | def readFile(self, pathToFile):
"""
Returns data from a file.
@type pathToFile: str
@param pathToFile: Path to the file.
@rtype: str
@return: The data from file.
"""
fd = open(pathToFile, "rb")
data = fd.read()
fd.close()... | [
"def",
"readFile",
"(",
"self",
",",
"pathToFile",
")",
":",
"fd",
"=",
"open",
"(",
"pathToFile",
",",
"\"rb\"",
")",
"data",
"=",
"fd",
".",
"read",
"(",
")",
"fd",
".",
"close",
"(",
")",
"return",
"data"
] | Returns data from a file.
@type pathToFile: str
@param pathToFile: Path to the file.
@rtype: str
@return: The data from file. | [
"Returns",
"data",
"from",
"a",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L186-L199 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.write | def write(self, filename = ""):
"""
Writes data from L{PE} object to a file.
@rtype: str
@return: The L{PE} stream data.
@raise IOError: If the file could not be opened for write operations.
"""
file_data = str(self)
if filename:
try:... | python | def write(self, filename = ""):
"""
Writes data from L{PE} object to a file.
@rtype: str
@return: The L{PE} stream data.
@raise IOError: If the file could not be opened for write operations.
"""
file_data = str(self)
if filename:
try:... | [
"def",
"write",
"(",
"self",
",",
"filename",
"=",
"\"\"",
")",
":",
"file_data",
"=",
"str",
"(",
"self",
")",
"if",
"filename",
":",
"try",
":",
"self",
".",
"__write",
"(",
"filename",
",",
"file_data",
")",
"except",
"IOError",
":",
"raise",
"IOE... | Writes data from L{PE} object to a file.
@rtype: str
@return: The L{PE} stream data.
@raise IOError: If the file could not be opened for write operations. | [
"Writes",
"data",
"from",
"L",
"{",
"PE",
"}",
"object",
"to",
"a",
"file",
".",
"@rtype",
":",
"str",
"@return",
":",
"The",
"L",
"{",
"PE",
"}",
"stream",
"data",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L201-L217 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.__write | def __write(self, thePath, theData):
"""
Write data to a file.
@type thePath: str
@param thePath: The file path.
@type theData: str
@param theData: The data to write.
"""
fd = open(thePath, "wb")
fd.write(theData)
fd.c... | python | def __write(self, thePath, theData):
"""
Write data to a file.
@type thePath: str
@param thePath: The file path.
@type theData: str
@param theData: The data to write.
"""
fd = open(thePath, "wb")
fd.write(theData)
fd.c... | [
"def",
"__write",
"(",
"self",
",",
"thePath",
",",
"theData",
")",
":",
"fd",
"=",
"open",
"(",
"thePath",
",",
"\"wb\"",
")",
"fd",
".",
"write",
"(",
"theData",
")",
"fd",
".",
"close",
"(",
")"
] | Write data to a file.
@type thePath: str
@param thePath: The file path.
@type theData: str
@param theData: The data to write. | [
"Write",
"data",
"to",
"a",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L219-L231 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._updateDirectoriesData | def _updateDirectoriesData(self, peStr):
"""
Updates the data in every L{Directory} object.
@type peStr: str
@param peStr: C{str} representation of the L{PE} object.
@rtype: str
@return: A C{str} representation of the L{PE} object.
"""
da... | python | def _updateDirectoriesData(self, peStr):
"""
Updates the data in every L{Directory} object.
@type peStr: str
@param peStr: C{str} representation of the L{PE} object.
@rtype: str
@return: A C{str} representation of the L{PE} object.
"""
da... | [
"def",
"_updateDirectoriesData",
"(",
"self",
",",
"peStr",
")",
":",
"dataDirs",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dataDirectory",
"wr",
"=",
"utils",
".",
"WriteData",
"(",
"data",
")",
"for",
"dir",
"in",
"dataDirs",
":",
"data... | Updates the data in every L{Directory} object.
@type peStr: str
@param peStr: C{str} representation of the L{PE} object.
@rtype: str
@return: A C{str} representation of the L{PE} object. | [
"Updates",
"the",
"data",
"in",
"every",
"L",
"{",
"Directory",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L247-L266 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._getPaddingDataToSectionOffset | def _getPaddingDataToSectionOffset(self):
"""
Returns the data between the last section header and the begenning of data from the first section.
@rtype: str
@return: Data between last section header and the begenning of the first section.
"""
start = self._getPad... | python | def _getPaddingDataToSectionOffset(self):
"""
Returns the data between the last section header and the begenning of data from the first section.
@rtype: str
@return: Data between last section header and the begenning of the first section.
"""
start = self._getPad... | [
"def",
"_getPaddingDataToSectionOffset",
"(",
"self",
")",
":",
"start",
"=",
"self",
".",
"_getPaddingToSectionOffset",
"(",
")",
"end",
"=",
"self",
".",
"sectionHeaders",
"[",
"0",
"]",
".",
"pointerToRawData",
".",
"value",
"-",
"start",
"return",
"self",
... | Returns the data between the last section header and the begenning of data from the first section.
@rtype: str
@return: Data between last section header and the begenning of the first section. | [
"Returns",
"the",
"data",
"between",
"the",
"last",
"section",
"header",
"and",
"the",
"begenning",
"of",
"data",
"from",
"the",
"first",
"section",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L268-L277 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._getSignature | def _getSignature(self, readDataInstance, dataDirectoryInstance):
"""
Returns the digital signature within a digital signed PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing a PE file data.
@type dataDirector... | python | def _getSignature(self, readDataInstance, dataDirectoryInstance):
"""
Returns the digital signature within a digital signed PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing a PE file data.
@type dataDirector... | [
"def",
"_getSignature",
"(",
"self",
",",
"readDataInstance",
",",
"dataDirectoryInstance",
")",
":",
"signature",
"=",
"\"\"",
"if",
"readDataInstance",
"is",
"not",
"None",
"and",
"dataDirectoryInstance",
"is",
"not",
"None",
":",
"securityDirectory",
"=",
"data... | Returns the digital signature within a digital signed PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing a PE file data.
@type dataDirectoryInstance: L{DataDirectory}
@param dataDirectoryInstance: A L{DataDirectory} o... | [
"Returns",
"the",
"digital",
"signature",
"within",
"a",
"digital",
"signed",
"PE",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L279-L306 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._getOverlay | def _getOverlay(self, readDataInstance, sectionHdrsInstance):
"""
Returns the overlay data from the PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing the PE file data.
@type sectionHdrsInstance: L{SectionHead... | python | def _getOverlay(self, readDataInstance, sectionHdrsInstance):
"""
Returns the overlay data from the PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing the PE file data.
@type sectionHdrsInstance: L{SectionHead... | [
"def",
"_getOverlay",
"(",
"self",
",",
"readDataInstance",
",",
"sectionHdrsInstance",
")",
":",
"if",
"readDataInstance",
"is",
"not",
"None",
"and",
"sectionHdrsInstance",
"is",
"not",
"None",
":",
"# adjust the offset in readDataInstance to the RawOffset + RawSize of th... | Returns the overlay data from the PE file.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance containing the PE file data.
@type sectionHdrsInstance: L{SectionHeaders}
@param sectionHdrsInstance: A L{SectionHeaders} instance containing t... | [
"Returns",
"the",
"overlay",
"data",
"from",
"the",
"PE",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L308-L334 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getOffsetFromRva | def getOffsetFromRva(self, rva):
"""
Converts an offset to an RVA.
@type rva: int
@param rva: The RVA to be converted.
@rtype: int
@return: An integer value representing an offset in the PE file.
"""
offset = -1
s = self.getSectio... | python | def getOffsetFromRva(self, rva):
"""
Converts an offset to an RVA.
@type rva: int
@param rva: The RVA to be converted.
@rtype: int
@return: An integer value representing an offset in the PE file.
"""
offset = -1
s = self.getSectio... | [
"def",
"getOffsetFromRva",
"(",
"self",
",",
"rva",
")",
":",
"offset",
"=",
"-",
"1",
"s",
"=",
"self",
".",
"getSectionByRva",
"(",
"rva",
")",
"if",
"s",
"!=",
"offset",
":",
"offset",
"=",
"(",
"rva",
"-",
"self",
".",
"sectionHeaders",
"[",
"s... | Converts an offset to an RVA.
@type rva: int
@param rva: The RVA to be converted.
@rtype: int
@return: An integer value representing an offset in the PE file. | [
"Converts",
"an",
"offset",
"to",
"an",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L336-L354 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getRvaFromOffset | def getRvaFromOffset(self, offset):
"""
Converts a RVA to an offset.
@type offset: int
@param offset: The offset value to be converted to RVA.
@rtype: int
@return: The RVA obtained from the given offset.
"""
rva = -1
s = self.getS... | python | def getRvaFromOffset(self, offset):
"""
Converts a RVA to an offset.
@type offset: int
@param offset: The offset value to be converted to RVA.
@rtype: int
@return: The RVA obtained from the given offset.
"""
rva = -1
s = self.getS... | [
"def",
"getRvaFromOffset",
"(",
"self",
",",
"offset",
")",
":",
"rva",
"=",
"-",
"1",
"s",
"=",
"self",
".",
"getSectionByOffset",
"(",
"offset",
")",
"if",
"s",
":",
"rva",
"=",
"(",
"offset",
"-",
"self",
".",
"sectionHeaders",
"[",
"s",
"]",
".... | Converts a RVA to an offset.
@type offset: int
@param offset: The offset value to be converted to RVA.
@rtype: int
@return: The RVA obtained from the given offset. | [
"Converts",
"a",
"RVA",
"to",
"an",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L356-L372 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getSectionByOffset | def getSectionByOffset(self, offset):
"""
Given an offset in the file, tries to determine the section this offset belong to.
@type offset: int
@param offset: Offset value.
@rtype: int
@return: An index, starting at 0, that represents the section the give... | python | def getSectionByOffset(self, offset):
"""
Given an offset in the file, tries to determine the section this offset belong to.
@type offset: int
@param offset: Offset value.
@rtype: int
@return: An index, starting at 0, that represents the section the give... | [
"def",
"getSectionByOffset",
"(",
"self",
",",
"offset",
")",
":",
"index",
"=",
"-",
"1",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"sectionHeaders",
")",
")",
":",
"if",
"(",
"offset",
"<",
"self",
".",
"sectionHeaders",
"[",
"i",
... | Given an offset in the file, tries to determine the section this offset belong to.
@type offset: int
@param offset: Offset value.
@rtype: int
@return: An index, starting at 0, that represents the section the given offset belongs to. | [
"Given",
"an",
"offset",
"in",
"the",
"file",
"tries",
"to",
"determine",
"the",
"section",
"this",
"offset",
"belong",
"to",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L374-L389 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getSectionIndexByName | def getSectionIndexByName(self, name):
"""
Given a string representing a section name, tries to find the section index.
@type name: str
@param name: A section name.
@rtype: int
@return: The index, starting at 0, of the section.
"""
index = -1
... | python | def getSectionIndexByName(self, name):
"""
Given a string representing a section name, tries to find the section index.
@type name: str
@param name: A section name.
@rtype: int
@return: The index, starting at 0, of the section.
"""
index = -1
... | [
"def",
"getSectionIndexByName",
"(",
"self",
",",
"name",
")",
":",
"index",
"=",
"-",
"1",
"if",
"name",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"sectionHeaders",
")",
")",
":",
"if",
"self",
".",
"sectionHeaders",
"[",
"i",
... | Given a string representing a section name, tries to find the section index.
@type name: str
@param name: A section name.
@rtype: int
@return: The index, starting at 0, of the section. | [
"Given",
"a",
"string",
"representing",
"a",
"section",
"name",
"tries",
"to",
"find",
"the",
"section",
"index",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L391-L408 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getSectionByRva | def getSectionByRva(self, rva):
"""
Given a RVA in the file, tries to determine the section this RVA belongs to.
@type rva: int
@param rva: RVA value.
@rtype: int
@return: An index, starting at 1, that represents the section the given RVA belongs to.
... | python | def getSectionByRva(self, rva):
"""
Given a RVA in the file, tries to determine the section this RVA belongs to.
@type rva: int
@param rva: RVA value.
@rtype: int
@return: An index, starting at 1, that represents the section the given RVA belongs to.
... | [
"def",
"getSectionByRva",
"(",
"self",
",",
"rva",
")",
":",
"index",
"=",
"-",
"1",
"if",
"rva",
"<",
"self",
".",
"sectionHeaders",
"[",
"0",
"]",
".",
"virtualAddress",
".",
"value",
":",
"return",
"index",
"for",
"i",
"in",
"range",
"(",
"len",
... | Given a RVA in the file, tries to determine the section this RVA belongs to.
@type rva: int
@param rva: RVA value.
@rtype: int
@return: An index, starting at 1, that represents the section the given RVA belongs to. | [
"Given",
"a",
"RVA",
"in",
"the",
"file",
"tries",
"to",
"determine",
"the",
"section",
"this",
"RVA",
"belongs",
"to",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L410-L437 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._getPaddingToSectionOffset | def _getPaddingToSectionOffset(self):
"""
Returns the offset to last section header present in the PE file.
@rtype: int
@return: The offset where the end of the last section header resides in the PE file.
"""
return len(str(self.dosHeader) + str(self.dosStub) + s... | python | def _getPaddingToSectionOffset(self):
"""
Returns the offset to last section header present in the PE file.
@rtype: int
@return: The offset where the end of the last section header resides in the PE file.
"""
return len(str(self.dosHeader) + str(self.dosStub) + s... | [
"def",
"_getPaddingToSectionOffset",
"(",
"self",
")",
":",
"return",
"len",
"(",
"str",
"(",
"self",
".",
"dosHeader",
")",
"+",
"str",
"(",
"self",
".",
"dosStub",
")",
"+",
"str",
"(",
"self",
".",
"ntHeaders",
")",
"+",
"str",
"(",
"self",
".",
... | Returns the offset to last section header present in the PE file.
@rtype: int
@return: The offset where the end of the last section header resides in the PE file. | [
"Returns",
"the",
"offset",
"to",
"last",
"section",
"header",
"present",
"in",
"the",
"PE",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L449-L456 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.fullLoad | def fullLoad(self):
"""Parse all the directories in the PE file."""
self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE) | python | def fullLoad(self):
"""Parse all the directories in the PE file."""
self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE) | [
"def",
"fullLoad",
"(",
"self",
")",
":",
"self",
".",
"_parseDirectories",
"(",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dataDirectory",
",",
"self",
".",
"PE_TYPE",
")"
] | Parse all the directories in the PE file. | [
"Parse",
"all",
"the",
"directories",
"in",
"the",
"PE",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L458-L460 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._internalParse | def _internalParse(self, readDataInstance):
"""
Populates the attributes of the L{PE} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance with the data of a PE file.
"""
self.dosHeader = DosHeader.parse(readDataInstance)
... | python | def _internalParse(self, readDataInstance):
"""
Populates the attributes of the L{PE} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance with the data of a PE file.
"""
self.dosHeader = DosHeader.parse(readDataInstance)
... | [
"def",
"_internalParse",
"(",
"self",
",",
"readDataInstance",
")",
":",
"self",
".",
"dosHeader",
"=",
"DosHeader",
".",
"parse",
"(",
"readDataInstance",
")",
"self",
".",
"dosStub",
"=",
"readDataInstance",
".",
"read",
"(",
"self",
".",
"dosHeader",
".",... | Populates the attributes of the L{PE} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} instance with the data of a PE file. | [
"Populates",
"the",
"attributes",
"of",
"the",
"L",
"{",
"PE",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L462-L493 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.addSection | def addSection(self, data, name =".pype32\x00", flags = 0x60000000):
"""
Adds a new section to the existing L{PE} instance.
@type data: str
@param data: The data to be added in the new section.
@type name: str
@param name: (Optional) The name for the new... | python | def addSection(self, data, name =".pype32\x00", flags = 0x60000000):
"""
Adds a new section to the existing L{PE} instance.
@type data: str
@param data: The data to be added in the new section.
@type name: str
@param name: (Optional) The name for the new... | [
"def",
"addSection",
"(",
"self",
",",
"data",
",",
"name",
"=",
"\".pype32\\x00\"",
",",
"flags",
"=",
"0x60000000",
")",
":",
"fa",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"fileAlignment",
".",
"value",
"sa",
"=",
"self",
".",
"ntHea... | Adds a new section to the existing L{PE} instance.
@type data: str
@param data: The data to be added in the new section.
@type name: str
@param name: (Optional) The name for the new section.
@type flags: int
@param flags: (Optional) The attribut... | [
"Adds",
"a",
"new",
"section",
"to",
"the",
"existing",
"L",
"{",
"PE",
"}",
"instance",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L495-L532 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.extendSection | def extendSection(self, sectionIndex, data):
"""
Extends an existing section in the L{PE} instance.
@type sectionIndex: int
@param sectionIndex: The index for the section to be extended.
@type data: str
@param data: The data to include in the section.
... | python | def extendSection(self, sectionIndex, data):
"""
Extends an existing section in the L{PE} instance.
@type sectionIndex: int
@param sectionIndex: The index for the section to be extended.
@type data: str
@param data: The data to include in the section.
... | [
"def",
"extendSection",
"(",
"self",
",",
"sectionIndex",
",",
"data",
")",
":",
"fa",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"fileAlignment",
".",
"value",
"sa",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"sectionAlignmen... | Extends an existing section in the L{PE} instance.
@type sectionIndex: int
@param sectionIndex: The index for the section to be extended.
@type data: str
@param data: The data to include in the section.
@raise IndexError: If an invalid C{sectionIndex} w... | [
"Extends",
"an",
"existing",
"section",
"in",
"the",
"L",
"{",
"PE",
"}",
"instance",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L534-L616 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._fixPe | def _fixPe(self):
"""
Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage.
"""
sizeOfImage = 0
for sh in self.sectionHeaders:
sizeOfImage += sh.misc
self.ntHeaders.optionaHeader.sizeoOfImage.value = self._sectio... | python | def _fixPe(self):
"""
Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage.
"""
sizeOfImage = 0
for sh in self.sectionHeaders:
sizeOfImage += sh.misc
self.ntHeaders.optionaHeader.sizeoOfImage.value = self._sectio... | [
"def",
"_fixPe",
"(",
"self",
")",
":",
"sizeOfImage",
"=",
"0",
"for",
"sh",
"in",
"self",
".",
"sectionHeaders",
":",
"sizeOfImage",
"+=",
"sh",
".",
"misc",
"self",
".",
"ntHeaders",
".",
"optionaHeader",
".",
"sizeoOfImage",
".",
"value",
"=",
"self"... | Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage. | [
"Fixes",
"the",
"necessary",
"fields",
"in",
"the",
"PE",
"file",
"instance",
"in",
"order",
"to",
"create",
"a",
"valid",
"PE32",
".",
"i",
".",
"e",
".",
"SizeOfImage",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L618-L625 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._adjustFileAlignment | def _adjustFileAlignment(self, value, fileAlignment):
"""
Align a value to C{FileAligment}.
@type value: int
@param value: The value to align.
@type fileAlignment: int
@param fileAlignment: The value to be used to align the C{value} parameter.
... | python | def _adjustFileAlignment(self, value, fileAlignment):
"""
Align a value to C{FileAligment}.
@type value: int
@param value: The value to align.
@type fileAlignment: int
@param fileAlignment: The value to be used to align the C{value} parameter.
... | [
"def",
"_adjustFileAlignment",
"(",
"self",
",",
"value",
",",
"fileAlignment",
")",
":",
"if",
"fileAlignment",
">",
"consts",
".",
"DEFAULT_FILE_ALIGNMENT",
":",
"if",
"not",
"utils",
".",
"powerOfTwo",
"(",
"fileAlignment",
")",
":",
"print",
"\"Warning: File... | Align a value to C{FileAligment}.
@type value: int
@param value: The value to align.
@type fileAlignment: int
@param fileAlignment: The value to be used to align the C{value} parameter.
@rtype: int
@return: The aligned value. | [
"Align",
"a",
"value",
"to",
"C",
"{",
"FileAligment",
"}",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L627-L650 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._adjustSectionAlignment | def _adjustSectionAlignment(self, value, fileAlignment, sectionAlignment):
"""
Align a value to C{SectionAligment}.
@type value: int
@param value: The value to be aligned.
@type fileAlignment: int
@param fileAlignment: The value to be used as C{FileAlig... | python | def _adjustSectionAlignment(self, value, fileAlignment, sectionAlignment):
"""
Align a value to C{SectionAligment}.
@type value: int
@param value: The value to be aligned.
@type fileAlignment: int
@param fileAlignment: The value to be used as C{FileAlig... | [
"def",
"_adjustSectionAlignment",
"(",
"self",
",",
"value",
",",
"fileAlignment",
",",
"sectionAlignment",
")",
":",
"if",
"fileAlignment",
"<",
"consts",
".",
"DEFAULT_FILE_ALIGNMENT",
":",
"if",
"fileAligment",
"!=",
"sectionAlignment",
":",
"print",
"\"FileAlign... | Align a value to C{SectionAligment}.
@type value: int
@param value: The value to be aligned.
@type fileAlignment: int
@param fileAlignment: The value to be used as C{FileAlignment}.
@type sectionAlignment: int
@param sectionAlignment: The value... | [
"Align",
"a",
"value",
"to",
"C",
"{",
"SectionAligment",
"}",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L652-L677 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getDwordAtRva | def getDwordAtRva(self, rva):
"""
Returns a C{DWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given RVA.
"""
return datatypes.DWORD.parse(utils.... | python | def getDwordAtRva(self, rva):
"""
Returns a C{DWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given RVA.
"""
return datatypes.DWORD.parse(utils.... | [
"def",
"getDwordAtRva",
"(",
"self",
",",
"rva",
")",
":",
"return",
"datatypes",
".",
"DWORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"4",
")",
")",
")"
] | Returns a C{DWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given RVA. | [
"Returns",
"a",
"C",
"{",
"DWORD",
"}",
"from",
"a",
"given",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L679-L689 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getWordAtRva | def getWordAtRva(self, rva):
"""
Returns a C{WORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given RVA.
"""
return datatypes.WORD.parse(utils.ReadDa... | python | def getWordAtRva(self, rva):
"""
Returns a C{WORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given RVA.
"""
return datatypes.WORD.parse(utils.ReadDa... | [
"def",
"getWordAtRva",
"(",
"self",
",",
"rva",
")",
":",
"return",
"datatypes",
".",
"WORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"2",
")",
")",
")"
] | Returns a C{WORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given RVA. | [
"Returns",
"a",
"C",
"{",
"WORD",
"}",
"from",
"a",
"given",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L691-L701 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getDwordAtOffset | def getDwordAtOffset(self, offset):
"""
Returns a C{DWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given offset.
"""
return datatyp... | python | def getDwordAtOffset(self, offset):
"""
Returns a C{DWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given offset.
"""
return datatyp... | [
"def",
"getDwordAtOffset",
"(",
"self",
",",
"offset",
")",
":",
"return",
"datatypes",
".",
"DWORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtOffset",
"(",
"offset",
",",
"4",
")",
")",
")"
] | Returns a C{DWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{DWORD} from.
@rtype: L{DWORD}
@return: The L{DWORD} obtained at the given offset. | [
"Returns",
"a",
"C",
"{",
"DWORD",
"}",
"from",
"a",
"given",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L703-L713 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.