Returns a note in abc notation from given note object (JSON)
NOTE: min duration is 2
@param {object} prevNote - The previous note
@param {object} curNote - The note that should be transformed to abc
@returns {string}
430029
function getAbcNote(prevNote, curNote) {
  var _accidental = '';
  if (typeof curNote.pitch.accidental !== 'undefined' && parseInt(curNote.pitch.accidental) !== 0) {
    _accidental = accidental.json[curNote.pitch.accidental];
  }
  var _pitch = pitches.json[parseInt(curNote.pitch.octave)][curNote.pitch.step];
  var _duration = parseInt(curNote.duration);
  if (typeof prevNote !== 'undefined') {
    if (prevNote.dot) {
      _duration = _duration * 2;
    }
  }
  var _dotted = '';
  if (curNote.dot === true || curNote.dot === 'true') {
    _duration = _duration / 1.5;
    _dotted = '>';
  }

  // check if rest
  if (curNote.rest === true || curNote.rest === 'true') {
    // return rest as abc
    return "z" + _duration + _dotted;
  } else {
    // return note as abc
    return _accidental + _pitch + _duration + _dotted;
  }
}
952794
function(obj, num, chordPos) {
        if (currSlur[chordPos] === undefined) {
          // There isn't an exact match for note position, but we'll take any other open slur.
          for (x = 0; x < currSlur.length; x++) {
            if (currSlur[x] !== undefined) {
              chordPos = x;
              break;
            }
          }
          if (currSlur[chordPos] === undefined) {
            var offNum = chordPos*100+1;
            Common.each(obj.endSlur, function(x) { if (offNum === x) --offNum; });
            currSlur[chordPos] = [offNum];
          }
        }
        var slurNum;
        for (var i = 0; i < num; i++) {
          slurNum = currSlur[chordPos].pop();
          obj.endSlur.push(slurNum);
//					lyr.syllable += '<' + slurNum;	// TODO-PER: debugging
        }
        if (currSlur[chordPos].length === 0)
          delete currSlur[chordPos];
        return slurNum;
      }
936637
def phon(self, cls = 'current', previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT):
        """"""
        if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
        if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHandling.EITHER):
            for e in self:
                if isinstance(e, New) or isinstance(e, Current):
                    return previousdelimiter + e.phon(cls, "", strict, correctionhandling)
        if correctionhandling in (CorrectionHandling.ORIGINAL, CorrectionHandling.EITHER):
            for e in self:
                if isinstance(e, Original):
                    return previousdelimiter + e.phon(cls, "", correctionhandling)
        raise NoSuchPhon
1211360
function(oneaccidental) {
    var key = this.key(), limit = oneaccidental ? 2 : 3;

    return ['m3', 'm2', 'm-2', 'm-3']
      .map(this.interval.bind(this))
      .filter(function(note) {
      var acc = note.accidentalValue();
      var diff = key - (note.key() - acc);

      if (diff < limit && diff > -limit) {
        var product = vector.mul(knowledge.sharp, diff - acc);
        note.coord = vector.add(note.coord, product);
        return true;
      }
    });
  }
1269297
function (prevNode, newNode) {
      if (prevNode === newNode) {
          return;
      }
      TNode.replaceNodeBy.call(this,prevNode, newNode);
      var aen=this.attEltNodes;
      if (aen) {
          for (var i=0,sz=aen.length; sz>i;i++) {
              aen[i].replaceNodeBy(prevNode, newNode);
          }
      }
  }
719332
function Ne(pt){var ut=pt.length;if(ut<=dt)return String.fromCharCode.apply(String,pt);// avoid extra slice()
// Decode in chunks to avoid "call stack size exceeded".
for(var bt="",ht=0;ht<ut;)bt+=String.fromCharCode.apply(String,pt.slice(ht,ht+=dt));return bt}
241411
Rule Element() {
		return FirstOf(Tuplet(), SlurBegin(), SlurEnd(),
			WSPS().label(Space), ChordOrText(),
			NthRepeat(), EndNthRepeat(),
			Barline(), Gracing(), BrokenRhythm(),
			//.| = dashed barline, no staccato barline
			//+>+ = Gracing, > = BrokenRhythm
			//!fermata! before f, e and a parsed into notes
			Stem(), Rest(), 
			GraceNotes(), MultiMeasureRest(), MeasureRepeat(),
			Rollback(), InlineField(), UnusedChar()
		).label(Element);
	}
1117942
def sub_notes(docs):
    
    def substitute(match):
        ret = "</p><div class=\"alert alert-{}\" role=\"alert\"><h4>{}</h4>" \
              "<p>{}</p></div>".format(NOTE_TYPE[match.group(1).lower()],
                                       match.group(1).capitalize(), match.group(2))
        if len(match.groups()) >= 4 and not match.group(4): ret += '\n<p>'
        return ret
    for regex in NOTE_RE:
        docs = regex.sub(substitute,docs)
    return docs
