code
stringlengths
1
1.72M
language
stringclasses
1 value
import pygame import copy import itertools from pygame.locals import * from globals import * from tile import Tile from mysprite import MySprite from snake import BasicSnake # snake container class SnakeContainer: def __init__(self): self.snakes = [] self.humans = [] self.bots = [] def getAliveSnakes(self):...
Python
import pygame from globals import * class Tile: def __init__(self, position, isWall = False): self.position = position self.isWall = isWall self.snakes = [] def getSymbol(self): aliveSnakes = filter (lambda snake: snake.isAlive, self.snakes) if self.isWall: return WALL elif aliveSnakes == []: re...
Python
#!/usr/bin/env python import os import sys import pygame import time import math from pygame.locals import * from globals import * from grid import GameGrid from snake import Snake, BasicSnake from ai import AI, AIGrid, AISnake # pygame.init() causes delays upon quit due to SDL mixer on my system # pygame.time.get_t...
Python
from globals import * from mysprite import MySprite # basic snake logic class BasicSnake: def __init__(self, grid, isHuman, segments, totalLength, symbol, direction): self.grid = grid self.isHuman = isHuman self.length = len(segments) self.totalLength = totalLength self.symbol = symbol self.direction = di...
Python
from datetime import datetime from math import fabs import random from grid import BasicGrid, SnakeContainer from snake import BasicSnake from globals import * # There is a special case when snake.totalLength == 1. # This case is supported but requires some additional # code, which is not really pretty. Maybe there i...
Python
# directions/moves UP = 0 RIGHT = 1 DOWN = 2 LEFT = 3 STRAIGHT = 0 RELMOVES = [STRAIGHT, RIGHT, LEFT] MOVES = [UP, RIGHT, DOWN, LEFT] MOVESTRS = ["UP", "RIGHT", "DOWN", "LEFT"] RMOVESTRS = ["STRAIGHT", "RIGHT", "NONE", "LEFT"] # converts relative direction (LEFT, RIGHT, STRAIGHT) into absolute (UP, RIGHT,...
Python
import pygame from globals import * # describes all sprites in the game class MySprite(pygame.sprite.DirtySprite): def __init__(self, color, position): pygame.sprite.DirtySprite.__init__(self) # create the image that will be displayed # and fill it with the right color self.image = pygame.Surface([TILESIZ...
Python
import os import sys import unittest gae_path = '/usr/local/google/home/proppy/google_appengine' current_path = os.path.abspath(os.path.dirname(__file__)) tests_path = os.path.join(current_path, 'tests') sys.path[0:0] = [ current_path, tests_path, gae_path, # All libs used by webapp2 and extras. o...
Python
import ConfigParser import os import textwrap import StringIO import sys import unittest import StringIO import test_utils from manage.config import Config class TestConfig(test_utils.BaseTestCase): def get_fp(self, config): return StringIO.StringIO(textwrap.dedent(config)) def test_get(self): ...
Python
import ConfigParser import re InterpolationError = ConfigParser.InterpolationError InterpolationSyntaxError = ConfigParser.InterpolationSyntaxError NoOptionError = ConfigParser.NoOptionError NoSectionError = ConfigParser.NoSectionError class Converter(object): """Converts config values to several types. Sup...
Python
# Author: Steven J. Bethard <steven.bethard@gmail.com>. """Command-line parsing library This module is an optparse-inspired command-line parsing library that: - handles both optional and positional arguments - produces highly informative usage messages - supports parsers that dispatch to sub-parsers The...
Python
class BaseAction(object): """Base interface for custom actions.""" #: Reference to :class:`Manager`. manager = None #: Action name. name = None #: ArgumentParser description. description = None #: ArgumentParser epilog. epilog = None def __init__(self, manager): raise ...
Python
# -*- coding: utf-8 -*- """ webapp2 ======= `webapp2`_ is a lightweight Python web framework compatible with Google App Engine's `webapp`_. webapp2 is `simple`_. it follows the simplicity of webapp, but improves it in some ways: it adds better URI routing and exception handling, a full featured response object and a m...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.jinja2 ===================== Jinja2 template support for webapp2. Learn more about Jinja2: http://jinja.pocoo.org/ :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import absolute_import i...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.auth =================== Utilities for authentication and authorization. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import logging import time import webapp2 from webapp2_extras import security from web...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine.auth.models ==================================== Auth related models. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import time try: from ndb import model except ImportError: # pragma: no cove...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine.auth ============================= Authentication and authorization utilities. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine.sessions_ndb ===================================== Extended sessions stored in datastore using the ndb library. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import absolute_import ...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine ======================== App Engine-specific modules. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine.users ============================== Helpers for google.appengine.api.users. :copyright: 2011 tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from google.appengine.api import users def login_required(handler_method): ...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.appengine.sessions_memcache ========================================== Extended sessions stored in memcache. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from google.appengine.api import memcache from weba...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.local ~~~~~~~~~~~~~~~~~~~~ This module implements thread-local utilities. This implementation comes from werkzeug.local. :copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: ...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.xsrf =================== Helpers for defending against cross-site request forgery attacks. :copyright: 2012 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ __author__ = 'John Lockwood' import base64 import hmac import hashli...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.routes ===================== Extra route classes for webapp2. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import re import urllib from webob import exc import webapp2 class MultiRoute(object): """B...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.sessions ======================= Lightweight but flexible session support for webapp2. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import re import webapp2 from webapp2_extras import securecookie from we...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.json =================== JSON helpers for webapp2. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import absolute_import import base64 import urllib try: # Preference for installed libra...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.local_app ~~~~~~~~~~~~~~~~~~~~~~~~ This module is deprecated. The functionality is now available directly in webapp2. Previously it implemented a WSGIApplication adapted for threaded environments. :copyright: 2011 by tipfy.org. :license: Apac...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.securecookie =========================== A serializer for signed cookies. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import Cookie import hashlib import hmac import logging import time from webapp2_extra...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.sessions_ndb =========================== Extended sessions stored in datastore using the ndb library. App Engine-specific modules were moved to webapp2_extras.appengine. This module is here for compatibility purposes. :copyright: 2011 by tipfy.org. ...
Python
# -*- coding: utf-8 -*- """ webapp2_extras ============== Extra modules for webapp2. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """
Python
# -*- coding: utf-8 -*- """ webapp2_extras.users ==================== Helpers for google.appengine.api.users. App Engine-specific modules were moved to webapp2_extras.appengine. This module is here for compatibility purposes. :copyright: 2011 tipfy.org. :license: Apache Sotware License, s...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.i18n =================== Internationalization support for webapp2. Several ideas borrowed from tipfy.i18n and Flask-Babel. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import datetime import gettext as...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.sessions_memcache ================================ Extended sessions stored in memcache. App Engine-specific modules were moved to webapp2_extras.appengine. This module is here for compatibility purposes. :copyright: 2011 by tipfy.org. :license: ...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.mako =================== Mako template support for webapp2. Learn more about Mako: http://www.makotemplates.org/ :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import absolute_import fro...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.security ======================= Security related helpers such as secure password hashing tools and a random token generator. :copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. :co...
Python
# -*- coding: utf-8 -*- """ webapp2_extras.config ===================== Configuration object for webapp2. This module is deprecated. See :class:`webapp2.WSGIApplication.config`. :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ impor...
Python
# -*- coding: utf-8 -*- import os import webapp2 from webapp2_extras import jinja2 import test_base current_dir = os.path.abspath(os.path.dirname(__file__)) template_path = os.path.join(current_dir, 'resources', 'jinja2_templates') compiled_path = os.path.join(current_dir, 'resources', '...
Python
# -*- coding: utf-8 -*- from google.appengine.api import datastore_errors from google.appengine.api import memcache import webapp2 from webapp2_extras import sessions from webapp2_extras import sessions_ndb import test_base app = webapp2.WSGIApplication(config={ 'webapp2_extras.sessions': { 'secret_key'...
Python
# -*- coding: utf-8 -*- import webapp2 from webapp2_extras import config as app_config import test_base class TestConfig(test_base.BaseTestCase): def tearDown(self): pass def test_get(self): config = app_config.Config({'foo': { 'bar': 'baz', 'doo': 'ding', }}...
Python
# -*- coding: utf-8 -*- import webapp2 from webapp2_extras import local_app import test_base class TestLocalApp(test_base.BaseTestCase): def test_dispatch(self): def hello_handler(request, *args, **kwargs): return webapp2.Response('Hello, World!') app = local_app.WSGIApplication([('/...
Python
# -*- coding: utf-8 -*- import base64 from webapp2_extras import xsrf import test_base class TestXSRFToken(test_base.BaseTestCase): def test_verify_timeout(self): token = xsrf.XSRFToken('user@example.com', 'secret', current_time=1354160000) ...
Python
# -*- coding: utf-8 -*- import random import webapp2 from webapp2 import BaseRoute, RedirectHandler, Request, Route, Router import test_base class TestRoute(test_base.BaseTestCase): def test_no_variable(self): route = Route(r'/hello', None) route, args, kwargs = route.match(Request.blank('/hello...
Python
# -*- coding: utf-8 -*- import webapp2 from webapp2_extras import sessions import test_base app = webapp2.WSGIApplication(config={ 'webapp2_extras.sessions': { 'secret_key': 'my-super-secret', }, }) class TestSecureCookieSession(test_base.BaseTestCase): factory = sessions.SecureCookieSessionFact...
Python
# -*- coding: utf-8 -*- import webob import webob.exc import webapp2 import test_base class TestMiscellaneous(test_base.BaseTestCase): def test_abort(self): self.assertRaises(webob.exc.HTTPOk, webapp2.abort, 200) self.assertRaises(webob.exc.HTTPCreated, webapp2.abort, 201) self.assertRa...
Python
# -*- coding: utf-8 -*- import webapp2 from webapp2_extras.routes import (DomainRoute, HandlerPrefixRoute, RedirectRoute, NamePrefixRoute, PathPrefixRoute) import test_base class HomeHandler(webapp2.RequestHandler): def get(self, **kwargs): self.response.out.write('home sweet home') app = webapp2....
Python
# -*- coding: utf-8 -*- import os import webapp2 from webapp2_extras import mako import test_base current_dir = os.path.abspath(os.path.dirname(__file__)) template_path = os.path.join(current_dir, 'resources', 'mako_templates') class TestMako(test_base.BaseTestCase): def test_render_template(self): app...
Python
# -*- coding: utf-8 -*- """ Tests for webapp2 webapp2.RequestHandler """ import os import StringIO import sys import urllib import webapp2 import test_base class BareHandler(object): def __init__(self, request, response): self.response = response response.write('I am not a RequestHandler but I w...
Python
# -*- coding: utf-8 -*- from webapp2_extras import json import test_base class TestJson(test_base.BaseTestCase): def test_encode(self): self.assertEqual(json.encode( '<script>alert("hello")</script>'), '"<script>alert(\\"hello\\")<\\/script>"') def test_decode(self): ...
Python
# -*- coding: utf-8 -*- import StringIO import webapp2 import test_base def _norm_req(s): return '\r\n'.join(s.strip().replace('\r','').split('\n')) _test_req = """ POST /webob/ HTTP/1.0 Accept: */* Cache-Control: max-age=0 Content-Type: multipart/form-data; boundary=----------------------------deb95b63e42a Ho...
Python
import webapp2 from webapp2_extras import sessions from webapp2_extras import auth from webapp2_extras.appengine.auth import models from google.appengine.ext.ndb import model import test_base class TestAuth(test_base.BaseTestCase): def setUp(self): super(TestAuth, self).setUp() self.register_m...
Python
from __future__ import division from jinja2.runtime import LoopContext, TemplateReference, Macro, Markup, TemplateRuntimeError, missing, concat, escape, markup_join, unicode_join, to_string, TemplateNotFound name = 'template1.html' def root(context): l_message = context.resolve('message') if 0: yield None ...
Python
from protorpc import messages from protorpc import remote class BonjourRequest(messages.Message): my_name = messages.StringField(1, required=True) class BonjourResponse(messages.Message): hello = messages.StringField(1, required=True) class BonjourService(remote.Service): @remote.method(BonjourRequest, B...
Python
default_config = { 'templates_dir': 'templates', }
Python
import webapp2 class LazyHandler(webapp2.RequestHandler): def get(self, **kwargs): self.response.out.write('I am a laaazy view.') class CustomMethodHandler(webapp2.RequestHandler): def custom_method(self): self.response.out.write('I am a custom method.') def handle_exception(request, respo...
Python
from webapp2_extras import config from webapp2_extras import i18n default_config = { 'locale': 'en_US', 'timezone': 'America/Chicago', 'required': config.REQUIRED_VALUE, } def locale_selector(store, request): return i18n.get_store().default_locale def timezone_selector(store, request): return i18...
Python
from webapp2_extras import auth from webapp2_extras.appengine.auth import models from google.appengine.ext.ndb import model import test_base class UniqueConstraintViolation(Exception): pass class User(model.Model): username = model.StringProperty(required=True) auth_id = model.StringProperty() ema...
Python
# -*- coding: utf-8 -*- import webapp2 from webapp2_extras import sessions from webapp2_extras import sessions_memcache import test_base app = webapp2.WSGIApplication(config={ 'webapp2_extras.sessions': { 'secret_key': 'my-super-secret', }, }) class TestMemcacheSession(test_base.BaseTestCase): ...
Python
# -*- coding: utf-8 -*- import datetime import gettext as gettext_stdlib import os from babel.numbers import NumberFormatError from pytz.gae import pytz import webapp2 from webapp2_extras import i18n import test_base class I18nTestCase(test_base.BaseTestCase): def setUp(self): super(I18nTestCase, self...
Python
# -*- coding: utf-8 -*- import re from webapp2_extras import security import test_base class TestSecurity(test_base.BaseTestCase): def test_generate_random_string(self): self.assertRaises(ValueError, security.generate_random_string, None) self.assertRaises(ValueError, security.generate_random_st...
Python
# -*- coding: utf-8 -*- import os import webapp2 from webapp2_extras import users import test_base def set_current_user(email, user_id, is_admin=False): os.environ['USER_EMAIL'] = email or '' os.environ['USER_ID'] = user_id or '' os.environ['USER_IS_ADMIN'] = '1' if is_admin else '0' class LoginRequir...
Python
# -*- coding: utf-8 -*- import webapp2 import test_base class NoStringOrUnicodeConversion(object): pass class StringConversion(object): def __str__(self): return 'foo'.encode('utf-8') class UnicodeConversion(object): def __unicode__(self): return 'bar'.decode('utf-8') class TestResp...
Python
# -*- coding: utf-8 -*- from webapp2_extras import securecookie import test_base class TestSecureCookie(test_base.BaseTestCase): def test_secure_cookie_serializer(self): serializer = securecookie.SecureCookieSerializer('secret-key') serializer._get_timestamp = lambda: 1 value = ['a', 'b'...
Python
# -*- coding: utf-8 -*- from google.appengine.ext import webapp import webapp2 import test_base # Old WSGIApplication, new RequestHandler. class NewStyleHandler(webapp2.RequestHandler): def get(self, text): self.response.out.write(text) app = webapp.WSGIApplication([ (r'/test/(.*)', NewStyleHandler...
Python
# -*- coding: utf-8 -*- """ webapp2 ======= Taking Google App Engine's webapp to the next level! :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import with_statement import cgi import inspect import logging import os import re import ...
Python
import webapp2 class HomeHandler(webapp2.RequestHandler): def get(self, **kwargs): html = '<a href="%s">test item</a>' % self.url_for('view', item='test') self.response.out.write(html) class ViewHandler(webapp2.RequestHandler): def get(self, **kwargs): item = kwargs.get('item') ...
Python
import webapp2 class LazyHandler(webapp2.RequestHandler): def get(self, **kwargs): self.response.out.write('I am a laaazy view.')
Python
# -*- coding: utf-8 -*- """ webapp2 ======= Taking Google App Engine's webapp to the next level! :copyright: 2011 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ from __future__ import with_statement import cgi import inspect import logging import os import re import ...
Python
from jinja2 import nodes from jinja2.ext import Extension class FragmentCacheExtension(Extension): # a set of names that trigger the extension. tags = set(['cache']) def __init__(self, environment): super(FragmentCacheExtension, self).__init__(environment) # add the defaults to the envir...
Python
# -*- coding: utf-8 -*- """ Jinja Documentation Extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for automatically documenting filters and tests. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ import os import re import inspect import jinja2 from itertools import islice from typ...
Python
# -*- coding: utf-8 -*- # # Jinja2 documentation build configuration file, created by # sphinx-quickstart on Sun Apr 27 21:42:41 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleab...
Python
# -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from itertools import chain, imap from jinja2.nodes import EvalContext, _context_function_types from jinja2.utils import Markup, partial, soft_unicode, escape, miss...
Python
# -*- coding: utf-8 -*- """ jinja2.nodes ~~~~~~~~~~~~ This module implements additional nodes derived from the ast base node. It also provides some node tree helper functions like `in_lineno` and `get_nodes` used by the parser and translator in order to normalize python and jinja nodes. :...
Python
# -*- coding: utf-8 -*- """ jinja2.debug ~~~~~~~~~~~~ Implements the debug interface for Jinja. This module does some pretty ugly stuff with the Python traceback system in order to achieve tracebacks with correct line numbers, locals and contents. :copyright: (c) 2010 by the Jinja Team. :...
Python
# -*- coding: utf-8 -*- """ jinja2.compiler ~~~~~~~~~~~~~~~ Compiles nodes into python code. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from cStringIO import StringIO from itertools import chain from copy import deepcopy from jinja2 import nodes from j...
Python
# -*- coding: utf-8 -*- """ jinja2.optimizer ~~~~~~~~~~~~~~~~ The jinja optimizer is currently trying to constant fold a few expressions and modify the AST in place so that it should be easier to evaluate it. Because the AST does not contain all the scoping information and the compiler has to ...
Python
# -*- coding: utf-8 -*- """ jinja2.utils ~~~~~~~~~~~~ Utility functions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import sys import errno try: from thread import allocate_lock except ImportError: from dummy_thread import allocate_lo...
Python
# -*- coding: utf-8 -*- """ jinja2.ext ~~~~~~~~~~ Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two example extensions exist: an i18n and a cache extension. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from collections impor...
Python
# -*- coding: utf-8 -*- """ jinja2.visitor ~~~~~~~~~~~~~~ This module implements a visitor for the nodes. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from jinja2.nodes import Node class NodeVisitor(object): """Walks the abstract syntax tree and call visitor functions for every...
Python
# -*- coding: utf-8 -*- """ jinja2.parser ~~~~~~~~~~~~~ Implements the template parser. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from jinja2 import nodes from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError from jinja2.utils impo...
Python
# -*- coding: utf-8 -*- """ jinja2.loaders ~~~~~~~~~~~~~~ Jinja loader classes. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import os import sys import weakref from types import ModuleType from os import path try: from hashlib import sha1 except Imp...
Python
# -*- coding: utf-8 -*- """ jinja2.tests ~~~~~~~~~~~~ Jinja test functions. Used with the "is" operator. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re from jinja2.runtime import Undefined try: from collections import Mapping as MappingType ...
Python
# -*- coding: utf-8 -*- """ jinja2.filters ~~~~~~~~~~~~~~ Bundled jinja filters. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import math from random import choice from operator import itemgetter from itertools import imap, groupby from jinja2....
Python
import gc import unittest from jinja2._markupsafe import Markup, escape, escape_silent class MarkupTestCase(unittest.TestCase): def test_markup_operations(self): # adding two strings should escape the unsafe one unsafe = '<script type="application/x-some-script">alert("foo");</script>' sa...
Python
# -*- coding: utf-8 -*- """ jinja2._markupsafe._bundle ~~~~~~~~~~~~~~~~~~~~~~~~~~ This script pulls in markupsafe from a source folder and bundles it with Jinja2. It does not pull in the speedups module though. :copyright: Copyright 2010 by the Jinja team, see AUTHORS. :license: BSD, see ...
Python
# -*- coding: utf-8 -*- """ markupsafe._native ~~~~~~~~~~~~~~~~~~ Native Python implementation the C module is not compiled. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from jinja2._markupsafe import Markup def escape(s): """Convert the characters...
Python
# -*- coding: utf-8 -*- """ markupsafe ~~~~~~~~~~ Implements a Markup string. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import re from itertools import imap __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent'] _striptags_re = re.compile...
Python
# -*- coding: utf-8 -*- """ markupsafe._constants ~~~~~~~~~~~~~~~~~~~~~ Highlevel implementation of the Markup string. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ HTML_ENTITIES = { 'AElig': 198, 'Aacute': 193, 'Acirc': 194, 'Agrave': 1...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.debug ~~~~~~~~~~~~~~~~~~~~~~ Tests the debug system. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import sys import unittest from jinja2.testsuite import JinjaTestCase, filesystem_loader from jinja2 import E...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.utils ~~~~~~~~~~~~~~~~~~~~~~ Tests utilities jinja uses. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import gc import unittest import pickle from jinja2.testsuite import JinjaTestCase from jinja2.utils imp...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.ext ~~~~~~~~~~~~~~~~~~~~ Tests for the extensions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environment, DictLoader...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.lexnparse ~~~~~~~~~~~~~~~~~~~~~~~~~~ All the unittests regarding lexing, parsing and syntax. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import sys import unittest from jinja2.testsuite import JinjaTestCase ...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.imports ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the import features (with includes). :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environm...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.core_tags ~~~~~~~~~~~~~~~~~~~~~~~~~~ Test the core tags like for and if. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environment...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.tests ~~~~~~~~~~~~~~~~~~~~~~ Who tests the tests? :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Markup, Environment env = Environm...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.filters ~~~~~~~~~~~~~~~~~~~~~~~~ Tests for the jinja filters. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Markup, Environment en...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.regression ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests corner cases and bugs. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Template, Enviro...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.loader ~~~~~~~~~~~~~~~~~~~~~~~ Test the loaders. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import os import sys import tempfile import shutil import unittest from jinja2.testsuite import JinjaTestCase, dic...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.doctests ~~~~~~~~~~~~~~~~~~~~~~~~~ The doctests. Collects all tests we want to test from the Jinja modules. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest import doctest def suite(): f...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite ~~~~~~~~~~~~~~~~ All the unittests of Jinja2. These tests can be executed by either running run-tests.py using multiple Python versions at the same time. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ i...
Python
# -*- coding: utf-8 -*- """ jinja2.testsuite.api ~~~~~~~~~~~~~~~~~~~~ Tests the public API and related stuff. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environment, Undefi...
Python