code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# -*- 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... | [
[
8,
0,
0.1333,
0.2,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2444,
0.0222,
0,
0.66,
0.25,
409,
0,
1,
0,
0,
409,
0,
0
],
[
2,
0,
0.4556,
0.3111,
0,
0.66,
... | [
"\"\"\"\n markupsafe._native\n ~~~~~~~~~~~~~~~~~~\n\n Native Python implementation the C module is not compiled.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.",
"from jinja2._markupsafe import Markup",
"def escape(s):\n \"\"\"Convert the characters ... |
# -*- 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... | [
[
8,
0,
0.0133,
0.02,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0244,
0.0022,
0,
0.66,
0.0556,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0267,
0.0022,
0,
0.66,
... | [
"\"\"\"\n jinja2.loaders\n ~~~~~~~~~~~~~~\n\n Jinja loader classes.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD, see LICENSE for more details.",
"import os",
"import sys",
"import weakref",
"from types import ModuleType",
"from os import path",
"try:\n from hashlib impo... |
# -*- coding: utf-8 -*-
"""
jinja2.exceptions
~~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
class TemplateError(Exception):
"""Baseclass for all template errors."""
def __init__(self, message=None):
i... | [
[
8,
0,
0.042,
0.0629,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.1364,
0.0979,
0,
0.66,
0.1111,
179,
0,
2,
0,
0,
645,
0,
4
],
[
8,
1,
0.0979,
0.007,
1,
0.48,
... | [
"\"\"\"\n jinja2.exceptions\n ~~~~~~~~~~~~~~~~~\n\n Jinja exceptions.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD, see LICENSE for more details.",
"class TemplateError(Exception):\n \"\"\"Baseclass for all template errors.\"\"\"\n\n def __init__(self, message=None):\n i... |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | [
[
8,
0,
0.2174,
0.3913,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4203,
0.0145,
0,
0.66,
0.1,
959,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.4348,
0.0145,
0,
0.66,
... | [
"\"\"\"\n jinja2\n ~~~~~~\n\n Jinja2 is a template engine written in pure Python. It provides a\n Django inspired non-XML syntax but supports inline expressions and\n an optional sandboxed environment.",
"__docformat__ = 'restructuredtext en'",
"__version__ = '2.6'",
"from jinja2.environment i... |
# -*- 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.... | [
[
8,
0,
0.0075,
0.0113,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0138,
0.0013,
0,
0.66,
0.0192,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.015,
0.0013,
0,
0.66,... | [
"\"\"\"\n jinja2.filters\n ~~~~~~~~~~~~~~\n\n Bundled jinja filters.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD, see LICENSE for more details.",
"import re",
"import math",
"from random import choice",
"from operator import itemgetter",
"from itertools import imap, groupby"... |
# -*- coding: utf-8 -*-
"""
jinja2.defaults
~~~~~~~~~~~~~~~
Jinja default filters and tags.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
# defaults for the parser / lexer
BLOCK_START_STRING ... | [
[
8,
0,
0.15,
0.225,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.275,
0.025,
0,
0.66,
0.0667,
677,
0,
3,
0,
0,
677,
0,
0
],
[
14,
0,
0.375,
0.025,
0,
0.66,
... | [
"\"\"\"\n jinja2.defaults\n ~~~~~~~~~~~~~~~\n\n Jinja default filters and tags.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD, see LICENSE for more details.",
"from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner",
"BLOCK_START_STRING = '{%'",
"BLOCK_END_STRING = '%}'",
... |
# -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | [
[
8,
0,
0.0615,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1231,
0.0077,
0,
0.66,
0.0278,
924,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1385,
0.0077,
0,
0.66,
... | [
"\"\"\"\n jinja2._stringdefs\n ~~~~~~~~~~~~~~~~~~\n\n Strings of all Unicode characters of a certain category.\n Used for matching in Unicode-aware languages. Run to regenerate.\n\n Inspired by chartypes_create.py from the MoinMoin project, original",
"Cc = u'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x0... |
# -*- 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... | [
[
8,
0,
0.0067,
0.01,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0123,
0.0011,
0,
0.66,
0.1429,
436,
0,
1,
0,
0,
436,
0,
0
],
[
1,
0,
0.0134,
0.0011,
0,
0.66,
... | [
"\"\"\"\n jinja2.parser\n ~~~~~~~~~~~~~\n\n Implements the template parser.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD, see LICENSE for more details.",
"from jinja2 import nodes",
"from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError",
"from jinja2.utils im... |
# -*- 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... | [
[
8,
0,
0.069,
0.1034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1264,
0.0115,
0,
0.66,
0.3333,
990,
0,
1,
0,
0,
990,
0,
0
],
[
3,
0,
0.3333,
0.3563,
0,
0.66,... | [
"\"\"\"\n jinja2.visitor\n ~~~~~~~~~~~~~~\n\n This module implements a visitor for the nodes.\n\n :copyright: (c) 2010 by the Jinja Team.\n :license: BSD.",
"from jinja2.nodes import Node",
"class NodeVisitor(object):\n \"\"\"Walks the abstract syntax tree and call visitor functions for every\... |
from jinja2 import Environment
env = Environment(extensions=['jinja2.ext.i18n'])
env.globals['gettext'] = {
'Hello %(user)s!': 'Hallo %(user)s!'
}.__getitem__
env.globals['ngettext'] = lambda s, p, n: {
'%(count)s user': '%(count)d Benutzer',
'%(count)s users': '%(count)d Benutzer'
}[n == 1 and s or p]
pri... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
436,
0,
1,
0,
0,
436,
0,
0
]
] | [
"from jinja2 import Environment"
] |
from jinja2 import Environment
from jinja2.loaders import FileSystemLoader
env = Environment(loader=FileSystemLoader('templates'))
tmpl = env.get_template('broken.html')
print tmpl.render(seq=[3, 2, 4, 5, 3, 2, 0, 2, 1])
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
436,
0,
1,
0,
0,
436,
0,
0
],
[
1,
0,
0.2857,
0.1429,
0,
0.66,
0.25,
456,
0,
1,
0,
0,
456,
0,
0
],
[
14,
0,
0.5714,
0.1429,
0,
0... | [
"from jinja2 import Environment",
"from jinja2.loaders import FileSystemLoader",
"env = Environment(loader=FileSystemLoader('templates'))",
"tmpl = env.get_template('broken.html')",
"print(tmpl.render(seq=[3, 2, 4, 5, 3, 2, 0, 2, 1]))"
] |
from __pypy__ import tproxy
def make_proxy(obj, proxy):
if tproxy is None:
return proxy
def operation_handler(operation, *args, **kwargs):
if operation in ('__getattribute__', '__getattr__'):
return getattr(proxy, args[0])
elif operation == '__setattr__':
proxy.... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
683,
0,
1,
0,
0,
683,
0,
0
],
[
2,
0,
0.6429,
0.7857,
0,
0.66,
1,
764,
0,
2,
1,
0,
0,
0,
6
],
[
4,
1,
0.3929,
0.1429,
1,
0.67,
... | [
"from __pypy__ import tproxy",
"def make_proxy(obj, proxy):\n if tproxy is None:\n return proxy\n def operation_handler(operation, *args, **kwargs):\n if operation in ('__getattribute__', '__getattr__'):\n return getattr(proxy, args[0])\n elif operation == '__setattr__':\n ... |
from jinja2 import Environment
from jinja2.loaders import DictLoader
env = Environment(loader=DictLoader({
'child.html': u'''\
{% extends master_layout or 'master.html' %}
{% include helpers = 'helpers.html' %}
{% macro get_the_answer() %}42{% endmacro %}
{% title = 'Hello World' %}
{% block body %}
{{ get_the_ans... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
436,
0,
1,
0,
0,
436,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.25,
456,
0,
1,
0,
0,
456,
0,
0
],
[
14,
0,
0.5,
0.7407,
0,
0.66,
... | [
"from jinja2 import Environment",
"from jinja2.loaders import DictLoader",
"env = Environment(loader=DictLoader({\n'child.html': u'''\\\n{% extends master_layout or 'master.html' %}\n{% include helpers = 'helpers.html' %}\n{% macro get_the_answer() %}42{% endmacro %}\n{% title = 'Hello World' %}\n{% block body ... |
from jinja2 import Environment
env = Environment(line_statement_prefix="#", variable_start_string="${", variable_end_string="}")
print env.from_string("""\
<ul>
# for item in range(10)
<li class="${loop.cycle('odd', 'even')}">${item}</li>
# endfor
</ul>\
""").render()
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
436,
0,
1,
0,
0,
436,
0,
0
]
] | [
"from jinja2 import Environment"
] |
from jinja2 import Environment
from jinja2.loaders import DictLoader
env = Environment(loader=DictLoader({
'a': '''[A[{% block body %}{% endblock %}]]''',
'b': '''{% extends 'a' %}{% block body %}[B]{% endblock %}''',
'c': '''{% extends 'b' %}{% block body %}###{{ super() }}###{% endblock %}'''
}))
print env.get_te... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
436,
0,
1,
0,
0,
436,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.3333,
456,
0,
1,
0,
0,
456,
0,
0
],
[
14,
0,
0.5833,
0.4167,
0,
... | [
"from jinja2 import Environment",
"from jinja2.loaders import DictLoader",
"env = Environment(loader=DictLoader({\n'a': '''[A[{% block body %}{% endblock %}]]''',\n'b': '''{% extends 'a' %}{% block body %}[B]{% endblock %}''',\n'c': '''{% extends 'b' %}{% block body %}###{{ super() }}###{% endblock %}'''\n}))",... |
# -*- coding: utf-8 -*-
"""
RealWorldish Benchmark
~~~~~~~~~~~~~~~~~~~~~~
A more real-world benchmark of Jinja2. Like the other benchmark in the
Jinja2 repository this has no real-world usefulnes (despite the name).
Just go away and ignore it. NOW!
:copyright: (c) 2009 by the Jinja Team.
... | [
[
8,
0,
0.0625,
0.0982,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1161,
0.0089,
0,
0.66,
0.0312,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.125,
0.0089,
0,
0.66,... | [
"\"\"\"\n RealWorldish Benchmark\n ~~~~~~~~~~~~~~~~~~~~~~\n\n A more real-world benchmark of Jinja2. Like the other benchmark in the\n Jinja2 repository this has no real-world usefulnes (despite the name).\n Just go away and ignore it. NOW!",
"import sys",
"from os.path import join, dirname, ab... |
# -*- coding: utf-8 -*-
from rwbench import ROOT
from os.path import join
from django.conf import settings
settings.configure(
TEMPLATE_DIRS=(join(ROOT, 'django'),),
TEMPLATE_LOADERS=(
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
)),
)
... | [
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0,
384,
0,
1,
0,
0,
384,
0,
0
],
[
1,
0,
0.0222,
0.0074,
0,
0.66,
0.0588,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0296,
0.0074,
0,
0.... | [
"from rwbench import ROOT",
"from os.path import join",
"from django.conf import settings",
"settings.configure(\n TEMPLATE_DIRS=(join(ROOT, 'django'),),\n TEMPLATE_LOADERS=(\n ('django.template.loaders.cached.Loader', (\n 'django.template.loaders.filesystem.Loader',\n )),\n ... |
try:
from cProfile import Profile
except ImportError:
from profile import Profile
from pstats import Stats
from jinja2 import Environment as JinjaEnvironment
context = {
'page_title': 'mitsuhiko\'s benchmark',
'table': [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)]
}
source = ""... | [
[
7,
0,
0.0481,
0.0769,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0385,
0.0192,
1,
0.58,
0,
686,
0,
1,
0,
0,
686,
0,
0
],
[
1,
1,
0.0769,
0.0192,
1,
0.58,
... | [
"try:\n from cProfile import Profile\nexcept ImportError:\n from profile import Profile",
" from cProfile import Profile",
" from profile import Profile",
"from pstats import Stats",
"from jinja2 import Environment as JinjaEnvironment",
"context = {\n 'page_title': 'mitsuhiko\\'s benchmark'... |
"""\
This benchmark compares some python templating engines with Jinja 2 so
that we get a picture of how fast Jinja 2 is for a semi real world
template. If a template engine is not installed the test is skipped.\
"""
import sys
import cgi
from timeit import Timer
from jinja2 import Environment as JinjaEnvi... | [
[
8,
0,
0.0069,
0.0115,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0139,
0.0023,
0,
0.66,
0.05,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0162,
0.0023,
0,
0.66,
... | [
"\"\"\"\\\n This benchmark compares some python templating engines with Jinja 2 so\n that we get a picture of how fast Jinja 2 is for a semi real world\n template. If a template engine is not installed the test is skipped.\\\n\"\"\"",
"import sys",
"import cgi",
"from timeit import Timer",
"from j... |
"""Compatibility stuff"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code mus... | [
[
8,
0,
0.0208,
0.0208,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.7292,
0.1042,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
0
],
[
14,
1,
0.7083,
0.0208,
1,
0.55,
... | [
"\"\"\"Compatibility stuff\"\"\"",
"try:\n set = set\n frozenset = frozenset\nexcept NameError:\n from sets import Set as set, ImmutableSet as frozenset",
" set = set",
" frozenset = frozenset",
" from sets import Set as set, ImmutableSet as frozenset",
"try:\n reversed = reversed\nex... |
""" @package antlr3.tree
@brief ANTLR3 runtime package, treewizard module
A utility module to create ASTs at runtime.
See <http://www.antlr.org/wiki/display/~admin/2007/07/02/Exploring+Concept+of+TreeWizard> for an overview. Note that the API of the Python implementation is slightly different.
"""
# begin[licence]
#... | [
[
8,
0,
0.0065,
0.0114,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0637,
0.0016,
0,
0.66,
0.0556,
315,
0,
1,
0,
0,
315,
0,
0
],
[
1,
0,
0.0654,
0.0016,
0,
0.66... | [
"\"\"\" @package antlr3.tree\n@brief ANTLR3 runtime package, treewizard module\n\nA utility module to create ASTs at runtime.\nSee <http://www.antlr.org/wiki/display/~admin/2007/07/02/Exploring+Concept+of+TreeWizard> for an overview. Note that the API of the Python implementation is slightly different.\n\n\"\"\"",
... |
"""ANTLR3 runtime package"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code ... | [
[
8,
0,
0.0035,
0.0035,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1176,
0.0035,
0,
0.66,
0.1429,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1211,
0.0035,
0,
0.66... | [
"\"\"\"ANTLR3 runtime package\"\"\"",
"import sys",
"import optparse",
"import antlr3",
"class _Main(object):\n def __init__(self):\n self.stdin = sys.stdin\n self.stdout = sys.stdout\n self.stderr = sys.stderr\n\n \n def parseOptions(self, argv):",
" def __init__(self... |
"""ANTLR3 runtime package"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code ... | [
[
8,
0,
0.0175,
0.0175,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5789,
0.0175,
0,
0.66,
0.125,
648,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6667,
0.0175,
0,
0.66,... | [
"\"\"\"ANTLR3 runtime package\"\"\"",
"EOF = -1",
"DEFAULT_CHANNEL = 0",
"HIDDEN_CHANNEL = 99",
"EOR_TOKEN_TYPE = 1",
"DOWN = 2",
"UP = 3",
"MIN_TOKEN_TYPE = UP+1",
"INVALID_TOKEN_TYPE = 0"
] |
""" @package antlr3.tree
@brief ANTLR3 runtime package, tree module
This module contains all support classes for AST construction and tree parsers.
"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or... | [
[
8,
0,
0.0014,
0.0025,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0167,
0.0004,
0,
0.66,
0.0417,
315,
0,
4,
0,
0,
315,
0,
0
],
[
1,
0,
0.0172,
0.0004,
0,
0.66... | [
"\"\"\" @package antlr3.tree\n@brief ANTLR3 runtime package, tree module\n\nThis module contains all support classes for AST construction and tree parsers.\n\n\"\"\"",
"from antlr3.constants import UP, DOWN, EOF, INVALID_TOKEN_TYPE",
"from antlr3.recognizers import BaseRecognizer, RuleReturnScope",
"from antl... |
""" @package antlr3.dottreegenerator
@brief ANTLR3 runtime package, tree module
This module contains all support classes for AST construction and tree parsers.
"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary fo... | [
[
8,
0,
0.0167,
0.0286,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1952,
0.0048,
0,
0.66,
0.25,
551,
0,
1,
0,
0,
551,
0,
0
],
[
1,
0,
0.2,
0.0048,
0,
0.66,
... | [
"\"\"\" @package antlr3.dottreegenerator\n@brief ANTLR3 runtime package, tree module\n\nThis module contains all support classes for AST construction and tree parsers.\n\n\"\"\"",
"from antlr3.tree import CommonTreeAdaptor",
"import stringtemplate3",
"class DOTTreeGenerator(object):\n \"\"\"\n A utility... |
"""ANTLR3 exception hierarchy"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source c... | [
[
8,
0,
0.0027,
0.0027,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0907,
0.0027,
0,
0.66,
0.0769,
315,
0,
1,
0,
0,
315,
0,
0
],
[
3,
0,
0.103,
0.011,
0,
0.66,
... | [
"\"\"\"ANTLR3 exception hierarchy\"\"\"",
"from antlr3.constants import INVALID_TOKEN_TYPE",
"class BacktrackingFailed(Exception):\n \"\"\"@brief Raised to signal failed backtrack attempt\"\"\"\n\n pass",
" \"\"\"@brief Raised to signal failed backtrack attempt\"\"\"",
"class RecognitionException(E... |
"""ANTLR3 runtime package"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code ... | [
[
8,
0,
0.0024,
0.0024,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0793,
0.0024,
0,
0.66,
0.1429,
315,
0,
3,
0,
0,
315,
0,
0
],
[
3,
0,
0.2356,
0.2764,
0,
0.66... | [
"\"\"\"ANTLR3 runtime package\"\"\"",
"from antlr3.constants import EOF, DEFAULT_CHANNEL, INVALID_TOKEN_TYPE",
"class Token(object):\n \"\"\"@brief Abstract token baseclass.\"\"\"\n\n def getText(self):\n \"\"\"@brief Get the text of the token.\n\n Using setter/getter methods is deprecated. ... |
"""ANTLR3 runtime package"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code ... | [
[
8,
0,
0.0007,
0.0007,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0227,
0.0007,
0,
0.66,
0.0526,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0234,
0.0007,
0,
0.66... | [
"\"\"\"ANTLR3 runtime package\"\"\"",
"import codecs",
"from StringIO import StringIO",
"from antlr3.constants import DEFAULT_CHANNEL, EOF",
"from antlr3.tokens import Token, EOF_TOKEN",
"class IntStream(object):\n \"\"\"\n @brief Base interface for streams of integer values.\n\n A simple stream ... |
"""ANTLR3 runtime package"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code ... | [
[
8,
0,
0.0047,
0.0047,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1549,
0.0047,
0,
0.66,
0.3333,
315,
0,
1,
0,
0,
315,
0,
0
],
[
1,
0,
0.1596,
0.0047,
0,
0.66... | [
"\"\"\"ANTLR3 runtime package\"\"\"",
"from antlr3.constants import EOF",
"from antlr3.exceptions import NoViableAltException, BacktrackingFailed",
"class DFA(object):\n \"\"\"@brief A DFA implemented as a set of transition tables.\n\n Any state that has a semantic predicate edge is special; those state... |
# -*- 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.
... | [
[
8,
0,
0.375,
0.6,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.7,
0.05,
0,
0.66,
0.3333,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.875,
0.2,
0,
0.66,
0.6667,... | [
"\"\"\"\n webapp2_extras.sessions_ndb\n ===========================\n\n Extended sessions stored in datastore using the ndb library.\n\n App Engine-specific modules were moved to webapp2_extras.appengine.\n This module is here for compatibility purposes.",
"import warnings",
"warnings.warn(Deprec... |
# -*- 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... | [
[
8,
0,
0.375,
0.6,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.7,
0.05,
0,
0.66,
0.3333,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.875,
0.2,
0,
0.66,
0.6667,... | [
"\"\"\"\n webapp2_extras.users\n ====================\n\n Helpers for google.appengine.api.users.\n\n App Engine-specific modules were moved to webapp2_extras.appengine.\n This module is here for compatibility purposes.",
"import warnings",
"warnings.warn(DeprecationWarning(\n 'webapp2_extras.... |
# -*- 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... | [
[
8,
0,
0.0093,
0.014,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0171,
0.0016,
0,
0.66,
0.0556,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0186,
0.0016,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.auth\n ===================\n\n Utilities for authentication and authorization.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"import logging",
"import time",
"import webapp2",
"from webapp2_extras import security",
... |
# -*- 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... | [
[
8,
0,
0.017,
0.0255,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0312,
0.0028,
0,
0.66,
0.0909,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.034,
0.0028,
0,
0.66,
... | [
"\"\"\"\n webapp2_extras.routes\n =====================\n\n Extra route classes for webapp2.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"import re",
"import urllib",
"from webob import exc",
"import webapp2",
"class MultiRoute(object):\... |
# -*- 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... | [
[
8,
0,
0.0556,
0.0833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1019,
0.0093,
0,
0.66,
0.1,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1204,
0.0093,
0,
0.66,
... | [
"\"\"\"\n webapp2_extras.json\n ===================\n\n JSON helpers for webapp2.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"from __future__ import absolute_import",
"import base64",
"import urllib",
"try:\n # Preference for installed... |
# -*- 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... | [
[
8,
0,
0.0126,
0.0189,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0231,
0.0021,
0,
0.66,
0.0625,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0273,
0.0021,
0,
0.66... | [
"\"\"\"\n webapp2_extras.sessions\n =======================\n\n Lightweight but flexible session support for webapp2.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"import re",
"import webapp2",
"from webapp2_extras import securecookie",
"fr... |
# -*- 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... | [
[
8,
0,
0.3333,
0.5417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.625,
0.0417,
0,
0.66,
0.25,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.7083,
0.0417,
0,
0.66,
... | [
"\"\"\"\n webapp2_extras.local_app\n ~~~~~~~~~~~~~~~~~~~~~~~~\n\n This module is deprecated. The functionality is now available\n directly in webapp2.\n\n Previously it implemented a WSGIApplication adapted for threaded",
"import warnings",
"import webapp2",
"warnings.warn(DeprecationWarning(\n... |
# -*- 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:
... | [
[
8,
0,
0.0303,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.0758,
0.0433,
0,
0.66,
0.2,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0606,
0.0043,
1,
0.06,
0... | [
"\"\"\"\n webapp2_extras.local\n ~~~~~~~~~~~~~~~~~~~~\n\n This module implements thread-local utilities.\n\n This implementation comes from werkzeug.local.",
"try:\n from greenlet import getcurrent as get_current_greenlet\nexcept ImportError: # pragma: no cover\n try:\n from py.magic impo... |
# -*- 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... | [
[
8,
0,
0.0307,
0.0482,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.057,
0.0044,
0,
0.66,
0.125,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0658,
0.0044,
0,
0.66,
... | [
"\"\"\"\n webapp2_extras.config\n =====================\n\n Configuration object for webapp2.\n\n This module is deprecated. See :class:`webapp2.WSGIApplication.config`.",
"from __future__ import absolute_import",
"import warnings",
"import webapp2",
"warnings.warn(DeprecationWarning(\n 'weba... |
# -*- 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
... | [
[
8,
0,
0.0513,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.094,
0.0085,
0,
0.66,
0.1429,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1111,
0.0085,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.appengine.sessions_ndb\n =====================================\n\n Extended sessions stored in datastore using the ndb library.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"from __future__ import absolute_import",
"fro... |
# -*- 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):
... | [
[
8,
0,
0.0857,
0.1286,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1571,
0.0143,
0,
0.66,
0.3333,
279,
0,
1,
0,
0,
279,
0,
0
],
[
2,
0,
0.3786,
0.3714,
0,
0.66... | [
"\"\"\"\n webapp2_extras.appengine.users\n ==============================\n\n Helpers for google.appengine.api.users.\n\n :copyright: 2011 tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"from google.appengine.api import users",
"def login_required(handler_method):\n ... |
# -*- 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... | [
[
8,
0,
0.0144,
0.0216,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0264,
0.0024,
0,
0.66,
0.1429,
654,
0,
1,
0,
0,
654,
0,
0
],
[
7,
0,
0.0349,
0.0096,
0,
0.66... | [
"\"\"\"\n webapp2_extras.appengine.auth.models\n ====================================\n\n Auth related models.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"import time",
"try:\n from ndb import model\nexcept ImportError: # pragma: no cover\... |
# -*- coding: utf-8 -*-
"""
webapp2_extras.appengine.auth
=============================
Authentication and authorization utilities.
:copyright: 2011 by tipfy.org.
:license: Apache Sotware License, see LICENSE for details.
"""
| [
[
8,
0,
0.6,
0.9,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"\n webapp2_extras.appengine.auth\n =============================\n\n Authentication and authorization utilities.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details."
] |
# -*- coding: utf-8 -*-
"""
webapp2_extras.appengine
========================
App Engine-specific modules.
:copyright: 2011 by tipfy.org.
:license: Apache Sotware License, see LICENSE for details.
"""
| [
[
8,
0,
0.6,
0.9,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"\n webapp2_extras.appengine\n ========================\n\n App Engine-specific modules.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details."
] |
# -*- 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... | [
[
8,
0,
0.1176,
0.1765,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2157,
0.0196,
0,
0.66,
0.3333,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.2549,
0.0196,
0,
0.66... | [
"\"\"\"\n webapp2_extras.appengine.sessions_memcache\n ==========================================\n\n Extended sessions stored in memcache.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details.",
"from google.appengine.api import memcache",
"from webapp2_... |
# -*- 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... | [
[
8,
0,
0.0515,
0.0809,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0956,
0.0074,
0,
0.66,
0.125,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1103,
0.0074,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.mako\n ===================\n\n Mako template support for webapp2.\n\n Learn more about Mako: http://www.makotemplates.org/",
"from __future__ import absolute_import",
"from mako import lookup",
"import webapp2",
"default_config = {\n 'template_path': 'templates',\n}",... |
# -*- coding: utf-8 -*-
"""
webapp2_extras
==============
Extra modules for webapp2.
:copyright: 2011 by tipfy.org.
:license: Apache Sotware License, see LICENSE for details.
"""
| [
[
8,
0,
0.6,
0.9,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"\n webapp2_extras\n ==============\n\n Extra modules for webapp2.\n\n :copyright: 2011 by tipfy.org.\n :license: Apache Sotware License, see LICENSE for details."
] |
# -*- 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... | [
[
8,
0,
0.0304,
0.0478,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0565,
0.0043,
0,
0.66,
0.125,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0652,
0.0043,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.jinja2\n =====================\n\n Jinja2 template support for webapp2.\n\n Learn more about Jinja2: http://jinja.pocoo.org/",
"from __future__ import absolute_import",
"import jinja2",
"import webapp2",
"default_config = {\n 'template_path': 'templates',\n 'compil... |
# -*- 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... | [
[
8,
0,
0.0077,
0.012,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0142,
0.0011,
0,
0.66,
0.0244,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0153,
0.0011,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.i18n\n ===================\n\n Internationalization support for webapp2.\n\n Several ideas borrowed from tipfy.i18n and Flask-Babel.",
"import datetime",
"import gettext as gettext_stdlib",
"import babel",
"from babel import dates",
"from babel import numbers",
"from... |
# -*- 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... | [
[
8,
0,
0.0344,
0.055,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0642,
0.0046,
0,
0.66,
0.0385,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0734,
0.0046,
0,
0.66,... | [
"\"\"\"\n webapp2_extras.security\n =======================\n\n Security related helpers such as secure password hashing tools and a\n random token generator.\n\n :copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.",
"from __future__ import division",
"import hashlib",
"imp... |
# -*- 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: ... | [
[
8,
0,
0.375,
0.6,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.7,
0.05,
0,
0.66,
0.3333,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.875,
0.2,
0,
0.66,
0.6667,... | [
"\"\"\"\n webapp2_extras.sessions_memcache\n ================================\n\n Extended sessions stored in memcache.\n\n App Engine-specific modules were moved to webapp2_extras.appengine.\n This module is here for compatibility purposes.",
"import warnings",
"warnings.warn(DeprecationWarning(... |
"""Native adapter for serving CherryPy via its builtin server."""
import logging
import sys
import cherrypy
from cherrypy._cpcompat import BytesIO
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil
from cherrypy import wsgiserver
class NativeGateway(wsgiserver.Gateway):
... | [
[
8,
0,
0.0067,
0.0067,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0.1111,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66... | [
"\"\"\"Native adapter for serving CherryPy via its builtin server.\"\"\"",
"import logging",
"import sys",
"import cherrypy",
"from cherrypy._cpcompat import BytesIO",
"from cherrypy._cperror import format_exc, bare_error",
"from cherrypy.lib import httputil",
"from cherrypy import wsgiserver",
"cla... |
import os
import sys
import time
import warnings
import cherrypy
from cherrypy._cpcompat import basestring, copykeys, ntob, unicodestr
from cherrypy._cpcompat import SimpleCookie, CookieError, py3k
from cherrypy import _cpreqbody, _cpconfig
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import... | [
[
1,
0,
0.0021,
0.001,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0031,
0.001,
0,
0.66,
0.0526,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0042,
0.001,
0,
0.6... | [
"import os",
"import sys",
"import time",
"import warnings",
"import cherrypy",
"from cherrypy._cpcompat import basestring, copykeys, ntob, unicodestr",
"from cherrypy._cpcompat import SimpleCookie, CookieError, py3k",
"from cherrypy import _cpreqbody, _cpconfig",
"from cherrypy._cperror import form... |
"""
Simple config
=============
Although CherryPy uses the :mod:`Python logging module <logging>`, it does so
behind the scenes so that simple logging is simple, but complicated logging
is still possible. "Simple" logging means that you can log to the screen
(i.e. console/stdout) or to a file, and that you can easily ... | [
[
8,
0,
0.1148,
0.2273,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2318,
0.0023,
0,
0.66,
0.0833,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.2341,
0.0023,
0,
0.66... | [
"\"\"\"\nSimple config\n=============\n\nAlthough CherryPy uses the :mod:`Python logging module <logging>`, it does so\nbehind the scenes so that simple logging is simple, but complicated logging\nis still possible. \"Simple\" logging means that you can log to the screen\n(i.e. console/stdout) or to a file, and tha... |
# This is a backport of Python-2.4's threading.local() implementation
"""Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class from threa... | [
[
8,
0,
0.2908,
0.5607,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6255,
0.0837,
0,
0.66,
0.25,
595,
0,
1,
0,
0,
186,
0,
10
],
[
14,
1,
0.59,
0.0042,
1,
0.87,
... | [
"\"\"\"Thread-local objects\n\n(Note that this module provides a Python version of thread\n threading.local class. Depending on the version of Python you're\n using, there may be a faster one available. You should always import\n the local class from threading.)\n\nThread-local objects support the management of t... |
"""WSGI server interface (see PEP 333). This adds some CP-specific bits to
the framework-agnostic wsgiserver package.
"""
import sys
import cherrypy
from cherrypy import wsgiserver
class CPWSGIServer(wsgiserver.CherryPyWSGIServer):
"""Wrapper for wsgiserver.CherryPyWSGIServer.
wsgiserver has been design... | [
[
8,
0,
0.0317,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0635,
0.0159,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0952,
0.0159,
0,
0.66,
... | [
"\"\"\"WSGI server interface (see PEP 333). This adds some CP-specific bits to\nthe framework-agnostic wsgiserver package.\n\"\"\"",
"import sys",
"import cherrypy",
"from cherrypy import wsgiserver",
"class CPWSGIServer(wsgiserver.CherryPyWSGIServer):\n \"\"\"Wrapper for wsgiserver.CherryPyWSGIServer.\n... |
"""
Tutorial - Multiple objects
This tutorial shows you how to create a site structure through multiple
possibly nested request handler objects.
"""
import cherrypy
class HomePage:
def index(self):
return '''
<p>Hi, this is the home page! Check out the other
fun stuff on this sit... | [
[
8,
0,
0.0357,
0.0612,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0816,
0.0102,
0,
0.66,
0.0909,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.1633,
0.1122,
0,
0.66... | [
"\"\"\"\nTutorial - Multiple objects\n\nThis tutorial shows you how to create a site structure through multiple\npossibly nested request handler objects.\n\"\"\"",
"import cherrypy",
"class HomePage:\n def index(self):\n return '''\n <p>Hi, this is the home page! Check out the other\n ... |
"""
Tutorial: HTTP errors
HTTPError is used to return an error response to the client.
CherryPy has lots of options regarding how such errors are
logged, displayed, and formatted.
"""
import os
localDir = os.path.dirname(__file__)
curpath = os.path.normpath(os.path.join(os.getcwd(), localDir))
import cherrypy
cl... | [
[
8,
0,
0.0617,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1358,
0.0123,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.1481,
0.0123,
0,
0.66... | [
"\"\"\"\n\nTutorial: HTTP errors\n\nHTTPError is used to return an error response to the client.\nCherryPy has lots of options regarding how such errors are\nlogged, displayed, and formatted.",
"import os",
"localDir = os.path.dirname(__file__)",
"curpath = os.path.normpath(os.path.join(os.getcwd(), localDir)... |
"""
Tutorial - Hello World
The most basic (working) CherryPy application possible.
"""
# Import CherryPy global namespace
import cherrypy
class HelloWorld:
""" Sample request handler class. """
def index(self):
# CherryPy will call this method for the root URI ("/") and send
# its return val... | [
[
8,
0,
0.0857,
0.1429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2286,
0.0286,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.4571,
0.3714,
0,
0.66,
... | [
"\"\"\"\nTutorial - Hello World\n\nThe most basic (working) CherryPy application possible.\n\"\"\"",
"import cherrypy",
"class HelloWorld:\n \"\"\" Sample request handler class. \"\"\"\n\n def index(self):\n # CherryPy will call this method for the root URI (\"/\") and send\n # its return va... |
'''
Bonus Tutorial: Using SQLObject
This is a silly little contacts manager application intended to
demonstrate how to use SQLObject from within a CherryPy2 project. It
also shows how to use inline Cheetah templates.
SQLObject is an Object/Relational Mapper that allows you to access
data stored in an RDBMS in a pytho... | [
[
8,
0,
0.0952,
0.1845,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1964,
0.006,
0,
0.66,
0.125,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.2024,
0.006,
0,
0.66,
... | [
"'''\nBonus Tutorial: Using SQLObject\n\nThis is a silly little contacts manager application intended to\ndemonstrate how to use SQLObject from within a CherryPy2 project. It\nalso shows how to use inline Cheetah templates.\n\nSQLObject is an Object/Relational Mapper that allows you to access",
"import cherrypy",... |
"""
Tutorial: File upload and download
Uploads
-------
When a client uploads a file to a CherryPy application, it's placed
on disk immediately. CherryPy will pass it to your exposed method
as an argument (see "myFile" below); that arg will have a "file"
attribute, which is a handle to the temporary uploaded file.
If... | [
[
8,
0,
0.1963,
0.3832,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4019,
0.0093,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.4112,
0.0093,
0,
0.6... | [
"\"\"\"\n\nTutorial: File upload and download\n\nUploads\n-------\n\nWhen a client uploads a file to a CherryPy application, it's placed",
"import os",
"localDir = os.path.dirname(__file__)",
"absDir = os.path.join(os.getcwd(), localDir)",
"import cherrypy",
"from cherrypy.lib import static",
"class Fil... |
"""
Bonus Tutorial: Using generators to return result bodies
Instead of returning a complete result string, you can use the yield
statement to return one result part after another. This may be convenient
in situations where using a template package like CherryPy or Cheetah
would be overkill, and messy string concatena... | [
[
8,
0,
0.0957,
0.1702,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2128,
0.0213,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.4894,
0.4468,
0,
0.66,
... | [
"\"\"\"\nBonus Tutorial: Using generators to return result bodies\n\nInstead of returning a complete result string, you can use the yield\nstatement to return one result part after another. This may be convenient\nin situations where using a template package like CherryPy or Cheetah\nwould be overkill, and messy st... |
"""
Tutorial - The default method
Request handler objects can implement a method called "default" that
is called when no other suitable method/object could be found.
Essentially, if CherryPy2 can't find a matching request handler object
for the given request URI, it will use the default method of the object
located de... | [
[
8,
0,
0.1406,
0.2656,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2969,
0.0156,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.5625,
0.4531,
0,
0.66,
... | [
"\"\"\"\nTutorial - The default method\n\nRequest handler objects can implement a method called \"default\" that\nis called when no other suitable method/object could be found.\nEssentially, if CherryPy2 can't find a matching request handler object\nfor the given request URI, it will use the default method of the o... |
"""
Tutorial - Multiple methods
This tutorial shows you how to link to other methods of your request
handler.
"""
import cherrypy
class HelloWorld:
def index(self):
# Let's link to another method here.
return 'We have an <a href="showMessage">important message</a> for you!'
index.exposed... | [
[
8,
0,
0.1094,
0.1875,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0312,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.4688,
0.3438,
0,
0.66,
... | [
"\"\"\"\nTutorial - Multiple methods\n\nThis tutorial shows you how to link to other methods of your request\nhandler.\n\"\"\"",
"import cherrypy",
"class HelloWorld:\n \n def index(self):\n # Let's link to another method here.\n return 'We have an <a href=\"showMessage\">important message</... |
"""
Tutorial - Passing variables
This tutorial shows you how to pass GET/POST variables to methods.
"""
import cherrypy
class WelcomePage:
def index(self):
# Ask for the user's name.
return '''
<form action="greetUser" method="GET">
What is your name?
<input ... | [
[
8,
0,
0.0566,
0.0943,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.4717,
0.5849,
0,
0.66,
... | [
"\"\"\"\nTutorial - Passing variables\n\nThis tutorial shows you how to pass GET/POST variables to methods.\n\"\"\"",
"import cherrypy",
"class WelcomePage:\n\n def index(self):\n # Ask for the user's name.\n return '''\n <form action=\"greetUser\" method=\"GET\">\n What i... |
"""
Tutorial - Sessions
Storing session data in CherryPy applications is very easy: cherrypy
provides a dictionary called "session" that represents the session
data for the current user. If you use RAM based sessions, you can store
any kind of object into that dictionary; otherwise, you are limited to
objects that can... | [
[
8,
0,
0.1136,
0.2045,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0227,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.5,
0.3864,
0,
0.66,
0.... | [
"\"\"\"\nTutorial - Sessions\n\nStoring session data in CherryPy applications is very easy: cherrypy\nprovides a dictionary called \"session\" that represents the session\ndata for the current user. If you use RAM based sessions, you can store\nany kind of object into that dictionary; otherwise, you are limited to\... |
# This is used in test_config to test unrepr of "from A import B"
thing2 = object() | [
[
14,
0,
1,
0.3333,
0,
0.66,
0,
699,
3,
0,
0,
0,
186,
10,
1
]
] | [
"thing2 = object()"
] |
"""
Tutorial - Object inheritance
You are free to derive your request handler classes from any base
class you wish. In most real-world applications, you will probably
want to create a central base class used for all your pages, which takes
care of things like printing a common page header and footer.
"""
import cherr... | [
[
8,
0,
0.0542,
0.0964,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1205,
0.012,
0,
0.66,
0.1429,
639,
0,
1,
0,
0,
639,
0,
0
],
[
3,
0,
0.2651,
0.2289,
0,
0.66,... | [
"\"\"\"\nTutorial - Object inheritance\n\nYou are free to derive your request handler classes from any base\nclass you wish. In most real-world applications, you will probably\nwant to create a central base class used for all your pages, which takes\ncare of things like printing a common page header and footer.\n\"... |
"""
Configuration system for CherryPy.
Configuration in CherryPy is implemented via dictionaries. Keys are strings
which name the mapped value, which may be of any type.
Architecture
------------
CherryPy Requests are part of an Application, which runs in a global context,
and configuration data may apply to any of... | [
[
8,
0,
0.2034,
0.4034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4102,
0.0034,
0,
0.66,
0.0769,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.4136,
0.0034,
0,
0.66... | [
"\"\"\"\nConfiguration system for CherryPy.\n\nConfiguration in CherryPy is implemented via dictionaries. Keys are strings\nwhich name the mapped value, which may be of any type.\n\n\nArchitecture",
"import cherrypy",
"from cherrypy._cpcompat import set, basestring",
"from cherrypy.lib import reprconf",
"Na... |
"""CherryPy tools. A "tool" is any helper, adapted to CP.
Tools are usually designed to be used in a variety of ways (although some
may only offer one if they choose):
Library calls
All tools are callables that can be used wherever needed.
The arguments are straightforward and should be detail... | [
[
8,
0,
0.0235,
0.0451,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.049,
0.002,
0,
0.66,
0.0189,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.051,
0.002,
0,
0.66,
... | [
"\"\"\"CherryPy tools. A \"tool\" is any helper, adapted to CP.\n\nTools are usually designed to be used in a variety of ways (although some\nmay only offer one if they choose):\n \n Library calls\n All tools are callables that can be used wherever needed.\n The arguments are straightforward and... |
"""
Starting in CherryPy 3.1, cherrypy.server is implemented as an
:ref:`Engine Plugin<plugins>`. It's an instance of
:class:`cherrypy._cpserver.Server`, which is a subclass of
:class:`cherrypy.process.servers.ServerAdapter`. The ``ServerAdapter`` class
is designed to control other servers, as well.
Multiple servers/p... | [
[
8,
0,
0.1323,
0.2623,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.267,
0.0023,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.2693,
0.0023,
0,
0.66,... | [
"\"\"\"\nStarting in CherryPy 3.1, cherrypy.server is implemented as an\n:ref:`Engine Plugin<plugins>`. It's an instance of\n:class:`cherrypy._cpserver.Server`, which is a subclass of\n:class:`cherrypy.process.servers.ServerAdapter`. The ``ServerAdapter`` class\nis designed to control other servers, as well.\n\nMul... |
"""Windows service. Requires pywin32."""
import os
import win32api
import win32con
import win32event
import win32service
import win32serviceutil
from cherrypy.process import wspbus, plugins
class ConsoleCtrlHandler(plugins.SimplePlugin):
"""A WSPBus plugin for handling Win32 console events (like Ctrl-C)."""
... | [
[
8,
0,
0.0057,
0.0057,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0172,
0.0057,
0,
0.66,
0.0714,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.023,
0.0057,
0,
0.66,... | [
"\"\"\"Windows service. Requires pywin32.\"\"\"",
"import os",
"import win32api",
"import win32con",
"import win32event",
"import win32service",
"import win32serviceutil",
"from cherrypy.process import wspbus, plugins",
"class ConsoleCtrlHandler(plugins.SimplePlugin):\n \"\"\"A WSPBus plugin for ... |
"""Site services for use with a Web Site Process Bus."""
import os
import re
import signal as _signal
import sys
import time
import threading
from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set
# _module__file__base is used by Autoreload to make
# absolute any filenames retrieved from ... | [
[
8,
0,
0.0015,
0.0015,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0044,
0.0015,
0,
0.66,
0.0526,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0059,
0.0015,
0,
0.66... | [
"\"\"\"Site services for use with a Web Site Process Bus.\"\"\"",
"import os",
"import re",
"import signal as _signal",
"import sys",
"import time",
"import threading",
"from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set",
"_module__file__base = os.getcwd()",
"class... |
"""An implementation of the Web Site Process Bus.
This module is completely standalone, depending only on the stdlib.
Web Site Process Bus
--------------------
A Bus object is used to contain and manage site-wide behavior:
daemonization, HTTP server start/stop, process reload, signal handling,
drop privileges, PID f... | [
[
8,
0,
0.0718,
0.1412,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1458,
0.0023,
0,
0.66,
0.05,
585,
0,
1,
0,
0,
585,
0,
0
],
[
1,
0,
0.1481,
0.0023,
0,
0.66,
... | [
"\"\"\"An implementation of the Web Site Process Bus.\n\nThis module is completely standalone, depending only on the stdlib.\n\nWeb Site Process Bus\n--------------------\n\nA Bus object is used to contain and manage site-wide behavior:",
"import atexit",
"import os",
"import sys",
"import threading",
"im... |
"""Site container for an HTTP server.
A Web Site Process Bus object is used to connect applications, servers,
and frameworks with site-wide services such as daemonization, process
reload, signal handling, drop privileges, PID file management, logging
for all of these, and many more.
The 'plugins' module defines a few... | [
[
8,
0,
0.4286,
0.7857,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.9286,
0.0714,
0,
0.66,
0.5,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
1,
0.0714,
0,
0.66,
1,... | [
"\"\"\"Site container for an HTTP server.\n\nA Web Site Process Bus object is used to connect applications, servers,\nand frameworks with site-wide services such as daemonization, process\nreload, signal handling, drop privileges, PID file management, logging\nfor all of these, and many more.\n\nThe 'plugins' modul... |
"""<MyProject>, a CherryPy application.
Use this as a base for creating new CherryPy applications. When you want
to make a new app, copy and paste this folder to some other location
(maybe site-packages) and rename it to the name of your project,
then tweak as desired.
Even before any tweaking, this should serve a fe... | [
[
8,
0,
0.1148,
0.2131,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2459,
0.0164,
0,
0.66,
0.1667,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.2623,
0.0164,
0,
0.66... | [
"\"\"\"<MyProject>, a CherryPy application.\n\nUse this as a base for creating new CherryPy applications. When you want\nto make a new app, copy and paste this folder to some other location\n(maybe site-packages) and rename it to the name of your project,\nthen tweak as desired.\n\nEven before any tweaking, this sh... |
"""Native adapter for serving CherryPy via mod_python
Basic usage:
##########################################
# Application in a module called myapp.py
##########################################
import cherrypy
class Root:
@cherrypy.expose
def index(self):
return 'Hi there, Ho there, Hey there'
# ... | [
[
8,
0,
0.0828,
0.1628,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1686,
0.0029,
0,
0.66,
0.0588,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.1715,
0.0029,
0,
0.66... | [
"\"\"\"Native adapter for serving CherryPy via mod_python\n\nBasic usage:\n\n##########################################\n# Application in a module called myapp.py\n##########################################",
"import logging",
"import sys",
"import cherrypy",
"from cherrypy._cpcompat import BytesIO, copyite... |
"""CherryPy dispatchers.
A 'dispatcher' is the object which looks up the 'page handler' callable
and collects config for the current request based on the path_info, other
request attributes, and the application architecture. The core calls the
dispatcher as early as possible, passing it a 'path_info' argument.
The de... | [
[
8,
0,
0.0086,
0.0157,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0189,
0.0016,
0,
0.66,
0.0625,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0204,
0.0016,
0,
0.66... | [
"\"\"\"CherryPy dispatchers.\n\nA 'dispatcher' is the object which looks up the 'page handler' callable\nand collects config for the current request based on the path_info, other\nrequest attributes, and the application architecture. The core calls the\ndispatcher as early as possible, passing it a 'path_info' argu... |
"""Exception classes for CherryPy.
CherryPy provides (and uses) exceptions for declaring that the HTTP response
should be a status other than the default "200 OK". You can ``raise`` them like
normal Python exceptions. You can also call them and they will raise themselves;
this means you can set an :class:`HTTPError<ch... | [
[
8,
0,
0.0953,
0.1888,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1924,
0.0018,
0,
0.66,
0.0556,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.1942,
0.0018,
0,
0.66... | [
"\"\"\"Exception classes for CherryPy.\n\nCherryPy provides (and uses) exceptions for declaring that the HTTP response\nshould be a status other than the default \"200 OK\". You can ``raise`` them like\nnormal Python exceptions. You can also call them and they will raise themselves;\nthis means you can set an :clas... |
"""WSGI interface (see PEP 333 and 3333).
Note that WSGI environ keys and values are 'native strings'; that is,
whatever the type of "" is. For Python 2, that's a byte string; for Python 3,
it's a unicode string. But PEP 3333 says: "even if Python's str type is
actually Unicode "under the hood", the content of native ... | [
[
8,
0,
0.011,
0.0196,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0245,
0.0025,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0294,
0.0025,
0,
0.66,... | [
"\"\"\"WSGI interface (see PEP 333 and 3333).\n\nNote that WSGI environ keys and values are 'native strings'; that is,\nwhatever the type of \"\" is. For Python 2, that's a byte string; for Python 3,\nit's a unicode string. But PEP 3333 says: \"even if Python's str type is\nactually Unicode \"under the hood\", the ... |
"""Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
from cherrypy._cpcompat import basestring, py3k
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
... | [
[
8,
0,
0.0049,
0.0049,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0146,
0.0049,
0,
0.66,
0.1667,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0244,
0.0049,
0,
0.66... | [
"\"\"\"Manage HTTP servers with CherryPy.\"\"\"",
"import warnings",
"import cherrypy",
"from cherrypy.lib import attributes",
"from cherrypy._cpcompat import basestring, py3k",
"from cherrypy.process.servers import *",
"class Server(ServerAdapter):\n \"\"\"An adapter for an HTTP server.\n \n Y... |
"""Compatibility code for using CherryPy with various versions of Python.
CherryPy 3.2 is compatible with Python versions 2.3+. This module provides a
useful abstraction over the differences between Python versions, sometimes by
preferring a newer idiom, sometimes an older one, and sometimes a custom one.
In particul... | [
[
8,
0,
0.0283,
0.0535,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0566,
0.0031,
0,
0.66,
0.0345,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0597,
0.0031,
0,
0.66... | [
"\"\"\"Compatibility code for using CherryPy with various versions of Python.\n\nCherryPy 3.2 is compatible with Python versions 2.3+. This module provides a\nuseful abstraction over the differences between Python versions, sometimes by\npreferring a newer idiom, sometimes an older one, and sometimes a custom one.\... |
import os
import warnings
import cherrypy
from cherrypy._cpcompat import iteritems, copykeys, builtins
class Checker(object):
"""A checker for CherryPy sites and their mounted applications.
When this object is called at engine startup, it executes each
of its own methods whose names start with ``che... | [
[
1,
0,
0.0031,
0.0031,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0061,
0.0031,
0,
0.66,
0.25,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0122,
0.0031,
0,
0.... | [
"import os",
"import warnings",
"import cherrypy",
"from cherrypy._cpcompat import iteritems, copykeys, builtins",
"class Checker(object):\n \"\"\"A checker for CherryPy sites and their mounted applications.\n \n When this object is called at engine startup, it executes each\n of its own methods... |
"""CherryPy is a pythonic, object-oriented HTTP framework.
CherryPy consists of not one, but four separate API layers.
The APPLICATION LAYER is the simplest. CherryPy applications are written as
a tree of classes and methods, where each branch in the tree corresponds to
a branch in the URL path. Each method is a 'pa... | [
[
8,
0,
0.0473,
0.0929,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0962,
0.0016,
0,
0.66,
0.0164,
162,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0994,
0.0016,
0,
0.66,... | [
"\"\"\"CherryPy is a pythonic, object-oriented HTTP framework.\n\n\nCherryPy consists of not one, but four separate API layers.\n\nThe APPLICATION LAYER is the simplest. CherryPy applications are written as\na tree of classes and methods, where each branch in the tree corresponds to\na branch in the URL path. Each ... |
"""Request body processing for CherryPy.
.. versionadded:: 3.2
Application authors have complete control over the parsing of HTTP request
entities. In short, :attr:`cherrypy.request.body<cherrypy._cprequest.Request.body>`
is now always set to an instance of :class:`RequestBody<cherrypy._cpreqbody.RequestBody>`,
and *... | [
[
8,
0,
0.0534,
0.1057,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.1093,
0.0041,
0,
0.66,
0.0526,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.1088,
0.001,
1,
0.78,
... | [
"\"\"\"Request body processing for CherryPy.\n\n.. versionadded:: 3.2\n\nApplication authors have complete control over the parsing of HTTP request\nentities. In short, :attr:`cherrypy.request.body<cherrypy._cprequest.Request.body>`\nis now always set to an instance of :class:`RequestBody<cherrypy._cpreqbody.Reques... |
"""CherryPy Application and Tree objects."""
import os
import sys
import cherrypy
from cherrypy._cpcompat import ntou, py3k
from cherrypy import _cpconfig, _cplogging, _cprequest, _cpwsgi, tools
from cherrypy.lib import httputil
class Application(object):
"""A CherryPy Application.
Servers and gateways... | [
[
8,
0,
0.0034,
0.0034,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0103,
0.0034,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0138,
0.0034,
0,
0.66,... | [
"\"\"\"CherryPy Application and Tree objects.\"\"\"",
"import os",
"import sys",
"import cherrypy",
"from cherrypy._cpcompat import ntou, py3k",
"from cherrypy import _cpconfig, _cplogging, _cprequest, _cpwsgi, tools",
"from cherrypy.lib import httputil",
"class Application(object):\n \"\"\"A Cherr... |
"""A library for integrating Python's builtin ``ssl`` library with CherryPy.
The ssl module must be importable for SSL functionality.
To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of
``BuiltinSSLAdapter``.
"""
try:
import ssl
except ImportError:
ssl = None
try:
from _pyio imp... | [
[
8,
0,
0.044,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.1154,
0.044,
0,
0.66,
0.2,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.1099,
0.011,
1,
0.92,
0,
... | [
"\"\"\"A library for integrating Python's builtin ``ssl`` library with CherryPy.\n\nThe ssl module must be importable for SSL functionality.\n\nTo use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of\n``BuiltinSSLAdapter``.\n\"\"\"",
"try:\n import ssl\nexcept ImportError:\n ssl = None"... |
"""A high-speed, production ready, thread pooled, generic HTTP server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('... | [
[
8,
0,
0.0172,
0.0338,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0365,
0.0039,
0,
0.66,
0.0147,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.0392,
0.0005,
0,
0.66,... | [
"\"\"\"A high-speed, production ready, thread pooled, generic HTTP server.\n\nSimplest example on how to use this module directly\n(without using CherryPy's application machinery)::\n\n from cherrypy import wsgiserver\n \n def my_crazy_app(environ, start_response):",
"__all__ = ['HTTPRequest', 'HTTPConne... |
__all__ = ['HTTPRequest', 'HTTPConnection', 'HTTPServer',
'SizeCheckWrapper', 'KnownLengthRFile', 'ChunkedRFile',
'MaxSizeExceeded', 'NoSSLError', 'FatalSSLAlert',
'WorkerThread', 'ThreadPool', 'SSLAdapter',
'CherryPyWSGIServer',
'Gateway', 'WSGIGateway', 'WSGIGate... | [
[
14,
0,
0.2857,
0.5,
0,
0.66,
0,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.6429,
0.0714,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.8571,
0.3571,
0,
0.66,
... | [
"__all__ = ['HTTPRequest', 'HTTPConnection', 'HTTPServer',\n 'SizeCheckWrapper', 'KnownLengthRFile', 'ChunkedRFile',\n 'MaxSizeExceeded', 'NoSSLError', 'FatalSSLAlert',\n 'WorkerThread', 'ThreadPool', 'SSLAdapter',\n 'CherryPyWSGIServer',\n 'Gateway', 'WSGIGateway',... |
import cherrypy
from cherrypy.lib import httpauth
def check_auth(users, encrypt=None, realm=None):
"""If an authorization header contains credentials, return True, else False."""
request = cherrypy.serving.request
if 'authorization' in request.headers:
# make sure the provided credentials are corr... | [
[
1,
0,
0.0115,
0.0115,
0,
0.66,
0,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.023,
0.0115,
0,
0.66,
0.25,
125,
0,
1,
0,
0,
125,
0,
0
],
[
2,
0,
0.2874,
0.4713,
0,
0.6... | [
"import cherrypy",
"from cherrypy.lib import httpauth",
"def check_auth(users, encrypt=None, realm=None):\n \"\"\"If an authorization header contains credentials, return True, else False.\"\"\"\n request = cherrypy.serving.request\n if 'authorization' in request.headers:\n # make sure the provid... |
import struct
import time
import cherrypy
from cherrypy._cpcompat import basestring, BytesIO, ntob, set, unicodestr
from cherrypy.lib import file_generator
from cherrypy.lib import set_vary_header
def decode(encoding=None, default_encoding='utf-8'):
"""Replace or extend the list of charsets used to decode a requ... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
399,
0,
1,
0,
0,
399,
0,
0
],
[
1,
0,
0.0052,
0.0026,
0,
0.66,
0.1,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0103,
0.0026,
0,
0.6... | [
"import struct",
"import time",
"import cherrypy",
"from cherrypy._cpcompat import basestring, BytesIO, ntob, set, unicodestr",
"from cherrypy.lib import file_generator",
"from cherrypy.lib import set_vary_header",
"def decode(encoding=None, default_encoding='utf-8'):\n \"\"\"Replace or extend the li... |
"""Profiler tools for CherryPy.
CherryPy users
==============
You can profile any of your pages as follows::
from cherrypy.lib import profiler
class Root:
p = profile.Profiler("/path/to/profile/dir")
def index(self):
self.p.run(self._index)
index.exposed = Tr... | [
[
8,
0,
0.0841,
0.1635,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.1899,
0.0288,
0,
0.66,
0.0833,
121,
0,
1,
1,
0,
0,
0,
3
],
[
8,
1,
0.1827,
0.0048,
1,
0.73,
... | [
"\"\"\"Profiler tools for CherryPy.\n\nCherryPy users\n==============\n\nYou can profile any of your pages as follows::\n\n from cherrypy.lib import profiler",
"def new_func_strip_path(func_name):\n \"\"\"Make profiler output more readable by adding ``__init__`` modules' parents\"\"\"\n filename, line, n... |
import gc
import inspect
import os
import sys
import time
try:
import objgraph
except ImportError:
objgraph = None
import cherrypy
from cherrypy import _cprequest, _cpwsgi
from cherrypy.process.plugins import SimplePlugin
class ReferrerTree(object):
"""An object which gathers all referrers of an object... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
92,
0,
1,
0,
0,
92,
0,
0
],
[
1,
0,
0.0093,
0.0047,
0,
0.66,
0.0667,
878,
0,
1,
0,
0,
878,
0,
0
],
[
1,
0,
0.014,
0.0047,
0,
0.6... | [
"import gc",
"import inspect",
"import os",
"import sys",
"import time",
"try:\n import objgraph\nexcept ImportError:\n objgraph = None",
" import objgraph",
" objgraph = None",
"import cherrypy",
"from cherrypy import _cprequest, _cpwsgi",
"from cherrypy.process.plugins import Simpl... |
# This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
__doc__ = """An implementation of the server-side of HTTP Digest Access
Authentication, which is described in :rfc:`2617`.
Example usage, using the built-in get_ha1_dict_plain function which... | [
[
14,
0,
0.0329,
0.0411,
0,
0.66,
0,
155,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0575,
0.0027,
0,
0.66,
0.05,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0603,
0.0027,
0,
0.6... | [
"__doc__ = \"\"\"An implementation of the server-side of HTTP Digest Access\nAuthentication, which is described in :rfc:`2617`.\n\nExample usage, using the built-in get_ha1_dict_plain function which uses a dict\nof plaintext passwords as the credentials store::\n\n userpassdict = {'alice' : '4x5istwelve'}\n g... |
import sys
import cherrypy
from cherrypy._cpcompat import basestring, ntou, json, json_encode, json_decode
def json_processor(entity):
"""Read application/json data into request.json."""
if not entity.headers.get(ntou("Content-Length"), ntou("")):
raise cherrypy.HTTPError(411)
body = entity.fp... | [
[
1,
0,
0.0115,
0.0115,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.023,
0.0115,
0,
0.66,
0.1667,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.0345,
0.0115,
0,
0... | [
"import sys",
"import cherrypy",
"from cherrypy._cpcompat import basestring, ntou, json, json_encode, json_decode",
"def json_processor(entity):\n \"\"\"Read application/json data into request.json.\"\"\"\n if not entity.headers.get(ntou(\"Content-Length\"), ntou(\"\")):\n raise cherrypy.HTTPErro... |
"""HTTP library functions.
This module contains functions for building an HTTP application
framework: any one, not just one whose name starts with "Ch". ;) If you
reference any modules from some popular framework inside *this* module,
FuManChu will personally hang you up by your thumbs and submit you
to a public canin... | [
[
8,
0,
0.0089,
0.0158,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0198,
0.002,
0,
0.66,
0.04,
984,
0,
1,
0,
0,
984,
0,
0
],
[
1,
0,
0.0217,
0.002,
0,
0.66,
... | [
"\"\"\"HTTP library functions.\n\nThis module contains functions for building an HTTP application\nframework: any one, not just one whose name starts with \"Ch\". ;) If you\nreference any modules from some popular framework inside *this* module,\nFuManChu will personally hang you up by your thumbs and submit you\nt... |
import warnings
warnings.warn('cherrypy.lib.http has been deprecated and will be removed '
'in CherryPy 3.3 use cherrypy.lib.httputil instead.',
DeprecationWarning)
from cherrypy.lib.httputil import *
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.4286,
0.4286,
0,
0.66,
0.5,
960,
3,
2,
0,
0,
0,
0,
1
],
[
1,
0,
0.8571,
0.1429,
0,
0.66,... | [
"import warnings",
"warnings.warn('cherrypy.lib.http has been deprecated and will be removed '\n 'in CherryPy 3.3 use cherrypy.lib.httputil instead.',\n DeprecationWarning)",
"from cherrypy.lib.httputil import *"
] |
"""Session implementation for CherryPy.
You need to edit your config file to use sessions. Here's an example::
[/]
tools.sessions.on = True
tools.sessions.storage_type = "file"
tools.sessions.storage_path = "/home/site/sessions"
tools.sessions.timeout = 60
This sets the session to be stored in fi... | [
[
8,
0,
0.0494,
0.0976,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0999,
0.0011,
0,
0.66,
0.0417,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.101,
0.0011,
0,
0.66,... | [
"\"\"\"Session implementation for CherryPy.\n\nYou need to edit your config file to use sessions. Here's an example::\n\n [/]\n tools.sessions.on = True\n tools.sessions.storage_type = \"file\"\n tools.sessions.storage_path = \"/home/site/sessions\"",
"import datetime",
"import os",
"import random... |
"""Functions for builtin CherryPy tools."""
import logging
import re
import cherrypy
from cherrypy._cpcompat import basestring, ntob, md5, set
from cherrypy.lib import httputil as _httputil
# Conditional HTTP request support #
def validate_etags(autotags=False, debug=False):... | [
[
8,
0,
0.0016,
0.0016,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0049,
0.0016,
0,
0.66,
0.04,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0065,
0.0016,
0,
0.66,
... | [
"\"\"\"Functions for builtin CherryPy tools.\"\"\"",
"import logging",
"import re",
"import cherrypy",
"from cherrypy._cpcompat import basestring, ntob, md5, set",
"from cherrypy.lib import httputil as _httputil",
"def validate_etags(autotags=False, debug=False):\n \"\"\"Validate the current ETag aga... |
try:
from io import UnsupportedOperation
except ImportError:
UnsupportedOperation = object()
import logging
import mimetypes
mimetypes.init()
mimetypes.types_map['.dwg']='image/x-dwg'
mimetypes.types_map['.ico']='image/x-icon'
mimetypes.types_map['.bz2']='application/x-bzip2'
mimetypes.types_map['.gz']='applica... | [
[
7,
0,
0.0069,
0.011,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
1
],
[
1,
1,
0.0055,
0.0028,
1,
0.92,
0,
518,
0,
1,
0,
0,
518,
0,
0
],
[
14,
1,
0.011,
0.0028,
1,
0.92,
... | [
"try:\n from io import UnsupportedOperation\nexcept ImportError:\n UnsupportedOperation = object()",
" from io import UnsupportedOperation",
" UnsupportedOperation = object()",
"import logging",
"import mimetypes",
"mimetypes.init()",
"mimetypes.types_map['.dwg']='image/x-dwg'",
"mimetypes... |
"""Generic configuration system using unrepr.
Configuration data may be supplied as a Python dictionary, as a filename,
or as an open file object. When you supply a filename or file, Python's
builtin ConfigParser is used (with some extensions).
Namespaces
----------
Configuration keys are separated into namespaces b... | [
[
8,
0,
0.0206,
0.0392,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.0474,
0.0103,
0,
0.66,
0.0667,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0474,
0.0021,
1,
0.17,
... | [
"\"\"\"Generic configuration system using unrepr.\n\nConfiguration data may be supplied as a Python dictionary, as a filename,\nor as an open file object. When you supply a filename or file, Python's\nbuiltin ConfigParser is used (with some extensions).\n\nNamespaces\n----------",
"try:\n # Python 3.0+\n fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.