diff options
| author | Brian Jarrett <celttechie@gmail.com> | 2014-07-11 11:02:05 -0600 |
|---|---|---|
| committer | Brian Jarrett <celttechie@gmail.com> | 2014-07-12 11:58:39 -0600 |
| commit | 7cd01e3a51dc83ff6b87070cf8b1459b1cbc2fa0 (patch) | |
| tree | 29c6620368ed998798312ea9f46cb87a6e9a8a5e /lib/sqlalchemy/sql/annotation.py | |
| parent | 600e6bfb3fa261b98b1ae7237080c8f5e757d09a (diff) | |
| download | sqlalchemy-7cd01e3a51dc83ff6b87070cf8b1459b1cbc2fa0.tar.gz | |
Style fixes for sql package
Diffstat (limited to 'lib/sqlalchemy/sql/annotation.py')
| -rw-r--r-- | lib/sqlalchemy/sql/annotation.py | 13 |
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: |
