sequence stringlengths 1.27k 35.1k | code stringlengths 75 8.58k |
|---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_find_cert_in_list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children... | def _find_cert_in_list(cert, issuer, certificate_list, crl_issuer):
revoked_certificates = certificate_list['tbs_cert_list']['revoked_certificates']
cert_serial = cert.serial_number
issuer_name = issuer.subject
known_extensions = set([
'crl_reason',
'hold_instruction_code',
'inva... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'derive_coordinates'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def derive_coordinates(self):
if self._coordinates_resolved:
return
if self.seg_map is not None:
self.start, self.filename, include_ref = self.seg_map.derive_source_offset(self.start)
self.end, end_filename, _ = self.seg_map.derive_source_offset(self.end, is_end=True)... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'children'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def children(self, unroll=False, skip_not_present=True):
for child_inst in self.inst.children:
if skip_not_present:
if not child_inst.properties.get('ispresent', True):
continue
if unroll and isinstance(child_inst, comp.AddressableComponent) and child_... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_by_path'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | def find_by_path(self, path):
pathparts = path.split('.')
current_node = self
for pathpart in pathparts:
m = re.fullmatch(r'^(\w+)((?:\[(?:\d+|0[xX][\da-fA-F]+)\])*)$', pathpart)
if not m:
raise ValueError("Invalid path")
inst_name, array_suffi... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_property'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def get_property(self, prop_name, **kwargs):
ovr_default = False
default = None
if 'default' in kwargs:
ovr_default = True
default = kwargs.pop('default')
if kwargs:
raise TypeError("got an unexpected keyword argument '%s'" % list(kwargs.keys())[0])
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'elaborate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def elaborate(self, top_def_name=None, inst_name=None, parameters=None):
if parameters is None:
parameters = {}
if top_def_name is not None:
if top_def_name not in self.root.comp_defs:
self.msg.fatal("Elaboration target '%s' not found" % top_def_name)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'resolve_addresses'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def resolve_addresses(self, node):
prop_alignment = self.alignment_stack[-1]
if prop_alignment is None:
prop_alignment = 1
prev_node = None
for child_node in node.children(skip_not_present=False):
if not isinstance(child_node, AddressableNode):
con... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_include'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def parse_include(self, start):
i = start
while i:
if self.text[i] == '\n':
i += 1
break
i -= 1
line_start = i
if not (self.text[line_start:start] == "" or self.text[line_start:start].isspace()):
self.env.msg.fatal(
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_paths'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | def get_paths(patterns, start_dirs=None, max_depth=1):
if len(patterns) == 1 and not start_dirs:
pattern = patterns[0]
directory = os.path.dirname(pattern)
if directory:
patterns = [os.path.basename(pattern)]
start_dirs = directory
max_depth = 1
if not... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '34']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'edit_files'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '28', '31']}; {'id': '4', '... | def edit_files(patterns, expressions=None,
functions=None, executables=None,
start_dirs=None, max_depth=1, dry_run=True,
output=sys.stdout, encoding=None, newline=None):
if not is_list(patterns):
raise TypeError("patterns should be a list")
if expressions and... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'detect_events'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def detect_events(dat, method, value=None):
if 'thresh' in method or 'custom' == method:
if method == 'above_thresh':
above_det = dat >= value
detected = _detect_start_end(above_det)
if method == 'below_thresh':
below_det = dat < value
detected = _dete... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge_close'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | def merge_close(events, min_interval, merge_to_longer=False):
half_iv = min_interval / 2
merged = []
for higher in events:
if not merged:
merged.append(higher)
else:
lower = merged[-1]
if higher['start'] - half_iv <= lower['end'] + half_iv:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_remove_duplicate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def _remove_duplicate(old_events, dat):
diff_events = diff(old_events, axis=0)
dupl = where((diff_events[:, 0] == 0) & (diff_events[:, 2] == 0))[0]
dupl += 1
n_nondupl_events = old_events.shape[0] - len(dupl)
new_events = zeros((n_nondupl_events, old_events.shape[1]), dtype='int')
if len(dupl):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'math'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | def math(data, operator=None, operator_name=None, axis=None):
if operator is not None and operator_name is not None:
raise TypeError('Parameters "operator" and "operator_name" are '
'mutually exclusive')
if operator_name is not None:
if isinstance(operator_name, str):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'detect_Massimini2004'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'childr... | def detect_Massimini2004(dat_orig, s_freq, time, opts):
if opts.invert:
dat_orig = -dat_orig
dat_det = transform_signal(dat_orig, s_freq, 'double_butter',
opts.det_filt)
above_zero = detect_events(dat_det, 'above_thresh', value=0.)
sw_in_chan = []
if above_zer... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '29']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26']}; {'id': '4', 'type': 'i... | def filter_(data, axis='time', low_cut=None, high_cut=None, order=4,
ftype='butter', Rs=None, notchfreq=50, notchquality=25):
nyquist = data.s_freq / 2.
btype = None
if low_cut is not None and high_cut is not None:
if low_cut > nyquist or high_cut > nyquist:
raise ValueError(... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'select'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def select(data, trial=None, invert=False, **axes_to_select):
if trial is not None and not isinstance(trial, Iterable):
raise TypeError('Trial needs to be iterable.')
for axis_to_select, values_to_select in axes_to_select.items():
if (not isinstance(values_to_select, Iterable) or
isin... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '49']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fetch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '13', '16', '19', '22', '25', '28', '31', '34', '37', '40', '4... | def fetch(dataset, annot, cat=(0, 0, 0, 0), evt_type=None, stage=None,
cycle=None, chan_full=None, epoch=None, epoch_dur=30,
epoch_overlap=0, epoch_step=None, reject_epoch=False,
reject_artf=False, min_dur=0, buffer=0):
bundles = get_times(annot, evt_type=evt_type, stage=stage, cycle=c... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_times'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20']}; {'id': '4', 'type': 'identifier'... | def get_times(annot, evt_type=None, stage=None, cycle=None, chan=None,
exclude=False, buffer=0):
getter = annot.get_epochs
last = annot.last_second
if stage is None:
stage = (None,)
if cycle is None:
cycle = (None,)
if chan is None:
chan = (None,)
if evt_typ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_concat'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'bun... | def _concat(bundles, cat=(0, 0, 0, 0)):
chan = sorted(set([x['chan'] for x in bundles]))
cycle = sorted(set([x['cycle'] for x in bundles]))
stage = sorted(set([x['stage'] for x in bundles]))
evt_type = sorted(set([x['name'] for x in bundles]))
all_cycle = None
all_stage = None
all_evt_type =... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'toggle_pac'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}... | def toggle_pac(self):
if Pac is not None:
pac_on = self.pac['pac_on'].get_value()
self.pac['prep'].setEnabled(pac_on)
self.pac['box_metric'].setEnabled(pac_on)
self.pac['box_complex'].setEnabled(pac_on)
self.pac['box_surro'].setEnabled(pac_on)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_segments'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | def get_segments(self):
chunk = {k: v.isChecked() for k, v in self.chunk.items()}
lock_to_staging = self.lock_to_staging.get_value()
epoch_dur = self.epoch_param['dur'].get_value()
epoch_overlap = self.epoch_param['overlap_val'].value()
epoch_step = None
epoch = None
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compute_evt_params'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def compute_evt_params(self):
ev = self.event
glob = {k: v.get_value() for k, v in ev['global'].items()}
params = {k: v[0].get_value() for k, v in ev['local'].items()}
prep = {k: v[1].get_value() for k, v in ev['local'].items()}
slopes = {k: v.get_value() for k, v in ev['sw'].ite... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'detect_format'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fil... | def detect_format(filename):
filename = Path(filename)
if filename.is_dir():
if list(filename.glob('*.stc')) and list(filename.glob('*.erd')):
return Ktlx
elif (filename / 'patient.info').exists():
return Moberg
elif (filename / 'info.xml').exists():
r... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_videos'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def read_videos(self, begtime=None, endtime=None):
if isinstance(begtime, datetime):
begtime = begtime - self.header['start_time']
if isinstance(begtime, timedelta):
begtime = begtime.total_seconds()
if isinstance(endtime, datetime):
endtime = endtime - self.h... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_data'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20']}; {'id': '4', 'type': 'identifier'... | def read_data(self, chan=None, begtime=None, endtime=None, begsam=None,
endsam=None, s_freq=None):
data = ChanTime()
data.start_time = self.header['start_time']
data.s_freq = s_freq = s_freq if s_freq else self.header['s_freq']
if chan is None:
chan = self.h... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'export_freq_band'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def export_freq_band(xfreq, bands, filename):
heading_row_1 = ['Segment index',
'Start time',
'End time',
'Duration',
'Stitches',
'Stage',
'Cycle',
'Event type',
'C... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_cycles'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}... | def get_cycles(self):
cycles = self.rater.find('cycles')
if not cycles:
return None
starts = sorted(
[float(mrkr.text) for mrkr in cycles.findall('cyc_start')])
ends = sorted(
[float(mrkr.text) for mrkr in cycles.findall('cyc_end')])
cy... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_read_erd'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def _read_erd(erd_file, begsam, endsam):
hdr = _read_hdr_file(erd_file)
n_allchan = hdr['num_channels']
shorted = hdr['shorted']
n_shorted = sum(shorted)
if n_shorted > 0:
raise NotImplementedError('shorted channels not tested yet')
if hdr['file_schema'] in (7,):
abs_delta = b'\x... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'return_markers'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | def return_markers(self):
ent_file = self._filename.with_suffix('.ent')
if not ent_file.exists():
ent_file = self._filename.with_suffix('.ent.old')
try:
ent_notes = _read_ent(ent_file)
except (FileNotFoundError, PermissionError):
markers = []
e... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'band_power'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', 'chi... | def band_power(data, freq, scaling='power', n_fft=None, detrend=None,
array_out=False):
if not array_out:
power = {}
peakf = {}
else:
power = zeros((data.number_of('chan')[0], 1))
peakf = zeros((data.number_of('chan')[0], 1))
if isinstance(data, ChanFreq):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'morlet'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21']}; {'id': '4', 'type': 'identifie... | def morlet(freq, s_freq, ratio=5, sigma_f=None, dur_in_sd=4, dur_in_s=None,
normalization='peak', zero_mean=False):
if sigma_f is None:
sigma_f = freq / ratio
else:
ratio = freq / sigma_f
sigma_t = 1 / (2 * pi * sigma_f)
if ratio < 5 and not zero_mean:
lg.info('The wav... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_convert_timestr_to_seconds'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children'... | def _convert_timestr_to_seconds(time_str, rec_start):
if not CHECK_TIME_STR.match(time_str):
raise ValueError('Input can only contain digits and colons')
if ':' in time_str:
time_split = [int(x) for x in time_str.split(':')]
if len(time_split) == 2:
time_split.append(0)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mouseReleaseEvent'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def mouseReleaseEvent(self, event):
if not self.scene:
return
if self.event_sel:
return
if self.deselect:
self.deselect = False
return
if not self.ready:
return
chk_marker = self.parent.notes.action['new_bookmark'].isChe... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'next_event'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | def next_event(self, delete=False):
if delete:
msg = "Delete this event? This cannot be undone."
msgbox = QMessageBox(QMessageBox.Question, 'Delete event', msg)
msgbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msgbox.setDefaultButton(QMessageBox.Yes)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'montage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': ... | def montage(data, ref_chan=None, ref_to_avg=False, bipolar=None,
method='average'):
if ref_to_avg and ref_chan is not None:
raise TypeError('You cannot specify reference to the average and '
'the channels to use as reference')
if ref_chan is not None:
if (not ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove_artf_evts'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children'... | def remove_artf_evts(times, annot, chan=None, min_dur=0.1):
new_times = times
beg = times[0][0]
end = times[-1][-1]
chan = (chan, '') if chan else None
artefact = annot.get_events(name='Artefact', time=(beg, end), chan=chan,
qual='Good')
if artefact:
new_t... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_build_app_dict'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | def _build_app_dict(site, request, label=None):
app_dict = {}
if label:
models = {
m: m_a for m, m_a in site._registry.items()
if m._meta.app_label == label
}
else:
models = site._registry
for model, model_admin in models.items():
app_label = model... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_app_list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | def get_app_list(site, request):
app_dict = _build_app_dict(site, request)
app_list = sorted(app_dict.values(), key=lambda x: x['name'].lower())
for app in app_list:
app['models'].sort(key=lambda x: x['name'])
return app_list |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'ERROR', 'children': ['2']}; {'id': '2', 'type': 'function_definition', 'children': ['3', '4', '8']}; {'id': '3', 'type': 'function_name', 'children': [], 'value': 'format_query_results'}; {'id': '4', 'type': 'parameters', 'children': ['5', '6', '7']... | def format_query_results(self, r, prop_nr):
prop_dt = self.get_prop_datatype(prop_nr)
for i in r:
for value in {'item', 'sid', 'pq', 'pr', 'ref'}:
if value in i:
i[value] = i[value]['value'].split('/')[-1]
for value in {'v', 'qval', 'rval'}:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'times'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'p... | def times(p, mint, maxt=None):
'''Repeat a parser between `mint` and `maxt` times. DO AS MUCH MATCH AS IT CAN.
Return a list of values.'''
maxt = maxt if maxt else mint
@Parser
def times_parser(text, index):
cnt, values, res = 0, Value.success(index, []), None
while cnt < maxt:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'separated'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children':... | def separated(p, sep, mint, maxt=None, end=None):
'''Repeat a parser `p` separated by `s` between `mint` and `maxt` times.
When `end` is None, a trailing separator is optional.
When `end` is True, a trailing separator is required.
When `end` is False, a trailing separator is not allowed.
MATCHES AS ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'route'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']}; {'id': '5... | def route(*args):
def _validate_route(route):
if not isinstance(route, six.string_types):
raise TypeError('%s must be a string' % route)
if route in ('.', '..') or not re.match(
'^[0-9a-zA-Z-_$\(\)\.~!,;:*+@=]+$', route
):
raise ValueError(
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_object'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def find_object(obj, remainder, notfound_handlers, request):
'''
'Walks' the url path in search of an action for which a controller is
implemented and returns that controller object along with what's left
of the remainder.
'''
prev_obj = None
while True:
if obj is None:
r... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_app'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'roo... | def make_app(root, **kw):
'''
Utility for creating the Pecan application object. This function should
generally be called from the ``setup_app`` function in your project's
``app.py`` file.
:param root: A string representing a root controller object (e.g.,
"myapp.controller.root.Roo... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '22']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'redirect'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13', '16', '19']}; {'id': '4', 'type': 'default_parameter... | def redirect(location=None, internal=False, code=None, headers={},
add_slash=False, request=None):
'''
Perform a redirect, either internal or external. An internal redirect
performs the redirect server-side, while the external redirect utilizes
an HTTP 302 status code.
:param location: ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_args'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'childre... | def get_args(self, state, all_params, remainder, argspec, im_self):
'''
Determines the arguments for a controller based upon parameters
passed the argument specification for the controller.
'''
args = []
varargs = []
kwargs = dict()
valid_args = argspec.ar... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_route'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '... | def _route(self, args, request=None):
'''
Routes a request to the appropriate controller and returns its result.
Performs a bit of validation - refuses to route delete and put actions
via a GET request).
'''
if request is None:
from pecan import request
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_handle_get'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [],... | def _handle_get(self, method, remainder, request=None):
'''
Routes ``GET`` actions to the appropriate controller.
'''
if request is None:
self._raise_method_deprecation_warning(self._handle_get)
if not remainder or remainder == ['']:
remainder = list(six.m... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_handle_delete'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': ... | def _handle_delete(self, method, remainder, request=None):
'''
Routes ``DELETE`` actions to the appropriate controller.
'''
if request is None:
self._raise_method_deprecation_warning(self._handle_delete)
if remainder:
match = self._handle_custom_action(met... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'gunicorn_run'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '53', '230']}; {'id'... | def gunicorn_run():
try:
from gunicorn.app.wsgiapp import WSGIApplication
except ImportError as exc:
args = exc.args
arg0 = args[0] if args else ''
arg0 += ' (are you sure `gunicorn` is installed?)'
exc.args = (arg0,) + args[1:]
raise
class PecanApplication(WS... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'expose'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'children':... | def expose(template=None,
generic=False,
route=None,
**kw):
'''
Decorator used to flag controller methods as being "exposed" for
access via HTTP, and to configure that access.
:param template: The path to a template, relative to the base template
dir... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_operations_bulk'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | def add_operations_bulk(self, payload):
valid_indices, _, _ = self._check_agent_id_bulk(payload)
valid_payload = [payload[i] for i in valid_indices]
chunked_data = []
current_chunk = []
current_chunk_size = 0
for agent in valid_payload:
if (agent["operations"] and isinstance(agent["operati... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '... | def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
valid = True
try:
message = line.decode(encoding)
except UnicodeDecodeError:
message = line.decode(pydle.protocol.FALLBACK_ENCODING)
if len(message) > protocol.MESSAGE_LENGTH_LIMIT:
valid ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'construct'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | def construct(self, force=False):
command = str(self.command)
if not protocol.COMMAND_PATTERN.match(command) and not force:
raise pydle.protocol.ProtocolViolation('The constructed command does not follow the command pattern ({pat})'.format(pat=protocol.COMMAND_PATTERN.pattern), message=comma... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'ERROR', 'children': ['2', '244', '262', '267', '275', '276', '280', '281', '285', '286', '314', '318', '328', '331', '337', '341', '342']}; {'id': '2', 'type': 'function_definition', 'children': ['3', '4', '6', '132']}; {'id': '3', 'type': 'function... | def split(url):
scheme = netloc = path = query = fragment = ''
ip6_start = url.find('[')
scheme_end = url.find(':')
if ip6_start > 0 and ip6_start < scheme_end:
scheme_end = -1
if scheme_end > 0:
for c in url[:scheme_end]:
if c not in SCHEME_CHARS:
break
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'issue_cmd'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], '... | async def issue_cmd(self, cmd, value, retry=3):
async with self._cmd_lock:
if not self.connected:
_LOGGER.debug(
"Serial transport closed, not sending command %s", cmd)
return
while not self._cmdq.empty():
_LOGGER.debug(... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_reports'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'... | async def get_reports(self):
cmd = OTGW_CMD_REPORT
reports = {}
for value in OTGW_REPORTS.keys():
ret = await self._wait_for_cmd(cmd, value)
if ret is None:
reports[value] = None
continue
reports[value] = ret[2:]
status ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [],... | def build(self, client,
nobuild=False,
usecache=True,
pull=False):
if not nobuild:
self.update_source_images(client,
usecache=usecache,
pull=pull)
width = utils.get_console_w... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_check_yaml_and_paths'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def _check_yaml_and_paths(ymlfilepath, yamldefs):
relpath = os.path.relpath(ymlfilepath)
if '/' not in relpath:
relpath = './%s' % relpath
pathroot = os.path.abspath(os.path.dirname(ymlfilepath))
for imagename, defn in iteritems(yamldefs):
if imagename == '_SOURCE... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'generate_build'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19']}; {'id': '4', 'type': 'i... | def generate_build(self, image, targetname, rebuilds=None, cache_repo='', cache_tag='',
buildargs=None, **kwargs):
from_image = self.get_external_base_image(image)
if cache_repo or cache_tag:
cache_from = utils.generate_name(image, cache_repo, cache_tag)
else:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sort_dependencies'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],... | def sort_dependencies(self, image, dependencies=None):
if dependencies is None:
dependencies = OrderedDict()
if image in dependencies:
return
requires = self.ymldefs[image].get('requires', [])
for dep in requires:
self.sort_dependencies(dep, dependenci... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_external_base_image'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children... | def get_external_base_image(self, image, stack=None):
if stack is None:
stack = list()
mydef = self.ymldefs[image]
if image in stack:
stack.append(image)
raise errors.CircularDependencyError('Circular dependency found:\n' + '->'.join(stack))
stack.appe... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_htmlRenderDict'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | def _htmlRenderDict(pathParts, statDict, output):
keys = list(statDict.keys())
keys.sort()
links = []
output.write('<div class="level">')
for key in keys:
keyStr = cgi.escape(_utf8str(key))
value = statDict[key]
if hasattr(value, '__call__'):
value = value()
if hasattr(value, 'keys'):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '96', '98']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_session'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '14', '23', '32', '41', '46', '51', '56', '61',... | def create_session(
self,
kind: SessionKind,
proxy_user: str = None,
jars: List[str] = None,
py_files: List[str] = None,
files: List[str] = None,
driver_memory: str = None,
driver_cores: int = None,
executor_memory: str = None,
executor_cor... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sine_psd'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', ... | def sine_psd(data, delta, number_of_tapers=None, number_of_iterations=2,
degree_of_smoothing=1.0, statistics=False, verbose=False):
if verbose is True:
verbose = C.byref(C.c_char('y'))
else:
verbose = None
if number_of_tapers is None:
number_of_tapers = 0
mt = _Mtspe... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '25']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mt_deconvolve'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19', '22']}; {'id': '4', 'type... | def mt_deconvolve(data_a, data_b, delta, nfft=None, time_bandwidth=None,
number_of_tapers=None, weights="adaptive", demean=True,
fmax=0.0):
npts = len(data_a)
if len(data_b) != npts:
raise ValueError("Input arrays must have the same length!")
if nfft is None:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_server'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'child... | def create_server(self,
loop=None,
as_coroutine=False,
protocol_factory=None,
**server_config):
if loop is None:
import asyncio
loop = asyncio.get_event_loop()
if protocol_factory is None:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'event_emitter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '8']}; {'id': '4', 'type': 'default_parameter', 'children':... | def event_emitter(cls_=None, *, events=('*', )):
event_dict = dict.fromkeys(events, [])
allow_any_eventname = event_dict.pop('*', False) == []
def _event_emitter(cls):
def on(self, name, callback):
if not (callable(callback) or isawaitable(callback)):
raise ValueError("Ca... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_build_production_name'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [],... | def _build_production_name(self, glyph):
if self._postscriptNames:
production_name = self._postscriptNames.get(glyph.name)
return production_name if production_name else glyph.name
unicode_val = glyph.unicode
if glyph.unicode is not None:
return '%s%04X' % (
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makeOfficialGlyphOrder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [],... | def makeOfficialGlyphOrder(font, glyphOrder=None):
if glyphOrder is None:
glyphOrder = getattr(font, "glyphOrder", ())
names = set(font.keys())
order = []
if ".notdef" in names:
names.remove(".notdef")
order.append(".notdef")
for name in glyphOrder:
if name not in nam... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_layer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children'... | def from_layer(cls, font, layerName=None, copy=False, skipExportGlyphs=None):
if layerName is not None:
layer = font.layers[layerName]
else:
layer = font.layers.defaultLayer
if copy:
self = _copyLayer(layer, obj_type=cls)
self.lib = deepcopy(layer.... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '38']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compileInterpolatableTTFs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', ... | def compileInterpolatableTTFs(
ufos,
preProcessorClass=TTFInterpolatablePreProcessor,
outlineCompilerClass=OutlineTTFCompiler,
featureCompilerClass=None,
featureWriters=None,
glyphOrder=None,
useProductionNames=None,
cubicConversionError=None,
reverseDirection=True,
inplace=False... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_propagate_glyph_anchors'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'childre... | def _propagate_glyph_anchors(glyphSet, composite, processed):
if composite.name in processed:
return
processed.add(composite.name)
if not composite.components:
return
base_components = []
mark_components = []
anchor_names = set()
to_add = {}
for component in composite.com... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setupTable_name'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | def setupTable_name(self):
if "name" not in self.tables:
return
font = self.ufo
self.otf["name"] = name = newTable("name")
name.names = []
for nameRecord in getAttrWithFallback(
font.info, "openTypeNameRecords"):
nameId = nameRecord["nameID... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setupTable_cmap'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | def setupTable_cmap(self):
if "cmap" not in self.tables:
return
from fontTools.ttLib.tables._c_m_a_p import cmap_format_4
nonBMP = dict((k,v) for k,v in self.unicodeToGlyphNameMapping.items() if k > 65535)
if nonBMP:
mapping = dict((k,v) for k,v in self.unicodeToG... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_setupTable_hhea_or_vhea'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [... | def _setupTable_hhea_or_vhea(self, tag):
if tag not in self.tables:
return
if tag == "hhea":
isHhea = True
else:
isHhea = False
self.otf[tag] = table = newTable(tag)
mtxTable = self.otf.get(tag[0] + "mtx")
font = self.ufo
if isH... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dir'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | def dir(self,methods=True,showall=True):
import inspect
for k,v in sorted(self.__dict__.items()):
if k.startswith("_"): continue
print makeminlength("."+k,being.linelen),"\t",v
if not methods:
return
entmethods=dir(entity)
print
for x in [x for x in dir(self) if ("bound method "+self.classname() in... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tree'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | def tree(self,offset=0,prefix_inherited="",nofeatsplease=['Phoneme']):
tree = ""
numchild=0
for child in self.children:
if type(child)==type([]):
child=child[0]
numchild+=1
classname=child.classname()
if classname=="Word":
tree+="\n\n"
elif classname=="Line":
tree+="\n\n\n"
elif clas... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'stats_positions'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def stats_positions(self,meter=None,all_parses=False):
parses = self.allParses(meter=meter) if all_parses else [[parse] for parse in self.bestParses(meter=meter)]
dx={}
for parselist in parses:
for parse in parselist:
if not parse: continue
slot_i=0
for pos in parse.positions:
for slot in pos.... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'iparse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [... | def iparse(self,meter=None,num_processes=1,arbiter='Line',line_lim=None):
from Meter import Meter,genDefault,parse_ent,parse_ent_mp
import multiprocessing as mp
meter=self.get_meter(meter)
self.__parses[meter.id]=[]
self.__bestparses[meter.id]=[]
self.__boundParses[meter.id]=[]
self.__parsed_ents[meter.id... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_representation'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | def from_representation(self, representation):
object_dict = {}
failed = {}
for name, field in self.fields.items():
if name not in representation:
continue
try:
if (
not isinstance(representation[name], (list, tuple)) an... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'require_params'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def require_params(self, req):
params = {}
for name, param in self.params.items():
if name not in req.params and param.required:
missing = set(
p for p in self.params
if self.params[p].required
) - set(req.params.keys())... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'celf'}... | def parse(celf, s) :
"generates an Introspection tree from the given XML string description."
def from_string_elts(celf, attrs, tree) :
elts = dict((k, attrs[k]) for k in attrs)
child_tags = dict \
(
(childclass.tag_name, childclass)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'unparse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def unparse(self, indent_step = 4, max_linelen = 72) :
"returns an XML string description of this Introspection tree."
out = io.StringIO()
def to_string(obj, indent) :
tag_name = obj.tag_name
attrs = []
for attrname in obj.tag_attrs :
attr = ge... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'AddMethod'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'childr... | def AddMethod(self, interface, name, in_sig, out_sig, code):
'''Add a method to this object
interface: D-Bus interface to add this to. For convenience you can
specify '' here to add the method to the object's main
interface (as specified on construction).
na... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'AddTemplate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | def AddTemplate(self, template, parameters):
'''Load a template into the mock.
python-dbusmock ships a set of standard mocks for common system
services such as UPower and NetworkManager. With these the actual tests
become a lot simpler, as they only have to set up the particular
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_args'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '... | def format_args(self, args):
'''Format a D-Bus argument tuple into an appropriate logging string.'''
def format_arg(a):
if isinstance(a, dbus.Boolean):
return str(bool(a))
if isinstance(a, dbus.Byte):
return str(int(a))
if isinstance(a,... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'Introspect'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | def Introspect(self, object_path, connection):
'''Return XML description of this object's interfaces, methods and signals.
This wraps dbus-python's Introspect() method to include the dynamic
methods and properties.
'''
cls = self.__class__.__module__ + '.' + self.__class__.__name... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'argument'}; {'id': '3', 'type': 'parameters', 'children': ['4', '6', '9']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5... | def argument(*param_decls, cls=None, **attrs):
return click.argument(*param_decls, cls=cls or Argument, **attrs) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'option'}; {'id': '3', 'type': 'parameters', 'children': ['4', '6', '9']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']... | def option(*param_decls, cls=None, **attrs):
return click.option(*param_decls, cls=cls or Option, **attrs) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_to_loader_class'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'child... | def add_to_loader_class(cls, loader_class=None, tag=None, **kwargs):
if tag is None:
tag = ''
tag = tag.strip()
if not tag:
tag = cls.DEFAULT_TAG_NAME
if not tag.startswith('!'):
raise ValueError('`tag` argument should start with character "!"')
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '26', '28']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'print_table'}; {'id': '3', 'type': 'parameters', 'children': ['4', '8', '12', '21']}; {'id': '4', 'type': 'typed_parameter', 'c... | def print_table(column_names: IterableOfStrings,
rows: IterableOfTuples,
column_alignments: Optional[IterableOfStrings] = None,
primary_column_idx: int = 0,
) -> None:
header_template = ''
row_template = ''
table_width = 0
type_formatters =... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '26']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'model_fields'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23']}; {'id': '4', 'type': 'id... | def model_fields(model, db_session=None, only=None, exclude=None,
field_args=None, converter=None, exclude_pk=False,
exclude_fk=False):
mapper = model._sa_class_manager.mapper
converter = converter or _ModelConverter()
field_args = field_args or {}
properties = []
f... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'singularize'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def singularize(word, pos=NOUN, custom=None):
if custom and word in custom:
return custom[word]
if "-" in word:
w = word.split("-")
if len(w) > 1 and w[1] in plural_prepositions:
return singularize(w[0], pos, custom) + "-" + "-".join(w[1:])
if word.endswith("'"):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '37', '39']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'login_user'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '18', '27', '32']}; {'id': '4', 'type': 'identifier... | def login_user(self,
user: User,
remember: Optional[bool] = None,
duration: Optional[timedelta] = None,
force: bool = False,
fresh: bool = True,
) -> bool:
if not force:
if not user.acti... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '70', '78']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'url_for'}; {'id': '3', 'type': 'parameters', 'children': ['4', '8', '17', '32', '41', '50', '59', '68']}; {'id': '4', 'type': '... | def url_for(endpoint_or_url_or_config_key: str,
_anchor: Optional[str] = None,
_cls: Optional[Union[object, type]] = None,
_external: Optional[bool] = False,
_external_host: Optional[str] = None,
_method: Optional[str] = None,
_scheme: Optional[str... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '93', '95']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'redirect'}; {'id': '3', 'type': 'parameters', 'children': ['4', '13', '22', '31', '40', '55', '64', '73', '82', '91']}; {'id': ... | def redirect(where: Optional[str] = None,
default: Optional[str] = None,
override: Optional[str] = None,
_anchor: Optional[str] = None,
_cls: Optional[Union[object, type]] = None,
_external: Optional[bool] = False,
_external_host: Optional[st... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'auth_required'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children': ['5',... | def auth_required(decorated_fn=None, **role_rules):
required_roles = []
one_of_roles = []
if not (decorated_fn and callable(decorated_fn)):
if 'role' in role_rules and 'roles' in role_rules:
raise RuntimeError('specify only one of `role` or `roles` kwargs')
elif 'role' in role_ru... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_tree'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}... | def build_tree(self):
if self.built:
return
self.doc_root = self.root.element()
for key in self.sorted_fields():
if key not in self._fields:
continue
field = self._fields[key]
if field != self.root:
if isinstance(fie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.