summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/annotation.py
diff options
context:
space:
mode:
authorBrian Jarrett <celttechie@gmail.com>2014-07-11 11:02:05 -0600
committerBrian Jarrett <celttechie@gmail.com>2014-07-12 11:58:39 -0600
commit7cd01e3a51dc83ff6b87070cf8b1459b1cbc2fa0 (patch)
tree29c6620368ed998798312ea9f46cb87a6e9a8a5e /lib/sqlalchemy/sql/annotation.py
parent600e6bfb3fa261b98b1ae7237080c8f5e757d09a (diff)
downloadsqlalchemy-7cd01e3a51dc83ff6b87070cf8b1459b1cbc2fa0.tar.gz
Style fixes for sql package
Diffstat (limited to 'lib/sqlalchemy/sql/annotation.py')
-rw-r--r--lib/sqlalchemy/sql/annotation.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py
index 380624a9b..1f24a2331 100644
--- a/lib/sqlalchemy/sql/annotation.py
+++ b/lib/sqlalchemy/sql/annotation.py
@@ -13,6 +13,7 @@ copies of SQL constructs which contain context-specific markers and associations
from .. import util
from . import operators
+
class Annotated(object):
"""clones a ClauseElement and applies an 'annotations' dictionary.
@@ -93,14 +94,12 @@ class Annotated(object):
return hash(other) == hash(self)
-
# hard-generate Annotated subclasses. this technique
# is used instead of on-the-fly types (i.e. type.__new__())
# so that the resulting objects are pickleable.
annotated_classes = {}
-
def _deep_annotate(element, annotations, exclude=None):
"""Deep copy the given ClauseElement, annotating each element
with the given annotations dictionary.
@@ -110,8 +109,8 @@ def _deep_annotate(element, annotations, exclude=None):
"""
def clone(elem):
if exclude and \
- hasattr(elem, 'proxy_set') and \
- elem.proxy_set.intersection(exclude):
+ hasattr(elem, 'proxy_set') and \
+ elem.proxy_set.intersection(exclude):
newelem = elem._clone()
elif annotations != elem._annotations:
newelem = elem._annotate(annotations)
@@ -163,6 +162,7 @@ def _shallow_annotate(element, annotations):
element._copy_internals()
return element
+
def _new_annotation_type(cls, base_cls):
if issubclass(cls, Annotated):
return cls
@@ -178,11 +178,12 @@ def _new_annotation_type(cls, base_cls):
break
annotated_classes[cls] = anno_cls = type(
- "Annotated%s" % cls.__name__,
- (base_cls, cls), {})
+ "Annotated%s" % cls.__name__,
+ (base_cls, cls), {})
globals()["Annotated%s" % cls.__name__] = anno_cls
return anno_cls
+
def _prepare_annotations(target_hierarchy, base_cls):
stack = [target_hierarchy]
while stack: