コード例 #1
0
ファイル: test.py プロジェクト: ofabio/py2beam
def test5():
    global tree
    print '-- TEST 5 --'
    print 'output would be...'

    def hello():
        return 5
    print hello()

    print '------------'

    tree = Module([
        Def('hello', [], [
            Return(Int(5))
        ]),
        Print(Call(Var('hello'), []))
    ])

    composer = Composer('.', 'fabio', tree)
    composer.generate()
    composer.write()
コード例 #2
0
ファイル: example.py プロジェクト: zrathustra/fifthseason
import json

from composer import Composer
from constants import PIECES

# compose 4 pieces each in the style of each season
for piece, file in PIECES.iteritems():
    bot = Composer({piece: file})
    markov_piece = bot.measurify(bot.write(350), 4, 4)
    
    with open("output/json/" + piece + ".json", "w") as fp:
    
        json.dump(markov_piece, fp)

# write a fifth piece in the style of all 4 seasons
bot = Composer(PIECES)
markov_piece = bot.measurify(bot.write(350), 4, 4)

with open("output/json/" + piece + ".json", "w") as fp:

    json.dump(markov_piece, fp)
コード例 #3
0
ファイル: test.py プロジェクト: ofabio/py2beam
def compose():
    composer = Composer('.', 'prova', tree)
    composer.generate()
    composer.write()