<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,3 +21,43 @@ def task_clean(c):
     rm_rf(['bench_%s.*' % name for name in names])
     rm_rf(['%s.result'  % name for name in names])
     rm_rf('mako_modules')
+
+
+
+@recipe
+@product(&quot;bench_context.py&quot;)
+def file_bench_context_py(c):
+    &quot;&quot;&quot;create context data file *.py from *.yaml&quot;&quot;&quot;
+    import yaml
+    ydoc = yaml.load(open('bench_context.yaml'))
+    buf = []
+    buf.append(&quot;items = [\n&quot;)
+    for item in ydoc['list']:
+        buf.extend((
+            &quot;    {\n&quot;,
+            &quot;        'name':   %s,\n&quot; % repr(item['name']),
+            &quot;        'name2':  %s,\n&quot; % repr(item['name2']),
+            &quot;        'url':    %s,\n&quot; % repr(item['url']),
+            &quot;        'symbol': %s,\n&quot; % repr(item['symbol']),
+            &quot;        'price':   %s,\n&quot; % (item['price']),
+            &quot;        'change':  %s,\n&quot; % (item['change']),
+            &quot;        'ratio':   %s,\n&quot; % (item['ratio']),
+            &quot;    },\n&quot;,
+            ))
+    buf.append(&quot;]\n&quot;)
+    buf.append(&quot;\n&quot;)
+    buf.append(&quot;&quot;&quot;
+class StockInfo:
+    def __init__(self, name, name2, url, symbol, price, change, ratio):
+        self.name   = name
+        self.name2  = name2
+        self.url    = url
+        self.symbol = symbol
+        self.price  = price
+        self.change = change
+        self.ratio  = ratio
+
+items2 = [StockInfo(**item) for item in items]
+&quot;&quot;&quot;)
+    import kook.utils
+    kook.utils.write_file(c.product, ''.join(buf))</diff>
      <filename>python/benchmark/Kookbook.py</filename>
    </modified>
    <modified>
      <diff>@@ -877,25 +877,33 @@ def filter_targets(targets, target_list, excludes):
 def load_context_data(datafile):
     global mode, lang
     ## context data
-    msg(&quot;*** loading context data...\n&quot;)
-    if not datafile:
-        if   mode == 'dict':   datafile = 'bench_context.yaml'
-        elif mode == 'class':  datafile = 'bench_context.py'
-        else: assert False, &quot;** unreachable&quot;
-    if lang:
-        datafile = re.sub(r'(\.\w+)', r'_%s\1' % lang, datafile)
-    context = {}
-    if datafile.endswith('.py'):
-        exec(open(datafile).read(), globals(), context)
-    elif datafile.endswith('.yaml') or datafile.endswith('.yml'):
-        import yaml
-        s = open(datafile).read()
-        if encoding:
-            s = s.decode(encoding)
-        context = yaml.load(s)
-    else:
-        raise &quot;-f %s: invalid datafile type&quot; % datafile
+    #msg(&quot;*** loading context data...\n&quot;)
+    #if not datafile:
+    #    if   mode == 'dict':   datafile = 'bench_context.yaml'
+    #    elif mode == 'class':  datafile = 'bench_context.py'
+    #    else: assert False, &quot;** unreachable&quot;
+    #if datafile.endswith('.py'):
+    #    exec(open(datafile).read(), globals(), context)
+    #elif datafile.endswith('.yaml') or datafile.endswith('.yml'):
+    #    import yaml
+    #    s = open(datafile).read()
+    #    if encoding:
+    #        s = s.decode(encoding)
+    #    context = yaml.load(s)
+    #else:
+    #    raise &quot;-f %s: invalid datafile type&quot; % datafile
     #sys.stderr.write(&quot;*** debug: context=%s\n&quot; % (repr(context)))
+    #return context
+    if not datafile: datafile = 'bench_context.py'
+    if lang: datafile = re.sub(r'(\.\w+)', r'_%s\1' % lang, datafile)
+    msg(&quot;*** loading context data (file=%s)...\n&quot; % datafile)
+    s = read_file(datafile)
+    if encoding: s = s.decode(encoding)
+    context = {}
+    exec(s, globals(), context)
+    if 'items' in context and 'items2' in context:
+        k = mode == 'dict' and 'items' or 'items2'
+        context['list'] = context[k]
     return context
 
 </diff>
      <filename>python/benchmark/bench.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,186 @@
