sequence
stringlengths
492
15.9k
code
stringlengths
75
8.58k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_find_cert_in_list; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:cert; 5, identifier:issuer; 6, identifier:certificate_list; 7, identifier:crl_issuer; 8, block; 8, 9; 8, 17; 8, 23; 8, 29; 8, 40; 8, 46; 8, 123; 9, expression_statement; 9...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:derive_coordinates; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 12; 5, 68; 5, 72; 5, 76; 5, 80; 5, 108; 5, 289; 6, if_statement; 6, 7; 6, 10; 7, attribute; 7, 8; 7, 9; 8, identifier:self; 9, identifier:_coordinates_resolved; 10,...
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)...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:children; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:unroll; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:skip_not_present; 10, True; 11, block; 11, 12; 12, for_statement;...
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_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:find_by_path; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:path; 6, block; 6, 7; 6, 16; 6, 20; 6, 173; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:pathparts; 10, call; 10, 11; 10, 14; 11, attribute; ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_property; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:prop_name; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 13; 8, 17; 8, 35; 8, 54; 8, 112; 8, 117; 8, 130; 8, 142; 8, 161; 9, expressi...
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]) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:elaborate; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:top_def_name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:inst_name; 10, None; 11, default_parameter; 11, 12; ...
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) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:resolve_addresses; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:node; 6, block; 6, 7; 6, 16; 6, 25; 6, 29; 6, 258; 6, 282; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:prop_alignment; 10, subscript; 1...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parse_include; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:start; 6, block; 6, 7; 6, 11; 6, 32; 6, 36; 6, 88; 6, 97; 6, 109; 6, 139; 6, 155; 6, 166; 6, 175; 6, 184; 6, 253; 6, 321; 6, 357; 6, 363; 6, 410; 7, expression_statemen...
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( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_paths; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:patterns; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start_dirs; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:max_depth; 10, integer:1; 11, block; 11, 12; 11, 63; 11, ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 34; 2, function_name:edit_files; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 28; 3, 31; 4, identifier:patterns; 5, default_parameter; 5, 6; 5, 7; 6, identifier:expressions; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:functi...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:detect_events; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:dat; 5, identifier:method; 6, default_parameter; 6, 7; 6, 8; 7, identifier:value; 8, None; 9, block; 9, 10; 9, 200; 9, 243; 10, if_statement; 10, 11; 10, 18; 11, boolean_operator:or;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:merge_close; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:events; 5, identifier:min_interval; 6, default_parameter; 6, 7; 6, 8; 7, identifier:merge_to_longer; 8, False; 9, block; 9, 10; 9, 16; 9, 20; 9, 142; 10, expression_statement; 10, 11; ...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_remove_duplicate; 3, parameters; 3, 4; 3, 5; 4, identifier:old_events; 5, identifier:dat; 6, block; 6, 7; 6, 17; 6, 42; 6, 46; 6, 59; 6, 75; 6, 98; 6, 102; 6, 106; 6, 185; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifie...
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): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:math; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:operator; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:operator_name; 10, None; 11, default_parameter; 11, 12; 11, 1...
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): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:detect_Massimini2004; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:dat_orig; 5, identifier:s_freq; 6, identifier:time; 7, identifier:opts; 8, block; 8, 9; 8, 19; 8, 31; 8, 42; 8, 46; 8, 129; 8, 144; 9, if_statement; 9, 10; 9, 13; 10, at...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:filter_; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:axis; 7, string:'time'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:low_cut; 10, None;...
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(...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:select; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:trial; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:invert; 10, False; 11, dictionary_splat_pattern; 11, 12; 12, i...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 49; 2, function_name:fetch; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 3, 31; 3, 34; 3, 37; 3, 40; 3, 43; 3, 46; 4, identifier:dataset; 5, identifier:annot; 6, default_parameter; 6, 7; 6, 8; 7, identifier:cat; 8, tuple; 8, 9; 8, 10;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:get_times; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:annot; 5, default_parameter; 5, 6; 5, 7; 6, identifier:evt_type; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:stage; 10, None; 11, default_param...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:_concat; 3, parameters; 3, 4; 3, 5; 4, identifier:bundles; 5, default_parameter; 5, 6; 5, 7; 6, identifier:cat; 7, tuple; 7, 8; 7, 9; 7, 10; 7, 11; 8, integer:0; 9, integer:0; 10, integer:0; 11, integer:0; 12, block; 12, 13; 12, 29; 12, 45; 12...
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 =...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:toggle_pac; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 93; 6, if_statement; 6, 7; 6, 10; 7, comparison_operator:is; 7, 8; 7, 9; 8, identifier:Pac; 9, None; 10, block; 10, 11; 10, 23; 10, 34; 10, 45; 10, 56; 10, 67; 10, 78; 11, ...
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) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_segments; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 28; 5, 38; 5, 50; 5, 62; 5, 66; 5, 70; 5, 120; 5, 130; 5, 137; 5, 141; 5, 145; 5, 212; 5, 224; 5, 234; 5, 270; 5, 292; 5, 320; 5, 330; 5, 378; 5, 388; 5, 398; 5, 412; 5, ...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:compute_evt_params; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 12; 5, 34; 5, 58; 5, 82; 5, 104; 5, 114; 5, 124; 5, 132; 5, 138; 5, 153; 5, 175; 5, 179; 5, 183; 5, 197; 5, 270; 6, expression_statement; 6, 7; 7, assignment; 7, 8;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:detect_format; 3, parameters; 3, 4; 4, identifier:filename; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:filename; 9, call; 9, 10; 9, 11; 10, identifier:Path; 11, argument_list; 11, 12; 12, iden...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:read_videos; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:begtime; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:endtime; 10, None; 11, block; 11, 12; 11, 29; 11, 44; 11, 61; ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:read_data; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:chan; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:begtime; 10, None; 11, default_paramete...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:export_freq_band; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:xfreq; 5, identifier:bands; 6, identifier:filename; 7, block; 7, 8; 7, 21; 7, 34; 7, 54; 7, 62; 7, 104; 7, 145; 7, 152; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11;...
def export_freq_band(xfreq, bands, filename): heading_row_1 = ['Segment index', 'Start time', 'End time', 'Duration', 'Stitches', 'Stage', 'Cycle', 'Event type', 'C...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_cycles; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 17; 5, 23; 5, 44; 5, 65; 5, 69; 5, 78; 5, 96; 5, 180; 5, 184; 5, 213; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:cycles; 9, call; 9, 10; 9, 15;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_read_erd; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:erd_file; 5, identifier:begsam; 6, identifier:endsam; 7, block; 7, 8; 7, 15; 7, 21; 7, 27; 7, 34; 7, 44; 7, 61; 7, 74; 7, 80; 7, 89; 7, 96; 7, 108; 7, 114; 7, 126; 7, 162; 7, 278; 7, 331...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:return_markers; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 17; 5, 36; 5, 318; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:ent_file; 9, call; 9, 10; 9, 15; 10, attribute; 10, 11; 10, 14; 11, attribute...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:band_power; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:data; 5, identifier:freq; 6, default_parameter; 6, 7; 6, 8; 7, identifier:scaling; 8, string:'power'; 9, default_parameter; 9, 10; 9, 11; 10, identifier:n_fft; 11, ...
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): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:morlet; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:freq; 5, identifier:s_freq; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ratio; 8, integer:5; 9, default_parameter; 9, 10; 9, 11; 10, identifier:sigma_...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_convert_timestr_to_seconds; 3, parameters; 3, 4; 3, 5; 4, identifier:time_str; 5, identifier:rec_start; 6, block; 6, 7; 6, 21; 6, 120; 7, if_statement; 7, 8; 7, 15; 8, not_operator; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 1...
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) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:mouseReleaseEvent; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:event; 6, block; 6, 7; 6, 14; 6, 20; 6, 32; 6, 39; 6, 55; 6, 71; 6, 82; 6, 362; 6, 368; 6, 376; 7, if_statement; 7, 8; 7, 12; 8, not_operator; 8, 9; 9, attribute; 9...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:next_event; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:delete; 7, False; 8, block; 8, 9; 8, 65; 8, 71; 8, 77; 8, 85; 8, 129; 8, 141; 8, 160; 8, 216; 8, 230; 8, 292; 8, 298; 8, 307; 9, if_state...
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) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:montage; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ref_chan; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:ref_to_avg; 10, False; 11, default_parameter; 11, 1...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:remove_artf_evts; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:times; 5, identifier:annot; 6, default_parameter; 6, 7; 6, 8; 7, identifier:chan; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:min_dur; 11, float:0.1; 12, bl...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_build_app_dict; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:site; 5, identifier:request; 6, default_parameter; 6, 7; 6, 8; 7, identifier:label; 8, None; 9, block; 9, 10; 9, 14; 9, 51; 9, 257; 9, 267; 10, expression_statement; 10, 11; 11, as...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_app_list; 3, parameters; 3, 4; 3, 5; 4, identifier:site; 5, identifier:request; 6, block; 6, 7; 6, 15; 6, 38; 6, 58; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:app_dict; 10, call; 10, 11; 10, 12; 11, identifier...
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
0, module; 0, 1; 1, ERROR; 1, 2; 2, function_definition; 2, 3; 2, 4; 2, 8; 3, function_name:format_query_results; 4, parameters; 4, 5; 4, 6; 4, 7; 5, identifier:self; 6, identifier:r; 7, identifier:prop_nr; 8, block; 8, 9; 8, 18; 8, 114; 8, 187; 8, 248; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11...
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'}: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:times; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:p; 5, identifier:mint; 6, default_parameter; 6, 7; 6, 8; 7, identifier:maxt; 8, None; 9, block; 9, 10; 9, 12; 9, 19; 9, 153; 10, expression_statement; 10, 11; 11, string:'''Repeat a parser b...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:separated; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:p; 5, identifier:sep; 6, identifier:mint; 7, default_parameter; 7, 8; 7, 9; 8, identifier:maxt; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identifier:end; 12, None...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:route; 3, parameters; 3, 4; 4, list_splat_pattern; 4, 5; 5, identifier:args; 6, block; 6, 7; 6, 55; 6, 187; 6, 192; 7, function_definition; 7, 8; 7, 9; 7, 11; 8, function_name:_validate_route; 9, parameters; 9, 10; 10, identifier:route; 11, blo...
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( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:find_object; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:obj; 5, identifier:remainder; 6, identifier:notfound_handlers; 7, identifier:request; 8, block; 8, 9; 8, 11; 8, 15; 9, expression_statement; 9, 10; 10, string:''' 'Walks' the...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:make_app; 3, parameters; 3, 4; 3, 5; 4, identifier:root; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kw; 7, block; 7, 8; 7, 10; 7, 20; 7, 30; 7, 91; 7, 100; 7, 110; 7, 120; 7, 137; 7, 152; 7, 163; 7, 173; 7, 250; 7, 274; 8, expression_stat...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:redirect; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 4, default_parameter; 4, 5; 4, 6; 5, identifier:location; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:internal; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, ...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_args; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:self; 5, identifier:state; 6, identifier:all_params; 7, identifier:remainder; 8, identifier:argspec; 9, identifier:im_self; 10, block; 10, 11; 10, 13; 10, 17; 10, 21; 1...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_route; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:args; 6, default_parameter; 6, 7; 6, 8; 7, identifier:request; 8, None; 9, block; 9, 10; 9, 12; 9, 22; 9, 40; 9, 58; 9, 68; 9, 73; 9, 86; 9, 267; 10, expression_statemen...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_handle_get; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:method; 6, identifier:remainder; 7, default_parameter; 7, 8; 7, 9; 8, identifier:request; 9, None; 10, block; 10, 11; 10, 13; 10, 27; 10, 82; 10, 89; 10, 127...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_handle_delete; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:method; 6, identifier:remainder; 7, default_parameter; 7, 8; 7, 9; 8, identifier:request; 9, None; 10, block; 10, 11; 10, 13; 10, 27; 10, 77; 10, 87; 10, ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:gunicorn_run; 3, parameters; 4, block; 4, 5; 4, 53; 4, 230; 5, try_statement; 5, 6; 5, 14; 6, block; 6, 7; 7, import_from_statement; 7, 8; 7, 12; 8, dotted_name; 8, 9; 8, 10; 8, 11; 9, identifier:gunicorn; 10, identifier:app; 11, identifier:wsg...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:expose; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:template; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:generic; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identifier:route;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:add_operations_bulk; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:payload; 6, block; 6, 7; 6, 19; 6, 29; 6, 33; 6, 37; 6, 41; 6, 134; 6, 144; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 13; 9, pattern_list; 9, 10; 9, ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:line; 6, default_parameter; 6, 7; 6, 8; 7, identifier:encoding; 8, attribute; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:pydle; 11, identifier:protocol; 12, ...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:construct; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:force; 7, False; 8, block; 8, 9; 8, 18; 8, 55; 8, 63; 8, 73; 8, 143; 8, 160; 8, 202; 8, 208; 8, 248; 9, expression_statement; 9, 10; 10, a...
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...
0, module; 0, 1; 1, ERROR; 1, 2; 1, 244; 1, 262; 1, 267; 1, 275; 1, 276; 1, 280; 1, 281; 1, 285; 1, 286; 1, 314; 1, 318; 1, 328; 1, 331; 1, 337; 1, 341; 1, 342; 2, function_definition; 2, 3; 2, 4; 2, 6; 2, 132; 3, function_name:split; 4, parameters; 4, 5; 5, identifier:url; 6, ERROR; 6, 7; 6, 19; 6, 28; 6, 37; 6, 51; 6...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:issue_cmd; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:cmd; 6, identifier:value; 7, default_parameter; 7, 8; 7, 9; 8, identifier:retry; 9, integer:3; 10, block; 10, 11; 11, with_statement; 11, 12; 11, 17; 12, with_...
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(...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_reports; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 10; 5, 14; 5, 55; 5, 115; 5, 124; 5, 150; 5, 159; 5, 187; 5, 196; 5, 238; 5, 247; 5, 275; 5, 284; 5, 302; 5, 311; 5, 329; 5, 354; 5, 361; 6, expression_statement; 6, 7; 7,...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:build; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:client; 6, default_parameter; 6, 7; 6, 8; 7, identifier:nobuild; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:usecache; 11, True; 12, defaul...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_check_yaml_and_paths; 3, parameters; 3, 4; 3, 5; 4, identifier:ymlfilepath; 5, identifier:yamldefs; 6, block; 6, 7; 6, 18; 6, 29; 6, 47; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:relpath; 10, call; 10, 11; 10, 16...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:generate_build; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 4, identifier:self; 5, identifier:image; 6, identifier:targetname; 7, default_parameter; 7, 8; 7, 9; 8, identifier:rebuilds; 9, None; 10, default_parameter; 10,...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort_dependencies; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:image; 6, default_parameter; 6, 7; 6, 8; 7, identifier:dependencies; 8, None; 9, block; 9, 10; 9, 21; 9, 27; 9, 41; 9, 53; 9, 59; 10, if_statement; 10, 11; 10...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get_external_base_image; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:image; 6, default_parameter; 6, 7; 6, 8; 7, identifier:stack; 8, None; 9, block; 9, 10; 9, 21; 9, 29; 9, 55; 9, 62; 9, 82; 9, 136; 9, 146; 9, 163; 9, 22...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_htmlRenderDict; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:pathParts; 5, identifier:statDict; 6, identifier:output; 7, block; 7, 8; 7, 19; 7, 25; 7, 29; 7, 36; 7, 173; 7, 187; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10,...
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'): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 96; 1, 98; 2, function_name:create_session; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 14; 3, 23; 3, 32; 3, 41; 3, 46; 3, 51; 3, 56; 3, 61; 3, 66; 3, 75; 3, 80; 3, 85; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:kind; 7, type; 7, 8; 8, identifier:Se...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:sine_psd; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:data; 5, identifier:delta; 6, default_parameter; 6, 7; 6, 8; 7, identifier:number_of_tapers; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:number...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 25; 2, function_name:mt_deconvolve; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 4, identifier:data_a; 5, identifier:data_b; 6, identifier:delta; 7, default_parameter; 7, 8; 7, 9; 8, identifier:nfft; 9, None; 10, default_parameter; 10,...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:create_server; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:loop; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:as_coroutine; 10, False; 11, default_parameter; 1...
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: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:event_emitter; 3, parameters; 3, 4; 3, 7; 3, 8; 4, default_parameter; 4, 5; 4, 6; 5, identifier:cls_; 6, None; 7, keyword_separator; 8, default_parameter; 8, 9; 8, 10; 9, identifier:events; 10, tuple; 10, 11; 11, string:'*'; 12, block; 12, 13;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_build_production_name; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:glyph; 6, block; 6, 7; 6, 32; 6, 38; 6, 56; 6, 68; 6, 103; 6, 115; 6, 157; 6, 237; 7, if_statement; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:self;...
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' % ( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:makeOfficialGlyphOrder; 3, parameters; 3, 4; 3, 5; 4, identifier:font; 5, default_parameter; 5, 6; 5, 7; 6, identifier:glyphOrder; 7, None; 8, block; 8, 9; 8, 23; 8, 34; 8, 38; 8, 57; 8, 81; 8, 91; 9, if_statement; 9, 10; 9, 13; 10, comparison_...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:from_layer; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:cls; 5, identifier:font; 6, default_parameter; 6, 7; 6, 8; 7, identifier:layerName; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:copy; 11, False; 12, defaul...
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....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 38; 2, function_name:compileInterpolatableTTFs; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 4, identifier:ufos; 5, default_parameter; 5, 6; 5, 7; 6, identifier:preProcessorClass; 7, identifier:TTFInterpolatablePr...
def compileInterpolatableTTFs( ufos, preProcessorClass=TTFInterpolatablePreProcessor, outlineCompilerClass=OutlineTTFCompiler, featureCompilerClass=None, featureWriters=None, glyphOrder=None, useProductionNames=None, cubicConversionError=None, reverseDirection=True, inplace=False...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_propagate_glyph_anchors; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:glyphSet; 5, identifier:composite; 6, identifier:processed; 7, block; 7, 8; 7, 16; 7, 25; 7, 32; 7, 36; 7, 40; 7, 46; 7, 50; 7, 143; 7, 222; 7, 253; 7, 264; 8, if_statemen...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:setupTable_name; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 20; 5, 33; 5, 39; 5, 96; 5, 106; 5, 120; 5, 130; 5, 140; 5, 148; 5, 275; 5, 288; 5, 301; 5, 317; 6, if_statement; 6, 7; 6, 12; 7, comparison_operator:not; 7, 8;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:setupTable_cmap; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 22; 5, 46; 5, 84; 5, 91; 5, 97; 5, 103; 5, 109; 5, 115; 5, 122; 5, 128; 5, 134; 5, 140; 5, 146; 5, 159; 5, 165; 5, 173; 6, if_statement; 6, 7; 6, 12; 7, compari...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_setupTable_hhea_or_vhea; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:tag; 6, block; 6, 7; 6, 15; 6, 30; 6, 43; 6, 58; 6, 64; 6, 81; 6, 91; 6, 110; 6, 144; 6, 170; 6, 174; 6, 178; 6, 182; 6, 186; 6, 294; 6, 313; 6, 332; 6, 351;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:dir; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:methods; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:showall; 10, True; 11, block; 11, 12; 11, 15; 11, 51; 11, 56; 11, 63; ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:tree; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:offset; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:prefix_inherited; 10, string:""; 11, default_parameter; 11...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:stats_positions; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:meter; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:all_parses; 10, False; 11, block; 11, 12; 11, 38; 11, 42; 11...
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....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:iparse; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:meter; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:num_processes; 10, integer:1; 11, default_parameter; 11...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:from_representation; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:representation; 6, block; 6, 7; 6, 11; 6, 15; 6, 169; 6, 198; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:object_dict; 10, dictionary...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:require_params; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:req; 6, block; 6, 7; 6, 11; 6, 185; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:params; 10, dictionary; 11, for_statement; 11, 12; 11, 15;...
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())...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 4, identifier:celf; 5, identifier:s; 6, block; 6, 7; 6, 9; 6, 271; 6, 280; 6, 287; 7, expression_statement; 7, 8; 8, string:"generates an Introspection tree from the given XML string description."; 9, function_...
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) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:unparse; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:indent_step; 7, integer:4; 8, default_parameter; 8, 9; 8, 10; 9, identifier:max_linelen; 10, integer:72; 11, block; 11, 12; 11, 14; 1...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:AddMethod; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:self; 5, identifier:interface; 6, identifier:name; 7, identifier:in_sig; 8, identifier:out_sig; 9, identifier:code; 10, block; 10, 11; 10, 13; 10, 23; 10, 35; 10, 58; ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:AddTemplate; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:template; 6, identifier:parameters; 7, block; 7, 8; 7, 10; 7, 44; 7, 61; 7, 134; 7, 143; 7, 151; 7, 157; 8, expression_statement; 8, 9; 9, string:'''Load a template...
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 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:format_args; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:args; 6, block; 6, 7; 6, 9; 6, 195; 6, 199; 6, 217; 6, 226; 7, expression_statement; 7, 8; 8, string:'''Format a D-Bus argument tuple into an appropriate logging string.'...
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,...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:Introspect; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:object_path; 6, identifier:connection; 7, block; 7, 8; 7, 10; 7, 26; 7, 34; 7, 42; 7, 78; 7, 86; 7, 101; 7, 110; 7, 207; 7, 227; 7, 235; 8, expression_statement; 8, ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:argument; 3, parameters; 3, 4; 3, 6; 3, 9; 4, list_splat_pattern; 4, 5; 5, identifier:param_decls; 6, default_parameter; 6, 7; 6, 8; 7, identifier:cls; 8, None; 9, dictionary_splat_pattern; 9, 10; 10, identifier:attrs; 11, block; 11, 12; 12, r...
def argument(*param_decls, cls=None, **attrs): return click.argument(*param_decls, cls=cls or Argument, **attrs)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:option; 3, parameters; 3, 4; 3, 6; 3, 9; 4, list_splat_pattern; 4, 5; 5, identifier:param_decls; 6, default_parameter; 6, 7; 6, 8; 7, identifier:cls; 8, None; 9, dictionary_splat_pattern; 9, 10; 10, identifier:attrs; 11, block; 11, 12; 12, ret...
def option(*param_decls, cls=None, **attrs): return click.option(*param_decls, cls=cls or Option, **attrs)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:add_to_loader_class; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:loader_class; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:tag; 10, None; 11, dictionary_splat_pattern...
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 "!"') ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 1, 28; 2, function_name:print_table; 3, parameters; 3, 4; 3, 8; 3, 12; 3, 21; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:column_names; 6, type; 6, 7; 7, identifier:IterableOfStrings; 8, typed_parameter; 8, 9; 8, 10; 9, identifier:rows; 10, type; 10, 11; 11,...
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 =...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:model_fields; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:model; 5, default_parameter; 5, 6; 5, 7; 6, identifier:db_session; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:only; 10, None; 11, de...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:singularize; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:word; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pos; 7, identifier:NOUN; 8, default_parameter; 8, 9; 8, 10; 9, identifier:custom; 10, None; 11, block; 11, 12; 11, 23; 11, 73; 11...
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("'"): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 37; 1, 39; 2, function_name:login_user; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 18; 3, 27; 3, 32; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:user; 7, type; 7, 8; 8, identifier:User; 9, typed_default_parameter; 9, 10; 9, 11; 9, 17; 10, 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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 70; 1, 78; 2, function_name:url_for; 3, parameters; 3, 4; 3, 8; 3, 17; 3, 32; 3, 41; 3, 50; 3, 59; 3, 68; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:endpoint_or_url_or_config_key; 6, type; 6, 7; 7, identifier:str; 8, typed_default_parameter; 8, 9; 8, 10; 8, 16;...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 93; 1, 95; 2, function_name:redirect; 3, parameters; 3, 4; 3, 13; 3, 22; 3, 31; 3, 40; 3, 55; 3, 64; 3, 73; 3, 82; 3, 91; 4, typed_default_parameter; 4, 5; 4, 6; 4, 12; 5, identifier:where; 6, type; 6, 7; 7, generic_type; 7, 8; 7, 9; 8, identifier:Optional; 9, typ...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:auth_required; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:decorated_fn; 6, None; 7, dictionary_splat_pattern; 7, 8; 8, identifier:role_rules; 9, block; 9, 10; 9, 14; 9, 18; 9, 76; 9, 121; 9, 134; 10, expression_s...
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...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:build_tree; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 12; 5, 24; 5, 345; 6, if_statement; 6, 7; 6, 10; 7, attribute; 7, 8; 7, 9; 8, identifier:self; 9, identifier:built; 10, block; 10, 11; 11, return_statement; 12, expression_...
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...