sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:goto; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:reference_beats; 5, identifier:estimated_beats; 6, default_parameter; 6, 7; 6, 8; 7, identifier:goto_threshold; 8, float:0.35; 9, default_parameter; 9, 10; 9, 11; 10, identifier...
def goto(reference_beats, estimated_beats, goto_threshold=0.35, goto_mu=0.2, goto_sigma=0.2): """Calculate Goto's score, a binary 1 or 0 depending on some specific heuristic criteria Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt')...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sort_labeled_intervals; 3, parameters; 3, 4; 3, 5; 4, identifier:intervals; 5, default_parameter; 5, 6; 5, 7; 6, identifier:labels; 7, None; 8, block; 8, 9; 8, 11; 8, 24; 8, 30; 9, expression_statement; 9, 10; 10, string:'''Sort intervals, and ...
def sort_labeled_intervals(intervals, labels=None): '''Sort intervals, and optionally, their corresponding labels according to start time. Parameters ---------- intervals : np.ndarray, shape=(n, 2) The input intervals labels : list, optional Labels for each interval Return...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:bss_eval_sources; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:reference_sources; 5, identifier:estimated_sources; 6, default_parameter; 6, 7; 6, 8; 7, identifier:compute_permutation; 8, True; 9, block; 9, 10; 9, 12; 9, 13; 9, 30; 9, 47; 9, 5...
def bss_eval_sources(reference_sources, estimated_sources, compute_permutation=True): """ Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, interference and artifacts. The decomposition allows a time-invariant filter d...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:bss_eval_sources_framewise; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 11; 3, 16; 4, identifier:reference_sources; 5, identifier:estimated_sources; 6, default_parameter; 6, 7; 6, 8; 7, identifier:window; 8, binary_operator:*; 8, 9; 8, 10; 9, integer:...
def bss_eval_sources_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_sources Please be aware that this function does not compute permutations (by def...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:bss_eval_images_framewise; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 11; 3, 16; 4, identifier:reference_sources; 5, identifier:estimated_sources; 6, default_parameter; 6, 7; 6, 8; 7, identifier:window; 8, binary_operator:*; 8, 9; 8, 10; 9, integer:3...
def bss_eval_images_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_images Please be aware that this function does not compute permutations (by default...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:time_frequency; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 13; 3, 16; 4, identifier:gram; 5, identifier:frequencies; 6, identifier:times; 7, identifier:fs; 8, default_parameter; 8, 9; 8, 10; 9, identifier:function; 10, attribute; 10, 11; ...
def time_frequency(gram, frequencies, times, fs, function=np.sin, length=None, n_dec=1): """Reverse synthesis of a time-frequency representation of a signal Parameters ---------- gram : np.ndarray ``gram[n, m]`` is the magnitude of ``frequencies[n]`` from ``times[m]``...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:match_note_offsets; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:ref_intervals; 5, identifier:est_intervals; 6, default_parameter; 6, 7; 6, 8; 7, identifier:offset_ratio; 8, float:0.2; 9, default_parameter; 9, 10; 9, 11; 10, ide...
def match_note_offsets(ref_intervals, est_intervals, offset_ratio=0.2, offset_min_tolerance=0.05, strict=False): """Compute a maximum matching between reference and estimated notes, only taking note offsets into account. Given two note sequences represented by ``ref_intervals`` and ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:match_note_onsets; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:ref_intervals; 5, identifier:est_intervals; 6, default_parameter; 6, 7; 6, 8; 7, identifier:onset_tolerance; 8, float:0.05; 9, default_parameter; 9, 10; 9, 11; 10, identif...
def match_note_onsets(ref_intervals, est_intervals, onset_tolerance=0.05, strict=False): """Compute a maximum matching between reference and estimated notes, only taking note onsets into account. Given two note sequences represented by ``ref_intervals`` and ``est_intervals`` (see ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:validate; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:ref_time; 5, identifier:ref_freqs; 6, identifier:est_time; 7, identifier:est_freqs; 8, block; 8, 9; 8, 11; 8, 21; 8, 31; 8, 45; 8, 57; 8, 72; 8, 86; 8, 98; 8, 113; 8, 130; 8, 147; 8...
def validate(ref_time, ref_freqs, est_time, est_freqs): """Checks that the time and frequency inputs are well-formed. Parameters ---------- ref_time : np.ndarray reference time stamps in seconds ref_freqs : list of np.ndarray reference frequencies in Hz est_time : np.ndarray ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:segments; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:intervals; 5, identifier:labels; 6, default_parameter; 6, 7; 6, 8; 7, identifier:base; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:heigh...
def segments(intervals, labels, base=None, height=None, text=False, text_kw=None, ax=None, **kwargs): '''Plot a segmentation as a set of disjoint rectangles. Parameters ---------- intervals : np.ndarray, shape=(n, 2) segment intervals, in the format returned by :func:`mir_e...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:labeled_intervals; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:intervals; 5, identifier:labels; 6, default_parameter; 6, 7; 6, 8; 7, identifier:label_set; 8, None; 9, default_parameter; 9, 10; 9, 11;...
def labeled_intervals(intervals, labels, label_set=None, base=None, height=None, extend_labels=True, ax=None, tick=True, **kwargs): '''Plot labeled intervals with each label on its own row. Parameters ---------- intervals : np.ndarray, shape=(n, 2) se...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:events; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:times; 5, default_parameter; 5, 6; 5, 7; 6, identifier:labels; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:base; 10, None; 11, default_parameter; ...
def events(times, labels=None, base=None, height=None, ax=None, text_kw=None, **kwargs): '''Plot event times as a set of vertical lines Parameters ---------- times : np.ndarray, shape=(n,) event times, in the format returned by :func:`mir_eval.io.load_events` or :func...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:pitch; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:times; 5, identifier:frequencies; 6, default_parameter; 6, 7; 6, 8; 7, identifier:midi; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:unvoiced; 11, False;...
def pitch(times, frequencies, midi=False, unvoiced=False, ax=None, **kwargs): '''Visualize pitch contours Parameters ---------- times : np.ndarray, shape=(n,) Sample times of frequencies frequencies : np.ndarray, shape=(n,) frequencies (in Hz) of the pitch contours. Voicing...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:create; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:archive; 6, default_parameter; 6, 7; 6, 8; 7, identifier:interval; 8, None; 9, dictionary_splat_pattern; 9, 10; 10, identifier:import_args; 11, block; 11, 12; 11,...
def create(self, archive, interval=None, **import_args): """ Creating a table means uploading a file or setting up a sync table :param archive: URL to the file (both remote URLs or local paths are supported) or StringIO object :param interval: Interval in seconds. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 1, 9; 2, function_name:copy_data; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:data_length; 5, identifier:blocksize; 6, identifier:infp; 7, identifier:outfp; 8, comment; 9, block; 9, 10; 9, 12; 9, 16; 9, 55; 10, expression_statement; 10, 11; 11, string:...
def copy_data(data_length, blocksize, infp, outfp): # type: (int, int, BinaryIO, BinaryIO) -> None ''' A utility function to copy data from the input file object to the output file object. This function will use the most efficient copy method available, which is often sendfile. Parameters: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:instr; 6, comment; 7, block; 7, 8; 7, 10; 7, 22; 7, 37; 7, 83; 7, 120; 7, 132; 7, 144; 7, 157; 7, 244; 7, 280; 7, 290; 7, 291; 7, 292; 7, 293; 7, 299; 7, 305; 8, expressi...
def parse(self, instr): # type: (bytes) -> bool ''' A method to parse ISO hybridization info out of an existing ISO. Parameters: instr - The data for the ISO hybridization. Returns: Nothing. ''' if self._initialized: raise pycdlibexc...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 1, 13; 2, function_name:new; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:mac; 6, identifier:part_entry; 7, identifier:mbr_id; 8, identifier:part_offset; 9, identifier:geometry_sectors; 10, identifier:geome...
def new(self, mac, part_entry, mbr_id, part_offset, geometry_sectors, geometry_heads, part_type): # type: (bool, int, Optional[int], int, int, int, int) -> None ''' A method to add ISO hybridization to an ISO. Parameters: mac - Whether this ISO should be made bootab...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 1, 13; 2, function_name:_new; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:vd; 6, identifier:name; 7, identifier:parent; 8, identifier:seqnum; 9, identifier:isdir; 10, identifier:length; 11, identifier:xa; ...
def _new(self, vd, name, parent, seqnum, isdir, length, xa): # type: (headervd.PrimaryOrSupplementaryVD, bytes, Optional[DirectoryRecord], int, bool, int, bool) -> None ''' Internal method to create a new Directory Record. Parameters: vd - The Volume Descriptor this record is p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 1, 17; 2, function_name:new_dir; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, identifier:self; 5, identifier:vd; 6, identifier:name; 7, identifier:parent; 8, identifier:seqnum; 9, identifier:rock_ridge; 10, id...
def new_dir(self, vd, name, parent, seqnum, rock_ridge, rr_name, log_block_size, rr_relocated_child, rr_relocated, xa, file_mode): # type: (headervd.PrimaryOrSupplementaryVD, bytes, DirectoryRecord, int, str, bytes, int, bool, bool, bool, int) -> None ''' Create a new directory D...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 1, 10; 2, function_name:_add_child; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:child; 6, identifier:logical_block_size; 7, identifier:allow_duplicate; 8, identifier:check_overflow; 9, comment; 10, block; 10, 11; 10, 13; 10, 2...
def _add_child(self, child, logical_block_size, allow_duplicate, check_overflow): # type: (DirectoryRecord, int, bool, bool) -> bool ''' An internal method to add a child to this object. Note that this is called both during parsing and when adding a new object to the system, so it ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 1, 9; 2, function_name:remove_child; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:child; 6, identifier:index; 7, identifier:logical_block_size; 8, comment; 9, block; 9, 10; 9, 12; 9, 25; 9, 38; 9, 39; 9, 40; 9, 41; 9, 42; 9, 43; 9, 4...
def remove_child(self, child, index, logical_block_size): # type: (DirectoryRecord, int, int) -> bool ''' A method to remove a child from this Directory Record. Parameters: child - The child DirectoryRecord object to remove. index - The index of the child into this Dir...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_record; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:entries; 6, comment; 7, block; 7, 8; 7, 10; 7, 14; 7, 34; 7, 54; 7, 71; 7, 94; 7, 111; 7, 131; 7, 151; 7, 171; 7, 191; 7, 208; 7, 228; 7, 248; 7, 265; 7, 285; 7, 305; 8...
def _record(self, entries): # type: (RockRidgeEntries) -> bytes ''' Return a string representing the Rock Ridge entry. Parameters: entries - The dr_entries or ce_entries to generate a record for. Returns: A string representing the Rock Ridge entry. ''' ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 1, 8; 2, function_name:_add_name; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:rr_name; 6, identifier:curr_dr_len; 7, comment; 8, block; 8, 9; 8, 11; 8, 12; 8, 13; 8, 14; 8, 15; 8, 16; 8, 17; 8, 18; 8, 19; 8, 20; 8, 21; 8, 22; 8, 30; 8, 56...
def _add_name(self, rr_name, curr_dr_len): # type: (bytes, int) -> int ''' An internal method to add the appropriate name records to the ISO. Parameters: rr_name - The Rock Ridge name to add to the ISO. curr_dr_len - The current directory record length. Returns...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:add_entry; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:length; 6, comment; 7, block; 7, 8; 7, 10; 7, 15; 7, 16; 7, 162; 7, 181; 8, expression_statement; 8, 9; 9, string:''' Add a new entry to this Rock Ridge Conti...
def add_entry(self, length): # type: (int) -> int ''' Add a new entry to this Rock Ridge Continuation Block. This method attempts to find a gap that fits the new length anywhere within this Continuation Block. If successful, it returns the offset at which it placed this...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 1, 8; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:data; 6, identifier:extent; 7, comment; 8, block; 8, 9; 8, 11; 8, 23; 8, 54; 8, 66; 8, 85; 8, 105; 8, 121; 8, 152; 8, 176; 9, expression_statement; 9, 10; 10, strin...
def parse(self, data, extent): # type: (bytes, int) -> None ''' Parse the passed in data into a UDF Descriptor tag. Parameters: data - The data to parse. extent - The extent to compare against for the tag location. Returns: Nothing. ''' ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:data; 6, comment; 7, block; 7, 8; 7, 10; 7, 22; 7, 64; 7, 72; 7, 109; 7, 127; 7, 156; 7, 176; 7, 196; 7, 216; 7, 236; 7, 256; 7, 276; 8, expression_statement; 8, 9; 9, st...
def parse(self, data): # type: (bytes) -> None ''' Parse the passed in data into a UDF Timestamp. Parameters: data - The data to parse. Returns: Nothing. ''' if self._initialized: raise pycdlibexception.PyCdlibInternalError('UDF Time...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:data; 6, comment; 7, block; 7, 8; 7, 10; 7, 22; 7, 46; 7, 58; 7, 70; 7, 82; 7, 94; 7, 106; 7, 118; 7, 130; 7, 142; 7, 154; 7, 166; 8, expression_statement; 8, 9; 9, strin...
def parse(self, data): # type: (bytes) -> None ''' Parse the passed in data into a UDF Partition Header Descriptor. Parameters: data - The data to parse. Returns: Nothing. ''' if self._initialized: raise pycdlibexception.PyCdlibInter...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:finish_directory_parse; 3, parameters; 3, 4; 4, identifier:self; 5, comment; 6, block; 6, 7; 6, 9; 6, 22; 7, expression_statement; 7, 8; 8, string:''' A method to finish up the parsing of this UDF File Entry directory. In ...
def finish_directory_parse(self): # type: () -> None ''' A method to finish up the parsing of this UDF File Entry directory. In particular, this method checks to see if it is in sorted order for future use. Parameters: None. Returns: Nothing. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:valstr; 6, comment; 7, block; 7, 8; 7, 10; 7, 22; 7, 326; 8, expression_statement; 8, 9; 9, string:''' A method to parse an El Torito Boot Catalog out of a string...
def parse(self, valstr): # type: (bytes) -> bool ''' A method to parse an El Torito Boot Catalog out of a string. Parameters: valstr - The string to parse the El Torito Boot Catalog out of. Returns: Nothing. ''' if self._initialized: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_check_iso9660_filename; 3, parameters; 3, 4; 3, 5; 4, identifier:fullname; 5, identifier:interchange_level; 6, comment; 7, block; 7, 8; 7, 10; 7, 11; 7, 12; 7, 22; 7, 23; 7, 24; 7, 25; 7, 26; 7, 27; 7, 28; 7, 55; 7, 56; 7, 57; 7, 71; 7, ...
def _check_iso9660_filename(fullname, interchange_level): # type: (bytes, int) -> None ''' A function to check that a file identifier conforms to the ISO9660 rules for a particular interchange level. Parameters: fullname - The name to check. interchange_level - The interchange level to ch...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:_yield_children; 3, parameters; 3, 4; 4, identifier:rec; 5, comment; 6, block; 6, 7; 6, 9; 6, 24; 6, 28; 7, expression_statement; 7, 8; 8, string:''' An internal function to gather and yield all of the children of a Directory Reco...
def _yield_children(rec): # type: (dr.DirectoryRecord) -> Generator ''' An internal function to gather and yield all of the children of a Directory Record. Parameters: rec - The Directory Record to get all of the children from (must be a directory) Yields: Children of this ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 1, 8; 2, function_name:_find_dr_record_by_name; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:vd; 5, identifier:path; 6, identifier:encoding; 7, comment; 8, block; 8, 9; 8, 11; 8, 27; 8, 35; 8, 36; 8, 37; 8, 44; 8, 45; 8, 54; 8, 73; 8, 77; 8, 85; 8, 253; 9, ex...
def _find_dr_record_by_name(vd, path, encoding): # type: (headervd.PrimaryOrSupplementaryVD, bytes, str) -> dr.DirectoryRecord ''' An internal function to find an directory record on the ISO given an ISO or Joliet path. If the entry is found, it returns the directory record object corresponding to ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:_parse_volume_descriptors; 3, parameters; 3, 4; 4, identifier:self; 5, comment; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 12; 6, 13; 6, 14; 6, 15; 6, 16; 6, 27; 6, 330; 6, 331; 6, 332; 6, 333; 6, 334; 6, 335; 6, 336; 6, 349; 6, 359; 6, 360; ...
def _parse_volume_descriptors(self): # type: () -> None ''' An internal method to parse the volume descriptors on an ISO. Parameters: None. Returns: Nothing. ''' # Ecma-119 says that the Volume Descriptor set is a sequence of volume # de...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_find_rr_record; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rr_path; 6, comment; 7, block; 7, 8; 7, 10; 7, 26; 7, 36; 7, 37; 7, 38; 7, 45; 7, 46; 7, 55; 7, 74; 7, 78; 7, 278; 8, expression_statement; 8, 9; 9, string:''' ...
def _find_rr_record(self, rr_path): # type: (bytes) -> dr.DirectoryRecord ''' An internal method to find an directory record on the ISO given a Rock Ridge path. If the entry is found, it returns the directory record object corresponding to that entry. If the entry could not be ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:_parse_udf_descriptors; 3, parameters; 3, 4; 4, identifier:self; 5, comment; 6, block; 6, 7; 6, 9; 6, 19; 6, 20; 6, 37; 6, 132; 6, 133; 6, 156; 6, 157; 6, 180; 6, 181; 6, 194; 6, 211; 6, 215; 6, 225; 6, 233; 6, 245; 6, 259; 6, 277; 6, 281...
def _parse_udf_descriptors(self): # type: () -> None ''' An internal method to parse the UDF descriptors on the ISO. This should only be called if it the ISO has a valid UDF Volume Recognition Sequence at the beginning of the ISO. Parameters: None. Retu...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_walk_udf_directories; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:extent_to_inode; 6, comment; 7, block; 7, 8; 7, 10; 7, 20; 7, 45; 7, 55; 7, 67; 8, expression_statement; 8, 9; 9, string:''' An internal method to...
def _walk_udf_directories(self, extent_to_inode): # type: (Dict[int, inode.Inode]) -> None ''' An internal method to walk a UDF filesystem and add all the metadata to this object. Parameters: extent_to_inode - A map from extent numbers to Inodes. Returns: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 1, 9; 2, function_name:_write_directory_records; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:vd; 6, identifier:outfp; 7, identifier:progress; 8, comment; 9, block; 9, 10; 9, 12; 9, 20; 9, 24; 9, 28; 9, 42; 10, expression_statement; ...
def _write_directory_records(self, vd, outfp, progress): # type: (headervd.PrimaryOrSupplementaryVD, BinaryIO, PyCdlib._Progress) -> None ''' An internal method to write out the directory records from a particular Volume Descriptor. Parameters: vd - The Volume Descripto...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_rm_dr_link; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rec; 6, comment; 7, block; 7, 8; 7, 10; 7, 25; 7, 29; 7, 39; 7, 43; 7, 204; 8, expression_statement; 8, 9; 9, string:''' An internal method to remove a Dire...
def _rm_dr_link(self, rec): # type: (dr.DirectoryRecord) -> int ''' An internal method to remove a Directory Record link given the record. Parameters: rec - The Directory Record to remove. Returns: The number of bytes to remove from the ISO. ''' ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:_rm_udf_link; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rec; 6, comment; 7, block; 7, 8; 7, 10; 7, 32; 7, 33; 7, 34; 7, 35; 7, 36; 7, 37; 7, 38; 7, 48; 7, 52; 7, 207; 7, 208; 7, 222; 7, 236; 8, expression_statement; 8, ...
def _rm_udf_link(self, rec): # type: (udfmod.UDFFileEntry) -> int ''' An internal method to remove a UDF File Entry link. Parameters: rec - The UDF File Entry to remove. Returns: The number of bytes to remove from the ISO. ''' if not rec.is_file...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 1, 16; 1, 17; 2, function_name:rm_file; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:iso_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:rr_name; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:joliet_path; ...
def rm_file(self, iso_path, rr_name=None, joliet_path=None, udf_path=None): # pylint: disable=unused-argument # type: (str, Optional[str], Optional[str], Optional[str]) -> None ''' Remove a file from the ISO. Parameters: iso_path - The path to the file to remove. rr_n...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 1, 8; 2, function_name:get_record; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, comment; 8, block; 8, 9; 8, 11; 8, 24; 8, 28; 8, 61; 8, 73; 8, 94; 8, 115; 8, 129; 9, expression_statement; 9, 10; 10, ...
def get_record(self, **kwargs): # type: (str) -> Union[dr.DirectoryRecord, udfmod.UDFFileEntry] ''' Get the directory record for a particular path. Parameters: iso_path - The absolute path on the ISO9660 filesystem to get the record for. rr_path - T...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 1, 10; 2, function_name:full_path_from_dirrecord; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:rec; 6, default_parameter; 6, 7; 6, 8; 7, identifier:rockridge; 8, False; 9, comment; 10, block; 10, 11; 10, 13; 10, 26; 10, 30; 10, 239; 10, 25...
def full_path_from_dirrecord(self, rec, rockridge=False): # type: (Union[dr.DirectoryRecord, udfmod.UDFFileEntry], bool) -> str ''' A method to get the absolute path of a directory record. Parameters: rec - The directory record to get the full path for. rockridge - Whe...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_update_bird_conf_file; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:operation; 6, block; 6, 7; 6, 9; 6, 13; 6, 17; 6, 23; 6, 33; 6, 43; 6, 54; 6, 65; 6, 99; 6, 122; 6, 152; 6, 168; 6, 213; 6, 214; 6, 226; 6, 241; 6, 256; 6, 257...
def _update_bird_conf_file(self, operation): """Update BIRD configuration. It adds to or removes IP prefix from BIRD configuration. It also updates generation time stamp in the configuration file. Main program will exit if configuration file cant be read/written. Arguments: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:run; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 141; 5, 142; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, if_statement; 9, 10; 9, 14; 9, 24; 10, not_operator; 10, 11; 11, attribute; 11, 12; 11, 13; 12, ...
def run(self): """Lunch checks and triggers updates on BIRD configuration.""" # Lunch a thread for each configuration if not self.services: self.log.warning("no service checks are configured") else: self.log.info("going to lunch %s threads", len(self.services)) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:modify_ip_prefixes; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:config; 5, identifier:config_file; 6, identifier:variable_name; 7, identifier:dummy_ip_prefix; 8, identifier:reconfigure_cmd; 9, identifier:keep...
def modify_ip_prefixes( config, config_file, variable_name, dummy_ip_prefix, reconfigure_cmd, keep_changes, changes_counter, ip_version): """Modify IP prefixes in Bird configuration. Depending on the configuration either removes or reports IP pref...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:load_configuration; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:config_file; 5, identifier:config_dir; 6, identifier:service_file; 7, block; 7, 8; 7, 10; 7, 15; 7, 23; 7, 30; 7, 55; 7, 146; 7, 168; 7, 173; 7, 180; 7, 185; 8, expression_state...
def load_configuration(config_file, config_dir, service_file): """Build configuration objects. If all sanity checks against daemon and service check settings are passed then it builds a ConfigParser object which holds all our configuration and a dictionary data structure which holds Bird configuration ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:configuration_check; 3, parameters; 3, 4; 4, identifier:config; 5, block; 5, 6; 5, 8; 5, 18; 5, 31; 5, 41; 5, 42; 5, 43; 5, 80; 5, 98; 5, 137; 5, 216; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 1...
def configuration_check(config): """Perform a sanity check on configuration. First it performs a sanity check against settings for daemon and then against settings for each service check. Arguments: config (obj): A configparser object which holds our configuration. Returns: None i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:create_bird_config_files; 3, parameters; 3, 4; 4, identifier:bird_configuration; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 10; 8, 11; 8, 12; 9, identifier:ip_version; 10, identifier:bird_configu...
def create_bird_config_files(bird_configuration): """Create bird configuration files per IP version. Creates bird configuration files if they don't exist. It also creates the directories where we store the history of changes, if this functionality is enabled. Arguments: bird_configuration ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:setup_logger; 3, parameters; 3, 4; 4, identifier:config; 5, block; 5, 6; 5, 8; 5, 17; 5, 37; 5, 44; 5, 48; 5, 62; 5, 74; 5, 107; 5, 113; 5, 125; 5, 146; 5, 147; 5, 223; 5, 289; 5, 290; 5, 350; 5, 351; 5, 447; 6, expression_statement; 6, 7; 7, c...
def setup_logger(config): """Configure the logging environment. Notice: By default logging will go to STDOUT and messages for unhandled exceptions or crashes will go to STDERR. If log_file and/or log_server is set then we don't log to STDOUT. Messages for unhandled exceptions or...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:main; 3, parameters; 4, block; 4, 5; 4, 7; 4, 14; 4, 18; 4, 22; 4, 30; 4, 35; 4, 55; 4, 62; 4, 105; 4, 128; 4, 136; 4, 143; 4, 159; 4, 167; 4, 193; 4, 209; 5, expression_statement; 5, 6; 6, comment; 7, expression_statement; 7, 8; 8, assignment;...
def main(): """Run check. anycast-healthchecker is a multi-threaded software and for each service check it holds a thread. If a thread dies then the service is not monitored anymore and the route for the IP associated with service it wont be withdrawn in case service goes down in the meantime. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_ve_base; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:environ; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 12; 6, 13; 6, 14; 6, 29; 6, 55; 6, 154; 6, 155; 6, 156; 6, 157; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10,...
def get_ve_base(self, environ): """Find a directory to look for virtualenvs in. """ # set ve_base to a path we can look for virtualenvs: # 1. .vexrc # 2. WORKON_HOME (as defined for virtualenvwrapper's benefit) # 3. $HOME/.virtualenvs # (unless we got --path, then...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:generate; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:callback; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:interval; 10, integer:0; 11, block; 11, 12; 11, 14; 11, 64; 11, ...
def generate(self, callback=None, interval=0): """ Hash pieces and report progress to `callback` This method sets ``pieces`` in :attr:`metainfo`\ ``['info']`` when all pieces are hashed successfully. :param callable callback: Callable with signature ``(torrent, filepath, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:read_stream; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:stream; 6, default_parameter; 6, 7; 6, 8; 7, identifier:validate; 8, True; 9, block; 9, 10; 9, 12; 10, expression_statement; 10, 11; 11, comment; 12, try_statement; ...
def read_stream(cls, stream, validate=True): """ Read torrent metainfo from file-like object :param stream: Readable file-like object (e.g. :class:`io.BytesIO`) :param bool validate: Whether to run :meth:`validate` on the new Torrent object :raises ReadError: if rea...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:filepaths; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:exclude; 7, tuple; 8, default_parameter; 8, 9; 8, 10; 9, identifier:hidden; 10, True; 11, default_parameter; 11, 12; 11, 13;...
def filepaths(path, exclude=(), hidden=True, empty=True): """ Return list of absolute, sorted file paths path: Path to file or directory exclude: List of file name patterns to exclude hidden: Whether to include hidden files empty: Whether to include empty files Raise PathNotFoundError if p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, default_parameter; 6, 7; 6, 8; 7, identifier:provider; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 31; 9, 53; 9, 54; 9, 55; 9, 82; 10, expression_statement; 10, ...
def get(self, request, provider=None): """ method called on GET request :param django.http.HttpRequestself. request: The current request object :param unicode provider: Optional parameter. The user provider suffix. """ # if settings.CAS_FEDERATE is not True r...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:service_login; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 354; 5, 355; 5, 385; 6, expression_statement; 6, 7; 7, comment; 8, try_statement; 8, 9; 8, 10; 8, 238; 8, 270; 8, 295; 8, 320; 9, comment; 10, block; 10, 11; 10, 2...
def service_login(self): """ Perform login against a service :return: * The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be warned before ticket emission and has not yep been warned. * The redirection to the servi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:not_authenticated; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 165; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, identifier:service; 12, bloc...
def not_authenticated(self): """ Processing non authenticated users :return: * The rendering of ``settings.CAS_LOGIN_TEMPLATE`` with various messages depending of GET/POST parameters * The redirection to :class:`FederateAuth` if ``settin...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:match_path_to_api_path; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:path_definitions; 5, identifier:target_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:base_path; 8, string:''; 9, default_parameter; 9, 10; 9, 11; 10, identifi...
def match_path_to_api_path(path_definitions, target_path, base_path='', context=None): """ Match a request or response path to one of the api paths. Anything other than exactly one match is an error condition. """ if context is None: context = {} assert isinst...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_read_frame; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:length; 6, block; 6, 7; 6, 9; 6, 10; 6, 21; 6, 38; 6, 39; 6, 40; 6, 52; 6, 53; 6, 57; 6, 81; 6, 93; 6, 97; 6, 110; 6, 111; 6, 117; 6, 136; 6, 137; 6, 161; 6, 171; 6, 172;...
def _read_frame(self, length): """Read a response frame from the PN532 of at most length bytes in size. Returns the data inside the frame if found, otherwise raises an exception if there is an error parsing the frame. Note that less than length bytes might be returned! """ ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:call_function; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:command; 6, default_parameter; 6, 7; 6, 8; 7, identifier:response_length; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:params; 1...
def call_function(self, command, response_length=0, params=[], timeout_sec=1): """Send specified command to the PN532 and expect up to response_length bytes back in a response. Note that less than the expected bytes might be returned! Params can optionally specify an array of bytes to send as ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:createGraph; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:createCollections; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:isSmart; 1...
def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) : """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges def...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:map_v2_event_into_v1; 3, parameters; 3, 4; 4, identifier:event; 5, block; 5, 6; 5, 8; 5, 9; 5, 16; 5, 17; 5, 269; 5, 270; 6, expression_statement; 6, 7; 7, string:''' Helper method to convert Sensu 2.x event into Sensu 1.x event. '''; 8...
def map_v2_event_into_v1(event): ''' Helper method to convert Sensu 2.x event into Sensu 1.x event. ''' # return the event if it has already been mapped if "v2_event_mapped_into_v1" in event: return event # Trigger mapping code if enity exists and client does not if not bool(event....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 1, 14; 2, function_name:gen_df_site; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:list_csv_in; 6, identifier:list_table; 7, default_parameter; 7, 8; 7, 9; 8, identifier:url_base; 9, identifier:url_repo_input_site; 10, type; 10, 11...
def gen_df_site( list_csv_in=list_table, url_base=url_repo_input_site)->pd.DataFrame: '''Generate description info of supy output results as a dataframe Parameters ---------- path_csv_out : str, optional path to the output csv file (the default is 'df_output.csv') list_csv_i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:wait_for_tasks_to_complete; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:batch_service_client; 5, identifier:job_ids; 6, identifier:timeout; 7, block; 7, 8; 7, 10; 7, 22; 7, 35; 7, 123; 8, expression_statement; 8, 9; 9, comment; 10, expressio...
def wait_for_tasks_to_complete(batch_service_client, job_ids, timeout): """Returns when all tasks in the specified job reach the Completed state. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The id of the job whose ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 52; 2, function_name:plot_world_with_elegans; 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, 39; 3, 46; 3, 49; 4, identifier:world; 5, default_parameter; 5, 6; 5, 7; 6, identifier:radius; 7, None; 8, default_parameter; ...
def plot_world_with_elegans( world, radius=None, width=350, height=350, config=None, grid=True, wireframe=False, species_list=None, debug=None, max_count=1000, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6), return_id=False, predicator=None): """ Generate a plot ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 31; 2, function_name:plot_trajectory2d_with_matplotlib; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:obs; 5, default_parameter; 5, 6; 5, 7; 6, identifier:plane; 7, string:'xy'; 8, default_parameter; 8, 9; 8, 10; 9...
def plot_trajectory2d_with_matplotlib( obs, plane='xy', max_count=10, figsize=6, legend=True, wireframe=False, grid=True, noaxis=False, plot_range=None, **kwargs): """ Make a 2D plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 40; 2, function_name:plot_world2d_with_matplotlib; 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; 3, 38; 4, identifier:world; 5, default_parameter; 5, 6; 5, 7; 6, identifier:plane; 7, string:'xy'; 8, default_paramet...
def plot_world2d_with_matplotlib( world, plane='xy', marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, scale=1.0, **kwargs): """ Make a 2D plot from received instance of World and show it on IPython notebook. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:get_model; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:is_netfree; 6, False; 7, default_parameter; 7, 8; 7, 9; 8, identifier:without_reset; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, ident...
def get_model(is_netfree=False, without_reset=False, seeds=None, effective=False): """ Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES`` and ``REACTIONRULES``. Parameters ---------- is_netfree : bool, optional Return ``NetfreeModel`` if True, and ``NetworkMode...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:run_multiprocessing; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:target; 5, identifier:jobs; 6, default_parameter; 6, 7; 6, 8; 7, identifier:n; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:nproc; 11, None; 1...
def run_multiprocessing(target, jobs, n=1, nproc=None, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel by using `multiprocessing`. Parameters ---------- target : function A function to be evaluated. The ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:readbits; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:bits; 6, block; 6, 7; 6, 9; 6, 16; 6, 17; 6, 39; 6, 43; 6, 49; 6, 113; 6, 217; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 13; 10, comparison_opera...
def readbits(self, bits): """ Read the specified number of bits from the stream. Returns 0 for bits == 0. """ if bits == 0: return 0 # fast byte-aligned path if bits % 8 == 0 and self._bits_pending == 0: return self._read_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:export; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:swf; 6, identifier:shape; 7, dictionary_splat_pattern; 7, 8; 8, identifier:export_opts; 9, block; 9, 10; 9, 12; 9, 13; 9, 68; 9, 74; 9, 75; 9, 100; 9, 235; 9, 241;...
def export(self, swf, shape, **export_opts): """ Exports the specified shape of the SWF to SVG. @param swf The SWF. @param shape Which shape to export, either by characterId(int) or as a Tag object. """ # If `shape` is given as int, find corresponding shape tag. if is...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:draw_residual; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:x; 5, identifier:y; 6, identifier:yerr; 7, identifier:xerr; 8, default_parameter; 8, 9; 8, 10; 9, identifier:show_errbars; 10, True; 11, defa...
def draw_residual(x, y, yerr, xerr, show_errbars=True, ax=None, zero_line=True, grid=True, **kwargs): """Draw a residual plot on the axis. By default, if show_errbars if True, residuals are drawn as blue points with errorbars with no endcaps. If show_er...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:combined_message_class; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 19; 5, 23; 5, 24; 5, 25; 5, 26; 5, 27; 5, 28; 5, 29; 5, 33; 5, 61; 5, 124; 5, 138; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14...
def combined_message_class(self): """A ProtoRPC message class with both request and parameters fields. Caches the result in a local private variable. Uses _CopyField to create copies of the fields from the existing request and parameters classes since those fields are "owned" by the message classes. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:_get_token; 3, parameters; 3, 4; 3, 7; 3, 12; 4, default_parameter; 4, 5; 4, 6; 5, identifier:request; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:allowed_auth_schemes; 9, tuple; 9, 10; 9, 11; 10, string:'OAuth'; 11, string:'Beare...
def _get_token( request=None, allowed_auth_schemes=('OAuth', 'Bearer'), allowed_query_keys=('bearer_token', 'access_token')): """Get the auth token for this request. Auth token may be specified in either the Authorization header or as a query param (either access_token or bearer_token). We'll check in ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_get_id_token_user; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:token; 5, identifier:issuers; 6, identifier:audiences; 7, identifier:allowed_client_ids; 8, identifier:time_now; 9, identifier:cache; 10, block; 10, 11; 10, 1...
def _get_id_token_user(token, issuers, audiences, allowed_client_ids, time_now, cache): """Get a User for the given id token, if the token is valid. Args: token: The id_token to check. issuers: dict of Issuers audiences: List of audiences that are acceptable. allowed_client_ids: List of client IDs ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_verify_parsed_token; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:parsed_token; 5, identifier:issuers; 6, identifier:audiences; 7, identifier:allowed_client_ids; 8, default_parameter; 8, 9; 8, 10; 9, identifier:is_legacy_google_...
def _verify_parsed_token(parsed_token, issuers, audiences, allowed_client_ids, is_legacy_google_auth=True): """Verify a parsed user ID token. Args: parsed_token: The parsed token information. issuers: A list of allowed issuers audiences: The allowed audiences. allowed_client_ids: The allowed client...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_verify_signed_jwt_with_certs; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:jwt; 5, identifier:time_now; 6, identifier:cache; 7, default_parameter; 7, 8; 7, 9; 8, identifier:cert_uri; 9, identifier:_DEFAULT_CERT_URI; 10, block; 10, 11;...
def _verify_signed_jwt_with_certs( jwt, time_now, cache, cert_uri=_DEFAULT_CERT_URI): """Verify a JWT against public certs. See http://self-issued.info/docs/draft-jones-json-web-token.html. The PyCrypto library included with Google App Engine is severely limited and so you have to use it very carefull...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_sorted_methods; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:methods; 6, block; 6, 7; 6, 9; 6, 15; 6, 16; 6, 180; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 12; 10, not_operator; 10, 11; 11, ident...
def _get_sorted_methods(self, methods): """Get a copy of 'methods' sorted the way they would be on the live server. Args: methods: JSON configuration of an API's methods. Returns: The same configuration with the methods sorted based on what order they'll be checked by the server. """...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:api_server; 3, parameters; 3, 4; 3, 5; 4, identifier:api_services; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 11; 7, 21; 7, 28; 7, 35; 7, 43; 7, 44; 7, 53; 7, 62; 7, 63; 7, 74; 7, 91; 7, 92; 7, 93; 7, 109...
def api_server(api_services, **kwargs): """Create an api_server. The primary function of this method is to set up the WSGIApplication instance for the service handlers described by the services passed in. Additionally, it registers each API in ApiConfigRegistry for later use in the BackendService.getApiConfi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:__register_services; 3, parameters; 3, 4; 3, 5; 4, identifier:api_name_version_map; 5, identifier:api_config_registry; 6, block; 6, 7; 6, 9; 6, 17; 6, 21; 6, 118; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, as...
def __register_services(api_name_version_map, api_config_registry): """Register & return a list of each URL and class that handles that URL. This finds every service class in api_name_version_map, registers it with the given ApiConfigRegistry, builds the URL for that class, and adds the URL and its fac...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:transform_rest_request; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:orig_request; 6, identifier:params; 7, identifier:method_parameters; 8, block; 8, 9; 8, 11; 8, 19; 8, 23; 8, 24; 8, 43; 8, 44; 8, 85; 8, 86; 8, 87;...
def transform_rest_request(self, orig_request, params, method_parameters): """Translates a Rest request into an apiserving request. This makes a copy of orig_request and transforms it to apiserving format (moving request parameters to the body). The request can receive values from the path, query and ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 66; 2, function_name:api; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 3, 36; 3, 39; 3, 42; 3, 45; 3, 48; 3, 51; 3, 54; 3, 57; 3, 60; 3, 63; 4, identifier:name; 5, identifier:version; 6, default_parameter; 6, 7; 6,...
def api(name, version, description=None, hostname=None, audiences=None, scopes=None, allowed_client_ids=None, canonical_name=None, auth=None, owner_domain=None, owner_name=None, package_path=None, frontend_limits=None, title=None, documentation=None, auth_level=None, issuers=None, namesp...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 44; 2, function_name:method; 3, parameters; 3, 4; 3, 9; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 3, 41; 4, default_parameter; 4, 5; 4, 6; 5, identifier:request_message; 6, attribute; 6, 7; 6, 8; 7, identifier:message_types; 8, identifier:Void...
def method(request_message=message_types.VoidMessage, response_message=message_types.VoidMessage, name=None, path=None, http_method='POST', scopes=None, audiences=None, allowed_client_ids=None, auth_level=None, api_key_re...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:api_class; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:resource_name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:path; 10, None; 11, def...
def api_class(self, resource_name=None, path=None, audiences=None, scopes=None, allowed_client_ids=None, auth_level=None, api_key_required=None): """Get a decorator for a class that implements an API. This can be used for single-class or multi-class implementations. It's us...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:__field_to_subfields; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:field; 6, block; 6, 7; 6, 9; 6, 10; 6, 24; 6, 28; 6, 77; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, if_statement; 10, 11; 10, 19; 11, not_operato...
def __field_to_subfields(self, field): """Fully describes data represented by field, including the nested case. In the case that the field is not a message field, we have no fields nested within a message definition, so we can simply return that field. However, in the nested case, we can't simply descr...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:__schemas_descriptor; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 182; 5, 183; 5, 217; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11,...
def __schemas_descriptor(self): """Describes the schemas section of the discovery document. Returns: Dictionary describing the schemas of the document. """ # Filter out any keys that aren't 'properties', 'type', or 'id' result = {} for schema_key, schema_value in self.__parser.schemas().i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:__discovery_doc_descriptor; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:services; 6, default_parameter; 6, 7; 6, 8; 7, identifier:hostname; 8, None; 9, block; 9, 10; 9, 12; 9, 21; 9, 33; 9, 39; 9, 58; 9, 67; 9, 77; 9, 88;...
def __discovery_doc_descriptor(self, services, hostname=None): """Builds a discovery doc for an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaul...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:__definitions_descriptor; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 127; 5, 128; 5, 129; 5, 170; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11;...
def __definitions_descriptor(self): """Describes the definitions section of the OpenAPI spec. Returns: Dictionary describing the definitions of the spec. """ # Filter out any keys that aren't 'properties' or 'type' result = {} for def_key, def_value in self.__parser.schemas().iteritems():...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:__api_openapi_descriptor; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:services; 6, default_parameter; 6, 7; 6, 8; 7, identifier:hostname; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:x_google_api_nam...
def __api_openapi_descriptor(self, services, hostname=None, x_google_api_name=False): """Builds an OpenAPI description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:__message_to_schema; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:message_type; 6, block; 6, 7; 6, 9; 6, 18; 6, 28; 6, 41; 6, 45; 6, 314; 6, 320; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, ass...
def __message_to_schema(self, message_type): """Parse a single message into JSON Schema. Will recursively descend the message structure and also parse other messages references via MessageFields. Args: message_type: protorpc.messages.Message class to parse. Returns: An object represen...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:transform_parameter_value; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:parameter_name; 5, identifier:value; 6, identifier:parameter_config; 7, block; 7, 8; 7, 10; 7, 44; 7, 45; 7, 52; 7, 94; 8, expression_statement; 8, 9; 9, comment; 10, if_...
def transform_parameter_value(parameter_name, value, parameter_config): """Validates and transforms parameters to the type expected by the API. If the value is a list this will recursively call _transform_parameter_value on the values in the list. Otherwise, it checks all parameter rules for the the current va...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:extract_conf_from; 3, parameters; 3, 4; 3, 5; 3, 11; 3, 14; 4, identifier:mod; 5, default_parameter; 5, 6; 5, 7; 6, identifier:conf; 7, call; 7, 8; 7, 9; 8, identifier:ModuleConfig; 9, argument_list; 9, 10; 10, identifier:CONF_SPEC; 11, defaul...
def extract_conf_from(mod, conf=ModuleConfig(CONF_SPEC), depth=0, max_depth=2): """recursively extract keys from module or object by passed config scheme """ # extract config keys from module or object for key, default_value in six.iteritems(conf): conf[key] = _get_key_from_module(mod, key,...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:render_region; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 3, 16; 4, default_parameter; 4, 5; 4, 6; 5, identifier:widget; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:request; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identi...
def render_region(widget=None, request=None, view=None, page=None, region=None): """returns rendered content this is not too clear and little tricky, because external apps needs calling process method """ # change the request if not isinstance(request, dict): request.q...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:handle_ajax_method; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, identifier:method; 7, block; 7, 8; 7, 10; 7, 14; 7, 41; 7, 49; 7, 57; 7, 70; 7, 82; 7, 83; 7, 326; 8, expression_statement; 8, 9; 9, comment; 10,...
def handle_ajax_method(self, request, method): """handle ajax methods and return serialized reponse in the default state allows only authentificated users - Depends on method parameter render whole region or single widget - If widget_id is present then try to load this widget ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:ajax_upload; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, default_parameter; 6, 7; 6, 8; 7, identifier:folder_id; 8, None; 9, block; 9, 10; 9, 12; 9, 23; 9, 27; 9, 34; 9, 38; 9, 77; 9, 78; 9, 104; 10, expressio...
def ajax_upload(self, request, folder_id=None): """ receives an upload from the uploader. Receives only one file at the time. """ mimetype = "application/json" if request.is_ajax() else "text/html" content_type_key = 'content_type' response_params = {content_type_key: mim...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:collect; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 22; 5, 32; 5, 318; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:s...
def collect(self): """ Load and save ``PageColorScheme`` for every ``PageTheme`` .. code-block:: bash static/themes/bootswatch/united/variables.scss static/themes/bootswatch/united/styles.scss """ self.ignore_patterns = [ '*.png', '*.jpg', ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:urlpatterns; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 197; 6, expression_statement; 6, 7; 7, string:'''load and decorate urls from all modules then store it as cached property for less loading '''; 8, if...
def urlpatterns(self): '''load and decorate urls from all modules then store it as cached property for less loading ''' if not hasattr(self, '_urlspatterns'): urlpatterns = [] # load all urls # support .urls file and urls_conf = 'elephantblog.urls' on ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:reverse; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:viewname; 5, default_parameter; 5, 6; 5, 7; 6, identifier:urlconf; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:args; 10, None; 11, default_parameter; 11, 12; 1...
def reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None): """monkey patched reverse path supports easy patching 3rd party urls if 3rd party app has namespace for example ``catalogue`` and you create FeinCMS plugin with same name as this namespace reverse returns url from Applic...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:process_response; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, identifier:response; 7, block; 7, 8; 7, 10; 7, 195; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 22; 11, boolean_operat...
def process_response(self, request, response): """Convert HttpResponseRedirect to HttpResponse if request is via ajax to allow ajax request to redirect url """ if request.is_ajax() and hasattr(request, 'horizon'): queued_msgs = request.horizon['async_messages'] i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:process_exception; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, identifier:exception; 7, block; 7, 8; 7, 10; 7, 188; 7, 189; 7, 205; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 22; ...
def process_exception(self, request, exception): """Catches internal Horizon exception classes such as NotAuthorized, NotFound and Http302 and handles them gracefully. """ if isinstance(exception, (exceptions.NotAuthorized, exceptions.NotAuthenticated))...