-import yaml
+items = [
+    {
+        'name':   'Adobe Systems',
+        'name2':  'Adobe Systems Inc.',
+        'url':    'http://www.adobe.com',
+        'symbol': 'ADBE',
+        'price':   39.26,
+        'change':  0.13,
+        'ratio':   0.33,
+    },
+    {
+        'name':   'Advanced Micro Devices',
+        'name2':  'Advanced Micro Devices Inc.',
+        'url':    'http://www.amd.com',
+        'symbol': 'AMD',
+        'price':   16.22,
+        'change':  0.17,
+        'ratio':   1.06,
+    },
+    {
+        'name':   'Amazon.com',
+        'name2':  'Amazon.com Inc',
+        'url':    'http://www.amazon.com',
+        'symbol': 'AMZN',
+        'price':   36.85,
+        'change':  -0.23,
+        'ratio':   -0.62,
+    },
+    {
+        'name':   'Apple',
+        'name2':  'Apple Inc.',
+        'url':    'http://www.apple.com',
+        'symbol': 'AAPL',
+        'price':   85.38,
+        'change':  -0.87,
+        'ratio':   -1.01,
+    },
+    {
+        'name':   'BEA Systems',
+        'name2':  'BEA Systems Inc.',
+        'url':    'http://www.bea.com',
+        'symbol': 'BEAS',
+        'price':   12.46,
+        'change':  0.09,
+        'ratio':   0.73,
+    },
+    {
+        'name':   'CA',
+        'name2':  'CA, Inc.',
+        'url':    'http://www.ca.com',
+        'symbol': 'CA',
+        'price':   24.66,
+        'change':  0.38,
+        'ratio':   1.57,
+    },
+    {
+        'name':   'Cisco Systems',
+        'name2':  'Cisco Systems Inc.',
+        'url':    'http://www.cisco.com',
+        'symbol': 'CSCO',
+        'price':   26.35,
+        'change':  0.13,
+        'ratio':   0.5,
+    },
+    {
+        'name':   'Dell',
+        'name2':  'Dell Corp.',
+        'url':    'http://www.dell.com/',
+        'symbol': 'DELL',
+        'price':   23.73,
+        'change':  -0.42,
+        'ratio':   -1.74,
+    },
+    {
+        'name':   'eBay',
+        'name2':  'eBay Inc.',
+        'url':    'http://www.ebay.com',
+        'symbol': 'EBAY',
+        'price':   31.65,
+        'change':  -0.8,
+        'ratio':   -2.47,
+    },
+    {
+        'name':   'Google',
+        'name2':  'Google Inc.',
+        'url':    'http://www.google.com',
+        'symbol': 'GOOG',
+        'price':   495.84,
+        'change':  7.75,
+        'ratio':   1.59,
+    },
+    {
+        'name':   'Hewlett-Packard',
+        'name2':  'Hewlett-Packard Co.',
+        'url':    'http://www.hp.com',
+        'symbol': 'HPQ',
+        'price':   41.69,
+        'change':  -0.02,
+        'ratio':   -0.05,
+    },
+    {
+        'name':   'IBM',
+        'name2':  'International Business Machines Corp.',
+        'url':    'http://www.ibm.com',
+        'symbol': 'IBM',
+        'price':   97.45,
+        'change':  -0.06,
+        'ratio':   -0.06,
+    },
+    {
+        'name':   'Intel',
+        'name2':  'Intel Corp.',
+        'url':    'http://www.intel.com',
+        'symbol': 'INTC',
+        'price':   20.53,
+        'change':  -0.07,
+        'ratio':   -0.34,
+    },
+    {
+        'name':   'Juniper Networks',
+        'name2':  'Juniper Networks, Inc',
+        'url':    'http://www.juniper.net/',
+        'symbol': 'JNPR',
+        'price':   18.96,
+        'change':  0.5,
+        'ratio':   2.71,
+    },
+    {
+        'name':   'Microsoft',
+        'name2':  'Microsoft Corp',
+        'url':    'http://www.microsoft.com',
+        'symbol': 'MSFT',
+        'price':   30.6,
+        'change':  0.15,
+        'ratio':   0.49,
+    },
+    {
+        'name':   'Oracle',
+        'name2':  'Oracle Corp.',
+        'url':    'http://www.oracle.com',
+        'symbol': 'ORCL',
+        'price':   17.15,
+        'change':  0.17,
+        'ratio':   1.0,
+    },
+    {
+        'name':   'SAP',
+        'name2':  'SAP AG',
+        'url':    'http://www.sap.com',
+        'symbol': 'SAP',
+        'price':   46.2,
+        'change':  -0.16,
+        'ratio':   -0.35,
+    },
+    {
+        'name':   'Seagate Technology',
+        'name2':  'Seagate Technology',
+        'url':    'http://www.seagate.com/',
+        'symbol': 'STX',
+        'price':   27.35,
+        'change':  -0.36,
+        'ratio':   -1.3,
+    },
+    {
+        'name':   'Sun Microsystems',
+        'name2':  'Sun Microsystems Inc.',
+        'url':    'http://www.sun.com',
+        'symbol': 'SUNW',
+        'price':   6.33,
+        'change':  -0.01,
+        'ratio':   -0.16,
+    },
+    {
+        'name':   'Yahoo',
+        'name2':  'Yahoo! Inc.',
+        'url':    'http://www.yahoo.com',
+        'symbol': 'YHOO',
+        'price':   28.04,
+        'change':  -0.17,
+        'ratio':   -0.6,
+    },
+]
 
-ydoc = yaml.load(open('bench_context.yaml'))
 
 class StockInfo:
     def __init__(self, name, name2, url, symbol, price, change, ratio):
@@ -12,9 +192,4 @@ class StockInfo:
         self.change = change
         self.ratio  = ratio
 
-list = [StockInfo(**hash) for hash in ydoc['list']]
-
-locals().pop('yaml')
-locals().pop('ydoc')
-locals().pop('hash')
-locals().pop('StockInfo')
+items2 = [StockInfo(**item) for item in items]</diff>
      <filename>python/benchmark/bench_context.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>55c903ede7d0cec2d41c43c7d191c8fd5ca920f8</id>
    </parent>
  </parents>
  <author>
    <name>makoto kuwata</name>
    <email>kwa@kuwata-lab.com</email>
  </author>
  <url>http://github.com/kwatch/tenjin/commit/56053117cf0b37bbfef84ac533de565d913a5dd9</url>
  <id>56053117cf0b37bbfef84ac533de565d913a5dd9</id>
  <committed-date>2009-10-03T04:19:24-07:00</committed-date>
  <authored-date>2009-09-29T15:20:18-07:00</authored-date>
  <message>python: change 'bench_context.py' to include YAML data in advance</message>
  <tree>d1b56bd763c35236410c605045b8abf697888212</tree>
  <committer>
    <name>makoto kuwata</name>
    <email>kwa@kuwata-lab.com</email>
  </committer>
</commit>
