Commits

jason kirtland  committed 50a74ab

Removed unused imports, other import adjustments per pyflakes

  • Participants
  • Parent commits b063446

Comments (0)

Files changed (9)

File lib/sqlalchemy/databases/access.py

 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-import sys, string, re, datetime, random
-from sqlalchemy import sql, engine, schema, ansisql, types, exceptions, pool
+import random
+from sqlalchemy import sql, schema, ansisql, types, exceptions, pool
 import sqlalchemy.engine.default as default
 
 
         super(AccessExecutionContext, self).post_exec()
 
 
+const, daoEngine = None, None
 class AccessDialect(ansisql.ANSIDialect):
     colspecs = {
         types.Unicode : AcUnicode,
         win32com.client.gencache.EnsureModule('{00025E01-0000-0000-C000-000000000046}', 0, 5, 0)
 
         global const, daoEngine
-        const = win32com.client.constants
-        daoEngine = win32com.client.Dispatch('DAO.DBEngine.36')
+        if const is None:
+            const = win32com.client.constants
+            daoEngine = win32com.client.Dispatch('DAO.DBEngine.36')
 
         import pyodbc as module
         return module

File lib/sqlalchemy/engine/__init__.py

         
 """
 
-from sqlalchemy import databases
+import sqlalchemy.databases
 from sqlalchemy.engine.base import *
 from sqlalchemy.engine import strategies
 

File lib/sqlalchemy/engine/base.py

 execution and result contexts."""
 
 from sqlalchemy import exceptions, sql, schema, util, types, logging
-import StringIO, sys, re, random
+import StringIO, sys
 
 
 class Dialect(object):

File lib/sqlalchemy/engine/default.py

 
 """Provide default implementations of per-dialect sqlalchemy.engine classes"""
 
-from sqlalchemy import schema, exceptions, sql, types, util
-import sys, re, random
+from sqlalchemy import schema, exceptions, sql, util
+import re, random
 from sqlalchemy.engine import base
 
 

File lib/sqlalchemy/orm/dynamic.py

 from sqlalchemy import exceptions
 from sqlalchemy.orm import attributes, object_session
 from sqlalchemy.orm.query import Query
-from sqlalchemy.orm.mapper import has_identity
+from sqlalchemy.orm.mapper import has_identity, object_mapper
 
 class DynamicCollectionAttribute(attributes.InstrumentedAttribute):
     def __init__(self, class_, attribute_manager, key, typecallable, target_mapper, **kwargs):
             sess = object_session(self.instance)
             if sess is None:
                 try:
-                    sess = mapper.object_mapper(instance).get_session()
+                    sess = object_mapper(self.instance).get_session()
                 except exceptions.InvalidRequestError:
-                    raise exceptions.InvalidRequestError("Parent instance %s is not bound to a Session, and no contextual session is established; lazy load operation of attribute '%s' cannot proceed" % (instance.__class__, self.key))
+                    raise exceptions.InvalidRequestError("Parent instance %s is not bound to a Session, and no contextual session is established; lazy load operation of attribute '%s' cannot proceed" % (self.instance.__class__, self.key))
 
         return sess.query(self.attr.target_mapper).with_parent(self.instance)
 

File lib/sqlalchemy/orm/mapper.py

 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
+import weakref, warnings, operator
 from sqlalchemy import sql, util, exceptions, logging
 from sqlalchemy import sql_util as sqlutil
 from sqlalchemy.orm import util as mapperutil
 from sqlalchemy.orm.util import ExtensionCarrier
 from sqlalchemy.orm import sync
 from sqlalchemy.orm.interfaces import MapperProperty, EXT_CONTINUE, MapperExtension, SynonymProperty
-import weakref, warnings, operator
+deferred_load = None
 
 __all__ = ['Mapper', 'class_mapper', 'object_mapper', 'mapper_registry']
 

File lib/sqlalchemy/orm/scoping.py

-from sqlalchemy.util import ScopedRegistry, warn_deprecated, to_list
-from sqlalchemy.orm import MapperExtension, EXT_CONTINUE
+from sqlalchemy.util import ScopedRegistry, to_list
+from sqlalchemy.orm import MapperExtension, EXT_CONTINUE, object_session
 from sqlalchemy.orm.session import Session
-from sqlalchemy.orm.mapper import global_extensions
 from sqlalchemy import exceptions
 import types
 

File lib/sqlalchemy/orm/session.py

 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-import weakref, types
-
+import weakref
 from sqlalchemy import util, exceptions, sql, engine
-from sqlalchemy.orm import unitofwork, query, util as mapperutil, MapperExtension, EXT_CONTINUE
+from sqlalchemy.orm import unitofwork, query, util as mapperutil
 from sqlalchemy.orm.mapper import object_mapper as _object_mapper
 from sqlalchemy.orm.mapper import class_mapper as _class_mapper
-from sqlalchemy.orm.mapper import global_extensions
+
 
 __all__ = ['Session', 'SessionTransaction']
 

File lib/sqlalchemy/orm/shard.py

 from sqlalchemy.orm.session import Session
 from sqlalchemy.orm.query import Query
+from sqlalchemy import exceptions
 
 __all__ = ['ShardedSession', 'ShardedQuery']