572779
function getPreviousItem(opts: Options, value: Value, block?: Block): ?Block {
    const { document, startBlock } = value;
    block = block || startBlock;

    const currentItem = getCurrentItem(opts, value, block);
    if (!currentItem) {
        return null;
    }

    const previousSibling = document.getPreviousSibling(currentItem.key);

    if (!previousSibling) {
        return null;
    } else if (previousSibling.type === opts.typeItem) {
        return previousSibling;
    }
    return null;
}
238684
function (chord) {
  var noteRegex = '[A-Ga-g][#b]{0,2}';
  var root = chord.match(new RegExp('^' + noteRegex))[0];
  var bass = null;
  var symbol;

  root = note.create(root);

  // Strip note, strip spaces, strip bass
  symbol = chord.replace(/[\s]/g, '')
                .replace(new RegExp('^' + noteRegex), '')
                .replace(new RegExp('/' + noteRegex + '$'), '');

  bass = chord.match(new RegExp('/' + noteRegex + '$'));
  if (bass) bass = note.create(bass[0].slice(1));

  return { root: root, symbol: symbol, bass: bass };
}
397236
function attributesToString(obj, prevObj, level) {
            var attrs = '',
                prefix,
                tab;
            level = level || 1;
            tab = getTabs(level, true);
            _.forEach(obj, function (v, k) {
                if(excludeAttrs.indexOf(k) === -1){
                    var prev = prevObj && prevObj[k] !== undefined ? prevObj[k] : undefined;
                    prefix = attrs.length ? ',\n' : '';
                    if(_.isPlainObject(v)){
                        var subAttr = attributesToString(v, prev, level +1);
                        if(subAttr && subAttr.length)
                            attrs += (prefix + tab + k + ': {\n' + subAttr + '\n' + tab + '}');
                    } else {
                        if(prev !== v){
                            var val = k === 'type' ? 'types.' + v : v;
                            if(_.isArray(val))
                                val = arrayToString(val);
                            if(_.isFunction(val)){
                                val = funcToString(val.toString(), 2);
                            }
                            attrs += (prefix + tab + k + ': ' + val);
                        }
                    }
                }
            });

            return attrs;
        }
384522
def prewitt(image, mask=None):
    '''
    '''
    return np.sqrt(hprewitt(image,mask)**2 + vprewitt(image,mask)**2)
1185253
function() {
        if (!version) return;
        if (note) version.notes.push(note);

        version.rawNote = normText(
            _.chain(version.notes)
            .map(function(note) {
                return '* '+note.trim();
            })
            .value()
            .join('\n')
        );
        version.notes = _.map(version.notes, normText);
        changelog.versions.push(version);

        note = "";
        version = null;
    }
297805
public Note getNoteFirstExtendedLineLow() {
		if (m_lowNote == null) {
			//A 7th (label=6) for 5 lines,
			//A 5th (label=4) for 3 lines,
			//A 3rd (label=2) for 1 line
			byte label = (byte) (getStaffLines() + 1);
			Interval interv = new Interval(label,
				label==5?Interval.PERFECT:Interval.MAJOR,
				Interval.DOWNWARD);
			m_lowNote = interv.calculateSecondNote(getMiddleNote());
			m_lowNote.setAccidental(new Accidental());//Accidental.NONE
		}
		return m_lowNote;
	}
1335600
function reconstruct(str2, trace) {
	const isStr = typeof str2 === 'string'

	const prepend = (isString => {
		if (isString) {
			return (preString, postString) => preString + postString
		} else {
			return (_, postArray, preArray = _) => {
				Array.prototype.push.apply(preArray, postArray)
				return preArray
			}
		}
	})(isStr)

	let pointer = str2.length,
		c = isStr ? '' : []
	for (let i = 0, n = trace.length; i < n; i++) {
		const op = trace[i],
			op0 = op[0],
			op1 = op.slice(1),
			skipBlock = parseInt(op)
		if (skipBlock) {
			const skipChars = str2.slice(pointer - skipBlock, pointer)
			c = prepend(skipChars, c)
			pointer -= skipBlock
		} else if (op0 === 's') {
			c = prepend(op1, c, [op1])
			pointer--
		} else if (op0 === 'i') {
			c = prepend(op1, c, [op1])
		} else {
			pointer -= parseInt(op1) || 1
		}
	}
	return c
}
1002251
public Content getNavLinkPrevious(DocPath prev) {
        Content li;
        if (prev != null) {
            li = HtmlTree.LI(getHyperLink(prev, contents.prevLabel, "", ""));
        }
        else
            li = HtmlTree.LI(contents.prevLabel);
        return li;
    }
1015408
def get_next_base26(prev=None):
    
    if not prev:
        return 'a'

    r = re.compile("^[a-z]*$")
    if not r.match(prev):
        raise ValueError("Invalid base26")

    if not prev.endswith('z'):
        return prev[:-1] + chr(ord(prev[-1]) + 1)

    return get_next_base26(prev[:-1]) + 'a'