diff --git a/IPython/external/external/Itpl.py b/IPython/external/Itpl.py similarity index 100% rename from IPython/external/external/Itpl.py rename to IPython/external/Itpl.py diff --git a/IPython/external/external/configobj.py b/IPython/external/configobj.py similarity index 100% rename from IPython/external/external/configobj.py rename to IPython/external/configobj.py diff --git a/IPython/external/external/README b/IPython/external/external/README deleted file mode 100644 index 085adaa..0000000 --- a/IPython/external/external/README +++ /dev/null @@ -1,14 +0,0 @@ -=================== - External Packages -=================== - -This directory contains external packages which we ship inside IPython for ease -of distributions for users. - -Currently we include: - -- configobj -- Itpl -- MochiKit -- simplegeneric -- validate diff --git a/IPython/external/external/__init__.py b/IPython/external/external/__init__.py deleted file mode 100644 index 74c6808..0000000 --- a/IPython/external/external/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: utf-8 - -""" -This package contains all third-party modules bundled with IPython. -""" - -__docformat__ = "restructuredtext en" - -#------------------------------------------------------------------------------- -# Copyright (C) 2008 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- - -__all__ = ['simplegeneric','twisted','Itpl', 'MochiKit'] diff --git a/IPython/external/external/simplegeneric.py b/IPython/external/external/simplegeneric.py deleted file mode 100644 index d8c6d5b..0000000 --- a/IPython/external/external/simplegeneric.py +++ /dev/null @@ -1,130 +0,0 @@ -__all__ = ["generic"] - -from types import ClassType, InstanceType -classtypes = type, ClassType - -# This is version 0.6 of Philip J. Eby's simplegeneric module -# (http://cheeseshop.python.org/pypi/simplegeneric) patched to work -# with Python 2.3 (which doesn't support assigning to __name__) - -def generic(func): - """Create a simple generic function""" - - _sentinel = object() - - def _by_class(*args, **kw): - cls = args[0].__class__ - for t in type(cls.__name__, (cls,object), {}).__mro__: - f = _gbt(t, _sentinel) - if f is not _sentinel: - return f(*args, **kw) - else: - return func(*args, **kw) - - _by_type = {object: func, InstanceType: _by_class} - _gbt = _by_type.get - - def when_type(t): - """Decorator to add a method that will be called for type `t`""" - if not isinstance(t, classtypes): - raise TypeError( - "%r is not a type or class" % (t,) - ) - def decorate(f): - if _by_type.setdefault(t,f) is not f: - raise TypeError( - "%r already has method for type %r" % (func, t) - ) - return f - return decorate - - - - - - - _by_object = {} - _gbo = _by_object.get - - def when_object(o): - """Decorator to add a method that will be called for object `o`""" - def decorate(f): - if _by_object.setdefault(id(o), (o,f))[1] is not f: - raise TypeError( - "%r already has method for object %r" % (func, o) - ) - return f - return decorate - - - def dispatch(*args, **kw): - f = _gbo(id(args[0]), _sentinel) - if f is _sentinel: - for t in type(args[0]).__mro__: - f = _gbt(t, _sentinel) - if f is not _sentinel: - return f(*args, **kw) - else: - return func(*args, **kw) - else: - return f[1](*args, **kw) - - try: - dispatch.__name__ = func.__name__ - except TypeError: - pass - dispatch.__dict__ = func.__dict__.copy() - dispatch.__doc__ = func.__doc__ - dispatch.__module__ = func.__module__ - - dispatch.when_type = when_type - dispatch.when_object = when_object - dispatch.default = func - dispatch.has_object = lambda o: id(o) in _by_object - dispatch.has_type = lambda t: t in _by_type - return dispatch - - - - -def test_suite(): - import doctest - return doctest.DocFileSuite( - 'README.txt', - optionflags=doctest.ELLIPSIS|doctest.REPORT_ONLY_FIRST_FAILURE, - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/IPython/external/external/validate.py b/IPython/external/validate.py similarity index 100% rename from IPython/external/external/validate.py rename to IPython/external/validate.py