remove a few superfluous imports

This commit is contained in:
Mike Bayer
2010-04-29 14:10:28 -04:00
parent 74a8723df3
commit 559ba7a2aa
4 changed files with 13 additions and 16 deletions
-1
View File
@@ -1616,7 +1616,6 @@ def _state_session(state):
return None
# Lazy initialization to avoid circular imports
unitofwork.object_session = object_session
unitofwork._state_session = _state_session
from sqlalchemy.orm import mapper
mapper._expire_state = _expire_state
+11 -10
View File
@@ -34,8 +34,8 @@ from sqlalchemy.sql import operators
from sqlalchemy.sql.visitors import Visitable, cloned_traverse
import operator
functions, schema, sql_util, sqltypes = None, None, None, None
DefaultDialect, ClauseAdapter, Annotated = None, None, None
functions, sql_util, sqltypes = None, None, None
DefaultDialect = None
__all__ = [
'Alias', 'ClauseElement',
@@ -1075,10 +1075,10 @@ class ClauseElement(Visitable):
dictionary.
"""
global Annotated
if Annotated is None:
from sqlalchemy.sql.util import Annotated
return Annotated(self, values)
global sql_util
if sql_util is None:
from sqlalchemy.sql import util as sql_util
return sql_util.Annotated(self, values)
def _deannotate(self):
"""return a copy of this ClauseElement with an empty annotations
@@ -1973,10 +1973,11 @@ class FromClause(Selectable):
object, returning a copy of this :class:`FromClause`.
"""
global ClauseAdapter
if ClauseAdapter is None:
from sqlalchemy.sql.util import ClauseAdapter
return ClauseAdapter(alias).traverse(self)
global sql_util
if sql_util is None:
from sqlalchemy.sql import util as sql_util
return sql_util.ClauseAdapter(alias).traverse(self)
def correspond_on_equivalents(self, column, equivalents):
"""Return corresponding_column for the given column, or if None
-1
View File
@@ -288,7 +288,6 @@ class Annotated(object):
# so that the resulting objects are pickleable.
annotated_classes = {}
from sqlalchemy.sql import expression
for cls in expression.__dict__.values() + [schema.Column, schema.Table]:
if isinstance(cls, type) and issubclass(cls, expression.ClauseElement):
exec "class Annotated%s(Annotated, cls):\n" \
+2 -4
View File
@@ -1285,9 +1285,8 @@ class SchemaType(object):
def create(self, bind=None, checkfirst=False):
"""Issue CREATE ddl for this type, if applicable."""
from sqlalchemy.schema import _bind_or_error
if bind is None:
bind = _bind_or_error(self)
bind = schema._bind_or_error(self)
t = self.dialect_impl(bind.dialect)
if t is not self and isinstance(t, SchemaType):
t.create(bind=bind, checkfirst=checkfirst)
@@ -1295,9 +1294,8 @@ class SchemaType(object):
def drop(self, bind=None, checkfirst=False):
"""Issue DROP ddl for this type, if applicable."""
from sqlalchemy.schema import _bind_or_error
if bind is None:
bind = _bind_or_error(self)
bind = schema._bind_or_error(self)
t = self.dialect_impl(bind.dialect)
if t is not self and isinstance(t, SchemaType):
t.drop(bind=bind, checkfirst=checkfirst)