id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
221,400
MIT-LCP/wfdb-python
wfdb/io/record.py
_get_wanted_channels
def _get_wanted_channels(wanted_sig_names, record_sig_names, pad=False): """ Given some wanted signal names, and the signal names contained in a record, return the indices of the record channels that intersect. Parameters ---------- wanted_sig_names : list List of desired signal name st...
python
def _get_wanted_channels(wanted_sig_names, record_sig_names, pad=False): """ Given some wanted signal names, and the signal names contained in a record, return the indices of the record channels that intersect. Parameters ---------- wanted_sig_names : list List of desired signal name st...
[ "def", "_get_wanted_channels", "(", "wanted_sig_names", ",", "record_sig_names", ",", "pad", "=", "False", ")", ":", "if", "pad", ":", "return", "[", "record_sig_names", ".", "index", "(", "s", ")", "if", "s", "in", "record_sig_names", "else", "None", "for",...
Given some wanted signal names, and the signal names contained in a record, return the indices of the record channels that intersect. Parameters ---------- wanted_sig_names : list List of desired signal name strings record_sig_names : list List of signal names for a single record ...
[ "Given", "some", "wanted", "signal", "names", "and", "the", "signal", "names", "contained", "in", "a", "record", "return", "the", "indices", "of", "the", "record", "channels", "that", "intersect", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L1405-L1429
221,401
MIT-LCP/wfdb-python
wfdb/io/record.py
wrsamp
def wrsamp(record_name, fs, units, sig_name, p_signal=None, d_signal=None, fmt=None, adc_gain=None, baseline=None, comments=None, base_time=None, base_date=None, write_dir=''): """ Write a single segment WFDB record, creating a WFDB header file and any associated dat files. Parame...
python
def wrsamp(record_name, fs, units, sig_name, p_signal=None, d_signal=None, fmt=None, adc_gain=None, baseline=None, comments=None, base_time=None, base_date=None, write_dir=''): """ Write a single segment WFDB record, creating a WFDB header file and any associated dat files. Parame...
[ "def", "wrsamp", "(", "record_name", ",", "fs", ",", "units", ",", "sig_name", ",", "p_signal", "=", "None", ",", "d_signal", "=", "None", ",", "fmt", "=", "None", ",", "adc_gain", "=", "None", ",", "baseline", "=", "None", ",", "comments", "=", "Non...
Write a single segment WFDB record, creating a WFDB header file and any associated dat files. Parameters ---------- record_name : str The string name of the WFDB record to be written (without any file extensions). fs : int, or float The sampling frequency of the record. ...
[ "Write", "a", "single", "segment", "WFDB", "record", "creating", "a", "WFDB", "header", "file", "and", "any", "associated", "dat", "files", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L1435-L1539
221,402
MIT-LCP/wfdb-python
wfdb/io/record.py
is_monotonic
def is_monotonic(full_list): """ Determine whether elements in a list are monotonic. ie. unique elements are clustered together. ie. [5,5,3,4] is, [5,3,5] is not. """ prev_elements = set({full_list[0]}) prev_item = full_list[0] for item in full_list: if item != prev_item: ...
python
def is_monotonic(full_list): """ Determine whether elements in a list are monotonic. ie. unique elements are clustered together. ie. [5,5,3,4] is, [5,3,5] is not. """ prev_elements = set({full_list[0]}) prev_item = full_list[0] for item in full_list: if item != prev_item: ...
[ "def", "is_monotonic", "(", "full_list", ")", ":", "prev_elements", "=", "set", "(", "{", "full_list", "[", "0", "]", "}", ")", "prev_item", "=", "full_list", "[", "0", "]", "for", "item", "in", "full_list", ":", "if", "item", "!=", "prev_item", ":", ...
Determine whether elements in a list are monotonic. ie. unique elements are clustered together. ie. [5,5,3,4] is, [5,3,5] is not.
[ "Determine", "whether", "elements", "in", "a", "list", "are", "monotonic", ".", "ie", ".", "unique", "elements", "are", "clustered", "together", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L1542-L1559
221,403
MIT-LCP/wfdb-python
wfdb/io/record.py
BaseRecord._adjust_datetime
def _adjust_datetime(self, sampfrom): """ Adjust date and time fields to reflect user input if possible. Helper function for the `_arrange_fields` of both Record and MultiRecord objects. """ if sampfrom: dt_seconds = sampfrom / self.fs if self.bas...
python
def _adjust_datetime(self, sampfrom): """ Adjust date and time fields to reflect user input if possible. Helper function for the `_arrange_fields` of both Record and MultiRecord objects. """ if sampfrom: dt_seconds = sampfrom / self.fs if self.bas...
[ "def", "_adjust_datetime", "(", "self", ",", "sampfrom", ")", ":", "if", "sampfrom", ":", "dt_seconds", "=", "sampfrom", "/", "self", ".", "fs", "if", "self", ".", "base_date", "and", "self", ".", "base_time", ":", "self", ".", "base_datetime", "=", "dat...
Adjust date and time fields to reflect user input if possible. Helper function for the `_arrange_fields` of both Record and MultiRecord objects.
[ "Adjust", "date", "and", "time", "fields", "to", "reflect", "user", "input", "if", "possible", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L235-L255
221,404
MIT-LCP/wfdb-python
wfdb/io/record.py
Record.wrsamp
def wrsamp(self, expanded=False, write_dir=''): """ Write a wfdb header file and any associated dat files from this object. Parameters ---------- expanded : bool, optional Whether to write the expanded signal (e_d_signal) instead of the uniform si...
python
def wrsamp(self, expanded=False, write_dir=''): """ Write a wfdb header file and any associated dat files from this object. Parameters ---------- expanded : bool, optional Whether to write the expanded signal (e_d_signal) instead of the uniform si...
[ "def", "wrsamp", "(", "self", ",", "expanded", "=", "False", ",", "write_dir", "=", "''", ")", ":", "# Perform field validity and cohesion checks, and write the", "# header file.", "self", ".", "wrheader", "(", "write_dir", "=", "write_dir", ")", "if", "self", "."...
Write a wfdb header file and any associated dat files from this object. Parameters ---------- expanded : bool, optional Whether to write the expanded signal (e_d_signal) instead of the uniform signal (d_signal). write_dir : str, optional The d...
[ "Write", "a", "wfdb", "header", "file", "and", "any", "associated", "dat", "files", "from", "this", "object", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L350-L370
221,405
MIT-LCP/wfdb-python
wfdb/io/record.py
MultiRecord.wrsamp
def wrsamp(self, write_dir=''): """ Write a multi-segment header, along with headers and dat files for all segments, from this object. """ # Perform field validity and cohesion checks, and write the # header file. self.wrheader(write_dir=write_dir) # Perfo...
python
def wrsamp(self, write_dir=''): """ Write a multi-segment header, along with headers and dat files for all segments, from this object. """ # Perform field validity and cohesion checks, and write the # header file. self.wrheader(write_dir=write_dir) # Perfo...
[ "def", "wrsamp", "(", "self", ",", "write_dir", "=", "''", ")", ":", "# Perform field validity and cohesion checks, and write the", "# header file.", "self", ".", "wrheader", "(", "write_dir", "=", "write_dir", ")", "# Perform record validity and cohesion checks, and write th...
Write a multi-segment header, along with headers and dat files for all segments, from this object.
[ "Write", "a", "multi", "-", "segment", "header", "along", "with", "headers", "and", "dat", "files", "for", "all", "segments", "from", "this", "object", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L479-L490
221,406
MIT-LCP/wfdb-python
wfdb/io/record.py
MultiRecord._check_segment_cohesion
def _check_segment_cohesion(self): """ Check the cohesion of the segments field with other fields used to write the record """ if self.n_seg != len(self.segments): raise ValueError("Length of segments must match the 'n_seg' field") for i in range(n_seg): ...
python
def _check_segment_cohesion(self): """ Check the cohesion of the segments field with other fields used to write the record """ if self.n_seg != len(self.segments): raise ValueError("Length of segments must match the 'n_seg' field") for i in range(n_seg): ...
[ "def", "_check_segment_cohesion", "(", "self", ")", ":", "if", "self", ".", "n_seg", "!=", "len", "(", "self", ".", "segments", ")", ":", "raise", "ValueError", "(", "\"Length of segments must match the 'n_seg' field\"", ")", "for", "i", "in", "range", "(", "n...
Check the cohesion of the segments field with other fields used to write the record
[ "Check", "the", "cohesion", "of", "the", "segments", "field", "with", "other", "fields", "used", "to", "write", "the", "record" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L492-L518
221,407
MIT-LCP/wfdb-python
wfdb/io/record.py
MultiRecord._required_segments
def _required_segments(self, sampfrom, sampto): """ Determine the segments and the samples within each segment in a multi-segment record, that lie within a sample range. Parameters ---------- sampfrom : int The starting sample number to read for each channel....
python
def _required_segments(self, sampfrom, sampto): """ Determine the segments and the samples within each segment in a multi-segment record, that lie within a sample range. Parameters ---------- sampfrom : int The starting sample number to read for each channel....
[ "def", "_required_segments", "(", "self", ",", "sampfrom", ",", "sampto", ")", ":", "# The starting segment with actual samples", "if", "self", ".", "layout", "==", "'fixed'", ":", "startseg", "=", "0", "else", ":", "startseg", "=", "1", "# Cumulative sum of segme...
Determine the segments and the samples within each segment in a multi-segment record, that lie within a sample range. Parameters ---------- sampfrom : int The starting sample number to read for each channel. sampto : int The sample number at which to stop...
[ "Determine", "the", "segments", "and", "the", "samples", "within", "each", "segment", "in", "a", "multi", "-", "segment", "record", "that", "lie", "within", "a", "sample", "range", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L525-L577
221,408
MIT-LCP/wfdb-python
wfdb/io/record.py
MultiRecord._required_channels
def _required_channels(self, seg_numbers, channels, dir_name, pb_dir): """ Get the channel numbers to be read from each specified segment, given the channel numbers specified for the entire record. Parameters ---------- seg_numbers : list List of segment numb...
python
def _required_channels(self, seg_numbers, channels, dir_name, pb_dir): """ Get the channel numbers to be read from each specified segment, given the channel numbers specified for the entire record. Parameters ---------- seg_numbers : list List of segment numb...
[ "def", "_required_channels", "(", "self", ",", "seg_numbers", ",", "channels", ",", "dir_name", ",", "pb_dir", ")", ":", "# Fixed layout. All channels are the same.", "if", "self", ".", "layout", "==", "'fixed'", ":", "required_channels", "=", "[", "channels", "]"...
Get the channel numbers to be read from each specified segment, given the channel numbers specified for the entire record. Parameters ---------- seg_numbers : list List of segment numbers to read. channels : list The channel indices to read for the whole ...
[ "Get", "the", "channel", "numbers", "to", "be", "read", "from", "each", "specified", "segment", "given", "the", "channel", "numbers", "specified", "for", "the", "entire", "record", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L580-L625
221,409
MIT-LCP/wfdb-python
wfdb/io/tff.py
rdtff
def rdtff(file_name, cut_end=False): """ Read values from a tff file Parameters ---------- file_name : str Name of the .tff file to read cut_end : bool, optional If True, cuts out the last sample for all channels. This is for reading files which appear to terminate with ...
python
def rdtff(file_name, cut_end=False): """ Read values from a tff file Parameters ---------- file_name : str Name of the .tff file to read cut_end : bool, optional If True, cuts out the last sample for all channels. This is for reading files which appear to terminate with ...
[ "def", "rdtff", "(", "file_name", ",", "cut_end", "=", "False", ")", ":", "file_size", "=", "os", ".", "path", ".", "getsize", "(", "file_name", ")", "with", "open", "(", "file_name", ",", "'rb'", ")", "as", "fp", ":", "fields", ",", "file_fields", "...
Read values from a tff file Parameters ---------- file_name : str Name of the .tff file to read cut_end : bool, optional If True, cuts out the last sample for all channels. This is for reading files which appear to terminate with the incorrect number of samples (ie. samp...
[ "Read", "values", "from", "a", "tff", "file" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/tff.py#L14-L57
221,410
MIT-LCP/wfdb-python
wfdb/io/tff.py
_rdheader
def _rdheader(fp): """ Read header info of the windaq file """ tag = None # The '2' tag indicates the end of tags. while tag != 2: # For each header element, there is a tag indicating data type, # followed by the data size, followed by the data itself. 0's # pad the conte...
python
def _rdheader(fp): """ Read header info of the windaq file """ tag = None # The '2' tag indicates the end of tags. while tag != 2: # For each header element, there is a tag indicating data type, # followed by the data size, followed by the data itself. 0's # pad the conte...
[ "def", "_rdheader", "(", "fp", ")", ":", "tag", "=", "None", "# The '2' tag indicates the end of tags.", "while", "tag", "!=", "2", ":", "# For each header element, there is a tag indicating data type,", "# followed by the data size, followed by the data itself. 0's", "# pad the co...
Read header info of the windaq file
[ "Read", "header", "info", "of", "the", "windaq", "file" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/tff.py#L60-L139
221,411
MIT-LCP/wfdb-python
wfdb/io/tff.py
_rdsignal
def _rdsignal(fp, file_size, header_size, n_sig, bit_width, is_signed, cut_end): """ Read the signal Parameters ---------- cut_end : bool, optional If True, enables reading the end of files which appear to terminate with the incorrect number of samples (ie. sample not present for al...
python
def _rdsignal(fp, file_size, header_size, n_sig, bit_width, is_signed, cut_end): """ Read the signal Parameters ---------- cut_end : bool, optional If True, enables reading the end of files which appear to terminate with the incorrect number of samples (ie. sample not present for al...
[ "def", "_rdsignal", "(", "fp", ",", "file_size", ",", "header_size", ",", "n_sig", ",", "bit_width", ",", "is_signed", ",", "cut_end", ")", ":", "# Cannot initially figure out signal length because there", "# are escape sequences.", "fp", ".", "seek", "(", "header_siz...
Read the signal Parameters ---------- cut_end : bool, optional If True, enables reading the end of files which appear to terminate with the incorrect number of samples (ie. sample not present for all channels), by checking and skipping the reading the end of such files. Chec...
[ "Read", "the", "signal" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/tff.py#L142-L196
221,412
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
xqrs_detect
def xqrs_detect(sig, fs, sampfrom=0, sampto='end', conf=None, learn=True, verbose=True): """ Run the 'xqrs' qrs detection algorithm on a signal. See the docstring of the XQRS class for algorithm details. Parameters ---------- sig : numpy array The input ecg signal to app...
python
def xqrs_detect(sig, fs, sampfrom=0, sampto='end', conf=None, learn=True, verbose=True): """ Run the 'xqrs' qrs detection algorithm on a signal. See the docstring of the XQRS class for algorithm details. Parameters ---------- sig : numpy array The input ecg signal to app...
[ "def", "xqrs_detect", "(", "sig", ",", "fs", ",", "sampfrom", "=", "0", ",", "sampto", "=", "'end'", ",", "conf", "=", "None", ",", "learn", "=", "True", ",", "verbose", "=", "True", ")", ":", "xqrs", "=", "XQRS", "(", "sig", "=", "sig", ",", "...
Run the 'xqrs' qrs detection algorithm on a signal. See the docstring of the XQRS class for algorithm details. Parameters ---------- sig : numpy array The input ecg signal to apply the qrs detection on. fs : int or float The sampling frequency of the input signal. sampfrom : int...
[ "Run", "the", "xqrs", "qrs", "detection", "algorithm", "on", "a", "signal", ".", "See", "the", "docstring", "of", "the", "XQRS", "class", "for", "algorithm", "details", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L603-L648
221,413
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
gqrs_detect
def gqrs_detect(sig=None, fs=None, d_sig=None, adc_gain=None, adc_zero=None, threshold=1.0, hr=75, RRdelta=0.2, RRmin=0.28, RRmax=2.4, QS=0.07, QT=0.35, RTmin=0.25, RTmax=0.33, QRSa=750, QRSamin=130): """ Detect qrs locations in a single channel ecg. Functionally,...
python
def gqrs_detect(sig=None, fs=None, d_sig=None, adc_gain=None, adc_zero=None, threshold=1.0, hr=75, RRdelta=0.2, RRmin=0.28, RRmax=2.4, QS=0.07, QT=0.35, RTmin=0.25, RTmax=0.33, QRSa=750, QRSamin=130): """ Detect qrs locations in a single channel ecg. Functionally,...
[ "def", "gqrs_detect", "(", "sig", "=", "None", ",", "fs", "=", "None", ",", "d_sig", "=", "None", ",", "adc_gain", "=", "None", ",", "adc_zero", "=", "None", ",", "threshold", "=", "1.0", ",", "hr", "=", "75", ",", "RRdelta", "=", "0.2", ",", "RR...
Detect qrs locations in a single channel ecg. Functionally, a direct port of the gqrs algorithm from the original wfdb package. Accepts either a physical signal, or a digital signal with known adc_gain and adc_zero. See the notes below for a summary of the program. This algorithm is not being developed...
[ "Detect", "qrs", "locations", "in", "a", "single", "channel", "ecg", ".", "Functionally", "a", "direct", "port", "of", "the", "gqrs", "algorithm", "from", "the", "original", "wfdb", "package", ".", "Accepts", "either", "a", "physical", "signal", "or", "a", ...
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L1123-L1278
221,414
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._set_conf
def _set_conf(self): """ Set configuration parameters from the Conf object into the detector object. Time values are converted to samples, and amplitude values are in mV. """ self.rr_init = 60 * self.fs / self.conf.hr_init self.rr_max = 60 * self.fs / self.conf.h...
python
def _set_conf(self): """ Set configuration parameters from the Conf object into the detector object. Time values are converted to samples, and amplitude values are in mV. """ self.rr_init = 60 * self.fs / self.conf.hr_init self.rr_max = 60 * self.fs / self.conf.h...
[ "def", "_set_conf", "(", "self", ")", ":", "self", ".", "rr_init", "=", "60", "*", "self", ".", "fs", "/", "self", ".", "conf", ".", "hr_init", "self", ".", "rr_max", "=", "60", "*", "self", ".", "fs", "/", "self", ".", "conf", ".", "hr_min", "...
Set configuration parameters from the Conf object into the detector object. Time values are converted to samples, and amplitude values are in mV.
[ "Set", "configuration", "parameters", "from", "the", "Conf", "object", "into", "the", "detector", "object", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L126-L145
221,415
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._bandpass
def _bandpass(self, fc_low=5, fc_high=20): """ Apply a bandpass filter onto the signal, and save the filtered signal. """ self.fc_low = fc_low self.fc_high = fc_high b, a = signal.butter(2, [float(fc_low) * 2 / self.fs, float(fc_h...
python
def _bandpass(self, fc_low=5, fc_high=20): """ Apply a bandpass filter onto the signal, and save the filtered signal. """ self.fc_low = fc_low self.fc_high = fc_high b, a = signal.butter(2, [float(fc_low) * 2 / self.fs, float(fc_h...
[ "def", "_bandpass", "(", "self", ",", "fc_low", "=", "5", ",", "fc_high", "=", "20", ")", ":", "self", ".", "fc_low", "=", "fc_low", "self", ".", "fc_high", "=", "fc_high", "b", ",", "a", "=", "signal", ".", "butter", "(", "2", ",", "[", "float",...
Apply a bandpass filter onto the signal, and save the filtered signal.
[ "Apply", "a", "bandpass", "filter", "onto", "the", "signal", "and", "save", "the", "filtered", "signal", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L148-L162
221,416
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._set_init_params
def _set_init_params(self, qrs_amp_recent, noise_amp_recent, rr_recent, last_qrs_ind): """ Set initial online parameters """ self.qrs_amp_recent = qrs_amp_recent self.noise_amp_recent = noise_amp_recent # What happens if qrs_thr is calculated to b...
python
def _set_init_params(self, qrs_amp_recent, noise_amp_recent, rr_recent, last_qrs_ind): """ Set initial online parameters """ self.qrs_amp_recent = qrs_amp_recent self.noise_amp_recent = noise_amp_recent # What happens if qrs_thr is calculated to b...
[ "def", "_set_init_params", "(", "self", ",", "qrs_amp_recent", ",", "noise_amp_recent", ",", "rr_recent", ",", "last_qrs_ind", ")", ":", "self", ".", "qrs_amp_recent", "=", "qrs_amp_recent", "self", ".", "noise_amp_recent", "=", "noise_amp_recent", "# What happens if ...
Set initial online parameters
[ "Set", "initial", "online", "parameters" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L314-L330
221,417
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._set_default_init_params
def _set_default_init_params(self): """ Set initial running parameters using default values. The steady state equation is: `qrs_thr = 0.25*qrs_amp + 0.75*noise_amp` Estimate that qrs amp is 10x noise amp, giving: `qrs_thr = 0.325 * qrs_amp or 13/40 * qrs_amp` ...
python
def _set_default_init_params(self): """ Set initial running parameters using default values. The steady state equation is: `qrs_thr = 0.25*qrs_amp + 0.75*noise_amp` Estimate that qrs amp is 10x noise amp, giving: `qrs_thr = 0.325 * qrs_amp or 13/40 * qrs_amp` ...
[ "def", "_set_default_init_params", "(", "self", ")", ":", "if", "self", ".", "verbose", ":", "print", "(", "'Initializing using default parameters'", ")", "# Multiply the specified ecg thresholds by the filter and mwi gain", "# factors", "qrs_thr_init", "=", "self", ".", "q...
Set initial running parameters using default values. The steady state equation is: `qrs_thr = 0.25*qrs_amp + 0.75*noise_amp` Estimate that qrs amp is 10x noise amp, giving: `qrs_thr = 0.325 * qrs_amp or 13/40 * qrs_amp`
[ "Set", "initial", "running", "parameters", "using", "default", "values", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L333-L361
221,418
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._update_qrs
def _update_qrs(self, peak_num, backsearch=False): """ Update live qrs parameters. Adjust the recent rr-intervals and qrs amplitudes, and the qrs threshold. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is detected ...
python
def _update_qrs(self, peak_num, backsearch=False): """ Update live qrs parameters. Adjust the recent rr-intervals and qrs amplitudes, and the qrs threshold. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is detected ...
[ "def", "_update_qrs", "(", "self", ",", "peak_num", ",", "backsearch", "=", "False", ")", ":", "i", "=", "self", ".", "peak_inds_i", "[", "peak_num", "]", "# Update recent rr if the beat is consecutive (do this before", "# updating self.last_qrs_ind)", "rr_new", "=", ...
Update live qrs parameters. Adjust the recent rr-intervals and qrs amplitudes, and the qrs threshold. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is detected backsearch: bool, optional Whether the qrs was found via...
[ "Update", "live", "qrs", "parameters", ".", "Adjust", "the", "recent", "rr", "-", "intervals", "and", "qrs", "amplitudes", "and", "the", "qrs", "threshold", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L396-L435
221,419
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._is_twave
def _is_twave(self, peak_num): """ Check whether a segment is a t-wave. Compare the maximum gradient of the filtered signal segment with that of the previous qrs segment. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is ...
python
def _is_twave(self, peak_num): """ Check whether a segment is a t-wave. Compare the maximum gradient of the filtered signal segment with that of the previous qrs segment. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is ...
[ "def", "_is_twave", "(", "self", ",", "peak_num", ")", ":", "i", "=", "self", ".", "peak_inds_i", "[", "peak_num", "]", "# Due to initialization parameters, last_qrs_ind may be negative.", "# No way to check in this instance.", "if", "self", ".", "last_qrs_ind", "-", "s...
Check whether a segment is a t-wave. Compare the maximum gradient of the filtered signal segment with that of the previous qrs segment. Parameters ---------- peak_num : int The peak number of the mwi signal where the qrs is detected
[ "Check", "whether", "a", "segment", "is", "a", "t", "-", "wave", ".", "Compare", "the", "maximum", "gradient", "of", "the", "filtered", "signal", "segment", "with", "that", "of", "the", "previous", "qrs", "segment", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L438-L470
221,420
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._update_noise
def _update_noise(self, peak_num): """ Update live noise parameters """ i = self.peak_inds_i[peak_num] self.noise_amp_recent = (0.875*self.noise_amp_recent + 0.125*self.sig_i[i]) return
python
def _update_noise(self, peak_num): """ Update live noise parameters """ i = self.peak_inds_i[peak_num] self.noise_amp_recent = (0.875*self.noise_amp_recent + 0.125*self.sig_i[i]) return
[ "def", "_update_noise", "(", "self", ",", "peak_num", ")", ":", "i", "=", "self", ".", "peak_inds_i", "[", "peak_num", "]", "self", ".", "noise_amp_recent", "=", "(", "0.875", "*", "self", ".", "noise_amp_recent", "+", "0.125", "*", "self", ".", "sig_i",...
Update live noise parameters
[ "Update", "live", "noise", "parameters" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L472-L479
221,421
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._require_backsearch
def _require_backsearch(self): """ Determine whether a backsearch should be performed on prior peaks """ if self.peak_num == self.n_peaks_i-1: # If we just return false, we may miss a chance to backsearch. # Update this? return False next_peak...
python
def _require_backsearch(self): """ Determine whether a backsearch should be performed on prior peaks """ if self.peak_num == self.n_peaks_i-1: # If we just return false, we may miss a chance to backsearch. # Update this? return False next_peak...
[ "def", "_require_backsearch", "(", "self", ")", ":", "if", "self", ".", "peak_num", "==", "self", ".", "n_peaks_i", "-", "1", ":", "# If we just return false, we may miss a chance to backsearch.", "# Update this?", "return", "False", "next_peak_ind", "=", "self", ".",...
Determine whether a backsearch should be performed on prior peaks
[ "Determine", "whether", "a", "backsearch", "should", "be", "performed", "on", "prior", "peaks" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L481-L495
221,422
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS._run_detection
def _run_detection(self): """ Run the qrs detection after all signals and parameters have been configured and set. """ if self.verbose: print('Running QRS detection...') # Detected qrs indices self.qrs_inds = [] # qrs indices found via backse...
python
def _run_detection(self): """ Run the qrs detection after all signals and parameters have been configured and set. """ if self.verbose: print('Running QRS detection...') # Detected qrs indices self.qrs_inds = [] # qrs indices found via backse...
[ "def", "_run_detection", "(", "self", ")", ":", "if", "self", ".", "verbose", ":", "print", "(", "'Running QRS detection...'", ")", "# Detected qrs indices", "self", ".", "qrs_inds", "=", "[", "]", "# qrs indices found via backsearch", "self", ".", "backsearch_qrs_i...
Run the qrs detection after all signals and parameters have been configured and set.
[ "Run", "the", "qrs", "detection", "after", "all", "signals", "and", "parameters", "have", "been", "configured", "and", "set", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L510-L543
221,423
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
XQRS.detect
def detect(self, sampfrom=0, sampto='end', learn=True, verbose=True): """ Detect qrs locations between two samples. Parameters ---------- sampfrom : int, optional The starting sample number to run the detection on. sampto : int, optional The final...
python
def detect(self, sampfrom=0, sampto='end', learn=True, verbose=True): """ Detect qrs locations between two samples. Parameters ---------- sampfrom : int, optional The starting sample number to run the detection on. sampto : int, optional The final...
[ "def", "detect", "(", "self", ",", "sampfrom", "=", "0", ",", "sampto", "=", "'end'", ",", "learn", "=", "True", ",", "verbose", "=", "True", ")", ":", "if", "sampfrom", "<", "0", ":", "raise", "ValueError", "(", "\"'sampfrom' cannot be negative\"", ")",...
Detect qrs locations between two samples. Parameters ---------- sampfrom : int, optional The starting sample number to run the detection on. sampto : int, optional The final sample number to run the detection on. Set as 'end' to run on the entire sign...
[ "Detect", "qrs", "locations", "between", "two", "samples", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L546-L600
221,424
MIT-LCP/wfdb-python
wfdb/processing/qrs.py
GQRS.detect
def detect(self, x, conf, adc_zero): """ Run detection. x is digital signal """ self.c = conf self.annotations = [] self.sample_valid = False if len(x) < 1: return [] self.x = x self.adc_zero = adc_zero self.qfv = np.zeros((s...
python
def detect(self, x, conf, adc_zero): """ Run detection. x is digital signal """ self.c = conf self.annotations = [] self.sample_valid = False if len(x) < 1: return [] self.x = x self.adc_zero = adc_zero self.qfv = np.zeros((s...
[ "def", "detect", "(", "self", ",", "x", ",", "conf", ",", "adc_zero", ")", ":", "self", ".", "c", "=", "conf", "self", ".", "annotations", "=", "[", "]", "self", ".", "sample_valid", "=", "False", "if", "len", "(", "x", ")", "<", "1", ":", "ret...
Run detection. x is digital signal
[ "Run", "detection", ".", "x", "is", "digital", "signal" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/qrs.py#L750-L806
221,425
MIT-LCP/wfdb-python
wfdb/processing/hr.py
compute_hr
def compute_hr(sig_len, qrs_inds, fs): """ Compute instantaneous heart rate from peak indices. Parameters ---------- sig_len : int The length of the corresponding signal qrs_inds : numpy array The qrs index locations fs : int, or float The corresponding signal's samp...
python
def compute_hr(sig_len, qrs_inds, fs): """ Compute instantaneous heart rate from peak indices. Parameters ---------- sig_len : int The length of the corresponding signal qrs_inds : numpy array The qrs index locations fs : int, or float The corresponding signal's samp...
[ "def", "compute_hr", "(", "sig_len", ",", "qrs_inds", ",", "fs", ")", ":", "heart_rate", "=", "np", ".", "full", "(", "sig_len", ",", "np", ".", "nan", ",", "dtype", "=", "'float32'", ")", "if", "len", "(", "qrs_inds", ")", "<", "2", ":", "return",...
Compute instantaneous heart rate from peak indices. Parameters ---------- sig_len : int The length of the corresponding signal qrs_inds : numpy array The qrs index locations fs : int, or float The corresponding signal's sampling frequency. Returns ------- heart_...
[ "Compute", "instantaneous", "heart", "rate", "from", "peak", "indices", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/hr.py#L4-L40
221,426
MIT-LCP/wfdb-python
wfdb/processing/hr.py
calc_rr
def calc_rr(qrs_locs, fs=None, min_rr=None, max_rr=None, qrs_units='samples', rr_units='samples'): """ Compute rr intervals from qrs indices by extracting the time differences. Parameters ---------- qrs_locs : numpy array 1d array of qrs locations. fs : float, optional ...
python
def calc_rr(qrs_locs, fs=None, min_rr=None, max_rr=None, qrs_units='samples', rr_units='samples'): """ Compute rr intervals from qrs indices by extracting the time differences. Parameters ---------- qrs_locs : numpy array 1d array of qrs locations. fs : float, optional ...
[ "def", "calc_rr", "(", "qrs_locs", ",", "fs", "=", "None", ",", "min_rr", "=", "None", ",", "max_rr", "=", "None", ",", "qrs_units", "=", "'samples'", ",", "rr_units", "=", "'samples'", ")", ":", "rr", "=", "np", ".", "diff", "(", "qrs_locs", ")", ...
Compute rr intervals from qrs indices by extracting the time differences. Parameters ---------- qrs_locs : numpy array 1d array of qrs locations. fs : float, optional Sampling frequency of the original signal. Needed if `qrs_units` does not match `rr_units`. min_rr : flo...
[ "Compute", "rr", "intervals", "from", "qrs", "indices", "by", "extracting", "the", "time", "differences", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/hr.py#L43-L94
221,427
MIT-LCP/wfdb-python
wfdb/processing/hr.py
calc_mean_hr
def calc_mean_hr(rr, fs=None, min_rr=None, max_rr=None, rr_units='samples'): """ Compute mean heart rate in beats per minute, from a set of rr intervals. Returns 0 if rr is empty. Parameters ---------- rr : numpy array Array of rr intervals. fs : int, or float The correspond...
python
def calc_mean_hr(rr, fs=None, min_rr=None, max_rr=None, rr_units='samples'): """ Compute mean heart rate in beats per minute, from a set of rr intervals. Returns 0 if rr is empty. Parameters ---------- rr : numpy array Array of rr intervals. fs : int, or float The correspond...
[ "def", "calc_mean_hr", "(", "rr", ",", "fs", "=", "None", ",", "min_rr", "=", "None", ",", "max_rr", "=", "None", ",", "rr_units", "=", "'samples'", ")", ":", "if", "not", "len", "(", "rr", ")", ":", "return", "0", "if", "min_rr", "is", "not", "N...
Compute mean heart rate in beats per minute, from a set of rr intervals. Returns 0 if rr is empty. Parameters ---------- rr : numpy array Array of rr intervals. fs : int, or float The corresponding signal's sampling frequency. Required if 'input_time_units' == 'samples'. ...
[ "Compute", "mean", "heart", "rate", "in", "beats", "per", "minute", "from", "a", "set", "of", "rr", "intervals", ".", "Returns", "0", "if", "rr", "is", "empty", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/hr.py#L97-L142
221,428
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
compare_annotations
def compare_annotations(ref_sample, test_sample, window_width, signal=None): """ Compare a set of reference annotation locations against a set of test annotation locations. See the Comparitor class docstring for more information. Parameters ---------- ref_sample : 1d numpy array A...
python
def compare_annotations(ref_sample, test_sample, window_width, signal=None): """ Compare a set of reference annotation locations against a set of test annotation locations. See the Comparitor class docstring for more information. Parameters ---------- ref_sample : 1d numpy array A...
[ "def", "compare_annotations", "(", "ref_sample", ",", "test_sample", ",", "window_width", ",", "signal", "=", "None", ")", ":", "comparitor", "=", "Comparitor", "(", "ref_sample", "=", "ref_sample", ",", "test_sample", "=", "test_sample", ",", "window_width", "=...
Compare a set of reference annotation locations against a set of test annotation locations. See the Comparitor class docstring for more information. Parameters ---------- ref_sample : 1d numpy array Array of reference sample locations test_sample : 1d numpy array Array of test...
[ "Compare", "a", "set", "of", "reference", "annotation", "locations", "against", "a", "set", "of", "test", "annotation", "locations", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L334-L381
221,429
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
benchmark_mitdb
def benchmark_mitdb(detector, verbose=False, print_results=False): """ Benchmark a qrs detector against mitdb's records. Parameters ---------- detector : function The detector function. verbose : bool, optional The verbose option of the detector function. print_results : boo...
python
def benchmark_mitdb(detector, verbose=False, print_results=False): """ Benchmark a qrs detector against mitdb's records. Parameters ---------- detector : function The detector function. verbose : bool, optional The verbose option of the detector function. print_results : boo...
[ "def", "benchmark_mitdb", "(", "detector", ",", "verbose", "=", "False", ",", "print_results", "=", "False", ")", ":", "record_list", "=", "get_record_list", "(", "'mitdb'", ")", "n_records", "=", "len", "(", "record_list", ")", "# Function arguments for starmap",...
Benchmark a qrs detector against mitdb's records. Parameters ---------- detector : function The detector function. verbose : bool, optional The verbose option of the detector function. print_results : bool, optional Whether to print the overall performance, and the results f...
[ "Benchmark", "a", "qrs", "detector", "against", "mitdb", "s", "records", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L384-L454
221,430
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
benchmark_mitdb_record
def benchmark_mitdb_record(rec, detector, verbose): """ Benchmark a single mitdb record """ sig, fields = rdsamp(rec, pb_dir='mitdb', channels=[0]) ann_ref = rdann(rec, pb_dir='mitdb', extension='atr') qrs_inds = detector(sig=sig[:,0], fs=fields['fs'], verbose=verbose) comparitor = compare...
python
def benchmark_mitdb_record(rec, detector, verbose): """ Benchmark a single mitdb record """ sig, fields = rdsamp(rec, pb_dir='mitdb', channels=[0]) ann_ref = rdann(rec, pb_dir='mitdb', extension='atr') qrs_inds = detector(sig=sig[:,0], fs=fields['fs'], verbose=verbose) comparitor = compare...
[ "def", "benchmark_mitdb_record", "(", "rec", ",", "detector", ",", "verbose", ")", ":", "sig", ",", "fields", "=", "rdsamp", "(", "rec", ",", "pb_dir", "=", "'mitdb'", ",", "channels", "=", "[", "0", "]", ")", "ann_ref", "=", "rdann", "(", "rec", ","...
Benchmark a single mitdb record
[ "Benchmark", "a", "single", "mitdb", "record" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L457-L471
221,431
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
Comparitor._calc_stats
def _calc_stats(self): """ Calculate performance statistics after the two sets of annotations are compared. Example: ------------------- ref=500 test=480 { 30 { 470 } 10 } ------------------- tp = 470 fp = 10 fn = 30 ...
python
def _calc_stats(self): """ Calculate performance statistics after the two sets of annotations are compared. Example: ------------------- ref=500 test=480 { 30 { 470 } 10 } ------------------- tp = 470 fp = 10 fn = 30 ...
[ "def", "_calc_stats", "(", "self", ")", ":", "# Reference annotation indices that were detected", "self", ".", "matched_ref_inds", "=", "np", ".", "where", "(", "self", ".", "matching_sample_nums", "!=", "-", "1", ")", "[", "0", "]", "# Reference annotation indices ...
Calculate performance statistics after the two sets of annotations are compared. Example: ------------------- ref=500 test=480 { 30 { 470 } 10 } ------------------- tp = 470 fp = 10 fn = 30 specificity = 470 / 500 positive_pr...
[ "Calculate", "performance", "statistics", "after", "the", "two", "sets", "of", "annotations", "are", "compared", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L69-L116
221,432
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
Comparitor.compare
def compare(self): """ Main comparison function """ """ Note: Make sure to be able to handle these ref/test scenarios: A: o----o---o---o x-------x----x B: o----o-----o---o x--------x--x--x C: o------o-----o---o ...
python
def compare(self): """ Main comparison function """ """ Note: Make sure to be able to handle these ref/test scenarios: A: o----o---o---o x-------x----x B: o----o-----o---o x--------x--x--x C: o------o-----o---o ...
[ "def", "compare", "(", "self", ")", ":", "\"\"\"\n Note: Make sure to be able to handle these ref/test scenarios:\n\n A:\n o----o---o---o\n x-------x----x\n\n B:\n o----o-----o---o\n x--------x--x--x\n\n C:\n o------o-----o---o\n x-x-...
Main comparison function
[ "Main", "comparison", "function" ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L118-L197
221,433
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
Comparitor._get_closest_samp_num
def _get_closest_samp_num(self, ref_samp_num, start_test_samp_num): """ Return the closest testing sample number for the given reference sample number. Limit the search from start_test_samp_num. """ if start_test_samp_num >= self.n_test: raise ValueError('Invalid sta...
python
def _get_closest_samp_num(self, ref_samp_num, start_test_samp_num): """ Return the closest testing sample number for the given reference sample number. Limit the search from start_test_samp_num. """ if start_test_samp_num >= self.n_test: raise ValueError('Invalid sta...
[ "def", "_get_closest_samp_num", "(", "self", ",", "ref_samp_num", ",", "start_test_samp_num", ")", ":", "if", "start_test_samp_num", ">=", "self", ".", "n_test", ":", "raise", "ValueError", "(", "'Invalid starting test sample number.'", ")", "ref_samp", "=", "self", ...
Return the closest testing sample number for the given reference sample number. Limit the search from start_test_samp_num.
[ "Return", "the", "closest", "testing", "sample", "number", "for", "the", "given", "reference", "sample", "number", ".", "Limit", "the", "search", "from", "start_test_samp_num", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L200-L232
221,434
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
Comparitor.print_summary
def print_summary(self): """ Print summary metrics of the annotation comparisons. """ # True positives = matched reference samples self.tp = len(self.matched_ref_inds) # False positives = extra test samples not matched self.fp = self.n_test - self.tp # Fal...
python
def print_summary(self): """ Print summary metrics of the annotation comparisons. """ # True positives = matched reference samples self.tp = len(self.matched_ref_inds) # False positives = extra test samples not matched self.fp = self.n_test - self.tp # Fal...
[ "def", "print_summary", "(", "self", ")", ":", "# True positives = matched reference samples", "self", ".", "tp", "=", "len", "(", "self", ".", "matched_ref_inds", ")", "# False positives = extra test samples not matched", "self", ".", "fp", "=", "self", ".", "n_test"...
Print summary metrics of the annotation comparisons.
[ "Print", "summary", "metrics", "of", "the", "annotation", "comparisons", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L234-L261
221,435
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
Comparitor.plot
def plot(self, sig_style='', title=None, figsize=None, return_fig=False): """ Plot the comparison of two sets of annotations, possibly overlaid on their original signal. Parameters ---------- sig_style : str, optional The matplotlib style of the ...
python
def plot(self, sig_style='', title=None, figsize=None, return_fig=False): """ Plot the comparison of two sets of annotations, possibly overlaid on their original signal. Parameters ---------- sig_style : str, optional The matplotlib style of the ...
[ "def", "plot", "(", "self", ",", "sig_style", "=", "''", ",", "title", "=", "None", ",", "figsize", "=", "None", ",", "return_fig", "=", "False", ")", ":", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "figsize", ")", "ax", "=", "fig", "...
Plot the comparison of two sets of annotations, possibly overlaid on their original signal. Parameters ---------- sig_style : str, optional The matplotlib style of the signal title : str, optional The title of the plot figsize: tuple, optional ...
[ "Plot", "the", "comparison", "of", "two", "sets", "of", "annotations", "possibly", "overlaid", "on", "their", "original", "signal", "." ]
cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L264-L331
221,436
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine.add_module
def add_module(self, module): """ Ownership of module is transferred to the execution engine """ if module in self._modules: raise KeyError("module already added to this engine") ffi.lib.LLVMPY_AddModule(self, module) module._owned = True self._modules...
python
def add_module(self, module): """ Ownership of module is transferred to the execution engine """ if module in self._modules: raise KeyError("module already added to this engine") ffi.lib.LLVMPY_AddModule(self, module) module._owned = True self._modules...
[ "def", "add_module", "(", "self", ",", "module", ")", ":", "if", "module", "in", "self", ".", "_modules", ":", "raise", "KeyError", "(", "\"module already added to this engine\"", ")", "ffi", ".", "lib", ".", "LLVMPY_AddModule", "(", "self", ",", "module", "...
Ownership of module is transferred to the execution engine
[ "Ownership", "of", "module", "is", "transferred", "to", "the", "execution", "engine" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L80-L88
221,437
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine.remove_module
def remove_module(self, module): """ Ownership of module is returned """ with ffi.OutputString() as outerr: if ffi.lib.LLVMPY_RemoveModule(self, module, outerr): raise RuntimeError(str(outerr)) self._modules.remove(module) module._owned = False
python
def remove_module(self, module): """ Ownership of module is returned """ with ffi.OutputString() as outerr: if ffi.lib.LLVMPY_RemoveModule(self, module, outerr): raise RuntimeError(str(outerr)) self._modules.remove(module) module._owned = False
[ "def", "remove_module", "(", "self", ",", "module", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "outerr", ":", "if", "ffi", ".", "lib", ".", "LLVMPY_RemoveModule", "(", "self", ",", "module", ",", "outerr", ")", ":", "raise", "Runtime...
Ownership of module is returned
[ "Ownership", "of", "module", "is", "returned" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L105-L113
221,438
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine.target_data
def target_data(self): """ The TargetData for this execution engine. """ if self._td is not None: return self._td ptr = ffi.lib.LLVMPY_GetExecutionEngineTargetData(self) self._td = targets.TargetData(ptr) self._td._owned = True return self._td
python
def target_data(self): """ The TargetData for this execution engine. """ if self._td is not None: return self._td ptr = ffi.lib.LLVMPY_GetExecutionEngineTargetData(self) self._td = targets.TargetData(ptr) self._td._owned = True return self._td
[ "def", "target_data", "(", "self", ")", ":", "if", "self", ".", "_td", "is", "not", "None", ":", "return", "self", ".", "_td", "ptr", "=", "ffi", ".", "lib", ".", "LLVMPY_GetExecutionEngineTargetData", "(", "self", ")", "self", ".", "_td", "=", "target...
The TargetData for this execution engine.
[ "The", "TargetData", "for", "this", "execution", "engine", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L116-L125
221,439
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine._find_module_ptr
def _find_module_ptr(self, module_ptr): """ Find the ModuleRef corresponding to the given pointer. """ ptr = cast(module_ptr, c_void_p).value for module in self._modules: if cast(module._ptr, c_void_p).value == ptr: return module return None
python
def _find_module_ptr(self, module_ptr): """ Find the ModuleRef corresponding to the given pointer. """ ptr = cast(module_ptr, c_void_p).value for module in self._modules: if cast(module._ptr, c_void_p).value == ptr: return module return None
[ "def", "_find_module_ptr", "(", "self", ",", "module_ptr", ")", ":", "ptr", "=", "cast", "(", "module_ptr", ",", "c_void_p", ")", ".", "value", "for", "module", "in", "self", ".", "_modules", ":", "if", "cast", "(", "module", ".", "_ptr", ",", "c_void_...
Find the ModuleRef corresponding to the given pointer.
[ "Find", "the", "ModuleRef", "corresponding", "to", "the", "given", "pointer", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L136-L144
221,440
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine.set_object_cache
def set_object_cache(self, notify_func=None, getbuffer_func=None): """ Set the object cache "notifyObjectCompiled" and "getBuffer" callbacks to the given Python functions. """ self._object_cache_notify = notify_func self._object_cache_getbuffer = getbuffer_func # ...
python
def set_object_cache(self, notify_func=None, getbuffer_func=None): """ Set the object cache "notifyObjectCompiled" and "getBuffer" callbacks to the given Python functions. """ self._object_cache_notify = notify_func self._object_cache_getbuffer = getbuffer_func # ...
[ "def", "set_object_cache", "(", "self", ",", "notify_func", "=", "None", ",", "getbuffer_func", "=", "None", ")", ":", "self", ".", "_object_cache_notify", "=", "notify_func", "self", ".", "_object_cache_getbuffer", "=", "getbuffer_func", "# Lifetime of the object cac...
Set the object cache "notifyObjectCompiled" and "getBuffer" callbacks to the given Python functions.
[ "Set", "the", "object", "cache", "notifyObjectCompiled", "and", "getBuffer", "callbacks", "to", "the", "given", "Python", "functions", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L157-L168
221,441
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine._raw_object_cache_notify
def _raw_object_cache_notify(self, data): """ Low-level notify hook. """ if self._object_cache_notify is None: return module_ptr = data.contents.module_ptr buf_ptr = data.contents.buf_ptr buf_len = data.contents.buf_len buf = string_at(buf_ptr,...
python
def _raw_object_cache_notify(self, data): """ Low-level notify hook. """ if self._object_cache_notify is None: return module_ptr = data.contents.module_ptr buf_ptr = data.contents.buf_ptr buf_len = data.contents.buf_len buf = string_at(buf_ptr,...
[ "def", "_raw_object_cache_notify", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_object_cache_notify", "is", "None", ":", "return", "module_ptr", "=", "data", ".", "contents", ".", "module_ptr", "buf_ptr", "=", "data", ".", "contents", ".", "buf_p...
Low-level notify hook.
[ "Low", "-", "level", "notify", "hook", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L170-L186
221,442
numba/llvmlite
llvmlite/binding/executionengine.py
ExecutionEngine._raw_object_cache_getbuffer
def _raw_object_cache_getbuffer(self, data): """ Low-level getbuffer hook. """ if self._object_cache_getbuffer is None: return module_ptr = data.contents.module_ptr module = self._find_module_ptr(module_ptr) if module is None: # The LLVM EE...
python
def _raw_object_cache_getbuffer(self, data): """ Low-level getbuffer hook. """ if self._object_cache_getbuffer is None: return module_ptr = data.contents.module_ptr module = self._find_module_ptr(module_ptr) if module is None: # The LLVM EE...
[ "def", "_raw_object_cache_getbuffer", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_object_cache_getbuffer", "is", "None", ":", "return", "module_ptr", "=", "data", ".", "contents", ".", "module_ptr", "module", "=", "self", ".", "_find_module_ptr", ...
Low-level getbuffer hook.
[ "Low", "-", "level", "getbuffer", "hook", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/executionengine.py#L188-L206
221,443
numba/llvmlite
llvmlite/ir/builder.py
IRBuilder.position_before
def position_before(self, instr): """ Position immediately before the given instruction. The current block is also changed to the instruction's basic block. """ self._block = instr.parent self._anchor = self._block.instructions.index(instr)
python
def position_before(self, instr): """ Position immediately before the given instruction. The current block is also changed to the instruction's basic block. """ self._block = instr.parent self._anchor = self._block.instructions.index(instr)
[ "def", "position_before", "(", "self", ",", "instr", ")", ":", "self", ".", "_block", "=", "instr", ".", "parent", "self", ".", "_anchor", "=", "self", ".", "_block", ".", "instructions", ".", "index", "(", "instr", ")" ]
Position immediately before the given instruction. The current block is also changed to the instruction's basic block.
[ "Position", "immediately", "before", "the", "given", "instruction", ".", "The", "current", "block", "is", "also", "changed", "to", "the", "instruction", "s", "basic", "block", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L182-L188
221,444
numba/llvmlite
llvmlite/ir/builder.py
IRBuilder.position_after
def position_after(self, instr): """ Position immediately after the given instruction. The current block is also changed to the instruction's basic block. """ self._block = instr.parent self._anchor = self._block.instructions.index(instr) + 1
python
def position_after(self, instr): """ Position immediately after the given instruction. The current block is also changed to the instruction's basic block. """ self._block = instr.parent self._anchor = self._block.instructions.index(instr) + 1
[ "def", "position_after", "(", "self", ",", "instr", ")", ":", "self", ".", "_block", "=", "instr", ".", "parent", "self", ".", "_anchor", "=", "self", ".", "_block", ".", "instructions", ".", "index", "(", "instr", ")", "+", "1" ]
Position immediately after the given instruction. The current block is also changed to the instruction's basic block.
[ "Position", "immediately", "after", "the", "given", "instruction", ".", "The", "current", "block", "is", "also", "changed", "to", "the", "instruction", "s", "basic", "block", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L190-L196
221,445
numba/llvmlite
llvmlite/ir/builder.py
IRBuilder.resume
def resume(self, landingpad): """ Resume an in-flight exception. """ br = instructions.Branch(self.block, "resume", [landingpad]) self._set_terminator(br) return br
python
def resume(self, landingpad): """ Resume an in-flight exception. """ br = instructions.Branch(self.block, "resume", [landingpad]) self._set_terminator(br) return br
[ "def", "resume", "(", "self", ",", "landingpad", ")", ":", "br", "=", "instructions", ".", "Branch", "(", "self", ".", "block", ",", "\"resume\"", ",", "[", "landingpad", "]", ")", "self", ".", "_set_terminator", "(", "br", ")", "return", "br" ]
Resume an in-flight exception.
[ "Resume", "an", "in", "-", "flight", "exception", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L809-L815
221,446
numba/llvmlite
llvmlite/ir/builder.py
IRBuilder.asm
def asm(self, ftype, asm, constraint, args, side_effect, name=''): """ Inline assembler. """ asm = instructions.InlineAsm(ftype, asm, constraint, side_effect) return self.call(asm, args, name)
python
def asm(self, ftype, asm, constraint, args, side_effect, name=''): """ Inline assembler. """ asm = instructions.InlineAsm(ftype, asm, constraint, side_effect) return self.call(asm, args, name)
[ "def", "asm", "(", "self", ",", "ftype", ",", "asm", ",", "constraint", ",", "args", ",", "side_effect", ",", "name", "=", "''", ")", ":", "asm", "=", "instructions", ".", "InlineAsm", "(", "ftype", ",", "asm", ",", "constraint", ",", "side_effect", ...
Inline assembler.
[ "Inline", "assembler", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L829-L834
221,447
numba/llvmlite
llvmlite/ir/builder.py
IRBuilder.extract_element
def extract_element(self, vector, idx, name=''): """ Returns the value at position idx. """ instr = instructions.ExtractElement(self.block, vector, idx, name=name) self._insert(instr) return instr
python
def extract_element(self, vector, idx, name=''): """ Returns the value at position idx. """ instr = instructions.ExtractElement(self.block, vector, idx, name=name) self._insert(instr) return instr
[ "def", "extract_element", "(", "self", ",", "vector", ",", "idx", ",", "name", "=", "''", ")", ":", "instr", "=", "instructions", ".", "ExtractElement", "(", "self", ".", "block", ",", "vector", ",", "idx", ",", "name", "=", "name", ")", "self", ".",...
Returns the value at position idx.
[ "Returns", "the", "value", "at", "position", "idx", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L872-L878
221,448
numba/llvmlite
llvmlite/ir/module.py
Module.functions
def functions(self): """ A list of functions declared or defined in this module. """ return [v for v in self.globals.values() if isinstance(v, values.Function)]
python
def functions(self): """ A list of functions declared or defined in this module. """ return [v for v in self.globals.values() if isinstance(v, values.Function)]
[ "def", "functions", "(", "self", ")", ":", "return", "[", "v", "for", "v", "in", "self", ".", "globals", ".", "values", "(", ")", "if", "isinstance", "(", "v", ",", "values", ".", "Function", ")", "]" ]
A list of functions declared or defined in this module.
[ "A", "list", "of", "functions", "declared", "or", "defined", "in", "this", "module", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/module.py#L120-L125
221,449
numba/llvmlite
llvmlite/ir/module.py
Module.add_global
def add_global(self, globalvalue): """ Add a new global value. """ assert globalvalue.name not in self.globals self.globals[globalvalue.name] = globalvalue
python
def add_global(self, globalvalue): """ Add a new global value. """ assert globalvalue.name not in self.globals self.globals[globalvalue.name] = globalvalue
[ "def", "add_global", "(", "self", ",", "globalvalue", ")", ":", "assert", "globalvalue", ".", "name", "not", "in", "self", ".", "globals", "self", ".", "globals", "[", "globalvalue", ".", "name", "]", "=", "globalvalue" ]
Add a new global value.
[ "Add", "a", "new", "global", "value", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/module.py#L140-L145
221,450
numba/llvmlite
docs/gh-pages.py
sh2
def sh2(cmd): """Execute command in a subshell, return stdout. Stderr is unbuffered from the subshell.x""" p = Popen(cmd, stdout=PIPE, shell=True, env=sub_environment()) out = p.communicate()[0] retcode = p.returncode if retcode: raise CalledProcessError(retcode, cmd) else: ...
python
def sh2(cmd): """Execute command in a subshell, return stdout. Stderr is unbuffered from the subshell.x""" p = Popen(cmd, stdout=PIPE, shell=True, env=sub_environment()) out = p.communicate()[0] retcode = p.returncode if retcode: raise CalledProcessError(retcode, cmd) else: ...
[ "def", "sh2", "(", "cmd", ")", ":", "p", "=", "Popen", "(", "cmd", ",", "stdout", "=", "PIPE", ",", "shell", "=", "True", ",", "env", "=", "sub_environment", "(", ")", ")", "out", "=", "p", ".", "communicate", "(", ")", "[", "0", "]", "retcode"...
Execute command in a subshell, return stdout. Stderr is unbuffered from the subshell.x
[ "Execute", "command", "in", "a", "subshell", "return", "stdout", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/docs/gh-pages.py#L53-L63
221,451
numba/llvmlite
docs/gh-pages.py
sh3
def sh3(cmd): """Execute command in a subshell, return stdout, stderr If anything appears in stderr, print it out to sys.stderr""" p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True, env=sub_environment()) out, err = p.communicate() retcode = p.returncode if retcode: rais...
python
def sh3(cmd): """Execute command in a subshell, return stdout, stderr If anything appears in stderr, print it out to sys.stderr""" p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True, env=sub_environment()) out, err = p.communicate() retcode = p.returncode if retcode: rais...
[ "def", "sh3", "(", "cmd", ")", ":", "p", "=", "Popen", "(", "cmd", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ",", "shell", "=", "True", ",", "env", "=", "sub_environment", "(", ")", ")", "out", ",", "err", "=", "p", ".", "communic...
Execute command in a subshell, return stdout, stderr If anything appears in stderr, print it out to sys.stderr
[ "Execute", "command", "in", "a", "subshell", "return", "stdout", "stderr" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/docs/gh-pages.py#L66-L77
221,452
numba/llvmlite
docs/gh-pages.py
init_repo
def init_repo(path): """clone the gh-pages repo if we haven't already.""" sh("git clone %s %s"%(pages_repo, path)) here = os.getcwd() cd(path) sh('git checkout gh-pages') cd(here)
python
def init_repo(path): """clone the gh-pages repo if we haven't already.""" sh("git clone %s %s"%(pages_repo, path)) here = os.getcwd() cd(path) sh('git checkout gh-pages') cd(here)
[ "def", "init_repo", "(", "path", ")", ":", "sh", "(", "\"git clone %s %s\"", "%", "(", "pages_repo", ",", "path", ")", ")", "here", "=", "os", ".", "getcwd", "(", ")", "cd", "(", "path", ")", "sh", "(", "'git checkout gh-pages'", ")", "cd", "(", "her...
clone the gh-pages repo if we haven't already.
[ "clone", "the", "gh", "-", "pages", "repo", "if", "we", "haven", "t", "already", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/docs/gh-pages.py#L80-L86
221,453
numba/llvmlite
docs/source/user-guide/examples/ll_fpadd.py
create_execution_engine
def create_execution_engine(): """ Create an ExecutionEngine suitable for JIT code generation on the host CPU. The engine is reusable for an arbitrary number of modules. """ # Create a target machine representing the host target = llvm.Target.from_default_triple() target_machine = targe...
python
def create_execution_engine(): """ Create an ExecutionEngine suitable for JIT code generation on the host CPU. The engine is reusable for an arbitrary number of modules. """ # Create a target machine representing the host target = llvm.Target.from_default_triple() target_machine = targe...
[ "def", "create_execution_engine", "(", ")", ":", "# Create a target machine representing the host", "target", "=", "llvm", ".", "Target", ".", "from_default_triple", "(", ")", "target_machine", "=", "target", ".", "create_target_machine", "(", ")", "# And an execution eng...
Create an ExecutionEngine suitable for JIT code generation on the host CPU. The engine is reusable for an arbitrary number of modules.
[ "Create", "an", "ExecutionEngine", "suitable", "for", "JIT", "code", "generation", "on", "the", "host", "CPU", ".", "The", "engine", "is", "reusable", "for", "an", "arbitrary", "number", "of", "modules", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/docs/source/user-guide/examples/ll_fpadd.py#L26-L38
221,454
numba/llvmlite
docs/source/user-guide/examples/ll_fpadd.py
compile_ir
def compile_ir(engine, llvm_ir): """ Compile the LLVM IR string with the given engine. The compiled module object is returned. """ # Create a LLVM module object from the IR mod = llvm.parse_assembly(llvm_ir) mod.verify() # Now add the module and make sure it is ready for execution en...
python
def compile_ir(engine, llvm_ir): """ Compile the LLVM IR string with the given engine. The compiled module object is returned. """ # Create a LLVM module object from the IR mod = llvm.parse_assembly(llvm_ir) mod.verify() # Now add the module and make sure it is ready for execution en...
[ "def", "compile_ir", "(", "engine", ",", "llvm_ir", ")", ":", "# Create a LLVM module object from the IR", "mod", "=", "llvm", ".", "parse_assembly", "(", "llvm_ir", ")", "mod", ".", "verify", "(", ")", "# Now add the module and make sure it is ready for execution", "en...
Compile the LLVM IR string with the given engine. The compiled module object is returned.
[ "Compile", "the", "LLVM", "IR", "string", "with", "the", "given", "engine", ".", "The", "compiled", "module", "object", "is", "returned", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/docs/source/user-guide/examples/ll_fpadd.py#L41-L53
221,455
numba/llvmlite
llvmlite/binding/targets.py
get_default_triple
def get_default_triple(): """ Return the default target triple LLVM is configured to produce code for. """ with ffi.OutputString() as out: ffi.lib.LLVMPY_GetDefaultTargetTriple(out) return str(out)
python
def get_default_triple(): """ Return the default target triple LLVM is configured to produce code for. """ with ffi.OutputString() as out: ffi.lib.LLVMPY_GetDefaultTargetTriple(out) return str(out)
[ "def", "get_default_triple", "(", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "out", ":", "ffi", ".", "lib", ".", "LLVMPY_GetDefaultTargetTriple", "(", "out", ")", "return", "str", "(", "out", ")" ]
Return the default target triple LLVM is configured to produce code for.
[ "Return", "the", "default", "target", "triple", "LLVM", "is", "configured", "to", "produce", "code", "for", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/targets.py#L72-L78
221,456
numba/llvmlite
llvmlite/binding/targets.py
TargetData.get_element_offset
def get_element_offset(self, ty, position): """ Get byte offset of type's ty element at the given position """ offset = ffi.lib.LLVMPY_OffsetOfElement(self, ty, position) if offset == -1: raise ValueError("Could not determined offset of {}th " "el...
python
def get_element_offset(self, ty, position): """ Get byte offset of type's ty element at the given position """ offset = ffi.lib.LLVMPY_OffsetOfElement(self, ty, position) if offset == -1: raise ValueError("Could not determined offset of {}th " "el...
[ "def", "get_element_offset", "(", "self", ",", "ty", ",", "position", ")", ":", "offset", "=", "ffi", ".", "lib", ".", "LLVMPY_OffsetOfElement", "(", "self", ",", "ty", ",", "position", ")", "if", "offset", "==", "-", "1", ":", "raise", "ValueError", "...
Get byte offset of type's ty element at the given position
[ "Get", "byte", "offset", "of", "type", "s", "ty", "element", "at", "the", "given", "position" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/targets.py#L136-L146
221,457
numba/llvmlite
llvmlite/binding/targets.py
Target.create_target_machine
def create_target_machine(self, cpu='', features='', opt=2, reloc='default', codemodel='jitdefault', jitdebug=False, printmc=False): """ Create a new TargetMachine for this target and the given options. Specifying codemodel='default' w...
python
def create_target_machine(self, cpu='', features='', opt=2, reloc='default', codemodel='jitdefault', jitdebug=False, printmc=False): """ Create a new TargetMachine for this target and the given options. Specifying codemodel='default' w...
[ "def", "create_target_machine", "(", "self", ",", "cpu", "=", "''", ",", "features", "=", "''", ",", "opt", "=", "2", ",", "reloc", "=", "'default'", ",", "codemodel", "=", "'jitdefault'", ",", "jitdebug", "=", "False", ",", "printmc", "=", "False", ")...
Create a new TargetMachine for this target and the given options. Specifying codemodel='default' will result in the use of the "small" code model. Specifying codemodel='jitdefault' will result in the code model being picked based on platform bitness (32="small", 64="large").
[ "Create", "a", "new", "TargetMachine", "for", "this", "target", "and", "the", "given", "options", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/targets.py#L217-L249
221,458
numba/llvmlite
llvmlite/binding/targets.py
TargetMachine._emit_to_memory
def _emit_to_memory(self, module, use_object=False): """Returns bytes of object code of the module. Args ---- use_object : bool Emit object code or (if False) emit assembly code. """ with ffi.OutputString() as outerr: mb = ffi.lib.LLVMPY_TargetMac...
python
def _emit_to_memory(self, module, use_object=False): """Returns bytes of object code of the module. Args ---- use_object : bool Emit object code or (if False) emit assembly code. """ with ffi.OutputString() as outerr: mb = ffi.lib.LLVMPY_TargetMac...
[ "def", "_emit_to_memory", "(", "self", ",", "module", ",", "use_object", "=", "False", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "outerr", ":", "mb", "=", "ffi", ".", "lib", ".", "LLVMPY_TargetMachineEmitToMemory", "(", "self", ",", "...
Returns bytes of object code of the module. Args ---- use_object : bool Emit object code or (if False) emit assembly code.
[ "Returns", "bytes", "of", "object", "code", "of", "the", "module", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/targets.py#L285-L305
221,459
numba/llvmlite
llvmlite/binding/module.py
parse_assembly
def parse_assembly(llvmir, context=None): """ Create Module from a LLVM IR string """ if context is None: context = get_global_context() llvmir = _encode_string(llvmir) strbuf = c_char_p(llvmir) with ffi.OutputString() as errmsg: mod = ModuleRef( ffi.lib.LLVMPY_Pa...
python
def parse_assembly(llvmir, context=None): """ Create Module from a LLVM IR string """ if context is None: context = get_global_context() llvmir = _encode_string(llvmir) strbuf = c_char_p(llvmir) with ffi.OutputString() as errmsg: mod = ModuleRef( ffi.lib.LLVMPY_Pa...
[ "def", "parse_assembly", "(", "llvmir", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "get_global_context", "(", ")", "llvmir", "=", "_encode_string", "(", "llvmir", ")", "strbuf", "=", "c_char_p", "(", "llvmir"...
Create Module from a LLVM IR string
[ "Create", "Module", "from", "a", "LLVM", "IR", "string" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L12-L27
221,460
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.as_bitcode
def as_bitcode(self): """ Return the module's LLVM bitcode, as a bytes object. """ ptr = c_char_p(None) size = c_size_t(-1) ffi.lib.LLVMPY_WriteBitcodeToString(self, byref(ptr), byref(size)) if not ptr: raise MemoryError try: assert...
python
def as_bitcode(self): """ Return the module's LLVM bitcode, as a bytes object. """ ptr = c_char_p(None) size = c_size_t(-1) ffi.lib.LLVMPY_WriteBitcodeToString(self, byref(ptr), byref(size)) if not ptr: raise MemoryError try: assert...
[ "def", "as_bitcode", "(", "self", ")", ":", "ptr", "=", "c_char_p", "(", "None", ")", "size", "=", "c_size_t", "(", "-", "1", ")", "ffi", ".", "lib", ".", "LLVMPY_WriteBitcodeToString", "(", "self", ",", "byref", "(", "ptr", ")", ",", "byref", "(", ...
Return the module's LLVM bitcode, as a bytes object.
[ "Return", "the", "module", "s", "LLVM", "bitcode", "as", "a", "bytes", "object", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L62-L75
221,461
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.verify
def verify(self): """ Verify the module IR's correctness. RuntimeError is raised on error. """ with ffi.OutputString() as outmsg: if ffi.lib.LLVMPY_VerifyModule(self, outmsg): raise RuntimeError(str(outmsg))
python
def verify(self): """ Verify the module IR's correctness. RuntimeError is raised on error. """ with ffi.OutputString() as outmsg: if ffi.lib.LLVMPY_VerifyModule(self, outmsg): raise RuntimeError(str(outmsg))
[ "def", "verify", "(", "self", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "outmsg", ":", "if", "ffi", ".", "lib", ".", "LLVMPY_VerifyModule", "(", "self", ",", "outmsg", ")", ":", "raise", "RuntimeError", "(", "str", "(", "outmsg", ...
Verify the module IR's correctness. RuntimeError is raised on error.
[ "Verify", "the", "module", "IR", "s", "correctness", ".", "RuntimeError", "is", "raised", "on", "error", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L110-L116
221,462
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.data_layout
def data_layout(self): """ This module's data layout specification, as a string. """ # LLVMGetDataLayout() points inside a std::string managed by LLVM. with ffi.OutputString(owned=False) as outmsg: ffi.lib.LLVMPY_GetDataLayout(self, outmsg) return str(outm...
python
def data_layout(self): """ This module's data layout specification, as a string. """ # LLVMGetDataLayout() points inside a std::string managed by LLVM. with ffi.OutputString(owned=False) as outmsg: ffi.lib.LLVMPY_GetDataLayout(self, outmsg) return str(outm...
[ "def", "data_layout", "(", "self", ")", ":", "# LLVMGetDataLayout() points inside a std::string managed by LLVM.", "with", "ffi", ".", "OutputString", "(", "owned", "=", "False", ")", "as", "outmsg", ":", "ffi", ".", "lib", ".", "LLVMPY_GetDataLayout", "(", "self", ...
This module's data layout specification, as a string.
[ "This", "module", "s", "data", "layout", "specification", "as", "a", "string", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L130-L137
221,463
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.triple
def triple(self): """ This module's target "triple" specification, as a string. """ # LLVMGetTarget() points inside a std::string managed by LLVM. with ffi.OutputString(owned=False) as outmsg: ffi.lib.LLVMPY_GetTarget(self, outmsg) return str(outmsg)
python
def triple(self): """ This module's target "triple" specification, as a string. """ # LLVMGetTarget() points inside a std::string managed by LLVM. with ffi.OutputString(owned=False) as outmsg: ffi.lib.LLVMPY_GetTarget(self, outmsg) return str(outmsg)
[ "def", "triple", "(", "self", ")", ":", "# LLVMGetTarget() points inside a std::string managed by LLVM.", "with", "ffi", ".", "OutputString", "(", "owned", "=", "False", ")", "as", "outmsg", ":", "ffi", ".", "lib", ".", "LLVMPY_GetTarget", "(", "self", ",", "out...
This module's target "triple" specification, as a string.
[ "This", "module", "s", "target", "triple", "specification", "as", "a", "string", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L146-L153
221,464
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.global_variables
def global_variables(self): """ Return an iterator over this module's global variables. The iterator will yield a ValueRef for each global variable. Note that global variables don't include functions (a function is a "global value" but not a "global variable" in LLVM pa...
python
def global_variables(self): """ Return an iterator over this module's global variables. The iterator will yield a ValueRef for each global variable. Note that global variables don't include functions (a function is a "global value" but not a "global variable" in LLVM pa...
[ "def", "global_variables", "(", "self", ")", ":", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_ModuleGlobalsIter", "(", "self", ")", "return", "_GlobalsIterator", "(", "it", ",", "dict", "(", "module", "=", "self", ")", ")" ]
Return an iterator over this module's global variables. The iterator will yield a ValueRef for each global variable. Note that global variables don't include functions (a function is a "global value" but not a "global variable" in LLVM parlance)
[ "Return", "an", "iterator", "over", "this", "module", "s", "global", "variables", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "global", "variable", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L171-L181
221,465
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.functions
def functions(self): """ Return an iterator over this module's functions. The iterator will yield a ValueRef for each function. """ it = ffi.lib.LLVMPY_ModuleFunctionsIter(self) return _FunctionsIterator(it, dict(module=self))
python
def functions(self): """ Return an iterator over this module's functions. The iterator will yield a ValueRef for each function. """ it = ffi.lib.LLVMPY_ModuleFunctionsIter(self) return _FunctionsIterator(it, dict(module=self))
[ "def", "functions", "(", "self", ")", ":", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_ModuleFunctionsIter", "(", "self", ")", "return", "_FunctionsIterator", "(", "it", ",", "dict", "(", "module", "=", "self", ")", ")" ]
Return an iterator over this module's functions. The iterator will yield a ValueRef for each function.
[ "Return", "an", "iterator", "over", "this", "module", "s", "functions", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "function", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L184-L190
221,466
numba/llvmlite
llvmlite/binding/module.py
ModuleRef.struct_types
def struct_types(self): """ Return an iterator over the struct types defined in the module. The iterator will yield a TypeRef. """ it = ffi.lib.LLVMPY_ModuleTypesIter(self) return _TypesIterator(it, dict(module=self))
python
def struct_types(self): """ Return an iterator over the struct types defined in the module. The iterator will yield a TypeRef. """ it = ffi.lib.LLVMPY_ModuleTypesIter(self) return _TypesIterator(it, dict(module=self))
[ "def", "struct_types", "(", "self", ")", ":", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_ModuleTypesIter", "(", "self", ")", "return", "_TypesIterator", "(", "it", ",", "dict", "(", "module", "=", "self", ")", ")" ]
Return an iterator over the struct types defined in the module. The iterator will yield a TypeRef.
[ "Return", "an", "iterator", "over", "the", "struct", "types", "defined", "in", "the", "module", ".", "The", "iterator", "will", "yield", "a", "TypeRef", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/module.py#L193-L199
221,467
numba/llvmlite
llvmlite/binding/options.py
set_option
def set_option(name, option): """ Set the given LLVM "command-line" option. For example set_option("test", "-debug-pass=Structure") would display all optimization passes when generating code. """ ffi.lib.LLVMPY_SetCommandLine(_encode_string(name), _encode_strin...
python
def set_option(name, option): """ Set the given LLVM "command-line" option. For example set_option("test", "-debug-pass=Structure") would display all optimization passes when generating code. """ ffi.lib.LLVMPY_SetCommandLine(_encode_string(name), _encode_strin...
[ "def", "set_option", "(", "name", ",", "option", ")", ":", "ffi", ".", "lib", ".", "LLVMPY_SetCommandLine", "(", "_encode_string", "(", "name", ")", ",", "_encode_string", "(", "option", ")", ")" ]
Set the given LLVM "command-line" option. For example set_option("test", "-debug-pass=Structure") would display all optimization passes when generating code.
[ "Set", "the", "given", "LLVM", "command", "-", "line", "option", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/options.py#L6-L14
221,468
numba/llvmlite
llvmlite/ir/types.py
Type._get_ll_pointer_type
def _get_ll_pointer_type(self, target_data, context=None): """ Convert this type object to an LLVM type. """ from . import Module, GlobalVariable from ..binding import parse_assembly if context is None: m = Module() else: m = Module(contex...
python
def _get_ll_pointer_type(self, target_data, context=None): """ Convert this type object to an LLVM type. """ from . import Module, GlobalVariable from ..binding import parse_assembly if context is None: m = Module() else: m = Module(contex...
[ "def", "_get_ll_pointer_type", "(", "self", ",", "target_data", ",", "context", "=", "None", ")", ":", "from", ".", "import", "Module", ",", "GlobalVariable", "from", ".", ".", "binding", "import", "parse_assembly", "if", "context", "is", "None", ":", "m", ...
Convert this type object to an LLVM type.
[ "Convert", "this", "type", "object", "to", "an", "LLVM", "type", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/types.py#L35-L48
221,469
numba/llvmlite
llvmlite/ir/types.py
BaseStructType.structure_repr
def structure_repr(self): """ Return the LLVM IR for the structure representation """ ret = '{%s}' % ', '.join([str(x) for x in self.elements]) return self._wrap_packed(ret)
python
def structure_repr(self): """ Return the LLVM IR for the structure representation """ ret = '{%s}' % ', '.join([str(x) for x in self.elements]) return self._wrap_packed(ret)
[ "def", "structure_repr", "(", "self", ")", ":", "ret", "=", "'{%s}'", "%", "', '", ".", "join", "(", "[", "str", "(", "x", ")", "for", "x", "in", "self", ".", "elements", "]", ")", "return", "self", ".", "_wrap_packed", "(", "ret", ")" ]
Return the LLVM IR for the structure representation
[ "Return", "the", "LLVM", "IR", "for", "the", "structure", "representation" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/types.py#L477-L482
221,470
numba/llvmlite
llvmlite/ir/types.py
IdentifiedStructType.get_declaration
def get_declaration(self): """ Returns the string for the declaration of the type """ if self.is_opaque: out = "{strrep} = type opaque".format(strrep=str(self)) else: out = "{strrep} = type {struct}".format( strrep=str(self), struct=self.st...
python
def get_declaration(self): """ Returns the string for the declaration of the type """ if self.is_opaque: out = "{strrep} = type opaque".format(strrep=str(self)) else: out = "{strrep} = type {struct}".format( strrep=str(self), struct=self.st...
[ "def", "get_declaration", "(", "self", ")", ":", "if", "self", ".", "is_opaque", ":", "out", "=", "\"{strrep} = type opaque\"", ".", "format", "(", "strrep", "=", "str", "(", "self", ")", ")", "else", ":", "out", "=", "\"{strrep} = type {struct}\"", ".", "...
Returns the string for the declaration of the type
[ "Returns", "the", "string", "for", "the", "declaration", "of", "the", "type" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/types.py#L563-L572
221,471
numba/llvmlite
llvmlite/binding/ffi.py
ObjectRef.close
def close(self): """ Close this object and do any required clean-up actions. """ try: if not self._closed and not self._owned: self._dispose() finally: self.detach()
python
def close(self): """ Close this object and do any required clean-up actions. """ try: if not self._closed and not self._owned: self._dispose() finally: self.detach()
[ "def", "close", "(", "self", ")", ":", "try", ":", "if", "not", "self", ".", "_closed", "and", "not", "self", ".", "_owned", ":", "self", ".", "_dispose", "(", ")", "finally", ":", "self", ".", "detach", "(", ")" ]
Close this object and do any required clean-up actions.
[ "Close", "this", "object", "and", "do", "any", "required", "clean", "-", "up", "actions", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/ffi.py#L226-L234
221,472
numba/llvmlite
llvmlite/binding/ffi.py
ObjectRef.detach
def detach(self): """ Detach the underlying LLVM resource without disposing of it. """ if not self._closed: del self._as_parameter_ self._closed = True self._ptr = None
python
def detach(self): """ Detach the underlying LLVM resource without disposing of it. """ if not self._closed: del self._as_parameter_ self._closed = True self._ptr = None
[ "def", "detach", "(", "self", ")", ":", "if", "not", "self", ".", "_closed", ":", "del", "self", ".", "_as_parameter_", "self", ".", "_closed", "=", "True", "self", ".", "_ptr", "=", "None" ]
Detach the underlying LLVM resource without disposing of it.
[ "Detach", "the", "underlying", "LLVM", "resource", "without", "disposing", "of", "it", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/ffi.py#L236-L243
221,473
numba/llvmlite
llvmlite/binding/dylib.py
load_library_permanently
def load_library_permanently(filename): """ Load an external library """ with ffi.OutputString() as outerr: if ffi.lib.LLVMPY_LoadLibraryPermanently( _encode_string(filename), outerr): raise RuntimeError(str(outerr))
python
def load_library_permanently(filename): """ Load an external library """ with ffi.OutputString() as outerr: if ffi.lib.LLVMPY_LoadLibraryPermanently( _encode_string(filename), outerr): raise RuntimeError(str(outerr))
[ "def", "load_library_permanently", "(", "filename", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "outerr", ":", "if", "ffi", ".", "lib", ".", "LLVMPY_LoadLibraryPermanently", "(", "_encode_string", "(", "filename", ")", ",", "outerr", ")", "...
Load an external library
[ "Load", "an", "external", "library" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/dylib.py#L23-L30
221,474
numba/llvmlite
ffi/build.py
find_win32_generator
def find_win32_generator(): """ Find a suitable cmake "generator" under Windows. """ # XXX this assumes we will find a generator that's the same, or # compatible with, the one which was used to compile LLVM... cmake # seems a bit lacking here. cmake_dir = os.path.join(here_dir, 'dummy') ...
python
def find_win32_generator(): """ Find a suitable cmake "generator" under Windows. """ # XXX this assumes we will find a generator that's the same, or # compatible with, the one which was used to compile LLVM... cmake # seems a bit lacking here. cmake_dir = os.path.join(here_dir, 'dummy') ...
[ "def", "find_win32_generator", "(", ")", ":", "# XXX this assumes we will find a generator that's the same, or", "# compatible with, the one which was used to compile LLVM... cmake", "# seems a bit lacking here.", "cmake_dir", "=", "os", ".", "path", ".", "join", "(", "here_dir", "...
Find a suitable cmake "generator" under Windows.
[ "Find", "a", "suitable", "cmake", "generator", "under", "Windows", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/ffi/build.py#L48-L84
221,475
numba/llvmlite
llvmlite/ir/values.py
_escape_string
def _escape_string(text, _map={}): """ Escape the given bytestring for safe use as a LLVM array constant. """ if isinstance(text, str): text = text.encode('ascii') assert isinstance(text, (bytes, bytearray)) if not _map: for ch in range(256): if ch in _VALID_CHARS: ...
python
def _escape_string(text, _map={}): """ Escape the given bytestring for safe use as a LLVM array constant. """ if isinstance(text, str): text = text.encode('ascii') assert isinstance(text, (bytes, bytearray)) if not _map: for ch in range(256): if ch in _VALID_CHARS: ...
[ "def", "_escape_string", "(", "text", ",", "_map", "=", "{", "}", ")", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "text", "=", "text", ".", "encode", "(", "'ascii'", ")", "assert", "isinstance", "(", "text", ",", "(", "bytes", ",",...
Escape the given bytestring for safe use as a LLVM array constant.
[ "Escape", "the", "given", "bytestring", "for", "safe", "use", "as", "a", "LLVM", "array", "constant", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L20-L38
221,476
numba/llvmlite
llvmlite/ir/values.py
_ConstOpMixin.bitcast
def bitcast(self, typ): """ Bitcast this pointer constant to the given type. """ if typ == self.type: return self op = "bitcast ({0} {1} to {2})".format(self.type, self.get_reference(), typ) return FormattedConsta...
python
def bitcast(self, typ): """ Bitcast this pointer constant to the given type. """ if typ == self.type: return self op = "bitcast ({0} {1} to {2})".format(self.type, self.get_reference(), typ) return FormattedConsta...
[ "def", "bitcast", "(", "self", ",", "typ", ")", ":", "if", "typ", "==", "self", ".", "type", ":", "return", "self", "op", "=", "\"bitcast ({0} {1} to {2})\"", ".", "format", "(", "self", ".", "type", ",", "self", ".", "get_reference", "(", ")", ",", ...
Bitcast this pointer constant to the given type.
[ "Bitcast", "this", "pointer", "constant", "to", "the", "given", "type", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L46-L54
221,477
numba/llvmlite
llvmlite/ir/values.py
_ConstOpMixin.inttoptr
def inttoptr(self, typ): """ Cast this integer constant to the given pointer type. """ if not isinstance(self.type, types.IntType): raise TypeError("can only call inttoptr() on integer constants, not '%s'" % (self.type,)) if not isinstance(...
python
def inttoptr(self, typ): """ Cast this integer constant to the given pointer type. """ if not isinstance(self.type, types.IntType): raise TypeError("can only call inttoptr() on integer constants, not '%s'" % (self.type,)) if not isinstance(...
[ "def", "inttoptr", "(", "self", ",", "typ", ")", ":", "if", "not", "isinstance", "(", "self", ".", "type", ",", "types", ".", "IntType", ")", ":", "raise", "TypeError", "(", "\"can only call inttoptr() on integer constants, not '%s'\"", "%", "(", "self", ".", ...
Cast this integer constant to the given pointer type.
[ "Cast", "this", "integer", "constant", "to", "the", "given", "pointer", "type", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L56-L70
221,478
numba/llvmlite
llvmlite/ir/values.py
_ConstOpMixin.gep
def gep(self, indices): """ Call getelementptr on this pointer constant. """ if not isinstance(self.type, types.PointerType): raise TypeError("can only call gep() on pointer constants, not '%s'" % (self.type,)) outtype = self.type ...
python
def gep(self, indices): """ Call getelementptr on this pointer constant. """ if not isinstance(self.type, types.PointerType): raise TypeError("can only call gep() on pointer constants, not '%s'" % (self.type,)) outtype = self.type ...
[ "def", "gep", "(", "self", ",", "indices", ")", ":", "if", "not", "isinstance", "(", "self", ".", "type", ",", "types", ".", "PointerType", ")", ":", "raise", "TypeError", "(", "\"can only call gep() on pointer constants, not '%s'\"", "%", "(", "self", ".", ...
Call getelementptr on this pointer constant.
[ "Call", "getelementptr", "on", "this", "pointer", "constant", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L72-L90
221,479
numba/llvmlite
llvmlite/ir/values.py
Constant.literal_array
def literal_array(cls, elems): """ Construct a literal array constant made of the given members. """ tys = [el.type for el in elems] if len(tys) == 0: raise ValueError("need at least one element") ty = tys[0] for other in tys: if ty != othe...
python
def literal_array(cls, elems): """ Construct a literal array constant made of the given members. """ tys = [el.type for el in elems] if len(tys) == 0: raise ValueError("need at least one element") ty = tys[0] for other in tys: if ty != othe...
[ "def", "literal_array", "(", "cls", ",", "elems", ")", ":", "tys", "=", "[", "el", ".", "type", "for", "el", "in", "elems", "]", "if", "len", "(", "tys", ")", "==", "0", ":", "raise", "ValueError", "(", "\"need at least one element\"", ")", "ty", "="...
Construct a literal array constant made of the given members.
[ "Construct", "a", "literal", "array", "constant", "made", "of", "the", "given", "members", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L147-L158
221,480
numba/llvmlite
llvmlite/ir/values.py
Constant.literal_struct
def literal_struct(cls, elems): """ Construct a literal structure constant made of the given members. """ tys = [el.type for el in elems] return cls(types.LiteralStructType(tys), elems)
python
def literal_struct(cls, elems): """ Construct a literal structure constant made of the given members. """ tys = [el.type for el in elems] return cls(types.LiteralStructType(tys), elems)
[ "def", "literal_struct", "(", "cls", ",", "elems", ")", ":", "tys", "=", "[", "el", ".", "type", "for", "el", "in", "elems", "]", "return", "cls", "(", "types", ".", "LiteralStructType", "(", "tys", ")", ",", "elems", ")" ]
Construct a literal structure constant made of the given members.
[ "Construct", "a", "literal", "structure", "constant", "made", "of", "the", "given", "members", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L161-L166
221,481
numba/llvmlite
llvmlite/ir/values.py
Function.insert_basic_block
def insert_basic_block(self, before, name=''): """Insert block before """ blk = Block(parent=self, name=name) self.blocks.insert(before, blk) return blk
python
def insert_basic_block(self, before, name=''): """Insert block before """ blk = Block(parent=self, name=name) self.blocks.insert(before, blk) return blk
[ "def", "insert_basic_block", "(", "self", ",", "before", ",", "name", "=", "''", ")", ":", "blk", "=", "Block", "(", "parent", "=", "self", ",", "name", "=", "name", ")", "self", ".", "blocks", ".", "insert", "(", "before", ",", "blk", ")", "return...
Insert block before
[ "Insert", "block", "before" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L622-L627
221,482
numba/llvmlite
llvmlite/ir/values.py
Block.replace
def replace(self, old, new): """Replace an instruction""" if old.type != new.type: raise TypeError("new instruction has a different type") pos = self.instructions.index(old) self.instructions.remove(old) self.instructions.insert(pos, new) for bb in self.paren...
python
def replace(self, old, new): """Replace an instruction""" if old.type != new.type: raise TypeError("new instruction has a different type") pos = self.instructions.index(old) self.instructions.remove(old) self.instructions.insert(pos, new) for bb in self.paren...
[ "def", "replace", "(", "self", ",", "old", ",", "new", ")", ":", "if", "old", ".", "type", "!=", "new", ".", "type", ":", "raise", "TypeError", "(", "\"new instruction has a different type\"", ")", "pos", "=", "self", ".", "instructions", ".", "index", "...
Replace an instruction
[ "Replace", "an", "instruction" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L796-L806
221,483
numba/llvmlite
llvmlite/binding/analysis.py
get_function_cfg
def get_function_cfg(func, show_inst=True): """Return a string of the control-flow graph of the function in DOT format. If the input `func` is not a materialized function, the module containing the function is parsed to create an actual LLVM module. The `show_inst` flag controls whether the instructions...
python
def get_function_cfg(func, show_inst=True): """Return a string of the control-flow graph of the function in DOT format. If the input `func` is not a materialized function, the module containing the function is parsed to create an actual LLVM module. The `show_inst` flag controls whether the instructions...
[ "def", "get_function_cfg", "(", "func", ",", "show_inst", "=", "True", ")", ":", "assert", "func", "is", "not", "None", "if", "isinstance", "(", "func", ",", "ir", ".", "Function", ")", ":", "mod", "=", "parse_assembly", "(", "str", "(", "func", ".", ...
Return a string of the control-flow graph of the function in DOT format. If the input `func` is not a materialized function, the module containing the function is parsed to create an actual LLVM module. The `show_inst` flag controls whether the instructions of each block are printed.
[ "Return", "a", "string", "of", "the", "control", "-", "flow", "graph", "of", "the", "function", "in", "DOT", "format", ".", "If", "the", "input", "func", "is", "not", "a", "materialized", "function", "the", "module", "containing", "the", "function", "is", ...
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/analysis.py#L14-L29
221,484
numba/llvmlite
llvmlite/binding/analysis.py
view_dot_graph
def view_dot_graph(graph, filename=None, view=False): """ View the given DOT source. If view is True, the image is rendered and viewed by the default application in the system. The file path of the output is returned. If view is False, a graphviz.Source object is returned. If view is False and t...
python
def view_dot_graph(graph, filename=None, view=False): """ View the given DOT source. If view is True, the image is rendered and viewed by the default application in the system. The file path of the output is returned. If view is False, a graphviz.Source object is returned. If view is False and t...
[ "def", "view_dot_graph", "(", "graph", ",", "filename", "=", "None", ",", "view", "=", "False", ")", ":", "# Optionally depends on graphviz package", "import", "graphviz", "as", "gv", "src", "=", "gv", ".", "Source", "(", "graph", ")", "if", "view", ":", "...
View the given DOT source. If view is True, the image is rendered and viewed by the default application in the system. The file path of the output is returned. If view is False, a graphviz.Source object is returned. If view is False and the environment is in a IPython session, an IPython image objec...
[ "View", "the", "given", "DOT", "source", ".", "If", "view", "is", "True", "the", "image", "is", "rendered", "and", "viewed", "by", "the", "default", "application", "in", "the", "system", ".", "The", "file", "path", "of", "the", "output", "is", "returned"...
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/analysis.py#L32-L67
221,485
numba/llvmlite
llvmlite/binding/value.py
TypeRef.element_type
def element_type(self): """ Returns the pointed-to type. When the type is not a pointer, raises exception. """ if not self.is_pointer: raise ValueError("Type {} is not a pointer".format(self)) return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
python
def element_type(self): """ Returns the pointed-to type. When the type is not a pointer, raises exception. """ if not self.is_pointer: raise ValueError("Type {} is not a pointer".format(self)) return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
[ "def", "element_type", "(", "self", ")", ":", "if", "not", "self", ".", "is_pointer", ":", "raise", "ValueError", "(", "\"Type {} is not a pointer\"", ".", "format", "(", "self", ")", ")", "return", "TypeRef", "(", "ffi", ".", "lib", ".", "LLVMPY_GetElementT...
Returns the pointed-to type. When the type is not a pointer, raises exception.
[ "Returns", "the", "pointed", "-", "to", "type", ".", "When", "the", "type", "is", "not", "a", "pointer", "raises", "exception", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L64-L71
221,486
numba/llvmlite
llvmlite/binding/value.py
ValueRef.add_function_attribute
def add_function_attribute(self, attr): """Only works on function value Parameters ----------- attr : str attribute name """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) attrname = str(attr) ...
python
def add_function_attribute(self, attr): """Only works on function value Parameters ----------- attr : str attribute name """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) attrname = str(attr) ...
[ "def", "add_function_attribute", "(", "self", ",", "attr", ")", ":", "if", "not", "self", ".", "is_function", ":", "raise", "ValueError", "(", "'expected function value, got %s'", "%", "(", "self", ".", "_kind", ",", ")", ")", "attrname", "=", "str", "(", ...
Only works on function value Parameters ----------- attr : str attribute name
[ "Only", "works", "on", "function", "value" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L181-L196
221,487
numba/llvmlite
llvmlite/binding/value.py
ValueRef.attributes
def attributes(self): """ Return an iterator over this value's attributes. The iterator will yield a string for each attribute. """ itr = iter(()) if self.is_function: it = ffi.lib.LLVMPY_FunctionAttributesIter(self) itr = _AttributeListIterator(it...
python
def attributes(self): """ Return an iterator over this value's attributes. The iterator will yield a string for each attribute. """ itr = iter(()) if self.is_function: it = ffi.lib.LLVMPY_FunctionAttributesIter(self) itr = _AttributeListIterator(it...
[ "def", "attributes", "(", "self", ")", ":", "itr", "=", "iter", "(", "(", ")", ")", "if", "self", ".", "is_function", ":", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_FunctionAttributesIter", "(", "self", ")", "itr", "=", "_AttributeListIterator", "(", ...
Return an iterator over this value's attributes. The iterator will yield a string for each attribute.
[ "Return", "an", "iterator", "over", "this", "value", "s", "attributes", ".", "The", "iterator", "will", "yield", "a", "string", "for", "each", "attribute", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L218-L240
221,488
numba/llvmlite
llvmlite/binding/value.py
ValueRef.blocks
def blocks(self): """ Return an iterator over this function's blocks. The iterator will yield a ValueRef for each block. """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_FunctionBlocksIter(sel...
python
def blocks(self): """ Return an iterator over this function's blocks. The iterator will yield a ValueRef for each block. """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_FunctionBlocksIter(sel...
[ "def", "blocks", "(", "self", ")", ":", "if", "not", "self", ".", "is_function", ":", "raise", "ValueError", "(", "'expected function value, got %s'", "%", "(", "self", ".", "_kind", ",", ")", ")", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_FunctionBlocksI...
Return an iterator over this function's blocks. The iterator will yield a ValueRef for each block.
[ "Return", "an", "iterator", "over", "this", "function", "s", "blocks", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "block", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L243-L253
221,489
numba/llvmlite
llvmlite/binding/value.py
ValueRef.arguments
def arguments(self): """ Return an iterator over this function's arguments. The iterator will yield a ValueRef for each argument. """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_FunctionArgum...
python
def arguments(self): """ Return an iterator over this function's arguments. The iterator will yield a ValueRef for each argument. """ if not self.is_function: raise ValueError('expected function value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_FunctionArgum...
[ "def", "arguments", "(", "self", ")", ":", "if", "not", "self", ".", "is_function", ":", "raise", "ValueError", "(", "'expected function value, got %s'", "%", "(", "self", ".", "_kind", ",", ")", ")", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_FunctionArgu...
Return an iterator over this function's arguments. The iterator will yield a ValueRef for each argument.
[ "Return", "an", "iterator", "over", "this", "function", "s", "arguments", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "argument", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L256-L266
221,490
numba/llvmlite
llvmlite/binding/value.py
ValueRef.instructions
def instructions(self): """ Return an iterator over this block's instructions. The iterator will yield a ValueRef for each instruction. """ if not self.is_block: raise ValueError('expected block value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_BlockInstruct...
python
def instructions(self): """ Return an iterator over this block's instructions. The iterator will yield a ValueRef for each instruction. """ if not self.is_block: raise ValueError('expected block value, got %s' % (self._kind,)) it = ffi.lib.LLVMPY_BlockInstruct...
[ "def", "instructions", "(", "self", ")", ":", "if", "not", "self", ".", "is_block", ":", "raise", "ValueError", "(", "'expected block value, got %s'", "%", "(", "self", ".", "_kind", ",", ")", ")", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_BlockInstructio...
Return an iterator over this block's instructions. The iterator will yield a ValueRef for each instruction.
[ "Return", "an", "iterator", "over", "this", "block", "s", "instructions", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "instruction", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L269-L279
221,491
numba/llvmlite
llvmlite/binding/value.py
ValueRef.operands
def operands(self): """ Return an iterator over this instruction's operands. The iterator will yield a ValueRef for each operand. """ if not self.is_instruction: raise ValueError('expected instruction value, got %s' % (self._kind,)) ...
python
def operands(self): """ Return an iterator over this instruction's operands. The iterator will yield a ValueRef for each operand. """ if not self.is_instruction: raise ValueError('expected instruction value, got %s' % (self._kind,)) ...
[ "def", "operands", "(", "self", ")", ":", "if", "not", "self", ".", "is_instruction", ":", "raise", "ValueError", "(", "'expected instruction value, got %s'", "%", "(", "self", ".", "_kind", ",", ")", ")", "it", "=", "ffi", ".", "lib", ".", "LLVMPY_Instruc...
Return an iterator over this instruction's operands. The iterator will yield a ValueRef for each operand.
[ "Return", "an", "iterator", "over", "this", "instruction", "s", "operands", ".", "The", "iterator", "will", "yield", "a", "ValueRef", "for", "each", "operand", "." ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/binding/value.py#L282-L293
221,492
numba/llvmlite
llvmlite/ir/transforms.py
replace_all_calls
def replace_all_calls(mod, orig, repl): """Replace all calls to `orig` to `repl` in module `mod`. Returns the references to the returned calls """ rc = ReplaceCalls(orig, repl) rc.visit(mod) return rc.calls
python
def replace_all_calls(mod, orig, repl): """Replace all calls to `orig` to `repl` in module `mod`. Returns the references to the returned calls """ rc = ReplaceCalls(orig, repl) rc.visit(mod) return rc.calls
[ "def", "replace_all_calls", "(", "mod", ",", "orig", ",", "repl", ")", ":", "rc", "=", "ReplaceCalls", "(", "orig", ",", "repl", ")", "rc", ".", "visit", "(", "mod", ")", "return", "rc", ".", "calls" ]
Replace all calls to `orig` to `repl` in module `mod`. Returns the references to the returned calls
[ "Replace", "all", "calls", "to", "orig", "to", "repl", "in", "module", "mod", ".", "Returns", "the", "references", "to", "the", "returned", "calls" ]
fcadf8af11947f3fd041c5d6526c5bf231564883
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/transforms.py#L58-L64
221,493
rm-hull/luma.oled
luma/oled/device/color.py
color_device.display
def display(self, image): """ Renders a 24-bit RGB image to the Color OLED display. :param image: The image to render. :type image: PIL.Image.Image """ assert(image.mode == self.mode) assert(image.size == self.size) image = self.preprocess(image) ...
python
def display(self, image): """ Renders a 24-bit RGB image to the Color OLED display. :param image: The image to render. :type image: PIL.Image.Image """ assert(image.mode == self.mode) assert(image.size == self.size) image = self.preprocess(image) ...
[ "def", "display", "(", "self", ",", "image", ")", ":", "assert", "(", "image", ".", "mode", "==", "self", ".", "mode", ")", "assert", "(", "image", ".", "size", "==", "self", ".", "size", ")", "image", "=", "self", ".", "preprocess", "(", "image", ...
Renders a 24-bit RGB image to the Color OLED display. :param image: The image to render. :type image: PIL.Image.Image
[ "Renders", "a", "24", "-", "bit", "RGB", "image", "to", "the", "Color", "OLED", "display", "." ]
76055aa2ca486dc2f9def49754b74ffbccdc5491
https://github.com/rm-hull/luma.oled/blob/76055aa2ca486dc2f9def49754b74ffbccdc5491/luma/oled/device/color.py#L68-L96
221,494
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
events_for_onchain_secretreveal
def events_for_onchain_secretreveal( target_state: TargetTransferState, channel_state: NettingChannelState, block_number: BlockNumber, block_hash: BlockHash, ) -> List[Event]: """ Emits the event for revealing the secret on-chain if the transfer can not be settled off-chain. ...
python
def events_for_onchain_secretreveal( target_state: TargetTransferState, channel_state: NettingChannelState, block_number: BlockNumber, block_hash: BlockHash, ) -> List[Event]: """ Emits the event for revealing the secret on-chain if the transfer can not be settled off-chain. ...
[ "def", "events_for_onchain_secretreveal", "(", "target_state", ":", "TargetTransferState", ",", "channel_state", ":", "NettingChannelState", ",", "block_number", ":", "BlockNumber", ",", "block_hash", ":", "BlockHash", ",", ")", "->", "List", "[", "Event", "]", ":",...
Emits the event for revealing the secret on-chain if the transfer can not be settled off-chain.
[ "Emits", "the", "event", "for", "revealing", "the", "secret", "on", "-", "chain", "if", "the", "transfer", "can", "not", "be", "settled", "off", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L59-L98
221,495
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
handle_inittarget
def handle_inittarget( state_change: ActionInitTarget, channel_state: NettingChannelState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[TargetTransferState]: """ Handles an ActionInitTarget state change. """ transfer = state_change.tran...
python
def handle_inittarget( state_change: ActionInitTarget, channel_state: NettingChannelState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[TargetTransferState]: """ Handles an ActionInitTarget state change. """ transfer = state_change.tran...
[ "def", "handle_inittarget", "(", "state_change", ":", "ActionInitTarget", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "TransitionResult", "[", ...
Handles an ActionInitTarget state change.
[ "Handles", "an", "ActionInitTarget", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L101-L164
221,496
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
handle_offchain_secretreveal
def handle_offchain_secretreveal( target_state: TargetTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[TargetTransferState]: """ Validates and handles...
python
def handle_offchain_secretreveal( target_state: TargetTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[TargetTransferState]: """ Validates and handles...
[ "def", "handle_offchain_secretreveal", "(", "target_state", ":", "TargetTransferState", ",", "state_change", ":", "ReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", "block_number", ":...
Validates and handles a ReceiveSecretReveal state change.
[ "Validates", "and", "handles", "a", "ReceiveSecretReveal", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L167-L212
221,497
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
handle_onchain_secretreveal
def handle_onchain_secretreveal( target_state: TargetTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, ) -> TransitionResult[TargetTransferState]: """ Validates and handles a ContractReceiveSecretReveal state change. """ valid_secret = is_valid...
python
def handle_onchain_secretreveal( target_state: TargetTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, ) -> TransitionResult[TargetTransferState]: """ Validates and handles a ContractReceiveSecretReveal state change. """ valid_secret = is_valid...
[ "def", "handle_onchain_secretreveal", "(", "target_state", ":", "TargetTransferState", ",", "state_change", ":", "ContractReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", ")", "->", "TransitionResult", "[", "TargetTransferState", "]", ":", "val...
Validates and handles a ContractReceiveSecretReveal state change.
[ "Validates", "and", "handles", "a", "ContractReceiveSecretReveal", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L215-L238
221,498
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
handle_unlock
def handle_unlock( target_state: TargetTransferState, state_change: ReceiveUnlock, channel_state: NettingChannelState, ) -> TransitionResult[TargetTransferState]: """ Handles a ReceiveUnlock state change. """ balance_proof_sender = state_change.balance_proof.sender is_valid, events,...
python
def handle_unlock( target_state: TargetTransferState, state_change: ReceiveUnlock, channel_state: NettingChannelState, ) -> TransitionResult[TargetTransferState]: """ Handles a ReceiveUnlock state change. """ balance_proof_sender = state_change.balance_proof.sender is_valid, events,...
[ "def", "handle_unlock", "(", "target_state", ":", "TargetTransferState", ",", "state_change", ":", "ReceiveUnlock", ",", "channel_state", ":", "NettingChannelState", ",", ")", "->", "TransitionResult", "[", "TargetTransferState", "]", ":", "balance_proof_sender", "=", ...
Handles a ReceiveUnlock state change.
[ "Handles", "a", "ReceiveUnlock", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L241-L279
221,499
raiden-network/raiden
raiden/transfer/mediated_transfer/target.py
handle_block
def handle_block( target_state: TargetTransferState, channel_state: NettingChannelState, block_number: BlockNumber, block_hash: BlockHash, ) -> TransitionResult[TargetTransferState]: """ After Raiden learns about a new block this function must be called to handle expiration of th...
python
def handle_block( target_state: TargetTransferState, channel_state: NettingChannelState, block_number: BlockNumber, block_hash: BlockHash, ) -> TransitionResult[TargetTransferState]: """ After Raiden learns about a new block this function must be called to handle expiration of th...
[ "def", "handle_block", "(", "target_state", ":", "TargetTransferState", ",", "channel_state", ":", "NettingChannelState", ",", "block_number", ":", "BlockNumber", ",", "block_hash", ":", "BlockHash", ",", ")", "->", "TransitionResult", "[", "TargetTransferState", "]",...
After Raiden learns about a new block this function must be called to handle expiration of the hash time lock.
[ "After", "Raiden", "learns", "about", "a", "new", "block", "this", "function", "must", "be", "called", "to", "handle", "expiration", "of", "the", "hash", "time", "lock", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/target.py#L282-L322