File: python.html

package info (click to toggle)
rainbow.js 2.1.7%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 1,148 kB
  • sloc: javascript: 4,771; makefile: 13
file content (92 lines) | stat: -rw-r--r-- 2,521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<meta charset=utf-8>
<title>Syntax Highlighting</title>
<link href="../themes/css/blackboard.css" rel="stylesheet" type="text/css" media="screen">
<body>

<pre>
<code data-language="python">#!/usr/bin/env python
# Copyright 2012 Craig Campbell
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re, os, math
from util import Util
from instrument import Instrument

class WarpWhistle(object):
    TEMPO = 'tempo'
    VOLUME = 'volume'
    TIMBRE = 'timbre'
    ARPEGGIO = 'arpeggio'
    INSTRUMENT = 'instrument'
    PITCH = 'pitch'
    OCTAVE = 'octave'
    SLIDE = 'slide'
    Q = 'q'

    ABSOLUTE_NOTES = 'X-ABSOLUTE-NOTES'
    TRANSPOSE = 'X-TRANSPOSE'
    COUNTER = 'X-COUNTER'
    X_TEMPO = 'X-TEMPO'
    SMOOTH = 'X-SMOOTH'
    N106 = 'EX-NAMCO106'
    FDS = 'EX-DISKFM'
    VRC6 = 'EX-VRC6'
    PITCH_CORRECTION = 'PITCH-CORRECTION'

    CHIP_N106 = 'N106'
    CHIP_FDS = 'FDS'
    CHIP_VRC6 = 'VRC6'

    def __init__(self, content, logger, options):
        self.first_run = True

        # current voice we are processing if we are processing voices separately
        self.process_voice = None

        # list of voices to process
        self.voices_to_process = None

        # list of voices
        self.voices = None

        self.content = content
        self.logger = logger
        self.options = options
        self.reset()

    def reset(self):
        """
        This method resets the properties of the instance.
        """
        self.current_voices = []
        self.global_vars = {}
        self.vars = {}
        self.instruments = {}
        self.data = {}
        self.global_lines = []

    def getDataForVoice(self, voice, key):
        if not voice in self.data:
            return None

        if not key in self.data[voice]:
            return None

        return self.data[voice][key]</code>
</pre>

    <script src="../dist/rainbow.js"></script>
    <script src="../src/language/generic.js"></script>
    <script src="../src/language/python.js"></script>
</body>