Commit b6d3e410 authored by Ronny Pfannschmidt's avatar Ronny Pfannschmidt
Browse files

remove everything thats not in the stdlib or tells about the version from the vendor/stdlib branch

--HG--
branch : vendor/stdlib
parent 7406215587c6
.hg
.svn
*.pyc
*.pyo
*~
bin/pypy-c
include/*.h
lib_pypy/ctypes_config_cache/_[^_]*_*.py
pypy/_cache
pypy/doc/*.html
pypy/doc/config/*.html
pypy/doc/discussion/*.html
pypy/module/cpyext/src/*.o
pypy/module/cpyext/test/*.o
pypy/module/test_lib_pypy/ctypes_tests/*.o
pypy/translator/c/src/dtoa.o
pypy/translator/goal/pypy-c
pypy/translator/goal/target*-c
release/
\ No newline at end of file
syntax: glob
*.py[co]
*~
.*.swp
.idea
.project
.pydevproject
syntax: regexp
^testresult$
^site-packages$
^site-packages/.*$
^site-packages/.*$
^bin$
^pypy/bin/pypy-c
^pypy/module/cpyext/src/.+\.o$
^pypy/module/cpyext/src/.+\.obj$
^pypy/module/cpyext/test/.+\.errors$
^pypy/module/cpyext/test/.+\.o$
^pypy/module/cpyext/test/.+\.obj$
^pypy/module/cpyext/test/.+\.manifest$
^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
^pypy/doc/.+\.html$
^pypy/doc/config/.+\.rst$
^pypy/doc/basicblock\.asc$
^pypy/doc/.+\.svninfo$
^pypy/translator/c/src/libffi_msvc/.+\.obj$
^pypy/translator/c/src/libffi_msvc/.+\.dll$
^pypy/translator/c/src/libffi_msvc/.+\.lib$
^pypy/translator/c/src/libffi_msvc/.+\.exp$
^pypy/translator/c/src/cjkcodecs/.+\.o$
^pypy/translator/c/src/cjkcodecs/.+\.obj$
^pypy/translator/jvm/\.project$
^pypy/translator/jvm/\.classpath$
^pypy/translator/jvm/eclipse-bin$
^pypy/translator/jvm/src/pypy/.+\.class$
^pypy/translator/benchmark/docutils$
^pypy/translator/benchmark/templess$
^pypy/translator/benchmark/gadfly$
^pypy/translator/benchmark/mako$
^pypy/translator/benchmark/bench-custom\.benchmark_result$
^pypy/translator/benchmark/shootout_benchmarks$
^pypy/translator/goal/pypy-translation-snapshot$
^pypy/translator/goal/pypy-c
^pypy/translator/goal/pypy-jvm
^pypy/translator/goal/pypy-jvm.jar
^pypy/translator/goal/.+\.exe$
^pypy/translator/goal/.+\.dll$
^pypy/translator/goal/target.+-c$
^pypy/_cache$
^pypy/doc/statistic/.+\.html$
^pypy/doc/statistic/.+\.eps$
^pypy/doc/statistic/.+\.pdf$
^pypy/translator/cli/src/pypylib\.dll$
^pypy/translator/cli/src/query\.exe$
^pypy/translator/cli/src/main\.exe$
^lib_pypy/ctypes_config_cache/_.+_cache\.py$
^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
^pypy/translator/cli/query-descriptions$
^pypy/doc/discussion/.+\.html$
^include/.+\.h$
^include/.+\.inl$
^pypy/doc/_build/.*$
^pypy/doc/config/.+\.html$
^pypy/doc/config/style\.css$
^pypy/doc/jit/.+\.html$
^pypy/doc/jit/style\.css$
^pypy/doc/image/lattice1\.png$
^pypy/doc/image/lattice2\.png$
^pypy/doc/image/lattice3\.png$
^pypy/doc/image/stackless_informal\.png$
^pypy/doc/image/parsing_example.+\.png$
^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
^compiled
^.git/
^release/
b590cf6de4190623aad9aa698694c22e614d67b9 release-1.5
b48df0bf4e75b81d98f19ce89d4a7dc3e1dab5e5 benchmarked
d8ac7d23d3ec5f9a0fa1264972f74a010dbfd07f release-1.6
ff4af8f318821f7f5ca998613a60fca09aa137da release-1.7
License for files in the pypy/ directory
==================================================
Except when otherwise stated (look for LICENSE files in directories or
information at the beginning of each file) all software and
documentation in the 'pypy' directories is licensed as follows:
The MIT License
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
PyPy Copyright holders 2003-2012
-----------------------------------
Except when otherwise stated (look for LICENSE files or information at
the beginning of each file) the files in the 'pypy' directory are each
copyrighted by one or more of the following people and organizations:
Armin Rigo
Maciej Fijalkowski
Carl Friedrich Bolz
Amaury Forgeot d'Arc
Antonio Cuni
Samuele Pedroni
Michael Hudson
Holger Krekel
Alex Gaynor
Christian Tismer
Hakan Ardo
Benjamin Peterson
David Schneider
Eric van Riet Paap
Anders Chrigstrom
Richard Emslie
Dan Villiom Podlaski Christiansen
Alexander Schremmer
Lukas Diekmann
Aurelien Campeas
Anders Lehmann
Camillo Bruni
Niklaus Haldimann
Sven Hager
Leonardo Santagada
Toon Verwaest
Seo Sanghyeon
Justin Peel
Lawrence Oluyede
Bartosz Skowron
Jakub Gustak
Guido Wesdorp
Daniel Roberts
Laura Creighton
Adrien Di Mascio
Ludovic Aubry
Niko Matsakis
Wim Lavrijsen
Matti Picus
Jason Creighton
Jacob Hallen
Alex Martelli
Anders Hammarquist
Jan de Mooij
Stephan Diehl
Michael Foord
Stefan Schwarzer
Tomek Meka
Patrick Maupin
Bob Ippolito
Bruno Gola
Alexandre Fayolle
Marius Gedminas
Simon Burton
David Edelsohn
Jean-Paul Calderone
John Witulski
Timo Paulssen
holger krekel
Dario Bertini
Mark Pearse
Andreas Stührk
Jean-Philippe St. Pierre
Guido van Rossum
Pavel Vinogradov
Valentino Volonghi
Paul deGrandis
Ilya Osadchiy
Ronny Pfannschmidt
Adrian Kuhn
tav
Georg Brandl
Philip Jenvey
Gerald Klix
Wanja Saatkamp
Boris Feigin
Oscar Nierstrasz
David Malcolm
Eugene Oden
Henry Mason
Jeff Terrace
Lukas Renggli
Guenter Jantzen
Ned Batchelder
Bert Freudenberg
Amit Regmi
Ben Young
Nicolas Chauvat
Andrew Durdin
Michael Schneider
Nicholas Riley
Rocco Moretti
Gintautas Miliauskas
Michael Twomey
Igor Trindade Oliveira
Lucian Branescu Mihaila
Olivier Dormond
Jared Grubb
Karl Bartel
Gabriel Lavoie
Victor Stinner
Brian Dorsey
Stuart Williams
Toby Watson
Antoine Pitrou
Justas Sadzevicius
Neil Shepperd
Mikael Schönenberg
Gasper Zejn
Jonathan David Riehl
Elmo Mäntynen
Anders Qvist
Beatrice During
Alexander Sedov
Corbin Simpson
Vincent Legoll
Romain Guillebert
Alan McIntyre
Alex Perry
Jens-Uwe Mager
Simon Cross
Dan Stromberg
Guillebert Romain
Carl Meyer
Pieter Zieschang
Alejandro J. Cura
Sylvain Thenault
Christoph Gerum
Travis Francis Athougies
Henrik Vendelbo
Lutz Paelike
Jacob Oscarson
Martin Blais
Lucio Torre
Lene Wagner
Miguel de Val Borro
Artur Lisiecki
Bruno Gola
Ignas Mikalajunas
Stefano Rivera
Joshua Gilbert
Godefroid Chappelle
Yusei Tahara
Christopher Armstrong
Stephan Busemann
Gustavo Niemeyer
William Leslie
Akira Li
Kristjan Valur Jonsson
Bobby Impollonia
Michael Hudson-Doyle
Laurence Tratt
Yasir Suhail
Andrew Thompson
Anders Sigfridsson
Floris Bruynooghe
Jacek Generowicz
Dan Colish
Zooko Wilcox-O Hearn
Dan Loewenherz
Chris Lambacher
Dinu Gherman
Brett Cannon
Daniel Neuhäuser
Michael Chermside
Konrad Delong
Anna Ravencroft
Greg Price
Armin Ronacher
Christian Muirhead
Jim Baker
Rodrigo Araújo
Romain Guillebert
Heinrich-Heine University, Germany
Open End AB (formerly AB Strakt), Sweden
merlinux GmbH, Germany
tismerysoft GmbH, Germany
Logilab Paris, France
DFKI GmbH, Germany
Impara, Germany
Change Maker, Sweden
The PyPy Logo as used by http://speed.pypy.org and others was created
by Samuel Reis and is distributed on terms of Creative Commons Share Alike
License.
License for 'lib-python/2.7.0' and 'lib-python/2.7.0-modified'
==============================================================
Except when otherwise stated (look for LICENSE files or
copyright/license information at the beginning of each file) the files
in the 'lib-python/2.7.0' and 'lib-python/2.7.0-modified' directories
are all copyrighted by the Python Software Foundation and licensed under
the Python Software License of which you can find a copy here:
http://www.python.org/doc/Copyright.html
License for 'pypy/translator/jvm/src/jna.jar'
=============================================
The file 'pypy/translator/jvm/src/jna.jar' is licensed under the GNU
Lesser General Public License of which you can find a copy here:
http://www.gnu.org/licenses/lgpl.html
License for 'pypy/translator/jvm/src/jasmin.jar'
================================================
The file 'pypy/translator/jvm/src/jasmin.jar' is copyright (c) 1996-2004 Jon Meyer
and distributed with permission. The use of Jasmin by PyPy does not imply
that PyPy is endorsed by Jon Meyer nor any of Jasmin's contributors. Furthermore,
the following disclaimer applies to Jasmin:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License for 'pypy/module/unicodedata/'
======================================
The following files are from the website of The Unicode Consortium
at http://www.unicode.org/. For the terms of use of these files, see
http://www.unicode.org/terms_of_use.html . Or they are derived from
files from the above website, and the same terms of use apply.
CompositionExclusions-*.txt
EastAsianWidth-*.txt
LineBreak-*.txt
UnicodeData-*.txt
UnihanNumeric-*.txt
=====================================
PyPy: Python in Python Implementation
=====================================
Welcome to PyPy!
PyPy is both an implementation of the Python programming language, and
an extensive compiler framework for dynamic language implementations.
You can build self-contained Python implementations which execute
independently from CPython.
The home page is:
http://pypy.org/
The getting-started document will help guide you:
http://doc.pypy.org/en/latest/getting-started.html
It will also point you to the rest of the documentation which is generated
from files in the pypy/doc directory within the source repositories. Enjoy
and send us feedback!
the pypy-dev team <pypy-dev@python.org>
#
__version__ = '2.2.4.dev2'
"""
support for presenting detailed information in failing assertions.
"""
import py
import sys
import pytest
from _pytest.monkeypatch import monkeypatch
from _pytest.assertion import util
def pytest_addoption(parser):
group = parser.getgroup("debugconfig")
group.addoption('--assert', action="store", dest="assertmode",
choices=("rewrite", "reinterp", "plain",),
default="rewrite", metavar="MODE",
help="""control assertion debugging tools.
'plain' performs no assertion debugging.
'reinterp' reinterprets assert statements after they failed to provide assertion expression information.
'rewrite' (the default) rewrites assert statements in test modules on import
to provide assert expression information. """)
group.addoption('--no-assert', action="store_true", default=False,
dest="noassert", help="DEPRECATED equivalent to --assert=plain")
group.addoption('--nomagic', action="store_true", default=False,
dest="nomagic", help="DEPRECATED equivalent to --assert=plain")
class AssertionState:
"""State for the assertion plugin."""
def __init__(self, config, mode):
self.mode = mode
self.trace = config.trace.root.get("assertion")
def pytest_configure(config):
mode = config.getvalue("assertmode")
if config.getvalue("noassert") or config.getvalue("nomagic"):
mode = "plain"
if mode == "rewrite":
try:
import ast
except ImportError:
mode = "reinterp"
else:
if sys.platform.startswith('java'):
mode = "reinterp"
if mode != "plain":
_load_modules(mode)
m = monkeypatch()
config._cleanup.append(m.undo)
m.setattr(py.builtin.builtins, 'AssertionError',
reinterpret.AssertionError)
hook = None
if mode == "rewrite":
hook = rewrite.AssertionRewritingHook()
sys.meta_path.append(hook)
warn_about_missing_assertion(mode)
config._assertstate = AssertionState(config, mode)
config._assertstate.hook = hook
config._assertstate.trace("configured with mode set to %r" % (mode,))
def pytest_unconfigure(config):
hook = config._assertstate.hook
if hook is not None:
sys.meta_path.remove(hook)
def pytest_collection(session):
# this hook is only called when test modules are collected
# so for example not in the master process of pytest-xdist
# (which does not collect test modules)
hook = session.config._assertstate.hook
if hook is not None:
hook.set_session(session)
def pytest_runtest_setup(item):
def callbinrepr(op, left, right):
hook_result = item.ihook.pytest_assertrepr_compare(
config=item.config, op=op, left=left, right=right)
for new_expl in hook_result:
if new_expl:
res = '\n~'.join(new_expl)
if item.config.getvalue("assertmode") == "rewrite":
# The result will be fed back a python % formatting
# operation, which will fail if there are extraneous
# '%'s in the string. Escape them here.
res = res.replace("%", "%%")
return res
util._reprcompare = callbinrepr
def pytest_runtest_teardown(item):
util._reprcompare = None
def pytest_sessionfinish(session):
hook = session.config._assertstate.hook
if hook is not None:
hook.session = None
def _load_modules(mode):
"""Lazily import assertion related code."""
global rewrite, reinterpret
from _pytest.assertion import reinterpret
if mode == "rewrite":
from _pytest.assertion import rewrite
def warn_about_missing_assertion(mode):
try:
assert False
except AssertionError:
pass
else:
if mode == "rewrite":
specifically = ("assertions which are not in test modules "
"will be ignored")
else:
specifically = "failing tests may report as passing"
sys.stderr.write("WARNING: " + specifically +
" because assert statements are not executed "
"by the underlying Python interpreter "
"(are you using python -O?)\n")
pytest_assertrepr_compare = util.assertrepr_compare
"""
Find intermediate evalutation results in assert statements through builtin AST.
This should replace oldinterpret.py eventually.
"""
import sys
import ast
import py
from _pytest.assertion import util
from _pytest.assertion.reinterpret import BuiltinAssertionError
if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):
# See http://bugs.jython.org/issue1497
_exprs = ("BoolOp", "BinOp", "UnaryOp", "Lambda", "IfExp", "Dict",
"ListComp", "GeneratorExp", "Yield", "Compare", "Call",
"Repr", "Num", "Str", "Attribute", "Subscript", "Name",
"List", "Tuple")
_stmts = ("FunctionDef", "ClassDef", "Return", "Delete", "Assign",
"AugAssign", "Print", "For", "While", "If", "With", "Raise",
"TryExcept", "TryFinally", "Assert", "Import", "ImportFrom",
"Exec", "Global", "Expr", "Pass", "Break", "Continue")
_expr_nodes = set(getattr(ast, name) for name in _exprs)
_stmt_nodes = set(getattr(ast, name) for name in _stmts)
def _is_ast_expr(node):
return node.__class__ in _expr_nodes
def _is_ast_stmt(node):
return node.__class__ in _stmt_nodes
else:
def _is_ast_expr(node):
return isinstance(node, ast.expr)
def _is_ast_stmt(node):
return isinstance(node, ast.stmt)
class Failure(Exception):
"""Error found while interpreting AST."""
def __init__(self, explanation=""):
self.cause = sys.exc_info()
self.explanation = explanation
def interpret(source, frame, should_fail=False):
mod = ast.parse(source)
visitor = DebugInterpreter(frame)
try:
visitor.visit(mod)
except Failure:
failure = sys.exc_info()[1]
return getfailure(failure)
if should_fail:
return ("(assertion failed, but when it was re-run for "
"printing intermediate values, it did not fail. Suggestions: "
"compute assert expression before the assert or use --assert=plain)")
def run(offending_line, frame=None):
if frame is None:
frame = py.code.Frame(sys._getframe(1))
return interpret(offending_line, frame)
def getfailure(e):
explanation = util.format_explanation(e.explanation)
value = e.cause[1]
if str(value):
lines = explanation.split('\n')
lines[0] += " << %s" % (value,)
explanation = '\n'.join(lines)
text = "%s: %s" % (e.cause[0].__name__, explanation)
if text.startswith('AssertionError: assert '):
text = text[16:]
return text
operator_map = {
ast.BitOr : "|",
ast.BitXor : "^",
ast.BitAnd : "&",
ast.LShift : "<<",
ast.RShift : ">>",
ast.Add : "+",
ast.Sub : "-",
ast.Mult : "*",
ast.Div : "/",
ast.FloorDiv : "//",
ast.Mod : "%",
ast.Eq : "==",
ast.NotEq : "!=",
ast.Lt : "<",
ast.LtE : "<=",
ast.Gt : ">",
ast.GtE : ">=",
ast.Pow : "**",
ast.Is : "is",
ast.IsNot : "is not",
ast.In : "in",
ast.NotIn : "not in"
}
unary_map = {
ast.Not : "not %s",
ast.Invert : "~%s",
ast.USub : "-%s",
ast.UAdd : "+%s"
}
class DebugInterpreter(ast.NodeVisitor):
"""Interpret AST nodes to gleam useful debugging information. """
def __init__(self, frame):
self.frame = frame
def generic_visit(self, node):
# Fallback when we don't have a special implementation.
if _is_ast_expr(node):