Exemple #1
0
from xhpy.init import register_xhpy_module
register_xhpy_module('CodeStreak.xhpy.lib')
register_xhpy_module('CodeStreak.xhpy.base')
register_xhpy_module('CodeStreak.xhpy.contest')

from CodeStreak.xhpy.base import *
from CodeStreak.xhpy.contest import *
Exemple #2
0
from xhpy.init import register_xhpy_module
register_xhpy_module('lightning.ui')
register_xhpy_module('lightning.views')
Exemple #3
0
 def test_lineno_02(self):
   register_xhpy_module('lineno_02')
   from . import lineno_02
   self.assertEqual(7, lineno_02.result[1])
Exemple #4
0
 def test_pep0263_01(self):
   register_xhpy_module('pep0263_01')
   from . import pep0263_01
   self.assertEqual('<p>Andr\xe9</p>', str(pep0263_01.result))
Exemple #5
0
 def test_class_constants(self):
   register_xhpy_module('class_constants')
   from . import class_constants
   self.assertEqual({'etc': 1, 'bar': 2}, class_constants.result)
Exemple #6
0
 def test_docstrings_05(self):
   register_xhpy_module('docstrings_05')
   from . import docstrings_05
   self.assertEqual('b', docstrings_05.result)
from xhpy.init import register_xhpy_module
register_xhpy_module('post')
from post import render_post, render_index

import codecs
import datetime
import json
import sys
import os
import os.path

def _write_file(html, path):
  filename = os.path.join(root, path)
  dirname = os.path.dirname(filename)
  if not os.path.exists(dirname):
    os.makedirs(dirname)
  with codecs.open(filename, mode='w', encoding='utf-8') as f:
    f.write(html)

sys.stdout = codecs.getwriter('UTF-8')(sys.stdout)
root = sys.argv[1]
posts = [json.loads(line) for line in sys.stdin]
posts.sort(key=lambda post: post['order'])
for i, data in enumerate(posts):
  print u'Generating post: {0}'.format(data['title'])
  data['prev'] = {}
  data['next'] = {}
  if i > 0:
    data['prev'] = posts[i - 1]
  if i < len(posts) - 1:
    data['next'] = posts[i + 1]
Exemple #8
0
 def test_attr_float(self):
   register_xhpy_module('attr_float')
   from . import attr_float
   self.assertEqual('pass', attr_float.result)
Exemple #9
0
from xhpy.init import register_xhpy_module
register_xhpy_module('foo.ui')
register_xhpy_module('foo.views')
Exemple #10
0
# set up XHPy system, hook into UI libraries
from xhpy.init import register_xhpy_module
register_xhpy_module('cv.views')
register_xhpy_module('cv.ui')

# register signal handlers
# TODO: re-enable these. for now, we just want to find out how the
# through association looks so that we can use it in the correct manner...
#import signal_handlers
Exemple #11
0
 def test_pep0263_01(self):
   register_xhpy_module('pep0263_01')
   import pep0263_01
   self.assertEqual(u'<p>Andr\xe9</p>', unicode(pep0263_01.result))
Exemple #12
0
 def test_lineno_01(self):
   register_xhpy_module('lineno_01')
   import lineno_01
   self.assertEqual(7, lineno_01.result[1])
Exemple #13
0
 def test_docstrings_02(self):
   register_xhpy_module('docstrings_02')
   import docstrings_02
   self.assertEqual('b', docstrings_02.result)
Exemple #14
0
 def test_whitespace_07(self):
   register_xhpy_module('whitespace_07')
   import whitespace_07
   self.assertEqual(u'<a>abc</a>', unicode(whitespace_07.result))
Exemple #15
0
from xhpy.init import register_xhpy_module

register_xhpy_module("foo")
import foo
Exemple #16
0
 def test_attr_entity(self):
   register_xhpy_module('attr_entity')
   from . import attr_entity
   self.assertEqual('pass', attr_entity.result)
Exemple #17
0
 def test_stack_balance_fail(self):
   register_xhpy_module('stack_balance_fail')
   from . import stack_balance_fail
   self.assertEqual('pass', stack_balance_fail.result)
Exemple #18
0
 def test_attributes(self):
   register_xhpy_module('attributes')
   from . import attributes
   self.assertEqual('pass', attributes.result)
Exemple #19
0
 def test_whitespace_04(self):
   register_xhpy_module('whitespace_04')
   from . import whitespace_04
   self.assertEqual('<a><a></a>a</a>', str(whitespace_04.result))
Exemple #20
0
 def test_docstrings_03(self):
   register_xhpy_module('docstrings_03')
   from . import docstrings_03
   self.assertEqual('c', docstrings_03.result)
Exemple #21
0
 def test_whitespace_05(self):
   register_xhpy_module('whitespace_05')
   from . import whitespace_05
   self.assertEqual('<a>foo</a>', str(whitespace_05.result))
Exemple #22
0
 def test_klass(self):
   register_xhpy_module('klass')
   from . import klass
   self.assertEqual('pass', klass.result)
Exemple #23
0
 def test_whitespace_07(self):
   register_xhpy_module('whitespace_07')
   from . import whitespace_07
   self.assertEqual('<a>abc</a>', str(whitespace_07.result))
Exemple #24
0
 def test_logical_op(self):
   register_xhpy_module('logical_op')
   from . import logical_op
   self.assertEqual(True, logical_op.result)
Exemple #25
0
 def test_xhpy_function_param(self):
   register_xhpy_module('xhpy_function_param')
   from . import xhpy_function_param
   self.assertEqual('pass', xhpy_function_param.result)
Exemple #26
0
from xhpy.init import register_xhpy_module
register_xhpy_module('ui')
register_xhpy_module('view')
import view
view.render_list([
    "<script>alert('welcome to the jungle')</script>"
])
Exemple #27
0
 def test_array_constant(self):
   register_xhpy_module('array_constant')
   from . import array_constant
   self.assertEqual('pass', array_constant.result)
Exemple #28
0
Fichier : bar.py Projet : lez/xhpy
from xhpy.init import register_xhpy_module
register_xhpy_module('foo')
import foo
Exemple #29
0
 def test_attr_blank(self):
   register_xhpy_module('attr_blank')
   from . import attr_blank
   self.assertEqual('pass', attr_blank.result)
Exemple #30
0
from xhpy.init import register_xhpy_module
register_xhpy_module('CodeStreak.contests.views')
Exemple #31
0
 def test_whitespace_05(self):
   register_xhpy_module('whitespace_05')
   import whitespace_05
   self.assertEqual(u'<a>foo</a>', unicode(whitespace_05.result))