Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sqlalchemy stubs #857

Merged
merged 5 commits into from
Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ...
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 = ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed variable annotations above are failing mypy's own tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess I'll just annotate them with Any for now... I'll submit a PR in a few days.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already did, no worries! Just keep this in mind for future PRs.

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