text stringlengths 81 112k |
|---|
Parse a tensor.
def _parse_tensor(self, indices=False):
'''Parse a tensor.'''
if indices:
self.line = self._skip_lines(1)
tensor = np.zeros((3, 3))
for i in range(3):
tokens = self.line.split()
if indices:
tensor[i][0] = float(tokens[... |
Iterate over the lines and extract the required data.
def parse(self):
'''Iterate over the lines and extract the required data.'''
for self.line in self.output:
# Parse general data: charge, multiplicity, coordinates, etc.
self.index = 0
if self.line[1:13] == 'Total... |
Method executed when the event 'set' is triggered.
:param target: Object triggered
:param value: New value
:param oldvalue: Previous value
:param initiator: Column modified
:return: :raise ValidateError:
def __validate(self, target, value, oldvalue, initiator):
""" Met... |
Create an SQLAlchemy event listening the 'set' in a particular column.
:rtype : object
def __create_event(self):
""" Create an SQLAlchemy event listening the 'set' in a particular column.
:rtype : object
"""
if not event.contains(self.field, 'set', self.__validate):
... |
Remove the listener to stop the validation
def stop(self):
""" Remove the listener to stop the validation
"""
if event.contains(self.field, 'set', self.__validate):
event.remove(self.field, 'set', self.__validate) |
Restart the listener
def start(self):
""" Restart the listener
"""
if not event.contains(self.field, 'set', self.__validate):
self.__create_event() |
Nhap dai han
Args:
cucSo (TYPE): Description
gioiTinh (TYPE): Description
Returns:
TYPE: Description
def nhapDaiHan(self, cucSo, gioiTinh):
"""Nhap dai han
Args:
cucSo (TYPE): Description
gioiTinh (TYPE): Description
... |
A very easy-to-use version of GFL solver that just requires the data and
the edges.
def solve_gfl(data, edges=None, weights=None,
minlam=0.2, maxlam=1000.0, numlam=30,
alpha=0.2, inflate=2., converge=1e-6,
maxsteps=1000000, lam=None, verbose=0,
missing_val=No... |
Summary
Args:
nn (TYPE): ngay
tt (TYPE): thang
nnnn (TYPE): nam
duongLich (bool, optional): bool
timeZone (int, optional): +7 Vietnam
Returns:
TYPE: Description
Raises:
Exception: Description
def ngayThangNam(nn, tt, nnnn, duongLich=True, timeZone=... |
Summary
Args:
nn (int): ngày
tt (int): tháng
nnnn (int): năm
duongLich (bool, optional): True nếu là dương lịch, False âm lịch
timeZone (int, optional): Múi giờ
thangNhuan (bool, optional): Có phải là tháng nhuận không?
Returns:
TYPE: Description
def ca... |
chuyển đổi năm, tháng âm/dương lịch sang Can, Chi trong tiếng Việt.
Không tính đến can ngày vì phải chuyển đổi qua lịch Julius.
Hàm tìm can ngày là hàm canChiNgay(nn, tt, nnnn, duongLich=True,\
timeZone=7, thangNhuan=False)
Args:
nn (int): Ngày
tt (int):... |
Args:
tenHanh (string): Tên Hành trong ngũ hành, Kim hoặc K, Moc hoặc M,
Thuy hoặc T, Hoa hoặc H, Tho hoặc O
Returns:
Dictionary: ID của Hành, tên đầy đủ của Hành, số Cục của Hành
Raises:
Exception: Description
def nguHanh(tenHanh):
"""
Args:
tenHanh (string): ... |
Sử dụng Ngũ Hành nạp âm để tính Hành của năm.
Args:
diaChi (integer): Số thứ tự của địa chi (Tý=1, Sửu=2,...)
thienCan (integer): Số thứ tự của thiên can (Giáp=1, Ất=2,...)
Returns:
Trả về chữ viết tắt Hành của năm (K, T, H, O, M)
def nguHanhNapAm(diaChi, thienCan, xuatBanMenh=False):... |
Tìm vị trí của sao Tử vi
Args:
cuc (TYPE): Description
ngaySinhAmLich (TYPE): Description
Returns:
TYPE: Description
Raises:
Exception: Description
def timTuVi(cuc, ngaySinhAmLich):
"""Tìm vị trí của sao Tử vi
Args:
cuc (TYPE): Description
ngaySin... |
Translate a nucleotide sequence into an amino acid sequence.
Parameters
----------
ntseq : str
Nucleotide sequence composed of A, C, G, or T (uppercase or lowercase)
Returns
-------
aaseq : str
Amino acid sequence
Example
--------
>>> nt2aa('TGTGCCTGGAGTGTAGCTC... |
Represent nucleotide sequence by sequence of codon symbols.
'Translates' the nucleotide sequence into a symbolic representation of
'amino acids' where each codon gets its own unique character symbol. These
characters should be reserved only for representing the 64 individual
codons --- note that this... |
Cut genomic sequence from the right.
Parameters
----------
seq : str
Nucleotide sequence to be cut from the right
cutR : int
cutR - max_palindrome = how many nucleotides to cut from the right.
Negative cutR implies complementary palindromic insertions.
max_palindrome : int
... |
Cut genomic sequence from the left.
Parameters
----------
seq : str
Nucleotide sequence to be cut from the right
cutL : int
cutL - max_palindrome = how many nucleotides to cut from the left.
Negative cutL implies complementary palindromic insertions.
max_palindrome : int
... |
Generate the sub_codons_right dictionary of codon suffixes.
syntax of custom alphabet_files:
char: list,of,amino,acids,or,codons,separated,by,commas
Parameters
----------
alphabet_file : str
File name for a custom alphabet definition. If no file is provided, the
... |
Generate the sub_codons_left dictionary of codon prefixes.
Parameters
----------
codons_dict : dict
Dictionary, keyed by the allowed 'amino acid' symbols with the values
being lists of codons corresponding to the symbol.
Returns
-------
sub_codons_left : dict
Dictionar... |
Generate the sub_codons_right dictionary of codon suffixes.
Parameters
----------
codons_dict : dict
Dictionary, keyed by the allowed 'amino acid' symbols with the values
being lists of codons corresponding to the symbol.
Returns
-------
sub_codons_right : dict
Diction... |
Determine the type of a sequence.
Parameters
----------
seq : str
Sequence to be typed.
aa_alphabet : str
String of all characters recoginized as 'amino acids'. (i.e. the keys
of codons_dict: aa_alphabet = ''.join(codons_dict.keys()) )
Returns
-------
seq_type... |
Calculate the steady state dist of a 4 state markov transition matrix.
Parameters
----------
R : ndarray
Markov transition matrix
Returns
-------
p_ss : ndarray
Steady state probability distribution
def calc_steady_state_dist(R):
"""Calculate the steady state dist of a 4 s... |
Generate a random insertion nucleotide sequence of length ins_len.
Draws the sequence identity (for a set length) from the distribution
defined by the dinucleotide markov model of transition matrix R.
Parameters
----------
ins_len : int
Length of nucleotide sequence to be inserted.
C_R... |
Generate a productive CDR3 seq from a Monte Carlo draw of the model.
Parameters
----------
conserved_J_residues : str, optional
Conserved amino acid residues defining the CDR3 on the J side (normally
F, V, and/or W)
Returns
-------
ntseq : str
... |
Sample the genomic model for VDJ recombination events.
Returns
-------
recomb_events : dict
Dictionary of the VDJ recombination events. These are
integers determining gene choice, deletions, and number of insertions.
Example
--------
>>> sequence... |
Generate a productive CDR3 seq from a Monte Carlo draw of the model.
Parameters
----------
conserved_J_residues : str, optional
Conserved amino acid residues defining the CDR3 on the J side (normally
F, V, and/or W)
Returns
-------
ntseq : str
... |
Sample the genomic model for VDJ recombination events.
Returns
-------
recomb_events : dict
Dictionary of the VDJ recombination events. These are
integers determining gene choice, deletions, and number of insertions.
Example
--------
>>> sequence... |
Creates or updates rates for a source
def update_rates(self):
"""
Creates or updates rates for a source
"""
source, created = RateSource.objects.get_or_create(name=self.get_source_name())
source.base_currency = self.get_base_currency()
source.save()
for currency... |
Generate samples from the generalized graph trend filtering distribution via a modified Swendsen-Wang slice sampling algorithm.
Options for likelihood: gaussian, binomial, poisson. Options for prior: laplace, doublepareto.
def sample_gtf(data, D, k, likelihood='gaussian', prior='laplace',
... |
Compute Pgen for all seqs consistent with regular expression regex_seq.
Computes Pgen for a (limited vocabulary) regular expression of CDR3
amino acid sequences, conditioned on the V genes/alleles indicated in
V_usage_mask_in and the J genes/alleles in J_usage_mask_in. Please note
... |
Compute Pgen for the amino acid sequence CDR3_seq.
Conditioned on the V genes/alleles indicated in V_usage_mask_in and the
J genes/alleles in J_usage_mask_in. (Examples are TCRB sequences/model)
Parameters
----------
CDR3_seq : str
CDR3 sequence composed of... |
Compute Pgen of all seqs hamming dist 1 (in amino acids) from CDR3_seq.
Please note that this function will list out all the
sequences that are hamming distance 1 from the base sequence and then
calculate the Pgen of each sequence in succession. THIS CAN BE SLOW
as it computes Pg... |
Compute Pgen for the inframe nucleotide sequence CDR3_ntseq.
Conditioned on the V genes/alleles indicated in V_usage_mask_in and the
J genes/alleles in J_usage_mask_in. (Examples are TCRB sequences/model)
Parameters
----------
CDR3_ntseq : str
Inframe nucle... |
Format raw usage masks into lists of indices.
Usage masks allows the Pgen computation to be conditioned on the V and J
gene/allele identities. The inputted masks are lists of strings, or a
single string, of the names of the genes or alleles to be conditioned on.
The default mask ... |
List sequences that match regular expression template.
This function parses a limited regular expression vocabulary, and
lists all the sequences consistent with the regular expression. Supported
regex syntax: [] and {}. Cannot have two {} in a row. Note we can't use
Kline star (*... |
Find maximum match between CDR3_seq and ntseq from the left.
This function returns the length of the maximum length nucleotide
subsequence of ntseq contiguous from the left (or 5' end) that is
consistent with the 'amino acid' sequence CDR3_seq.
Parameters
----------
... |
Find maximum match between CDR3_seq and ntseq from the right.
This function returns the length of the maximum length nucleotide
subsequence of ntseq contiguous from the right (or 3' end) that is
consistent with the 'amino acid' sequence CDR3_seq
Parameters
----------
... |
Compute Pgen for CDR3 'amino acid' sequence CDR3_seq from VDJ model.
Conditioned on the already formatted V genes/alleles indicated in
V_usage_mask and the J genes/alleles in J_usage_mask.
(Examples are TCRB sequences/model)
Parameters
----------
CDR3_seq : st... |
Compute Pi_V.
This function returns the Pi array from the model factors of the V genomic
contributions, P(V)*P(delV|V). This corresponds to V_{x_1}.
For clarity in parsing the algorithm implementation, we include which
instance attributes are used in the method as 'param... |
Compute Pi_L.
This function returns the Pi array from the model factors of the V genomic
contributions, P(V)*P(delV|V), and the VD (N1) insertions,
first_nt_bias_insVD(m_1)PinsVD(\ell_{VD})\prod_{i=2}^{\ell_{VD}}Rvd(m_i|m_{i-1}).
This corresponds to V_{x_1}{M^{x_1}}_{x_2}.
... |
Compute Pi_J conditioned on D.
This function returns the Pi array from the model factors of the D and J
genomic contributions, P(D, J)*P(delJ|J) = P(D|J)P(J)P(delJ|J). This
corresponds to J(D)^{x_4}.
For clarity in parsing the algorithm implementation, we include which
... |
Compute Pi_JinsDJ conditioned on D.
This function returns the Pi array from the model factors of the J genomic
contributions, P(D,J)*P(delJ|J), and the DJ (N2) insertions,
first_nt_bias_insDJ(n_1)PinsDJ(\ell_{DJ})\prod_{i=2}^{\ell_{DJ}}Rdj(n_i|n_{i-1})
conditioned on D identity. T... |
Compute Pi_R.
This function returns the Pi array from the model factors of the D and J
genomic contributions, P(D, J)*P(delJ|J)P(delDl, delDr |D) and
the DJ (N2) insertions,
first_nt_bias_insDJ(n_1)PinsDJ(\ell_{DJ})\prod_{i=2}^{\ell_{DJ}}Rdj(n_i|n_{i-1}).
This corresponds t... |
Compute Pgen for CDR3 'amino acid' sequence CDR3_seq from VJ model.
Conditioned on the already formatted V genes/alleles indicated in
V_usage_mask and the J genes/alleles in J_usage_mask.
Parameters
----------
CDR3_seq : str
CDR3 sequence composed of 'amino... |
Compute Pi_V conditioned on J.
This function returns the Pi array from the model factors of the V genomic
contributions, P(V, J)*P(delV|V). This corresponds to V(J)_{x_1}.
For clarity in parsing the algorithm implementation, we include which
instance attributes are used i... |
Compute Pi_V_insVJ conditioned on J.
This function returns the Pi array from the model factors of the V genomic
contributions, P(V, J)*P(delV|V), and the VJ (N) insertions,
first_nt_bias_insVJ(m_1)PinsVJ(\ell_{VJ})\prod_{i=2}^{\ell_{VJ}}Rvj(m_i|m_{i-1}).
This corresponds to V(J)_{... |
Compute Pi_J.
This function returns the Pi array from the model factors of the J genomic
contributions, P(delJ|J). This corresponds to J(D)^{x_4}.
For clarity in parsing the algorithm implementation, we include which
instance attributes are used in the method as 'paramete... |
Solves the GFL for a fixed value of lambda.
def solve(self, lam):
'''Solves the GFL for a fixed value of lambda.'''
s = weighted_graphtf(self.nnodes, self.y, self.weights, lam,
self.Dk.shape[0], self.Dk.shape[1], self.Dk.nnz,
self.Dk.row.astype(... |
Follows the solution path to find the best lambda value.
def solution_path(self, min_lambda, max_lambda, lambda_bins, verbose=0):
'''Follows the solution path to find the best lambda value.'''
self.u = np.zeros(self.Dk.shape[0], dtype='double')
lambda_grid = np.exp(np.linspace(np.log(max_lambda... |
Solves the GFL for a fixed value of lambda.
def solve(self, lam):
'''Solves the GFL for a fixed value of lambda.'''
s = weighted_graphtf_logit(self.nnodes, self.trials, self.successes, lam,
self.Dk.shape[0], self.Dk.shape[1], self.Dk.nnz,
... |
Solves the GFL for a fixed value of lambda.
def solve(self, lam):
'''Solves the GFL for a fixed value of lambda.'''
s = weighted_graphtf_poisson(self.nnodes, self.obs, lam,
self.Dk.shape[0], self.Dk.shape[1], self.Dk.nnz,
self.Dk.row.ast... |
Constructs the V and J mask mapping dictionaries.
Parameters
----------
genV : list
List of genomic V information.
genJ : list
List of genomic J information.
def make_V_and_J_mask_mapping(self, genV, genJ):
"""Constructs the V and J m... |
Process P(delDl, delDr|D) into Pi arrays.
Sets the attributes PD_nt_pos_vec, PD_2nd_nt_pos_per_aa_vec,
min_delDl_given_DdelDr, max_delDl_given_DdelDr, and zeroD_given_D.
Parameters
----------
generative_model : GenerativeModelVDJ
VDJ generative model cl... |
Process P(J)*P(delJ|J) into Pi arrays.
Sets the attributes PJdelJ_nt_pos_vec and PJdelJ_2nd_nt_pos_per_aa_vec.
Parameters
----------
generative_model : GenerativeModelVDJ
VDJ generative model class containing the model parameters.
genomic_dat... |
Compute the transfer matrices for the VD junction.
Sets the attributes Tvd, Svd, Dvd, lTvd, and lDvd.
def generate_VD_junction_transfer_matrices(self):
"""Compute the transfer matrices for the VD junction.
Sets the attributes Tvd, Svd, Dvd, lTvd, and lDvd.
"""... |
Compute the transfer matrices for the VD junction.
Sets the attributes Tdj, Sdj, Ddj, rTdj, and rDdj.
def generate_DJ_junction_transfer_matrices(self):
"""Compute the transfer matrices for the VD junction.
Sets the attributes Tdj, Sdj, Ddj, rTdj, and rDdj.
"""... |
Process P(delV|V) into Pi arrays.
Set the attributes PVdelV_nt_pos_vec and PVdelV_2nd_nt_pos_per_aa_vec.
Parameters
----------
generative_model : GenerativeModelVJ
VJ generative model class containing the model parameters.
genomic_data : Geno... |
Process P(delJ|J) into Pi arrays.
Set the attributes PJdelJ_nt_pos_vec and PJdelJ_2nd_nt_pos_per_aa_vec.
Parameters
----------
generative_model : GenerativeModelVJ
VJ generative model class containing the model parameters.
genomic_data : Geno... |
Compute the transfer matrices for the VJ junction.
Sets the attributes Tvj, Svj, Dvj, lTvj, and lDvj.
def generate_VJ_junction_transfer_matrices(self):
"""Compute the transfer matrices for the VJ junction.
Sets the attributes Tvj, Svj, Dvj, lTvj, and lDvj.
"""... |
Prints IMAGE_DOS_HEADER fields.
def showDosHeaderData(peInstance):
""" Prints IMAGE_DOS_HEADER fields. """
dosFields = peInstance.dosHeader.getFields()
print "[+] IMAGE_DOS_HEADER values:\n"
for field in dosFields:
if isinstance(dosFields[field], datatypes.Array):
print "--> %... |
Prints IMAGE_FILE_HEADER fields.
def showFileHeaderData(peInstance):
""" Prints IMAGE_FILE_HEADER fields. """
fileHeaderFields = peInstance.ntHeaders.fileHeader.getFields()
print "[+] IMAGE_FILE_HEADER values:\n"
for field in fileHeaderFields:
print "--> %s = 0x%08x" % (field, fileHea... |
Prints IMAGE_OPTIONAL_HEADER fields.
def showOptionalHeaderData(peInstance):
""" Prints IMAGE_OPTIONAL_HEADER fields. """
print "[+] IMAGE_OPTIONAL_HEADER:\n"
ohFields = peInstance.ntHeaders.optionalHeader.getFields()
for field in ohFields:
if not isinstance(ohFields[field], datadirs.Data... |
Prints the DATA_DIRECTORY fields.
def showDataDirectoriesData(peInstance):
""" Prints the DATA_DIRECTORY fields. """
print "[+] Data directories:\n"
dirs = peInstance.ntHeaders.optionalHeader.dataDirectory
counter = 1
for dir in dirs:
print "[%d] --> Name: %s -- RVA: 0x%08x -- SIZE: 0x... |
Prints IMAGE_SECTION_HEADER for every section present in the file.
def showSectionsHeaders(peInstance):
""" Prints IMAGE_SECTION_HEADER for every section present in the file. """
print "[+] Sections information:\n"
print "--> NumberOfSections: %d\n" % peInstance.ntHeaders.fileHeader.numberOfSections.v... |
Shows imports information.
def showImports(peInstance):
""" Shows imports information. """
iidEntries = peInstance.ntHeaders.optionalHeader.dataDirectory[consts.IMPORT_DIRECTORY].info
if iidEntries:
for iidEntry in iidEntries:
fields = iidEntry.getFields()
print "module... |
Show exports information
def showExports(peInstance):
""" Show exports information """
exports = peInstance.ntHeaders.optionalHeader.dataDirectory[consts.EXPORT_DIRECTORY].info
if exports:
exp_fields = exports.getFields()
for field in exp_fields:
print "%s -> %x" % (field, exp... |
Returns all the class attributues.
@rtype: dict
@return: A dictionary containing all the class attributes.
def getFields(self):
"""
Returns all the class attributues.
@rtype: dict
@return: A dictionary containing all the class attributes.
"""
... |
Returns a new L{Array} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: The L{ReadData} object containing the array data.
@type arrayType: int
@param arrayType: The type of L{Array} to be built.
@type arrayLength: int
@param ... |
Calculates an Euler tour over the graph g from vertex start to vertex end.
Assumes start and end are odd-degree vertices and that there are no other odd-degree
vertices.
def calc_euler_tour(g, start, end):
'''Calculates an Euler tour over the graph g from vertex start to vertex end.
Assumes start and e... |
Greedily select trails by making the longest you can until the end
def greedy_trails(subg, odds, verbose):
'''Greedily select trails by making the longest you can until the end'''
if verbose:
print('\tCreating edge map')
edges = defaultdict(list)
for x,y in subg.edges():
edges[x].appe... |
Decompose a graph into a set of non-overlapping trails.
def decompose_graph(g, heuristic='tour', max_odds=20, verbose=0):
'''Decompose a graph into a set of non-overlapping trails.'''
# Get the connected subgraphs
subgraphs = [nx.subgraph(g, x).copy() for x in nx.connected_components(g)]
chains = []
... |
Add.
def plus(self, a):
""" Add. """
return Vector(self.x+a.x, self.y+a.y, self.z+a.z) |
Subtract.
def minus(self, a):
""" Subtract. """
return Vector(self.x-a.x, self.y-a.y, self.z-a.z) |
Multiply.
def times(self, a):
""" Multiply. """
return Vector(self.x*a, self.y*a, self.z*a) |
Divide.
def dividedBy(self, a):
""" Divide. """
return Vector(self.x/a, self.y/a, self.z/a) |
Lerp. Linear interpolation from self to a
def lerp(self, a, t):
""" Lerp. Linear interpolation from self to a"""
return self.plus(a.minus(self).times(t)); |
Create a new vertex between this vertex and `other` by linearly
interpolating all properties using a parameter of `t`. Subclasses should
override this to interpolate additional properties.
def interpolate(self, other, t):
"""
Create a new vertex between this vertex and `other` by linear... |
Split `polygon` by this plane if needed, then put the polygon or polygon
fragments in the appropriate lists. Coplanar polygons go into either
`coplanarFront` or `coplanarBack` depending on their orientation with
respect to this plane. Polygons in front or in back of this plane go into
ei... |
Convert solid space to empty space and empty space to solid space.
def invert(self):
"""
Convert solid space to empty space and empty space to solid space.
"""
for poly in self.polygons:
poly.flip()
self.plane.flip()
if self.front:
self.front.in... |
Recursively remove all polygons in `polygons` that are inside this BSP
tree.
def clipPolygons(self, polygons):
"""
Recursively remove all polygons in `polygons` that are inside this BSP
tree.
"""
if not self.plane:
return polygons[:]
front = []
... |
Remove all polygons in this BSP tree that are inside the other BSP tree
`bsp`.
def clipTo(self, bsp):
"""
Remove all polygons in this BSP tree that are inside the other BSP tree
`bsp`.
"""
self.polygons = bsp.clipPolygons(self.polygons)
if self.front:
... |
Return a list of all polygons in this BSP tree.
def allPolygons(self):
"""
Return a list of all polygons in this BSP tree.
"""
polygons = self.polygons[:]
if self.front:
polygons.extend(self.front.allPolygons())
if self.back:
polygons.extend(sel... |
Build a BSP tree out of `polygons`. When called on an existing tree, the
new polygons are filtered down to the bottom of the tree and become new
nodes there. Each set of polygons is partitioned using the first polygon
(no heuristic is used to pick a good split).
def build(self, polygons):
... |
Returns the rate from the default currency to `currency`.
def get_rate(currency):
"""Returns the rate from the default currency to `currency`."""
source = get_rate_source()
try:
return Rate.objects.get(source=source, currency=currency).value
except Rate.DoesNotExist:
raise CurrencyConve... |
Get the default Rate Source and return it.
def get_rate_source():
"""Get the default Rate Source and return it."""
backend = money_rates_settings.DEFAULT_BACKEND()
try:
return RateSource.objects.get(name=backend.get_source_name())
except RateSource.DoesNotExist:
raise CurrencyConversion... |
Convert 'amount' from 'currency_from' to 'currency_to'
def base_convert_money(amount, currency_from, currency_to):
"""
Convert 'amount' from 'currency_from' to 'currency_to'
"""
source = get_rate_source()
# Get rate for currency_from.
if source.base_currency != currency_from:
rate_from... |
Convert 'amount' from 'currency_from' to 'currency_to' and return a Money
instance of the converted amount.
def convert_money(amount, currency_from, currency_to):
"""
Convert 'amount' from 'currency_from' to 'currency_to' and return a Money
instance of the converted amount.
"""
new_amount = bas... |
Format a datetime object with Java SimpleDateFormat's-like string.
If datetime_obj is not given - use current datetime.
If format_string is not given - return number of millisecond since epoch.
:param format_string:
:param datetime_obj:
:return:
:rtype string
def format_date(format_string=Non... |
Tries to determine if a buffer is empty.
@type buffer: str
@param buffer: Buffer to test if it is empty.
@rtype: bool
@return: C{True} if the given buffer is empty, i.e. full of zeros,
C{False} if it doesn't.
def allZero(buffer):
"""
Tries to determine if a buffer is empty... |
Writes a byte into the L{WriteData} stream object.
@type byte: int
@param byte: Byte value to write into the stream.
def writeByte(self, byte):
"""
Writes a byte into the L{WriteData} stream object.
@type byte: int
@param byte: Byte value to write into ... |
Writes a word value into the L{WriteData} stream object.
@type word: int
@param word: Word value to write into the stream.
def writeWord(self, word):
"""
Writes a word value into the L{WriteData} stream object.
@type word: int
@param word: Word value to... |
Writes a dword value into the L{WriteData} stream object.
@type dword: int
@param dword: Dword value to write into the stream.
def writeDword(self, dword):
"""
Writes a dword value into the L{WriteData} stream object.
@type dword: int
@param dword: Dwor... |
Writes a qword value into the L{WriteData} stream object.
@type qword: int
@param qword: Qword value to write into the stream.
def writeQword(self, qword):
"""
Writes a qword value into the L{WriteData} stream object.
@type qword: int
@param qword: Qwor... |
Sets the offset of the L{WriteData} stream object in wich the data is written.
@type value: int
@param value: Integer value that represent the offset we want to start writing in the L{WriteData} stream.
@raise WrongOffsetValueException: The value is beyond the total length ... |
Skips the specified number as parameter to the current value of the L{WriteData} stream.
@type nroBytes: int
@param nroBytes: The number of bytes to skip.
def skipBytes(self, nroBytes):
"""
Skips the specified number as parameter to the current value of the L{WriteData} stream.... |
Reads a dword value from the L{ReadData} stream object.
@rtype: int
@return: The dword value read from the L{ReadData} stream.
def readDword(self):
"""
Reads a dword value from the L{ReadData} stream object.
@rtype: int
@return: The dword value read fro... |
Reads a word value from the L{ReadData} stream object.
@rtype: int
@return: The word value read from the L{ReadData} stream.
def readWord(self):
"""
Reads a word value from the L{ReadData} stream object.
@rtype: int
@return: The word value read from the... |
Reads a byte value from the L{ReadData} stream object.
@rtype: int
@return: The byte value read from the L{ReadData} stream.
def readByte(self):
"""
Reads a byte value from the L{ReadData} stream object.
@rtype: int
@return: The byte value read from the... |
Reads a qword value from the L{ReadData} stream object.
@rtype: int
@return: The qword value read from the L{ReadData} stream.
def readQword(self):
"""
Reads a qword value from the L{ReadData} stream object.
@rtype: int
@return: The qword value read fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.