Did I find the right examples for you? yes no

All Samples(12)  |  Call(10)  |  Derive(0)  |  Import(2)

        def block_workaround(bt, workaround):
    if isinstance(workaround, kurt.Block):
        w = workaround
        workaround = lambda block: w.copy()
    else:
        assert callable(workaround)
    bt = kurt.BlockType.get(bt)
    bt._add_workaround(workaround)
        


src/k/u/kurt-2.0.5/kurt/scratch14/__init__.py   kurt(Download)
import kurt
from kurt import StringIO
from kurt.plugin import Kurt, KurtPlugin, block_workaround
 
from kurt.scratch14.objtable import *
 
# 1.4 -> 2.0
block_workaround('stop script', kurt.Block('stop', 'this script'))
block_workaround('stop all', kurt.Block('stop', 'all'))
block_workaround('forever if',
    lambda block: kurt.Block('forever', [kurt.Block('if', *block.args)]))
block_workaround('loud?', kurt.Block('>', kurt.Block('loudness'), 30))

src/k/u/kurt-HEAD/kurt/scratch14/__init__.py   kurt(Download)
import kurt
from kurt import StringIO
from kurt.plugin import Kurt, KurtPlugin, block_workaround
 
from kurt.scratch14.objtable import *
 
# 1.4 -> 2.0
block_workaround('stop script', kurt.Block('stop', 'this script'))
block_workaround('stop all', kurt.Block('stop', 'all'))
block_workaround('forever if',
    lambda block: kurt.Block('forever', [kurt.Block('if', *block.args)]))
block_workaround('loud?', kurt.Block('>', kurt.Block('loudness'), 30))