text
stringlengths
81
112k
Reads an ASCII string from the L{ReadData} stream object. @rtype: str @return: An ASCII string read form the stream. def readString(self): """ Reads an ASCII string from the L{ReadData} stream object. @rtype: str @return: An ASCII string read form the s...
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. def readAlignedString(self, align = 4): ""...
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 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...
Send a notification to channels :param message: A message 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 ...
Prepares and sends an HTTP request. Returns the HTTPResponse object. :param method: str :param path: str :return: response :rtype: HTTPResponse def request(self, method, path, params=None, headers=None, cookies=None, data=None, json=None, allow_redirects=None, timeout=N...
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...
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 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 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 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...
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 ...
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 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...
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. ...
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...
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...
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...
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. def read_igor_VJ_palindrome_parameters(sel...
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 PVJ, PdelV_given_V, PdelJ_given_J, PinsVJ, and Rvj. Parameters ---------- marginals_file_name : str File name for a IGoR model marginals file. def load_and_process_igor_mo...
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 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 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{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{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. 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 L{TLSDirectory64} object. def parse(readDataInst...
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{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{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. de...
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{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{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{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. def parse(readData...
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. def parse(readData...
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. 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{NetDirectory} object. 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 new L{NetMetaDataHeader} object. def parse(read...
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. d...
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{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{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. def parse(read...
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...
Take address paths and verifies their accuracy client-side. Also fills in all the available metadata (WIF, public key, etc) 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 availa...
Follows the solution path of the generalized lasso to find the best lambda value. 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)) ...
Run the graph-fused logit lasso with a fixed lambda penalty. 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 ...
Calculates the log-likelihood of a Polya tree bin given the beta values. 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()
This method has to be module level function :type params: Params 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, ...
:type params: Params 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',...
:type sample: 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.ge...
when a test raises an uncaught exception :param test: :param error: :return: 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...
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. def parse(readDataInstance): """ Returns a L{Directory}-like object. ...
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...
Compute Pgens from a file and output to another file. 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 T...
Creates plateaus of constant value in the data. 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 l...
Pretty-print a matrix or vector. 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, la...
Pretty-print the matrix. 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)]))
Pretty-print the vector values. 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]))
Calculate the plateaus (degrees of freedom) of a graph of beta values in linear time. 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...
Heuristic method to return the uniques within some precision in a numpy array 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: ...
Create edge lists for an arbitrary hypercube. TODO: this is probably not the fastest way. 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 enu...
Calculate the k-th order trend filtering matrix given the oriented edge incidence matrix and the value of k. 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 ...
Decomposes the k-th order trend filtering matrix into a c-compatible set of arrays. 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] ...
Returns a sparse penalty matrix (D) from a list of edge pairs. Each edge can have an optional weight associated with it. 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 = []...
Get the Kolmogorov-Smirnov (KS) distance between two densities a and b. 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))...
Get the Total Variation (TV) distance between two densities a and b. 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 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): '''def jdFromDate(dd, mm, yy): Compute the (integral) Julian day number of day dd/mm/yyyy, i.e., the number ...
def jdToDate(jd): Convert a Julian day number to day/month/year. jd is an integer. 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 ...
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): ...
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): '''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...
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): '''def getLunarMonth11(yy, timeZone): Find the day that starts the luner month 11of the given year for the given time zone.''' # off = jdFromDate...
def getLeapMonthOffset(a11, timeZone): Find the index of the leap month after the month starting on the day a11. 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...
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): '''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....
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): '''def L2S(lunarD, lunarM, lunarY, lunarLeap, tZ = 7): Convert a lunar date to the corresponding solar date.''' if (lunarM < 11): a11 = get...
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. def hasMZSignature(self, rd): """ Check for MZ signature. @type rd: L{ReadData} ...
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. def hasPESignature(self, rd): """ Check for PE signature. @type rd: L{ReadData} ...
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. def validate(self): """ Performs validations over some fields of the PE structure to determine if the ...
Returns data from a file. @type pathToFile: str @param pathToFile: Path to the file. @rtype: str @return: The data from file. def readFile(self, pathToFile): """ Returns data from a file. @type pathToFile: str @param pathToFile:...
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. def write(self, filename = ""): """ Writes data from L{PE} object to a file. @rtype: str ...
Write data to a file. @type thePath: str @param thePath: The file path. @type theData: str @param theData: The data to write. def __write(self, thePath, theData): """ Write data to a file. @type thePath: str @param thePath: The ...
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. def _updateDirectoriesData(self, peStr): """ Updates the data in e...
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. def _getPaddingDataToSectionOffset(self): """ Returns the data between the last secti...
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 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...
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. def getOffsetFromRva(self, rva): """ Converts an offset to an RVA. @type rva:...
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. def getRvaFromOffset(self, offset): """ Converts a RVA to an offset. @ty...
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. def getSectionByOffset(self, offset)...
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. def getSectionIndexByName(self, name): """ Given a string representing a section nam...
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): """ Gi...
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. def _getPaddingToSectionOffset(self): """ Returns the offset to last section header present in the PE file. ...
Parse all the directories in the PE file. def fullLoad(self): """Parse all the directories in the PE file.""" self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE)
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. def _internalParse(self, readDataInstance): """ Populates the attributes of the L{PE} object. @type r...
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...
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...
Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage. 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: ...
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. def _adjustFileAlig...
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...
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. def getDwordAtRva(self, rva): """ Returns a C{DWORD} from a given 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. def getWordAtRva(self, rva): """ Returns a C{WORD} from a given RVA. @type...
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. def getDwordAtOffset(self, offset): """ Returns a C{DWORD} from a given o...