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
mretegan/crispy
crispy/modules/orca/parser.py
OutputData._parse_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[1]) ...
python
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[1]) ...
[ "def", "_parse_tensor", "(", "self", ",", "indices", "=", "False", ")", ":", "if", "indices", ":", "self", ".", "line", "=", "self", ".", "_skip_lines", "(", "1", ")", "tensor", "=", "np", ".", "zeros", "(", "(", "3", ",", "3", ")", ")", "for", ...
Parse a tensor.
[ "Parse", "a", "tensor", "." ]
7e241ac1a48d34ca769f3a6183c430360b5f6725
https://github.com/mretegan/crispy/blob/7e241ac1a48d34ca769f3a6183c430360b5f6725/crispy/modules/orca/parser.py#L157-L174
train
mretegan/crispy
crispy/modules/orca/parser.py
OutputData.parse
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 Charge': tokens = self.line.split() ...
python
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 Charge': tokens = self.line.split() ...
[ "def", "parse", "(", "self", ")", ":", "for", "self", ".", "line", "in", "self", ".", "output", ":", "# Parse general data: charge, multiplicity, coordinates, etc.", "self", ".", "index", "=", "0", "if", "self", ".", "line", "[", "1", ":", "13", "]", "==",...
Iterate over the lines and extract the required data.
[ "Iterate", "over", "the", "lines", "and", "extract", "the", "required", "data", "." ]
7e241ac1a48d34ca769f3a6183c430360b5f6725
https://github.com/mretegan/crispy/blob/7e241ac1a48d34ca769f3a6183c430360b5f6725/crispy/modules/orca/parser.py#L185-L275
train
xeBuz/Flask-Validator
flask_validator/validator.py
FlaskValidator.__validate
def __validate(self, target, value, oldvalue, initiator): """ 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: ...
python
def __validate(self, target, value, oldvalue, initiator): """ 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", ")", ":", "if", "value", "==", "oldvalue", ":", "return", "value", "if", "self", ".", "allow_null", "and", "value", "is", "None", ":", "return", "value", ...
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:
[ "Method", "executed", "when", "the", "event", "set", "is", "triggered", "." ]
ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9
https://github.com/xeBuz/Flask-Validator/blob/ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9/flask_validator/validator.py#L35-L62
train
xeBuz/Flask-Validator
flask_validator/validator.py
FlaskValidator.__create_event
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): event.listen(self.field, 'set', self.__validate, retval=True)
python
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): event.listen(self.field, 'set', self.__validate, retval=True)
[ "def", "__create_event", "(", "self", ")", ":", "if", "not", "event", ".", "contains", "(", "self", ".", "field", ",", "'set'", ",", "self", ".", "__validate", ")", ":", "event", ".", "listen", "(", "self", ".", "field", ",", "'set'", ",", "self", ...
Create an SQLAlchemy event listening the 'set' in a particular column. :rtype : object
[ "Create", "an", "SQLAlchemy", "event", "listening", "the", "set", "in", "a", "particular", "column", "." ]
ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9
https://github.com/xeBuz/Flask-Validator/blob/ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9/flask_validator/validator.py#L64-L70
train
xeBuz/Flask-Validator
flask_validator/validator.py
FlaskValidator.stop
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)
python
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)
[ "def", "stop", "(", "self", ")", ":", "if", "event", ".", "contains", "(", "self", ".", "field", ",", "'set'", ",", "self", ".", "__validate", ")", ":", "event", ".", "remove", "(", "self", ".", "field", ",", "'set'", ",", "self", ".", "__validate"...
Remove the listener to stop the validation
[ "Remove", "the", "listener", "to", "stop", "the", "validation" ]
ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9
https://github.com/xeBuz/Flask-Validator/blob/ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9/flask_validator/validator.py#L80-L84
train
xeBuz/Flask-Validator
flask_validator/validator.py
FlaskValidator.start
def start(self): """ Restart the listener """ if not event.contains(self.field, 'set', self.__validate): self.__create_event()
python
def start(self): """ Restart the listener """ if not event.contains(self.field, 'set', self.__validate): self.__create_event()
[ "def", "start", "(", "self", ")", ":", "if", "not", "event", ".", "contains", "(", "self", ".", "field", ",", "'set'", ",", "self", ".", "__validate", ")", ":", "self", ".", "__create_event", "(", ")" ]
Restart the listener
[ "Restart", "the", "listener" ]
ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9
https://github.com/xeBuz/Flask-Validator/blob/ef3dd0a24300c88cb728e6dc1a221e7e7127e1f9/flask_validator/validator.py#L86-L90
train
doanguyen/lasotuvi
lasotuvi/DiaBan.py
diaBan.nhapDaiHan
def nhapDaiHan(self, cucSo, gioiTinh): """Nhap dai han Args: cucSo (TYPE): Description gioiTinh (TYPE): Description Returns: TYPE: Description """ for cung in self.thapNhiCung: khoangCach = khoangCachCung(cung.cungSo, self.cungMen...
python
def nhapDaiHan(self, cucSo, gioiTinh): """Nhap dai han Args: cucSo (TYPE): Description gioiTinh (TYPE): Description Returns: TYPE: Description """ for cung in self.thapNhiCung: khoangCach = khoangCachCung(cung.cungSo, self.cungMen...
[ "def", "nhapDaiHan", "(", "self", ",", "cucSo", ",", "gioiTinh", ")", ":", "for", "cung", "in", "self", ".", "thapNhiCung", ":", "khoangCach", "=", "khoangCachCung", "(", "cung", ".", "cungSo", ",", "self", ".", "cungMenh", ",", "gioiTinh", ")", "cung", ...
Nhap dai han Args: cucSo (TYPE): Description gioiTinh (TYPE): Description Returns: TYPE: Description
[ "Nhap", "dai", "han" ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/DiaBan.py#L153-L166
train
tansey/gfl
pygfl/easy.py
solve_gfl
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=None, full_path=False, loss='normal'): '''A very easy-to-use version of G...
python
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=None, full_path=False, loss='normal'): '''A very easy-to-use version of G...
[ "def", "solve_gfl", "(", "data", ",", "edges", "=", "None", ",", "weights", "=", "None", ",", "minlam", "=", "0.2", ",", "maxlam", "=", "1000.0", ",", "numlam", "=", "30", ",", "alpha", "=", "0.2", ",", "inflate", "=", "2.", ",", "converge", "=", ...
A very easy-to-use version of GFL solver that just requires the data and the edges.
[ "A", "very", "easy", "-", "to", "-", "use", "version", "of", "GFL", "solver", "that", "just", "requires", "the", "data", "and", "the", "edges", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/easy.py#L27-L113
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
ngayThangNam
def ngayThangNam(nn, tt, nnnn, duongLich=True, timeZone=7): """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: De...
python
def ngayThangNam(nn, tt, nnnn, duongLich=True, timeZone=7): """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: De...
[ "def", "ngayThangNam", "(", "nn", ",", "tt", ",", "nnnn", ",", "duongLich", "=", "True", ",", "timeZone", "=", "7", ")", ":", "thangNhuan", "=", "0", "# if nnnn > 1000 and nnnn < 3000 and nn > 0 and \\", "if", "nn", ">", "0", "and", "nn", "<", "32", "and",...
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
[ "Summary" ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L218-L242
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
canChiNgay
def canChiNgay(nn, tt, nnnn, duongLich=True, timeZone=7, thangNhuan=False): """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, optio...
python
def canChiNgay(nn, tt, nnnn, duongLich=True, timeZone=7, thangNhuan=False): """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, optio...
[ "def", "canChiNgay", "(", "nn", ",", "tt", ",", "nnnn", ",", "duongLich", "=", "True", ",", "timeZone", "=", "7", ",", "thangNhuan", "=", "False", ")", ":", "if", "duongLich", "is", "False", ":", "[", "nn", ",", "tt", ",", "nnnn", "]", "=", "L2S"...
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
[ "Summary" ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L245-L265
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
ngayThangNamCanChi
def ngayThangNamCanChi(nn, tt, nnnn, duongLich=True, timeZone=7): """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...
python
def ngayThangNamCanChi(nn, tt, nnnn, duongLich=True, timeZone=7): """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...
[ "def", "ngayThangNamCanChi", "(", "nn", ",", "tt", ",", "nnnn", ",", "duongLich", "=", "True", ",", "timeZone", "=", "7", ")", ":", "if", "duongLich", "is", "True", ":", "[", "nn", ",", "tt", ",", "nnnn", ",", "thangNhuan", "]", "=", "ngayThangNam", ...
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):...
[ "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", "." ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L281-L305
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
nguHanh
def nguHanh(tenHanh): """ 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 """ if tenHanh in ["Kim",...
python
def nguHanh(tenHanh): """ 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 """ if tenHanh in ["Kim",...
[ "def", "nguHanh", "(", "tenHanh", ")", ":", "if", "tenHanh", "in", "[", "\"Kim\"", ",", "\"K\"", "]", ":", "return", "{", "\"id\"", ":", "1", ",", "\"tenHanh\"", ":", "\"Kim\"", ",", "\"cuc\"", ":", "4", ",", "\"tenCuc\"", ":", "\"Kim tứ Cục\",", "", ...
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
[ "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" ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L308-L338
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
nguHanhNapAm
def nguHanhNapAm(diaChi, thienCan, xuatBanMenh=False): """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,...
python
def nguHanhNapAm(diaChi, thienCan, xuatBanMenh=False): """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,...
[ "def", "nguHanhNapAm", "(", "diaChi", ",", "thienCan", ",", "xuatBanMenh", "=", "False", ")", ":", "banMenh", "=", "{", "\"K1\"", ":", "\"HẢI TRUNG KIM\",", "", "\"T1\"", ":", "\"GIÁNG HẠ THỦY\",", "", "\"H1\"", ":", "\"TÍCH LỊCH HỎA\",", "", "\"O1\"", ":", ...
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)
[ "Sử", "dụng", "Ngũ", "Hành", "nạp", "âm", "để", "tính", "Hành", "của", "năm", "." ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L361-L425
train
doanguyen/lasotuvi
lasotuvi/AmDuong.py
timTuVi
def timTuVi(cuc, ngaySinhAmLich): """Tìm vị trí của sao Tử vi Args: cuc (TYPE): Description ngaySinhAmLich (TYPE): Description Returns: TYPE: Description Raises: Exception: Description """ cungDan = 3 # Vị trí cung Dần ban đầu là 3 cucBanDau = cuc if c...
python
def timTuVi(cuc, ngaySinhAmLich): """Tìm vị trí của sao Tử vi Args: cuc (TYPE): Description ngaySinhAmLich (TYPE): Description Returns: TYPE: Description Raises: Exception: Description """ cungDan = 3 # Vị trí cung Dần ban đầu là 3 cucBanDau = cuc if c...
[ "def", "timTuVi", "(", "cuc", ",", "ngaySinhAmLich", ")", ":", "cungDan", "=", "3", "# Vị trí cung Dần ban đầu là 3", "cucBanDau", "=", "cuc", "if", "cuc", "not", "in", "[", "2", ",", "3", ",", "4", ",", "5", ",", "6", "]", ":", "# Tránh trường hợp infin...
Tìm vị trí của sao Tử vi Args: cuc (TYPE): Description ngaySinhAmLich (TYPE): Description Returns: TYPE: Description Raises: Exception: Description
[ "Tìm", "vị", "trí", "của", "sao", "Tử", "vi" ]
98383a3056f0a0633d6937d364c37eb788661c0d
https://github.com/doanguyen/lasotuvi/blob/98383a3056f0a0633d6937d364c37eb788661c0d/lasotuvi/AmDuong.py#L452-L475
train
zsethna/OLGA
olga/utils.py
nt2aa
def nt2aa(ntseq): """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 -------- >>> n...
python
def nt2aa(ntseq): """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 -------- >>> n...
[ "def", "nt2aa", "(", "ntseq", ")", ":", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", ",", "'a'", ":", "0", ",", "'c'", ":", "1", ",", "'g'", ":", "2", ",", "'t'", ":", "3", "}", ...
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...
[ "Translate", "a", "nucleotide", "sequence", "into", "an", "amino", "acid", "sequence", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L31-L53
train
zsethna/OLGA
olga/utils.py
nt2codon_rep
def nt2codon_rep(ntseq): """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 individua...
python
def nt2codon_rep(ntseq): """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 individua...
[ "def", "nt2codon_rep", "(", "ntseq", ")", ":", "#", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", ",", "'a'", ":", "0", ",", "'c'", ":", "1", ",", "'g'", ":", "2", ",", "'t'", ":", ...
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...
[ "Represent", "nucleotide", "sequence", "by", "sequence", "of", "codon", "symbols", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L55-L92
train
zsethna/OLGA
olga/utils.py
cutR_seq
def cutR_seq(seq, cutR, max_palindrome): """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 pa...
python
def cutR_seq(seq, cutR, max_palindrome): """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 pa...
[ "def", "cutR_seq", "(", "seq", ",", "cutR", ",", "max_palindrome", ")", ":", "complement_dict", "=", "{", "'A'", ":", "'T'", ",", "'C'", ":", "'G'", ",", "'G'", ":", "'C'", ",", "'T'", ":", "'A'", "}", "#can include lower case if wanted", "if", "cutR", ...
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", "right", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L95-L127
train
zsethna/OLGA
olga/utils.py
cutL_seq
def cutL_seq(seq, cutL, max_palindrome): """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 pali...
python
def cutL_seq(seq, cutL, max_palindrome): """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 pali...
[ "def", "cutL_seq", "(", "seq", ",", "cutL", ",", "max_palindrome", ")", ":", "complement_dict", "=", "{", "'A'", ":", "'T'", ",", "'C'", ":", "'G'", ",", "'G'", ":", "'C'", ",", "'T'", ":", "'A'", "}", "#can include lower case if wanted", "if", "cutL", ...
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 ...
[ "Cut", "genomic", "sequence", "from", "the", "left", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L129-L162
train
zsethna/OLGA
olga/utils.py
construct_codons_dict
def construct_codons_dict(alphabet_file = None): """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 al...
python
def construct_codons_dict(alphabet_file = None): """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 al...
[ "def", "construct_codons_dict", "(", "alphabet_file", "=", "None", ")", ":", "#Some symbols can't be used in the CDR3 sequences in order to allow for", "#regular expression parsing and general manipulation.", "protected_symbols", "=", "[", "' '", ",", "'\\t'", ",", "'\\n'", ",", ...
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_right", "dictionary", "of", "codon", "suffixes", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L165-L259
train
zsethna/OLGA
olga/utils.py
generate_sub_codons_left
def generate_sub_codons_left(codons_dict): """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 --...
python
def generate_sub_codons_left(codons_dict): """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 --...
[ "def", "generate_sub_codons_left", "(", "codons_dict", ")", ":", "sub_codons_left", "=", "{", "}", "for", "aa", "in", "codons_dict", ".", "keys", "(", ")", ":", "sub_codons_left", "[", "aa", "]", "=", "list", "(", "set", "(", "[", "x", "[", "0", "]", ...
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_left", "dictionary", "of", "codon", "prefixes", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L261-L281
train
zsethna/OLGA
olga/utils.py
generate_sub_codons_right
def generate_sub_codons_right(codons_dict): """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 ...
python
def generate_sub_codons_right(codons_dict): """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 ...
[ "def", "generate_sub_codons_right", "(", "codons_dict", ")", ":", "sub_codons_right", "=", "{", "}", "for", "aa", "in", "codons_dict", ".", "keys", "(", ")", ":", "sub_codons_right", "[", "aa", "]", "=", "list", "(", "set", "(", "[", "x", "[", "-", "1"...
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...
[ "Generate", "the", "sub_codons_right", "dictionary", "of", "codon", "suffixes", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L283-L303
train
zsethna/OLGA
olga/utils.py
determine_seq_type
def determine_seq_type(seq, aa_alphabet): """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...
python
def determine_seq_type(seq, aa_alphabet): """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...
[ "def", "determine_seq_type", "(", "seq", ",", "aa_alphabet", ")", ":", "if", "all", "(", "[", "x", "in", "'ACGTacgt'", "for", "x", "in", "seq", "]", ")", ":", "return", "'ntseq'", "elif", "all", "(", "[", "x", "in", "aa_alphabet", "for", "x", "in", ...
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...
[ "Determine", "the", "type", "of", "a", "sequence", ".", "Parameters", "----------" ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L305-L336
train
zsethna/OLGA
olga/utils.py
calc_steady_state_dist
def calc_steady_state_dist(R): """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 """ #Calc steady state d...
python
def calc_steady_state_dist(R): """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 """ #Calc steady state d...
[ "def", "calc_steady_state_dist", "(", "R", ")", ":", "#Calc steady state distribution for a dinucleotide bias matrix", "w", ",", "v", "=", "np", ".", "linalg", ".", "eig", "(", "R", ")", "for", "i", "in", "range", "(", "4", ")", ":", "if", "np", ".", "abs"...
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
[ "Calculate", "the", "steady", "state", "dist", "of", "a", "4", "state", "markov", "transition", "matrix", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/utils.py#L340-L361
train
zsethna/OLGA
olga/sequence_generation.py
rnd_ins_seq
def rnd_ins_seq(ins_len, C_R, CP_first_nt): """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 Le...
python
def rnd_ins_seq(ins_len, C_R, CP_first_nt): """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 Le...
[ "def", "rnd_ins_seq", "(", "ins_len", ",", "C_R", ",", "CP_first_nt", ")", ":", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", "}", "num2nt", "=", "'ACGT'", "if", "ins_len", "==", "0", ":"...
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", "random", "insertion", "nucleotide", "sequence", "of", "length", "ins_len", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/sequence_generation.py#L457-L502
train
zsethna/OLGA
olga/sequence_generation.py
SequenceGenerationVDJ.gen_rnd_prod_CDR3
def gen_rnd_prod_CDR3(self, conserved_J_residues = 'FVW'): """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...
python
def gen_rnd_prod_CDR3(self, conserved_J_residues = 'FVW'): """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...
[ "def", "gen_rnd_prod_CDR3", "(", "self", ",", "conserved_J_residues", "=", "'FVW'", ")", ":", "coding_pass", "=", "False", "while", "~", "coding_pass", ":", "recomb_events", "=", "self", ".", "choose_random_recomb_events", "(", ")", "V_seq", "=", "self", ".", ...
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 ...
[ "Generate", "a", "productive", "CDR3", "seq", "from", "a", "Monte", "Carlo", "draw", "of", "the", "model", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/sequence_generation.py#L187-L243
train
zsethna/OLGA
olga/sequence_generation.py
SequenceGenerationVDJ.choose_random_recomb_events
def choose_random_recomb_events(self): """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. ...
python
def choose_random_recomb_events(self): """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. ...
[ "def", "choose_random_recomb_events", "(", "self", ")", ":", "recomb_events", "=", "{", "}", "recomb_events", "[", "'V'", "]", "=", "self", ".", "CPV", ".", "searchsorted", "(", "np", ".", "random", ".", "random", "(", ")", ")", "#For 2D arrays make sure to ...
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...
[ "Sample", "the", "genomic", "model", "for", "VDJ", "recombination", "events", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/sequence_generation.py#L245-L283
train
zsethna/OLGA
olga/sequence_generation.py
SequenceGenerationVJ.gen_rnd_prod_CDR3
def gen_rnd_prod_CDR3(self, conserved_J_residues = 'FVW'): """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...
python
def gen_rnd_prod_CDR3(self, conserved_J_residues = 'FVW'): """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...
[ "def", "gen_rnd_prod_CDR3", "(", "self", ",", "conserved_J_residues", "=", "'FVW'", ")", ":", "coding_pass", "=", "False", "while", "~", "coding_pass", ":", "recomb_events", "=", "self", ".", "choose_random_recomb_events", "(", ")", "V_seq", "=", "self", ".", ...
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 ...
[ "Generate", "a", "productive", "CDR3", "seq", "from", "a", "Monte", "Carlo", "draw", "of", "the", "model", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/sequence_generation.py#L368-L422
train
zsethna/OLGA
olga/sequence_generation.py
SequenceGenerationVJ.choose_random_recomb_events
def choose_random_recomb_events(self): """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. ...
python
def choose_random_recomb_events(self): """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. ...
[ "def", "choose_random_recomb_events", "(", "self", ")", ":", "recomb_events", "=", "{", "}", "#For 2D arrays make sure to take advantage of a mod expansion to find indicies", "VJ_choice", "=", "self", ".", "CPVJ", ".", "searchsorted", "(", "np", ".", "random", ".", "ran...
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...
[ "Sample", "the", "genomic", "model", "for", "VDJ", "recombination", "events", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/sequence_generation.py#L424-L454
train
evonove/django-money-rates
djmoney_rates/backends.py
BaseRateBackend.update_rates
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, value in six.iteritems(self.get_rates...
python
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, value in six.iteritems(self.get_rates...
[ "def", "update_rates", "(", "self", ")", ":", "source", ",", "created", "=", "RateSource", ".", "objects", ".", "get_or_create", "(", "name", "=", "self", ".", "get_source_name", "(", ")", ")", "source", ".", "base_currency", "=", "self", ".", "get_base_cu...
Creates or updates rates for a source
[ "Creates", "or", "updates", "rates", "for", "a", "source" ]
ac1f7636b9a38d3e153eb833019342c4d88634c2
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/backends.py#L52-L67
train
tansey/gfl
pygfl/bayes.py
sample_gtf
def sample_gtf(data, D, k, likelihood='gaussian', prior='laplace', lambda_hyperparams=None, lam_walk_stdev=0.01, lam0=1., dp_hyperparameter=None, w_hyperparameters=None, iterations=7000, burn=2000, thin=10, robus...
python
def sample_gtf(data, D, k, likelihood='gaussian', prior='laplace', lambda_hyperparams=None, lam_walk_stdev=0.01, lam0=1., dp_hyperparameter=None, w_hyperparameters=None, iterations=7000, burn=2000, thin=10, robus...
[ "def", "sample_gtf", "(", "data", ",", "D", ",", "k", ",", "likelihood", "=", "'gaussian'", ",", "prior", "=", "'laplace'", ",", "lambda_hyperparams", "=", "None", ",", "lam_walk_stdev", "=", "0.01", ",", "lam0", "=", "1.", ",", "dp_hyperparameter", "=", ...
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.
[ "Generate", "samples", "from", "the", "generalized", "graph", "trend", "filtering", "distribution", "via", "a", "modified", "Swendsen", "-", "Wang", "slice", "sampling", "algorithm", ".", "Options", "for", "likelihood", ":", "gaussian", "binomial", "poisson", ".",...
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/bayes.py#L138-L274
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.compute_regex_CDR3_template_pgen
def compute_regex_CDR3_template_pgen(self, regex_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True, raise_overload_warning = True): """Compute Pgen for all seqs consistent with regular expression regex_seq. Computes Pgen for a (limited vocabulary) regular expression of CDR3...
python
def compute_regex_CDR3_template_pgen(self, regex_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True, raise_overload_warning = True): """Compute Pgen for all seqs consistent with regular expression regex_seq. Computes Pgen for a (limited vocabulary) regular expression of CDR3...
[ "def", "compute_regex_CDR3_template_pgen", "(", "self", ",", "regex_seq", ",", "V_usage_mask_in", "=", "None", ",", "J_usage_mask_in", "=", "None", ",", "print_warnings", "=", "True", ",", "raise_overload_warning", "=", "True", ")", ":", "V_usage_mask", ",", "J_us...
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", "all", "seqs", "consistent", "with", "regular", "expression", "regex_seq", ".", "Computes", "Pgen", "for", "a", "(", "limited", "vocabulary", ")", "regular", "expression", "of", "CDR3", "amino", "acid", "sequences", "conditioned", "on",...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L156-L213
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.compute_aa_CDR3_pgen
def compute_aa_CDR3_pgen(self, CDR3_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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 T...
python
def compute_aa_CDR3_pgen(self, CDR3_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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 T...
[ "def", "compute_aa_CDR3_pgen", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask_in", "=", "None", ",", "J_usage_mask_in", "=", "None", ",", "print_warnings", "=", "True", ")", ":", "if", "len", "(", "CDR3_seq", ")", "==", "0", ":", "return", "0", "for", ...
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", "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", ".", "(", "Exa...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L216-L264
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.compute_hamming_dist_1_pgen
def compute_hamming_dist_1_pgen(self, CDR3_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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...
python
def compute_hamming_dist_1_pgen(self, CDR3_seq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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...
[ "def", "compute_hamming_dist_1_pgen", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask_in", "=", "None", ",", "J_usage_mask_in", "=", "None", ",", "print_warnings", "=", "True", ")", ":", "#make sure that the symbol X is defined as the fully undetermined amino acid:", "#X ~...
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", "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",...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L266-L316
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.compute_nt_CDR3_pgen
def compute_nt_CDR3_pgen(self, CDR3_ntseq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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. (Ex...
python
def compute_nt_CDR3_pgen(self, CDR3_ntseq, V_usage_mask_in = None, J_usage_mask_in = None, print_warnings = True): """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. (Ex...
[ "def", "compute_nt_CDR3_pgen", "(", "self", ",", "CDR3_ntseq", ",", "V_usage_mask_in", "=", "None", ",", "J_usage_mask_in", "=", "None", ",", "print_warnings", "=", "True", ")", ":", "if", "not", "len", "(", "CDR3_ntseq", ")", "%", "3", "==", "0", ":", "...
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...
[ "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", ".", "...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L318-L368
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.format_usage_masks
def format_usage_masks(self, V_usage_mask_in, J_usage_mask_in, print_warnings = True): """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 si...
python
def format_usage_masks(self, V_usage_mask_in, J_usage_mask_in, print_warnings = True): """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 si...
[ "def", "format_usage_masks", "(", "self", ",", "V_usage_mask_in", ",", "J_usage_mask_in", ",", "print_warnings", "=", "True", ")", ":", "#Format the V usage mask", "if", "V_usage_mask_in", "is", "None", ":", "#Default case, use all productive V genes with non-zero probability...
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 ...
[ "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...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L377-L470
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.list_seqs_from_regex
def list_seqs_from_regex(self, regex_seq, print_warnings = True, raise_overload_warning = True): """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. Suppo...
python
def list_seqs_from_regex(self, regex_seq, print_warnings = True, raise_overload_warning = True): """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. Suppo...
[ "def", "list_seqs_from_regex", "(", "self", ",", "regex_seq", ",", "print_warnings", "=", "True", ",", "raise_overload_warning", "=", "True", ")", ":", "aa_symbols", "=", "''", ".", "join", "(", "self", ".", "codons_dict", ")", "default_max_reps", "=", "40", ...
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 (*...
[ "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", "....
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L472-L601
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.max_nt_to_aa_alignment_left
def max_nt_to_aa_alignment_left(self, CDR3_seq, ntseq): """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...
python
def max_nt_to_aa_alignment_left(self, CDR3_seq, ntseq): """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...
[ "def", "max_nt_to_aa_alignment_left", "(", "self", ",", "CDR3_seq", ",", "ntseq", ")", ":", "max_alignment", "=", "0", "if", "len", "(", "ntseq", ")", "==", "0", ":", "return", "0", "aa_aligned", "=", "True", "while", "aa_aligned", ":", "if", "ntseq", "[...
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", "left", ".", "This", "function", "returns", "the", "length", "of", "the", "maximum", "length", "nucleotide", "subsequence", "of", "ntseq", "contiguous", "from", "the", "left", "(...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L604-L652
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbability.max_nt_to_aa_alignment_right
def max_nt_to_aa_alignment_right(self, CDR3_seq, ntseq): """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 ...
python
def max_nt_to_aa_alignment_right(self, CDR3_seq, ntseq): """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 ...
[ "def", "max_nt_to_aa_alignment_right", "(", "self", ",", "CDR3_seq", ",", "ntseq", ")", ":", "r_CDR3_seq", "=", "CDR3_seq", "[", ":", ":", "-", "1", "]", "#reverse CDR3_seq", "r_ntseq", "=", "ntseq", "[", ":", ":", "-", "1", "]", "#reverse ntseq", "max_ali...
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 ---------- ...
[ "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", ...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L654-L703
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_CDR3_pgen
def compute_CDR3_pgen(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 seq...
python
def compute_CDR3_pgen(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 seq...
[ "def", "compute_CDR3_pgen", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask", ",", "J_usage_mask", ")", ":", "#Genomic V alignment/matching (contribution from P(V, delV)), return Pi_V", "Pi_V", ",", "max_V_align", "=", "self", ".", "compute_Pi_V", "(", "CDR3_seq", ",", ...
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", "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", "/", "all...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L849-L904
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_Pi_V
def compute_Pi_V(self, CDR3_seq, V_usage_mask): """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 ...
python
def compute_Pi_V(self, CDR3_seq, V_usage_mask): """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 ...
[ "def", "compute_Pi_V", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask", ")", ":", "#Note, the cutV_genomic_CDR3_segs INCLUDE the palindromic insertions and thus are max_palindrome nts longer than the template.", "#furthermore, the genomic sequence should be pruned to start at the conserved C...
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_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_", "{",...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L907-L968
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_Pi_L
def compute_Pi_L(self, CDR3_seq, Pi_V, max_V_align): """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...
python
def compute_Pi_L(self, CDR3_seq, Pi_V, max_V_align): """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...
[ "def", "compute_Pi_L", "(", "self", ",", "CDR3_seq", ",", "Pi_V", ",", "max_V_align", ")", ":", "#max_insertions = 30 #len(PinsVD) - 1 should zeropad the last few spots", "max_insertions", "=", "len", "(", "self", ".", "PinsVD", ")", "-", "1", "Pi_L", "=", "np", "...
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_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", ")", "inser...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L971-L1088
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_Pi_J_given_D
def compute_Pi_J_given_D(self, CDR3_seq, J_usage_mask): """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 c...
python
def compute_Pi_J_given_D(self, CDR3_seq, J_usage_mask): """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 c...
[ "def", "compute_Pi_J_given_D", "(", "self", ",", "CDR3_seq", ",", "J_usage_mask", ")", ":", "#Note, the cutJ_genomic_CDR3_segs INCLUDE the palindromic insertions and thus are max_palindrome nts longer than the template.", "#furthermore, the genomic sequence should be pruned to start at a conse...
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_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", ")", ...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1091-L1159
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_Pi_JinsDJ_given_D
def compute_Pi_JinsDJ_given_D(self, CDR3_seq, Pi_J_given_D, max_J_align): """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(\e...
python
def compute_Pi_JinsDJ_given_D(self, CDR3_seq, Pi_J_given_D, max_J_align): """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(\e...
[ "def", "compute_Pi_JinsDJ_given_D", "(", "self", ",", "CDR3_seq", ",", "Pi_J_given_D", ",", "max_J_align", ")", ":", "#max_insertions = 30 #len(PinsVD) - 1 should zeropad the last few spots", "max_insertions", "=", "len", "(", "self", ".", "PinsDJ", ")", "-", "1", "Pi_J...
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_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", "...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1162-L1282
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVDJ.compute_Pi_R
def compute_Pi_R(self, CDR3_seq, Pi_JinsDJ_given_D): """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})\pr...
python
def compute_Pi_R(self, CDR3_seq, Pi_JinsDJ_given_D): """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})\pr...
[ "def", "compute_Pi_R", "(", "self", ",", "CDR3_seq", ",", "Pi_JinsDJ_given_D", ")", ":", "#Need to consider all D alignments from all possible positions and right deletions.", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'...
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", "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...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1285-L1521
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVJ.compute_CDR3_pgen
def compute_CDR3_pgen(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 ...
python
def compute_CDR3_pgen(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 ...
[ "def", "compute_CDR3_pgen", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask", ",", "J_usage_mask", ")", ":", "#Genomic J alignment/matching (contribution from P(delJ | J)), return Pi_J and reduced J_usage_mask", "Pi_J", ",", "r_J_usage_mask", "=", "self", ".", "compute_Pi_J", ...
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", "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", "/", "alle...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1630-L1676
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVJ.compute_Pi_V_given_J
def compute_Pi_V_given_J(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 a...
python
def compute_Pi_V_given_J(self, CDR3_seq, V_usage_mask, J_usage_mask): """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 a...
[ "def", "compute_Pi_V_given_J", "(", "self", ",", "CDR3_seq", ",", "V_usage_mask", ",", "J_usage_mask", ")", ":", "#Note, the cutV_genomic_CDR3_segs INCLUDE the palindromic insertions and thus are max_palindrome nts longer than the template.", "#furthermore, the genomic sequence should be p...
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", "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", ...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1679-L1746
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVJ.compute_Pi_V_insVJ_given_J
def compute_Pi_V_insVJ_given_J(self, CDR3_seq, Pi_V_given_J, max_V_align): """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(...
python
def compute_Pi_V_insVJ_given_J(self, CDR3_seq, Pi_V_given_J, max_V_align): """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(...
[ "def", "compute_Pi_V_insVJ_given_J", "(", "self", ",", "CDR3_seq", ",", "Pi_V_given_J", ",", "max_V_align", ")", ":", "#max_insertions = 30 #len(PinsVJ) - 1 should zeropad the last few spots", "max_insertions", "=", "len", "(", "self", ".", "PinsVJ", ")", "-", "1", "Pi_...
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_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", ...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1749-L1868
train
zsethna/OLGA
olga/generation_probability.py
GenerationProbabilityVJ.compute_Pi_J
def compute_Pi_J(self, CDR3_seq, J_usage_mask): """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 ...
python
def compute_Pi_J(self, CDR3_seq, J_usage_mask): """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 ...
[ "def", "compute_Pi_J", "(", "self", ",", "CDR3_seq", ",", "J_usage_mask", ")", ":", "#Note, the cutJ_genomic_CDR3_segs INCLUDE the palindromic insertions and thus are max_palindrome nts longer than the template.", "#furthermore, the genomic sequence should be pruned to start at a conserved reg...
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...
[ "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"...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generation_probability.py#L1871-L1935
train
tansey/gfl
pygfl/trendfiltering.py
TrendFilteringSolver.solve
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('int32'), self.Dk.col.astype('int32'), self.D...
python
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('int32'), self.Dk.col.astype('int32'), self.D...
[ "def", "solve", "(", "self", ",", "lam", ")", ":", "s", "=", "weighted_graphtf", "(", "self", ".", "nnodes", ",", "self", ".", "y", ",", "self", ".", "weights", ",", "lam", ",", "self", ".", "Dk", ".", "shape", "[", "0", "]", ",", "self", ".", ...
Solves the GFL for a fixed value of lambda.
[ "Solves", "the", "GFL", "for", "a", "fixed", "value", "of", "lambda", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trendfiltering.py#L73-L81
train
tansey/gfl
pygfl/trendfiltering.py
TrendFilteringSolver.solution_path
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), np.log(min_lambda), lambda_bins)) aic_trace = n...
python
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), np.log(min_lambda), lambda_bins)) aic_trace = n...
[ "def", "solution_path", "(", "self", ",", "min_lambda", ",", "max_lambda", ",", "lambda_bins", ",", "verbose", "=", "0", ")", ":", "self", ".", "u", "=", "np", ".", "zeros", "(", "self", ".", "Dk", ".", "shape", "[", "0", "]", ",", "dtype", "=", ...
Follows the solution path to find the best lambda value.
[ "Follows", "the", "solution", "path", "to", "find", "the", "best", "lambda", "value", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trendfiltering.py#L83-L157
train
tansey/gfl
pygfl/trendfiltering.py
LogitTrendFilteringSolver.solve
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, self.Dk.row.astype('int32'), self.Dk.col.as...
python
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, self.Dk.row.astype('int32'), self.Dk.col.as...
[ "def", "solve", "(", "self", ",", "lam", ")", ":", "s", "=", "weighted_graphtf_logit", "(", "self", ".", "nnodes", ",", "self", ".", "trials", ",", "self", ".", "successes", ",", "lam", ",", "self", ".", "Dk", ".", "shape", "[", "0", "]", ",", "s...
Solves the GFL for a fixed value of lambda.
[ "Solves", "the", "GFL", "for", "a", "fixed", "value", "of", "lambda", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trendfiltering.py#L169-L177
train
tansey/gfl
pygfl/trendfiltering.py
PoissonTrendFilteringSolver.solve
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.astype('int32'), self.Dk.col.astype('int32'), se...
python
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.astype('int32'), self.Dk.col.astype('int32'), se...
[ "def", "solve", "(", "self", ",", "lam", ")", ":", "s", "=", "weighted_graphtf_poisson", "(", "self", ".", "nnodes", ",", "self", ".", "obs", ",", "lam", ",", "self", ".", "Dk", ".", "shape", "[", "0", "]", ",", "self", ".", "Dk", ".", "shape", ...
Solves the GFL for a fixed value of lambda.
[ "Solves", "the", "GFL", "for", "a", "fixed", "value", "of", "lambda", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trendfiltering.py#L188-L196
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParameters.make_V_and_J_mask_mapping
def make_V_and_J_mask_mapping(self, genV, genJ): """Constructs the V and J mask mapping dictionaries. Parameters ---------- genV : list List of genomic V information. genJ : list List of genomic J information. """ ...
python
def make_V_and_J_mask_mapping(self, genV, genJ): """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", ")", ":", "#construct mapping between allele/gene names and index for custom V_usage_masks", "V_allele_names", "=", "[", "V", "[", "0", "]", "for", "V", "in", "genV", "]", "V_mask_mapping", "="...
Constructs the V and J mask mapping dictionaries. Parameters ---------- genV : list List of genomic V information. genJ : list List of genomic J information.
[ "Constructs", "the", "V", "and", "J", "mask", "mapping", "dictionaries", ".", "Parameters", "----------", "genV", ":", "list", "List", "of", "genomic", "V", "information", ".", "genJ", ":", "list", "List", "of", "genomic", "J", "information", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L157-L195
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVDJ.preprocess_D_segs
def preprocess_D_segs(self, generative_model, genomic_data): """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 ---------- g...
python
def preprocess_D_segs(self, generative_model, genomic_data): """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 ---------- g...
[ "def", "preprocess_D_segs", "(", "self", ",", "generative_model", ",", "genomic_data", ")", ":", "cutD_genomic_CDR3_segs", "=", "genomic_data", ".", "cutD_genomic_CDR3_segs", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",...
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", "(", "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_mo...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L463-L541
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVDJ.generate_PJdelJ_nt_pos_vecs
def generate_PJdelJ_nt_pos_vecs(self, generative_model, genomic_data): """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 gener...
python
def generate_PJdelJ_nt_pos_vecs(self, generative_model, genomic_data): """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 gener...
[ "def", "generate_PJdelJ_nt_pos_vecs", "(", "self", ",", "generative_model", ",", "genomic_data", ")", ":", "cutJ_genomic_CDR3_segs", "=", "genomic_data", ".", "cutJ_genomic_CDR3_segs", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", ...
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...
[ "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"...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L543-L592
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVDJ.generate_VD_junction_transfer_matrices
def generate_VD_junction_transfer_matrices(self): """Compute the transfer matrices for the VD junction. Sets the attributes Tvd, Svd, Dvd, lTvd, and lDvd. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tvd Tvd ...
python
def generate_VD_junction_transfer_matrices(self): """Compute the transfer matrices for the VD junction. Sets the attributes Tvd, Svd, Dvd, lTvd, and lDvd. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tvd Tvd ...
[ "def", "generate_VD_junction_transfer_matrices", "(", "self", ")", ":", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", "}", "#Compute Tvd", "Tvd", "=", "{", "}", "for", "aa", "in", "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", "Tvd", "Svd", "Dvd", "lTvd", "and", "lDvd", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L594-L654
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVDJ.generate_DJ_junction_transfer_matrices
def generate_DJ_junction_transfer_matrices(self): """Compute the transfer matrices for the VD junction. Sets the attributes Tdj, Sdj, Ddj, rTdj, and rDdj. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tdj Tdj = {} for aa...
python
def generate_DJ_junction_transfer_matrices(self): """Compute the transfer matrices for the VD junction. Sets the attributes Tdj, Sdj, Ddj, rTdj, and rDdj. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tdj Tdj = {} for aa...
[ "def", "generate_DJ_junction_transfer_matrices", "(", "self", ")", ":", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", "}", "#Compute Tdj ", "Tdj", "=", "{", "}", "for", "aa", "in", "self", ...
Compute the transfer matrices for the VD junction. Sets the attributes Tdj, Sdj, Ddj, rTdj, and rDdj.
[ "Compute", "the", "transfer", "matrices", "for", "the", "VD", "junction", ".", "Sets", "the", "attributes", "Tdj", "Sdj", "Ddj", "rTdj", "and", "rDdj", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L656-L713
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVJ.generate_PVdelV_nt_pos_vecs
def generate_PVdelV_nt_pos_vecs(self, generative_model, genomic_data): """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 mo...
python
def generate_PVdelV_nt_pos_vecs(self, generative_model, genomic_data): """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 mo...
[ "def", "generate_PVdelV_nt_pos_vecs", "(", "self", ",", "generative_model", ",", "genomic_data", ")", ":", "cutV_genomic_CDR3_segs", "=", "genomic_data", ".", "cutV_genomic_CDR3_segs", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", ...
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", "(", "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"...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L860-L904
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVJ.generate_PJdelJ_nt_pos_vecs
def generate_PJdelJ_nt_pos_vecs(self, generative_model, genomic_data): """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 mo...
python
def generate_PJdelJ_nt_pos_vecs(self, generative_model, genomic_data): """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 mo...
[ "def", "generate_PJdelJ_nt_pos_vecs", "(", "self", ",", "generative_model", ",", "genomic_data", ")", ":", "cutJ_genomic_CDR3_segs", "=", "genomic_data", ".", "cutJ_genomic_CDR3_segs", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", ...
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...
[ "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"...
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L906-L953
train
zsethna/OLGA
olga/preprocess_generative_model_and_data.py
PreprocessedParametersVJ.generate_VJ_junction_transfer_matrices
def generate_VJ_junction_transfer_matrices(self): """Compute the transfer matrices for the VJ junction. Sets the attributes Tvj, Svj, Dvj, lTvj, and lDvj. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tvj Tv...
python
def generate_VJ_junction_transfer_matrices(self): """Compute the transfer matrices for the VJ junction. Sets the attributes Tvj, Svj, Dvj, lTvj, and lDvj. """ nt2num = {'A': 0, 'C': 1, 'G': 2, 'T': 3} #Compute Tvj Tv...
[ "def", "generate_VJ_junction_transfer_matrices", "(", "self", ")", ":", "nt2num", "=", "{", "'A'", ":", "0", ",", "'C'", ":", "1", ",", "'G'", ":", "2", ",", "'T'", ":", "3", "}", "#Compute Tvj", "Tvj", "=", "{", "}", "for", "aa", "in", "self", "."...
Compute the transfer matrices for the VJ junction. Sets the attributes Tvj, Svj, Dvj, lTvj, and lDvj.
[ "Compute", "the", "transfer", "matrices", "for", "the", "VJ", "junction", ".", "Sets", "the", "attributes", "Tvj", "Svj", "Dvj", "lTvj", "and", "lDvj", "." ]
e825c333f0f9a4eb02132e0bcf86f0dca9123114
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/preprocess_generative_model_and_data.py#L956-L1014
train
crackinglandia/pype32
tools/readpe.py
showDosHeaderData
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 "--> %s - Array of length %d" % (field,...
python
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 "--> %s - Array of length %d" % (field,...
[ "def", "showDosHeaderData", "(", "peInstance", ")", ":", "dosFields", "=", "peInstance", ".", "dosHeader", ".", "getFields", "(", ")", "print", "\"[+] IMAGE_DOS_HEADER values:\\n\"", "for", "field", "in", "dosFields", ":", "if", "isinstance", "(", "dosFields", "["...
Prints IMAGE_DOS_HEADER fields.
[ "Prints", "IMAGE_DOS_HEADER", "fields", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L43-L56
train
crackinglandia/pype32
tools/readpe.py
showFileHeaderData
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, fileHeaderFields[field].value)
python
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, fileHeaderFields[field].value)
[ "def", "showFileHeaderData", "(", "peInstance", ")", ":", "fileHeaderFields", "=", "peInstance", ".", "ntHeaders", ".", "fileHeader", ".", "getFields", "(", ")", "print", "\"[+] IMAGE_FILE_HEADER values:\\n\"", "for", "field", "in", "fileHeaderFields", ":", "print", ...
Prints IMAGE_FILE_HEADER fields.
[ "Prints", "IMAGE_FILE_HEADER", "fields", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L64-L70
train
crackinglandia/pype32
tools/readpe.py
showOptionalHeaderData
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.DataDirectory): print "--> %s ...
python
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.DataDirectory): print "--> %s ...
[ "def", "showOptionalHeaderData", "(", "peInstance", ")", ":", "print", "\"[+] IMAGE_OPTIONAL_HEADER:\\n\"", "ohFields", "=", "peInstance", ".", "ntHeaders", ".", "optionalHeader", ".", "getFields", "(", ")", "for", "field", "in", "ohFields", ":", "if", "not", "isi...
Prints IMAGE_OPTIONAL_HEADER fields.
[ "Prints", "IMAGE_OPTIONAL_HEADER", "fields", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L72-L79
train
crackinglandia/pype32
tools/readpe.py
showDataDirectoriesData
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%08x" % (counter, dir.name.value, ...
python
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%08x" % (counter, dir.name.value, ...
[ "def", "showDataDirectoriesData", "(", "peInstance", ")", ":", "print", "\"[+] Data directories:\\n\"", "dirs", "=", "peInstance", ".", "ntHeaders", ".", "optionalHeader", ".", "dataDirectory", "counter", "=", "1", "for", "dir", "in", "dirs", ":", "print", "\"[%d]...
Prints the DATA_DIRECTORY fields.
[ "Prints", "the", "DATA_DIRECTORY", "fields", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L81-L89
train
crackinglandia/pype32
tools/readpe.py
showSectionsHeaders
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.value for section in peInstance.sectionHeaders: fields = ...
python
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.value for section in peInstance.sectionHeaders: fields = ...
[ "def", "showSectionsHeaders", "(", "peInstance", ")", ":", "print", "\"[+] Sections information:\\n\"", "print", "\"--> NumberOfSections: %d\\n\"", "%", "peInstance", ".", "ntHeaders", ".", "fileHeader", ".", "numberOfSections", ".", "value", "for", "section", "in", "pe...
Prints IMAGE_SECTION_HEADER for every section present in the file.
[ "Prints", "IMAGE_SECTION_HEADER", "for", "every", "section", "present", "in", "the", "file", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L91-L104
train
crackinglandia/pype32
tools/readpe.py
showImports
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: %s" % iidEntry.metaData.mo...
python
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: %s" % iidEntry.metaData.mo...
[ "def", "showImports", "(", "peInstance", ")", ":", "iidEntries", "=", "peInstance", ".", "ntHeaders", ".", "optionalHeader", ".", "dataDirectory", "[", "consts", ".", "IMPORT_DIRECTORY", "]", ".", "info", "if", "iidEntries", ":", "for", "iidEntry", "in", "iidE...
Shows imports information.
[ "Shows", "imports", "information", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L106-L124
train
crackinglandia/pype32
tools/readpe.py
showExports
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_fields[field].value) ...
python
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_fields[field].value) ...
[ "def", "showExports", "(", "peInstance", ")", ":", "exports", "=", "peInstance", ".", "ntHeaders", ".", "optionalHeader", ".", "dataDirectory", "[", "consts", ".", "EXPORT_DIRECTORY", "]", ".", "info", "if", "exports", ":", "exp_fields", "=", "exports", ".", ...
Show exports information
[ "Show", "exports", "information" ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/tools/readpe.py#L126-L140
train
crackinglandia/pype32
pype32/baseclasses.py
BaseStructClass.getFields
def getFields(self): """ Returns all the class attributues. @rtype: dict @return: A dictionary containing all the class attributes. """ d = {} for i in self._attrsList: key = i value = getattr(self, i) d[key] = value ...
python
def getFields(self): """ Returns all the class attributues. @rtype: dict @return: A dictionary containing all the class attributes. """ d = {} for i in self._attrsList: key = i value = getattr(self, i) d[key] = value ...
[ "def", "getFields", "(", "self", ")", ":", "d", "=", "{", "}", "for", "i", "in", "self", ".", "_attrsList", ":", "key", "=", "i", "value", "=", "getattr", "(", "self", ",", "i", ")", "d", "[", "key", "]", "=", "value", "return", "d" ]
Returns all the class attributues. @rtype: dict @return: A dictionary containing all the class attributes.
[ "Returns", "all", "the", "class", "attributues", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/baseclasses.py#L65-L77
train
crackinglandia/pype32
pype32/datatypes.py
Array.parse
def parse(readDataInstance, arrayType, arrayLength): """ 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{...
python
def parse(readDataInstance, arrayType, arrayLength): """ 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{...
[ "def", "parse", "(", "readDataInstance", ",", "arrayType", ",", "arrayLength", ")", ":", "newArray", "=", "Array", "(", "arrayType", ")", "dataLength", "=", "len", "(", "readDataInstance", ")", "if", "arrayType", "is", "TYPE_DWORD", ":", "toRead", "=", "arra...
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 ...
[ "Returns", "a", "new", "L", "{", "Array", "}", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/datatypes.py#L145-L196
train
tansey/gfl
pygfl/trails.py
calc_euler_tour
def calc_euler_tour(g, start, end): '''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.''' even_g = nx.subgraph(g, g.nodes()).copy() if end in even_g.neighbors(start): # I...
python
def calc_euler_tour(g, start, end): '''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.''' even_g = nx.subgraph(g, g.nodes()).copy() if end in even_g.neighbors(start): # I...
[ "def", "calc_euler_tour", "(", "g", ",", "start", ",", "end", ")", ":", "even_g", "=", "nx", ".", "subgraph", "(", "g", ",", "g", ".", "nodes", "(", ")", ")", ".", "copy", "(", ")", "if", "end", "in", "even_g", ".", "neighbors", "(", "start", "...
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.
[ "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", "-", ...
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trails.py#L50-L79
train
tansey/gfl
pygfl/trails.py
greedy_trails
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].append(y) edges[y].append(x) if verbose: print('\tS...
python
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].append(y) edges[y].append(x) if verbose: print('\tS...
[ "def", "greedy_trails", "(", "subg", ",", "odds", ",", "verbose", ")", ":", "if", "verbose", ":", "print", "(", "'\\tCreating edge map'", ")", "edges", "=", "defaultdict", "(", "list", ")", "for", "x", ",", "y", "in", "subg", ".", "edges", "(", ")", ...
Greedily select trails by making the longest you can until the end
[ "Greedily", "select", "trails", "by", "making", "the", "longest", "you", "can", "until", "the", "end" ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trails.py#L307-L338
train
tansey/gfl
pygfl/trails.py
decompose_graph
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 = [] num_subgraphs = len(subgraphs) step = 0 while ...
python
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 = [] num_subgraphs = len(subgraphs) step = 0 while ...
[ "def", "decompose_graph", "(", "g", ",", "heuristic", "=", "'tour'", ",", "max_odds", "=", "20", ",", "verbose", "=", "0", ")", ":", "# Get the connected subgraphs", "subgraphs", "=", "[", "nx", ".", "subgraph", "(", "g", ",", "x", ")", ".", "copy", "(...
Decompose a graph into a set of non-overlapping trails.
[ "Decompose", "a", "graph", "into", "a", "set", "of", "non", "-", "overlapping", "trails", "." ]
ae0f078bab57aba9e827ed6162f247ff9dc2aa19
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/trails.py#L341-L414
train
timknip/pycsg
csg/geom.py
Vector.plus
def plus(self, a): """ Add. """ return Vector(self.x+a.x, self.y+a.y, self.z+a.z)
python
def plus(self, a): """ Add. """ return Vector(self.x+a.x, self.y+a.y, self.z+a.z)
[ "def", "plus", "(", "self", ",", "a", ")", ":", "return", "Vector", "(", "self", ".", "x", "+", "a", ".", "x", ",", "self", ".", "y", "+", "a", ".", "y", ",", "self", ".", "z", "+", "a", ".", "z", ")" ]
Add.
[ "Add", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L50-L52
train
timknip/pycsg
csg/geom.py
Vector.minus
def minus(self, a): """ Subtract. """ return Vector(self.x-a.x, self.y-a.y, self.z-a.z)
python
def minus(self, a): """ Subtract. """ return Vector(self.x-a.x, self.y-a.y, self.z-a.z)
[ "def", "minus", "(", "self", ",", "a", ")", ":", "return", "Vector", "(", "self", ".", "x", "-", "a", ".", "x", ",", "self", ".", "y", "-", "a", ".", "y", ",", "self", ".", "z", "-", "a", ".", "z", ")" ]
Subtract.
[ "Subtract", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L57-L59
train
timknip/pycsg
csg/geom.py
Vector.times
def times(self, a): """ Multiply. """ return Vector(self.x*a, self.y*a, self.z*a)
python
def times(self, a): """ Multiply. """ return Vector(self.x*a, self.y*a, self.z*a)
[ "def", "times", "(", "self", ",", "a", ")", ":", "return", "Vector", "(", "self", ".", "x", "*", "a", ",", "self", ".", "y", "*", "a", ",", "self", ".", "z", "*", "a", ")" ]
Multiply.
[ "Multiply", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L64-L66
train
timknip/pycsg
csg/geom.py
Vector.dividedBy
def dividedBy(self, a): """ Divide. """ return Vector(self.x/a, self.y/a, self.z/a)
python
def dividedBy(self, a): """ Divide. """ return Vector(self.x/a, self.y/a, self.z/a)
[ "def", "dividedBy", "(", "self", ",", "a", ")", ":", "return", "Vector", "(", "self", ".", "x", "/", "a", ",", "self", ".", "y", "/", "a", ",", "self", ".", "z", "/", "a", ")" ]
Divide.
[ "Divide", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L71-L73
train
timknip/pycsg
csg/geom.py
Vector.lerp
def lerp(self, a, t): """ Lerp. Linear interpolation from self to a""" return self.plus(a.minus(self).times(t));
python
def lerp(self, a, t): """ Lerp. Linear interpolation from self to a""" return self.plus(a.minus(self).times(t));
[ "def", "lerp", "(", "self", ",", "a", ",", "t", ")", ":", "return", "self", ".", "plus", "(", "a", ".", "minus", "(", "self", ")", ".", "times", "(", "t", ")", ")" ]
Lerp. Linear interpolation from self to a
[ "Lerp", ".", "Linear", "interpolation", "from", "self", "to", "a" ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L85-L87
train
timknip/pycsg
csg/geom.py
Vertex.interpolate
def interpolate(self, other, 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. """ return Vertex(self.pos.lerp(other.pos, t),...
python
def interpolate(self, other, 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. """ return Vertex(self.pos.lerp(other.pos, t),...
[ "def", "interpolate", "(", "self", ",", "other", ",", "t", ")", ":", "return", "Vertex", "(", "self", ".", "pos", ".", "lerp", "(", "other", ".", "pos", ",", "t", ")", ",", "self", ".", "normal", ".", "lerp", "(", "other", ".", "normal", ",", "...
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.
[ "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", "proper...
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L147-L154
train
timknip/pycsg
csg/geom.py
Plane.splitPolygon
def splitPolygon(self, polygon, coplanarFront, coplanarBack, front, back): """ 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 wi...
python
def splitPolygon(self, polygon, coplanarFront, coplanarBack, front, back): """ 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 wi...
[ "def", "splitPolygon", "(", "self", ",", "polygon", ",", "coplanarFront", ",", "coplanarBack", ",", "front", ",", "back", ")", ":", "COPLANAR", "=", "0", "# all the vertices are within EPSILON distance from plane", "FRONT", "=", "1", "# all the vertices are in front of ...
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...
[ "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"...
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L192-L260
train
timknip/pycsg
csg/geom.py
BSPNode.invert
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.invert() if self.back: self.back.invert() ...
python
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.invert() if self.back: self.back.invert() ...
[ "def", "invert", "(", "self", ")", ":", "for", "poly", "in", "self", ".", "polygons", ":", "poly", ".", "flip", "(", ")", "self", ".", "plane", ".", "flip", "(", ")", "if", "self", ".", "front", ":", "self", ".", "front", ".", "invert", "(", ")...
Convert solid space to empty space and empty space to solid space.
[ "Convert", "solid", "space", "to", "empty", "space", "and", "empty", "space", "to", "solid", "space", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L323-L336
train
timknip/pycsg
csg/geom.py
BSPNode.clipPolygons
def clipPolygons(self, polygons): """ Recursively remove all polygons in `polygons` that are inside this BSP tree. """ if not self.plane: return polygons[:] front = [] back = [] for poly in polygons: self.plane.splitPolygon(poly,...
python
def clipPolygons(self, polygons): """ Recursively remove all polygons in `polygons` that are inside this BSP tree. """ if not self.plane: return polygons[:] front = [] back = [] for poly in polygons: self.plane.splitPolygon(poly,...
[ "def", "clipPolygons", "(", "self", ",", "polygons", ")", ":", "if", "not", "self", ".", "plane", ":", "return", "polygons", "[", ":", "]", "front", "=", "[", "]", "back", "=", "[", "]", "for", "poly", "in", "polygons", ":", "self", ".", "plane", ...
Recursively remove all polygons in `polygons` that are inside this BSP tree.
[ "Recursively", "remove", "all", "polygons", "in", "polygons", "that", "are", "inside", "this", "BSP", "tree", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L338-L360
train
timknip/pycsg
csg/geom.py
BSPNode.clipTo
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: self.front.clipTo(bsp) if self.back: self.back.clipTo(bsp)
python
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: self.front.clipTo(bsp) if self.back: self.back.clipTo(bsp)
[ "def", "clipTo", "(", "self", ",", "bsp", ")", ":", "self", ".", "polygons", "=", "bsp", ".", "clipPolygons", "(", "self", ".", "polygons", ")", "if", "self", ".", "front", ":", "self", ".", "front", ".", "clipTo", "(", "bsp", ")", "if", "self", ...
Remove all polygons in this BSP tree that are inside the other BSP tree `bsp`.
[ "Remove", "all", "polygons", "in", "this", "BSP", "tree", "that", "are", "inside", "the", "other", "BSP", "tree", "bsp", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L362-L371
train
timknip/pycsg
csg/geom.py
BSPNode.allPolygons
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(self.back.allPolygons()) return polygons
python
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(self.back.allPolygons()) return polygons
[ "def", "allPolygons", "(", "self", ")", ":", "polygons", "=", "self", ".", "polygons", "[", ":", "]", "if", "self", ".", "front", ":", "polygons", ".", "extend", "(", "self", ".", "front", ".", "allPolygons", "(", ")", ")", "if", "self", ".", "back...
Return a list of all polygons in this BSP tree.
[ "Return", "a", "list", "of", "all", "polygons", "in", "this", "BSP", "tree", "." ]
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L373-L382
train
timknip/pycsg
csg/geom.py
BSPNode.build
def build(self, polygons): """ 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...
python
def build(self, polygons): """ 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...
[ "def", "build", "(", "self", ",", "polygons", ")", ":", "if", "len", "(", "polygons", ")", "==", "0", ":", "return", "if", "not", "self", ".", "plane", ":", "self", ".", "plane", "=", "polygons", "[", "0", "]", ".", "plane", ".", "clone", "(", ...
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).
[ "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", ".", ...
b8f9710fd15c38dcc275d56a2108f604af38dcc8
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/geom.py#L384-L412
train
evonove/django-money-rates
djmoney_rates/utils.py
get_rate
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 CurrencyConversionException( "Rate for %s in %s do not exist...
python
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 CurrencyConversionException( "Rate for %s in %s do not exist...
[ "def", "get_rate", "(", "currency", ")", ":", "source", "=", "get_rate_source", "(", ")", "try", ":", "return", "Rate", ".", "objects", ".", "get", "(", "source", "=", "source", ",", "currency", "=", "currency", ")", ".", "value", "except", "Rate", "."...
Returns the rate from the default currency to `currency`.
[ "Returns", "the", "rate", "from", "the", "default", "currency", "to", "currency", "." ]
ac1f7636b9a38d3e153eb833019342c4d88634c2
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/utils.py#L12-L21
train
evonove/django-money-rates
djmoney_rates/utils.py
get_rate_source
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 CurrencyConversionException( "Rate for %s source d...
python
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 CurrencyConversionException( "Rate for %s source d...
[ "def", "get_rate_source", "(", ")", ":", "backend", "=", "money_rates_settings", ".", "DEFAULT_BACKEND", "(", ")", "try", ":", "return", "RateSource", ".", "objects", ".", "get", "(", "name", "=", "backend", ".", "get_source_name", "(", ")", ")", "except", ...
Get the default Rate Source and return it.
[ "Get", "the", "default", "Rate", "Source", "and", "return", "it", "." ]
ac1f7636b9a38d3e153eb833019342c4d88634c2
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/utils.py#L24-L32
train
evonove/django-money-rates
djmoney_rates/utils.py
base_convert_money
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 = get_rate(currency_from) else: # If curren...
python
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 = get_rate(currency_from) else: # If curren...
[ "def", "base_convert_money", "(", "amount", ",", "currency_from", ",", "currency_to", ")", ":", "source", "=", "get_rate_source", "(", ")", "# Get rate for currency_from.", "if", "source", ".", "base_currency", "!=", "currency_from", ":", "rate_from", "=", "get_rate...
Convert 'amount' from 'currency_from' to 'currency_to'
[ "Convert", "amount", "from", "currency_from", "to", "currency_to" ]
ac1f7636b9a38d3e153eb833019342c4d88634c2
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/utils.py#L35-L55
train
evonove/django-money-rates
djmoney_rates/utils.py
convert_money
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 = base_convert_money(amount, currency_from, currency_to) return moneyed.Money(new_amount, currency_to)
python
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 = base_convert_money(amount, currency_from, currency_to) return moneyed.Money(new_amount, currency_to)
[ "def", "convert_money", "(", "amount", ",", "currency_from", ",", "currency_to", ")", ":", "new_amount", "=", "base_convert_money", "(", "amount", ",", "currency_from", ",", "currency_to", ")", "return", "moneyed", ".", "Money", "(", "new_amount", ",", "currency...
Convert 'amount' from 'currency_from' to 'currency_to' and return a Money instance of the converted amount.
[ "Convert", "amount", "from", "currency_from", "to", "currency_to", "and", "return", "a", "Money", "instance", "of", "the", "converted", "amount", "." ]
ac1f7636b9a38d3e153eb833019342c4d88634c2
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/utils.py#L58-L64
train
Blazemeter/apiritif
apiritif/utilities.py
format_date
def format_date(format_string=None, datetime_obj=None): """ 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_ob...
python
def format_date(format_string=None, datetime_obj=None): """ 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_ob...
[ "def", "format_date", "(", "format_string", "=", "None", ",", "datetime_obj", "=", "None", ")", ":", "datetime_obj", "=", "datetime_obj", "or", "datetime", ".", "now", "(", ")", "if", "format_string", "is", "None", ":", "seconds", "=", "int", "(", "datetim...
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
[ "Format", "a", "datetime", "object", "with", "Java", "SimpleDateFormat", "s", "-", "like", "string", "." ]
27b48a68425949998c2254e5e1e0226882d9eee8
https://github.com/Blazemeter/apiritif/blob/27b48a68425949998c2254e5e1e0226882d9eee8/apiritif/utilities.py#L93-L112
train
crackinglandia/pype32
pype32/utils.py
allZero
def allZero(buffer): """ 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. """ allZero = True for byte ...
python
def allZero(buffer): """ 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. """ allZero = True for byte ...
[ "def", "allZero", "(", "buffer", ")", ":", "allZero", "=", "True", "for", "byte", "in", "buffer", ":", "if", "byte", "!=", "\"\\x00\"", ":", "allZero", "=", "False", "break", "return", "allZero" ]
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.
[ "Tries", "to", "determine", "if", "a", "buffer", "is", "empty", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L65-L81
train
crackinglandia/pype32
pype32/utils.py
WriteData.writeByte
def writeByte(self, byte): """ Writes a byte into the L{WriteData} stream object. @type byte: int @param byte: Byte value to write into the stream. """ self.data.write(pack("B" if not self.signed else "b", byte))
python
def writeByte(self, byte): """ Writes a byte into the L{WriteData} stream object. @type byte: int @param byte: Byte value to write into the stream. """ self.data.write(pack("B" if not self.signed else "b", byte))
[ "def", "writeByte", "(", "self", ",", "byte", ")", ":", "self", ".", "data", ".", "write", "(", "pack", "(", "\"B\"", "if", "not", "self", ".", "signed", "else", "\"b\"", ",", "byte", ")", ")" ]
Writes a byte into the L{WriteData} stream object. @type byte: int @param byte: Byte value to write into the stream.
[ "Writes", "a", "byte", "into", "the", "L", "{", "WriteData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L106-L113
train
crackinglandia/pype32
pype32/utils.py
WriteData.writeWord
def writeWord(self, word): """ Writes a word value into the L{WriteData} stream object. @type word: int @param word: Word value to write into the stream. """ self.data.write(pack(self.endianness + ("H" if not self.signed else "h"), word))
python
def writeWord(self, word): """ Writes a word value into the L{WriteData} stream object. @type word: int @param word: Word value to write into the stream. """ self.data.write(pack(self.endianness + ("H" if not self.signed else "h"), word))
[ "def", "writeWord", "(", "self", ",", "word", ")", ":", "self", ".", "data", ".", "write", "(", "pack", "(", "self", ".", "endianness", "+", "(", "\"H\"", "if", "not", "self", ".", "signed", "else", "\"h\"", ")", ",", "word", ")", ")" ]
Writes a word value into the L{WriteData} stream object. @type word: int @param word: Word value to write into the stream.
[ "Writes", "a", "word", "value", "into", "the", "L", "{", "WriteData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L115-L122
train
crackinglandia/pype32
pype32/utils.py
WriteData.writeDword
def writeDword(self, dword): """ Writes a dword value into the L{WriteData} stream object. @type dword: int @param dword: Dword value to write into the stream. """ self.data.write(pack(self.endianness + ("L" if not self.signed else "l"), dword))
python
def writeDword(self, dword): """ Writes a dword value into the L{WriteData} stream object. @type dword: int @param dword: Dword value to write into the stream. """ self.data.write(pack(self.endianness + ("L" if not self.signed else "l"), dword))
[ "def", "writeDword", "(", "self", ",", "dword", ")", ":", "self", ".", "data", ".", "write", "(", "pack", "(", "self", ".", "endianness", "+", "(", "\"L\"", "if", "not", "self", ".", "signed", "else", "\"l\"", ")", ",", "dword", ")", ")" ]
Writes a dword value into the L{WriteData} stream object. @type dword: int @param dword: Dword value to write into the stream.
[ "Writes", "a", "dword", "value", "into", "the", "L", "{", "WriteData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L124-L131
train
crackinglandia/pype32
pype32/utils.py
WriteData.writeQword
def writeQword(self, qword): """ Writes a qword value into the L{WriteData} stream object. @type qword: int @param qword: Qword value to write into the stream. """ self.data.write(pack(self.endianness + ("Q" if not self.signed else "q"), qword))
python
def writeQword(self, qword): """ Writes a qword value into the L{WriteData} stream object. @type qword: int @param qword: Qword value to write into the stream. """ self.data.write(pack(self.endianness + ("Q" if not self.signed else "q"), qword))
[ "def", "writeQword", "(", "self", ",", "qword", ")", ":", "self", ".", "data", ".", "write", "(", "pack", "(", "self", ".", "endianness", "+", "(", "\"Q\"", "if", "not", "self", ".", "signed", "else", "\"q\"", ")", ",", "qword", ")", ")" ]
Writes a qword value into the L{WriteData} stream object. @type qword: int @param qword: Qword value to write into the stream.
[ "Writes", "a", "qword", "value", "into", "the", "L", "{", "WriteData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L133-L140
train
crackinglandia/pype32
pype32/utils.py
WriteData.setOffset
def setOffset(self, value): """ 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 WrongOffsetValue...
python
def setOffset(self, value): """ 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 WrongOffsetValue...
[ "def", "setOffset", "(", "self", ",", "value", ")", ":", "if", "value", ">=", "len", "(", "self", ".", "data", ".", "getvalue", "(", ")", ")", ":", "raise", "excep", ".", "WrongOffsetValueException", "(", "\"Wrong offset value. Must be less than %d\"", "%", ...
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 ...
[ "Sets", "the", "offset", "of", "the", "L", "{", "WriteData", "}", "stream", "object", "in", "wich", "the", "data", "is", "written", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L151-L162
train
crackinglandia/pype32
pype32/utils.py
WriteData.skipBytes
def skipBytes(self, nroBytes): """ 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. """ self.data.seek(nroBytes + self.data.tell())
python
def skipBytes(self, nroBytes): """ 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. """ self.data.seek(nroBytes + self.data.tell())
[ "def", "skipBytes", "(", "self", ",", "nroBytes", ")", ":", "self", ".", "data", ".", "seek", "(", "nroBytes", "+", "self", ".", "data", ".", "tell", "(", ")", ")" ]
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.
[ "Skips", "the", "specified", "number", "as", "parameter", "to", "the", "current", "value", "of", "the", "L", "{", "WriteData", "}", "stream", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L164-L171
train
crackinglandia/pype32
pype32/utils.py
ReadData.readDword
def readDword(self): """ Reads a dword value from the L{ReadData} stream object. @rtype: int @return: The dword value read from the L{ReadData} stream. """ dword = unpack(self.endianness + ('L' if not self.signed else 'l'), self.readAt(self.offset, 4))[0] ...
python
def readDword(self): """ Reads a dword value from the L{ReadData} stream object. @rtype: int @return: The dword value read from the L{ReadData} stream. """ dword = unpack(self.endianness + ('L' if not self.signed else 'l'), self.readAt(self.offset, 4))[0] ...
[ "def", "readDword", "(", "self", ")", ":", "dword", "=", "unpack", "(", "self", ".", "endianness", "+", "(", "'L'", "if", "not", "self", ".", "signed", "else", "'l'", ")", ",", "self", ".", "readAt", "(", "self", ".", "offset", ",", "4", ")", ")"...
Reads a dword value from the L{ReadData} stream object. @rtype: int @return: The dword value read from the L{ReadData} stream.
[ "Reads", "a", "dword", "value", "from", "the", "L", "{", "ReadData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L209-L218
train
crackinglandia/pype32
pype32/utils.py
ReadData.readWord
def readWord(self): """ Reads a word value from the L{ReadData} stream object. @rtype: int @return: The word value read from the L{ReadData} stream. """ word = unpack(self.endianness + ('H' if not self.signed else 'h'), self.readAt(self.offset, 2))[0] sel...
python
def readWord(self): """ Reads a word value from the L{ReadData} stream object. @rtype: int @return: The word value read from the L{ReadData} stream. """ word = unpack(self.endianness + ('H' if not self.signed else 'h'), self.readAt(self.offset, 2))[0] sel...
[ "def", "readWord", "(", "self", ")", ":", "word", "=", "unpack", "(", "self", ".", "endianness", "+", "(", "'H'", "if", "not", "self", ".", "signed", "else", "'h'", ")", ",", "self", ".", "readAt", "(", "self", ".", "offset", ",", "2", ")", ")", ...
Reads a word value from the L{ReadData} stream object. @rtype: int @return: The word value read from the L{ReadData} stream.
[ "Reads", "a", "word", "value", "from", "the", "L", "{", "ReadData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L220-L229
train
crackinglandia/pype32
pype32/utils.py
ReadData.readByte
def readByte(self): """ Reads a byte value from the L{ReadData} stream object. @rtype: int @return: The byte value read from the L{ReadData} stream. """ byte = unpack('B' if not self.signed else 'b', self.readAt(self.offset, 1))[0] self.offset += 1 ...
python
def readByte(self): """ Reads a byte value from the L{ReadData} stream object. @rtype: int @return: The byte value read from the L{ReadData} stream. """ byte = unpack('B' if not self.signed else 'b', self.readAt(self.offset, 1))[0] self.offset += 1 ...
[ "def", "readByte", "(", "self", ")", ":", "byte", "=", "unpack", "(", "'B'", "if", "not", "self", ".", "signed", "else", "'b'", ",", "self", ".", "readAt", "(", "self", ".", "offset", ",", "1", ")", ")", "[", "0", "]", "self", ".", "offset", "+...
Reads a byte value from the L{ReadData} stream object. @rtype: int @return: The byte value read from the L{ReadData} stream.
[ "Reads", "a", "byte", "value", "from", "the", "L", "{", "ReadData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L231-L240
train
crackinglandia/pype32
pype32/utils.py
ReadData.readQword
def readQword(self): """ Reads a qword value from the L{ReadData} stream object. @rtype: int @return: The qword value read from the L{ReadData} stream. """ qword = unpack(self.endianness + ('Q' if not self.signed else 'b'), self.readAt(self.offset, 8))[0] ...
python
def readQword(self): """ Reads a qword value from the L{ReadData} stream object. @rtype: int @return: The qword value read from the L{ReadData} stream. """ qword = unpack(self.endianness + ('Q' if not self.signed else 'b'), self.readAt(self.offset, 8))[0] ...
[ "def", "readQword", "(", "self", ")", ":", "qword", "=", "unpack", "(", "self", ".", "endianness", "+", "(", "'Q'", "if", "not", "self", ".", "signed", "else", "'b'", ")", ",", "self", ".", "readAt", "(", "self", ".", "offset", ",", "8", ")", ")"...
Reads a qword value from the L{ReadData} stream object. @rtype: int @return: The qword value read from the L{ReadData} stream.
[ "Reads", "a", "qword", "value", "from", "the", "L", "{", "ReadData", "}", "stream", "object", "." ]
192fd14dfc0dd36d953739a81c17fbaf5e3d6076
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L242-L251
train