summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/ext/declarative/clsregistry.py10
-rw-r--r--lib/sqlalchemy/orm/interfaces.py2
-rw-r--r--lib/sqlalchemy/orm/strategies.py23
-rw-r--r--lib/sqlalchemy/sql/visitors.py1
4 files changed, 36 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative/clsregistry.py b/lib/sqlalchemy/ext/declarative/clsregistry.py
index 3ef63a5ae..d2a09d823 100644
--- a/lib/sqlalchemy/ext/declarative/clsregistry.py
+++ b/lib/sqlalchemy/ext/declarative/clsregistry.py
@@ -71,6 +71,8 @@ class _MultipleClassMarker(object):
"""
+ __slots__ = 'on_remove', 'contents', '__weakref__'
+
def __init__(self, classes, on_remove=None):
self.on_remove = on_remove
self.contents = set([
@@ -127,6 +129,8 @@ class _ModuleMarker(object):
"""
+ __slots__ = 'parent', 'name', 'contents', 'mod_ns', 'path', '__weakref__'
+
def __init__(self, name, parent):
self.parent = parent
self.name = name
@@ -172,6 +176,8 @@ class _ModuleMarker(object):
class _ModNS(object):
+ __slots__ = '__parent',
+
def __init__(self, parent):
self.__parent = parent
@@ -193,6 +199,8 @@ class _ModNS(object):
class _GetColumns(object):
+ __slots__ = 'cls',
+
def __init__(self, cls):
self.cls = cls
@@ -221,6 +229,8 @@ inspection._inspects(_GetColumns)(
class _GetTable(object):
+ __slots__ = 'key', 'metadata'
+
def __init__(self, key, metadata):
self.key = key
self.metadata = metadata
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index bff73258c..68b86268c 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -560,6 +560,8 @@ class LoaderStrategy(object):
"""
+ __slots__ = 'parent_property', 'is_class_level', 'parent', 'key'
+
def __init__(self, parent):
self.parent_property = parent
self.is_class_level = False
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index d95f17f64..4e47a8f24 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -105,6 +105,8 @@ class UninstrumentedColumnLoader(LoaderStrategy):
if the argument is against the with_polymorphic selectable.
"""
+ __slots__ = 'columns',
+
def __init__(self, parent):
super(UninstrumentedColumnLoader, self).__init__(parent)
self.columns = self.parent_property.columns
@@ -128,6 +130,8 @@ class UninstrumentedColumnLoader(LoaderStrategy):
class ColumnLoader(LoaderStrategy):
"""Provide loading behavior for a :class:`.ColumnProperty`."""
+ __slots__ = 'columns', 'is_composite'
+
def __init__(self, parent):
super(ColumnLoader, self).__init__(parent)
self.columns = self.parent_property.columns
@@ -176,6 +180,8 @@ class ColumnLoader(LoaderStrategy):
class DeferredColumnLoader(LoaderStrategy):
"""Provide loading behavior for a deferred :class:`.ColumnProperty`."""
+ __slots__ = 'columns', 'group'
+
def __init__(self, parent):
super(DeferredColumnLoader, self).__init__(parent)
if hasattr(self.parent_property, 'composite_class'):
@@ -300,6 +306,8 @@ class LoadDeferredColumns(object):
class AbstractRelationshipLoader(LoaderStrategy):
"""LoaderStratgies which deal with related objects."""
+ __slots__ = 'mapper', 'target', 'uselist'
+
def __init__(self, parent):
super(AbstractRelationshipLoader, self).__init__(parent)
self.mapper = self.parent_property.mapper
@@ -316,6 +324,8 @@ class NoLoader(AbstractRelationshipLoader):
"""
+ __slots__ = ()
+
def init_class_attribute(self, mapper):
self.is_class_level = True
@@ -343,6 +353,10 @@ class LazyLoader(AbstractRelationshipLoader):
"""
+ __slots__ = (
+ '_lazywhere', '_rev_lazywhere', 'use_get', '_bind_to_col',
+ '_equated_columns', '_rev_bind_to_col', '_rev_equated_columns')
+
def __init__(self, parent):
super(LazyLoader, self).__init__(parent)
join_condition = self.parent_property._join_condition
@@ -647,6 +661,8 @@ class LazyLoader(AbstractRelationshipLoader):
class LoadLazyAttribute(object):
"""serializable loader object used by LazyLoader"""
+ __slots__ = 'key',
+
def __init__(self, key):
self.key = key
@@ -661,6 +677,8 @@ class LoadLazyAttribute(object):
@properties.RelationshipProperty.strategy_for(lazy="immediate")
class ImmediateLoader(AbstractRelationshipLoader):
+ __slots__ = ()
+
def init_class_attribute(self, mapper):
self.parent_property.\
_get_strategy_by_cls(LazyLoader).\
@@ -684,6 +702,8 @@ class ImmediateLoader(AbstractRelationshipLoader):
@log.class_logger
@properties.RelationshipProperty.strategy_for(lazy="subquery")
class SubqueryLoader(AbstractRelationshipLoader):
+ __slots__ = 'join_depth',
+
def __init__(self, parent):
super(SubqueryLoader, self).__init__(parent)
self.join_depth = self.parent_property.join_depth
@@ -1069,6 +1089,9 @@ class JoinedLoader(AbstractRelationshipLoader):
using joined eager loading.
"""
+
+ __slots__ = 'join_depth',
+
def __init__(self, parent):
super(JoinedLoader, self).__init__(parent)
self.join_depth = self.parent_property.join_depth
diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py
index bb525744a..d09b82148 100644
--- a/lib/sqlalchemy/sql/visitors.py
+++ b/lib/sqlalchemy/sql/visitors.py
@@ -51,6 +51,7 @@ class VisitableType(type):
Classes having no __visit_name__ attribute will remain unaffected.
"""
+
def __init__(cls, clsname, bases, clsdict):
if clsname != 'Visitable' and \
hasattr(cls, '__visit_name__'):