Update sqlalchemy stubs (#857)

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.
This commit is contained in:
Alexey
2017-01-24 02:56:30 +03:00
committed by Guido van Rossum
parent c5ffe4f1d9
commit ccdc609706
39 changed files with 56 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# Stubs for sqlalchemy.orm (Python 2)
# Stubs for sqlalchemy.orm (Python 2 and 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
@@ -6,7 +6,7 @@ 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
@@ -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

View File

@@ -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.

View File

@@ -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: ...

View File

@@ -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
@@ -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): ...

View File

@@ -1,3 +1,5 @@
from typing import Any
from .base import Immutable, Executable, \
ColumnCollection, ColumnSet, Generative
from .elements import ClauseElement, TextClause, ClauseList, \
@@ -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): ...

View File

@@ -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
@@ -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): ...