提交 7ace6b70 authored 作者: Roman Ring's avatar Roman Ring

remove python2x.py, fix imports associated with it

上级 938dbc86
...@@ -58,8 +58,7 @@ else: ...@@ -58,8 +58,7 @@ else:
cmp = cmp cmp = cmp
# Older Python 2.x compatibility from collections import OrderedDict, MutableMapping as DictMixin
from theano.compat.python2x import DictMixin, OrderedDict
def decode(x): def decode(x):
return x return x
......
"""
Helper functions to make theano backwards compatible with python 2.6 - 2.7
Now mostly there for compatibility as we don't support Python 2.6 anymore.
"""
from __future__ import absolute_import, print_function, division
try:
from UserDict import DictMixin
except ImportError:
from collections import MutableMapping as DictMixin
from collections import OrderedDict, Counter
__all__ = ['DictMixin', 'OrderedDict', 'Counter']
...@@ -5,6 +5,7 @@ help make new Ops more rapidly. ...@@ -5,6 +5,7 @@ help make new Ops more rapidly.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
import copy import copy
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
...@@ -12,7 +13,6 @@ import warnings ...@@ -12,7 +13,6 @@ import warnings
import theano import theano
from theano import gof from theano import gof
from theano.compat import OrderedDict
from six import iteritems, integer_types from six import iteritems, integer_types
from six.moves import xrange from six.moves import xrange
......
...@@ -5,14 +5,13 @@ and inplace operations. ...@@ -5,14 +5,13 @@ and inplace operations.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import deque from collections import deque, OrderedDict
from six import iteritems from six import iteritems
import theano import theano
from . import toolbox from . import toolbox
from . import graph from . import graph
from theano.compat import OrderedDict
from theano.misc.ordered_set import OrderedSet from theano.misc.ordered_set import OrderedSet
from .fg import InconsistencyError from .fg import InconsistencyError
......
...@@ -5,6 +5,7 @@ types that it can raise. ...@@ -5,6 +5,7 @@ types that it can raise.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
import sys import sys
import time import time
import traceback import traceback
...@@ -15,7 +16,6 @@ from theano.gof import utils ...@@ -15,7 +16,6 @@ from theano.gof import utils
from theano.gof import toolbox from theano.gof import toolbox
from theano import config from theano import config
from theano.compat import OrderedDict
from six import iteritems, itervalues from six import iteritems, itervalues
from six.moves import StringIO from six.moves import StringIO
from theano.misc.ordered_set import OrderedSet from theano.misc.ordered_set import OrderedSet
......
...@@ -5,7 +5,7 @@ amount of useful generic optimization tools. ...@@ -5,7 +5,7 @@ amount of useful generic optimization tools.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import deque, defaultdict from collections import deque, defaultdict, OrderedDict
import copy import copy
import inspect import inspect
import logging import logging
...@@ -19,7 +19,7 @@ import numpy ...@@ -19,7 +19,7 @@ import numpy
import theano import theano
from theano import config from theano import config
from theano.compat import izip, OrderedDict from theano.compat import izip
from six import string_types, iteritems, itervalues, integer_types from six import string_types, iteritems, itervalues, integer_types
from six.moves import reduce from six.moves import reduce
from theano.gof import graph, op, utils, unify, toolbox from theano.gof import graph, op, utils, unify, toolbox
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
import theano import theano
from theano.compat import OrderedDict
from theano.gof.utils import ( from theano.gof.utils import (
give_variables_names, hash_from_dict, remove, unique) give_variables_names, hash_from_dict, remove, unique)
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from functools import partial from functools import partial
from collections import OrderedDict
import sys import sys
import time import time
import inspect import inspect
import theano import theano
from theano import config from theano import config
from theano.compat import OrderedDict
from theano.gof import graph from theano.gof import graph
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
import linecache import linecache
import sys import sys
import traceback import traceback
...@@ -8,7 +9,7 @@ from six import iteritems, integer_types, string_types, with_metaclass ...@@ -8,7 +9,7 @@ from six import iteritems, integer_types, string_types, with_metaclass
from six.moves import StringIO from six.moves import StringIO
from theano import config from theano import config
from theano.compat import OrderedDict, PY3 from theano.compat import PY3
def simple_extract_stack(f=None, limit=None, skips=[]): def simple_extract_stack(f=None, limit=None, skips=[]):
......
"""Driver for gradient calculations.""" """Driver for gradient calculations."""
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
import six.moves.builtins as builtins import six.moves.builtins as builtins
import logging import logging
import time import time
...@@ -12,7 +13,7 @@ import theano ...@@ -12,7 +13,7 @@ import theano
from theano import gof from theano import gof
from theano.gof import utils, Variable from theano.gof import utils, Variable
from theano.compat import OrderedDict, izip from theano.compat import izip
from six.moves import xrange, reduce from six.moves import xrange, reduce
from theano.gof.null_type import NullType, null_type from theano.gof.null_type import NullType, null_type
from theano.gof.op import get_debug_values from theano.gof.op import get_debug_values
......
...@@ -47,6 +47,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -47,6 +47,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import logging import logging
import numpy import numpy
import warnings import warnings
from collections import OrderedDict
from theano.compat import ifilter, izip from theano.compat import ifilter, izip
from six import iteritems, integer_types from six import iteritems, integer_types
...@@ -59,7 +60,6 @@ from theano import tensor ...@@ -59,7 +60,6 @@ from theano import tensor
from theano import config from theano import config
from theano.updates import OrderedUpdates from theano.updates import OrderedUpdates
from theano.compile import ops from theano.compile import ops
from theano.compat import OrderedDict
from theano.scan_module import scan_op from theano.scan_module import scan_op
......
...@@ -60,6 +60,7 @@ import copy ...@@ -60,6 +60,7 @@ import copy
import itertools import itertools
import logging import logging
import time import time
from collections import OrderedDict
import numpy import numpy
from six import iteritems, integer_types from six import iteritems, integer_types
...@@ -73,7 +74,7 @@ from theano import compile, config, gradient, gof, tensor ...@@ -73,7 +74,7 @@ from theano import compile, config, gradient, gof, tensor
from theano.gof import PureOp, Apply from theano.gof import PureOp, Apply
from theano.gof.graph import io_connection_pattern from theano.gof.graph import io_connection_pattern
from theano.gof.toolbox import NoOutputFromInplace from theano.gof.toolbox import NoOutputFromInplace
from theano.compat import OrderedDict, izip from theano.compat import izip
from theano.tensor import TensorType from theano.tensor import TensorType
from theano.tensor.opt import Shape_i from theano.tensor.opt import Shape_i
from theano.gradient import grad_undefined, DisconnectedType, NullType from theano.gradient import grad_undefined, DisconnectedType, NullType
......
...@@ -53,13 +53,13 @@ from __future__ import absolute_import, print_function, division ...@@ -53,13 +53,13 @@ from __future__ import absolute_import, print_function, division
import logging import logging
import copy import copy
from sys import maxsize from sys import maxsize
from collections import OrderedDict
import numpy import numpy
import theano import theano
from theano import tensor, scalar from theano import tensor, scalar
from theano.tensor import opt, get_scalar_constant_value, Alloc, AllocEmpty from theano.tensor import opt, get_scalar_constant_value, Alloc, AllocEmpty
from theano import gof from theano import gof
from theano.compat import OrderedDict
from six import integer_types, iteritems from six import integer_types, iteritems
from six.moves import xrange from six.moves import xrange
from theano.compile import optdb from theano.compile import optdb
......
...@@ -18,6 +18,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -18,6 +18,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import copy import copy
import logging import logging
import warnings import warnings
from collections import OrderedDict
import numpy import numpy
...@@ -28,7 +29,6 @@ from six.moves import xrange ...@@ -28,7 +29,6 @@ from six.moves import xrange
from theano.compile.pfunc import rebuild_collect_shared from theano.compile.pfunc import rebuild_collect_shared
from theano import gof, compat from theano import gof, compat
from theano import tensor, scalar from theano import tensor, scalar
from theano.compat import OrderedDict
from theano.tensor.basic import get_scalar_constant_value from theano.tensor.basic import get_scalar_constant_value
......
...@@ -7,6 +7,7 @@ from tempfile import mkdtemp ...@@ -7,6 +7,7 @@ from tempfile import mkdtemp
import time import time
import unittest import unittest
import copy import copy
from collections import OrderedDict
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
from six.moves import xrange from six.moves import xrange
...@@ -23,7 +24,7 @@ from theano.compile.pfunc import rebuild_collect_shared ...@@ -23,7 +24,7 @@ from theano.compile.pfunc import rebuild_collect_shared
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
import theano.scalar.sharedvar import theano.scalar.sharedvar
from theano.scan_module.scan_op import Scan from theano.scan_module.scan_op import Scan
from theano.compat import PY3, OrderedDict from theano.compat import PY3
from theano.tests.unittest_tools import attr from theano.tests.unittest_tools import attr
......
...@@ -7,11 +7,11 @@ from __future__ import absolute_import, print_function, division ...@@ -7,11 +7,11 @@ from __future__ import absolute_import, print_function, division
__docformat__ = 'restructedtext en' __docformat__ = 'restructedtext en'
from collections import OrderedDict
import numpy import numpy
import theano import theano
import theano.tensor as T import theano.tensor as T
from theano.compat import OrderedDict
def gen_data(): def gen_data():
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
from theano.tests.record import RecordMode, Record from theano.tests.record import RecordMode, Record
from theano.compat import OrderedDict
from theano.tests import disturb_mem from theano.tests import disturb_mem
import numpy as np import numpy as np
import theano import theano
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from collections import OrderedDict
# #
# UNIT TEST # UNIT TEST
# #
...@@ -9,7 +10,7 @@ from six.moves import xrange ...@@ -9,7 +10,7 @@ from six.moves import xrange
import theano import theano
from theano import gof from theano import gof
from theano.compat import OrderedDict, izip from theano.compat import izip
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
from theano import gradient from theano import gradient
......
...@@ -13,9 +13,9 @@ The config option is in configdefaults.py ...@@ -13,9 +13,9 @@ The config option is in configdefaults.py
This note is written by Li Yao. This note is written by Li Yao.
""" """
from collections import OrderedDict
import numpy import numpy
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
from theano.compat import OrderedDict
import theano import theano
import theano.tensor as T import theano.tensor as T
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from theano.compat import OrderedDict from collections import OrderedDict
from six import iteritems from six import iteritems
from theano.compile.sharedvalue import SharedVariable from theano.compile.sharedvalue import SharedVariable
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论