Skip to content

Commit

Permalink
Update sqlalchemy stubs (#857)
Browse files Browse the repository at this point in the history
I believe this covers both #647 and #719.

Moved sqlalchemy stubs from 2 to 2and3;
changed sqlalchemy/util/compat.pyi:37 to be of type typing.Text;
added incomplete stubs for sqlalchemy.orm.utils and slqalchemy.sql.elements.ColumnElement.
  • Loading branch information
WouldYouKindly authored and gvanrossum committed Jan 23, 2017
1 parent c5ffe4f commit ccdc609
Show file tree
Hide file tree
Showing 39 changed files with 56 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Stubs for sqlalchemy.orm (Python 2)
# Stubs for sqlalchemy.orm (Python 2 and 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
# from . import mapper
# from . import interfaces
# from . import deprecated_interfaces
# from . import util
from . import util
# from . import properties
# from . import relationships
# from . import descriptor_props
Expand All @@ -27,7 +27,7 @@ from ..util import langhelpers
# MapperExtension = deprecated_interfaces.MapperExtension
# SessionExtension = deprecated_interfaces.SessionExtension
# AttributeExtension = deprecated_interfaces.AttributeExtension
# aliased = util.aliased
aliased = util.aliased
# join = util.join
# object_mapper = util.object_mapper
# outerjoin = util.outerjoin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stubs for sqlalchemy.orm.session (Python 2)
# Stubs for sqlalchemy.orm.session (Python 2 and 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

Expand Down
12 changes: 12 additions & 0 deletions third_party/2and3/sqlalchemy/orm/util.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Stubs for sqlalchemy.orm.session (Python 2 and 3)
from typing import Optional, Any, Text

from ..sql.selectable import FromClause

class AliasedClass(object):
def __init__(self, cls: Any, alias: Optional[FromClause] =None, name: Optional[Text] =None, flat: bool =False, adapt_on_names: bool =False,
with_polymorphic_mappers: Any =(), with_polymorphic_discriminator: Any =None, base_alias: Any =None, use_mapper_path: bool =False) -> None: ...
def __getattr__(self, key): ...
def __repr__(self): ...

def aliased(element: Any, alias: Optional[FromClause] =None, name: Optional[Text] =None, flat: bool =False, adapt_on_names: bool =False) -> AliasedClass: ...
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Stubs for sqlalchemy.sql.elements (Python 2 and 3)
from typing import Text, Any

from .visitors import Visitable
from .annotation import Annotated
Expand All @@ -7,7 +9,38 @@ from .. import util

class ClauseElement(Visitable): ...

class ColumnElement(ColumnOperators, ClauseElement): ...
class ColumnElement(ColumnOperators, ClauseElement):
__visit_name__ = 'column' # type: Text
primary_key = False # type: Any
foreign_keys = [] # type: Any
_label = None
_key_label = key = None
_alt_names = ()
def self_group(self, against=None): ...
def _negate(self): ...
@util.memoized_property
def type(self): ...
@util.memoized_property
def comparator(self): ...
def __getattr__(self, key): ...
def operate(self, op, *other, **kwargs): ...
def reverse_operate(self, op, other, **kwargs): ...
def _bind_param(self, operator, obj): ...
@property
def expression(self): ...
@property
def _select_iterable(self): ...
@util.memoized_property
def base_columns(self): ...
@util.memoized_property
def proxy_set(self): ...
def shares_lineage(self, othercolumn): ...
def _compare_name_for_result(self, other): ...
def _make_proxy(self, selectable, name=None, name_is_truncatable=False, **kw): ...
def compare(self, other, use_proxies=False, equivalents=None, **kw): ...
def label(self, name): ...
@util.memoized_property
def anon_label(self): ...

class BindParameter(ColumnElement): ...
class BinaryExpression(ColumnElement): ...
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from .base import Immutable, Executable, \
ColumnCollection, ColumnSet, Generative
from .elements import ClauseElement, TextClause, ClauseList, \
Expand Down Expand Up @@ -35,9 +37,9 @@ class FromClause(Selectable):
@property
def columns(self): ...
@property
def primary_key(self): ...
def primary_key(self) -> Any: ...
@property
def foreign_keys(self): ...
def foreign_keys(self) -> Any: ...
def _init_collections(self): ...
@property
def _cols_populated(self): ...
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stubs for sqlalchemy.util.compat (Python 2)

from typing import Any
from typing import Any, Text
from collections import namedtuple

import threading
Expand Down Expand Up @@ -34,7 +34,7 @@ def inspect_getargspec(func): ...

string_types = ... # type: Any
binary_type = ... # type: Any
text_type = unicode
text_type = Text
int_types = ... # type: Any

def callable(fn): ...
Expand Down

0 comments on commit ccdc609

Please sign in to comment.