From 123b3cb2ea31089803ae54230253e90ea94be1df Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 27 Jan 2016 19:13:51 -0800 Subject: [PATCH] Fix and greatly expand stubs for sqlalchemy. This probably still needs a lot more work to be perfect; in particular I'm not sure exactly which parts should be re-exported from sqlalchemy/__init__.pyi and sqlalchemy/sql/__init__.pyi, but this works with all the ways I can test it easily right now. Also, while I've fixed sqlalchemy.sql, sqlalchemy.orm is still totally broken since it tries to re-export tons of stuff that doesn't have stubs yet. --- third_party/2.7/sqlalchemy/__init__.pyi | 231 +++++++++--------- third_party/2.7/sqlalchemy/log.pyi | 14 ++ third_party/2.7/sqlalchemy/orm/__init__.pyi | 1 - third_party/2.7/sqlalchemy/pool.pyi | 13 +- third_party/2.7/sqlalchemy/schema.pyi | 5 +- third_party/2.7/sqlalchemy/sql/annotation.pyi | 11 + third_party/2.7/sqlalchemy/sql/base.pyi | 42 ++++ third_party/2.7/sqlalchemy/sql/ddl.pyi | 25 ++ third_party/2.7/sqlalchemy/sql/dml.pyi | 20 ++ third_party/2.7/sqlalchemy/sql/elements.pyi | 60 +++++ third_party/2.7/sqlalchemy/sql/expression.pyi | 72 ++++-- third_party/2.7/sqlalchemy/sql/functions.pyi | 47 ++++ third_party/2.7/sqlalchemy/sql/naming.pyi | 1 + third_party/2.7/sqlalchemy/sql/operators.pyi | 99 ++++++++ third_party/2.7/sqlalchemy/sql/schema.pyi | 36 +++ third_party/2.7/sqlalchemy/sql/selectable.pyi | 60 +++++ third_party/2.7/sqlalchemy/sql/sqltypes.pyi | 51 ++++ third_party/2.7/sqlalchemy/sql/type_api.pyi | 9 + .../2.7/sqlalchemy/util/_collections.pyi | 8 +- third_party/2.7/sqlalchemy/util/compat.pyi | 34 ++- .../2.7/sqlalchemy/util/langhelpers.pyi | 5 +- 21 files changed, 675 insertions(+), 169 deletions(-) create mode 100644 third_party/2.7/sqlalchemy/log.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/annotation.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/base.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/ddl.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/dml.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/elements.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/functions.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/naming.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/operators.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/schema.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/selectable.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/sqltypes.pyi create mode 100644 third_party/2.7/sqlalchemy/sql/type_api.pyi diff --git a/third_party/2.7/sqlalchemy/__init__.pyi b/third_party/2.7/sqlalchemy/__init__.pyi index 199904407..717082c18 100644 --- a/third_party/2.7/sqlalchemy/__init__.pyi +++ b/third_party/2.7/sqlalchemy/__init__.pyi @@ -1,113 +1,124 @@ # Stubs for sqlalchemy (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. -from sqlalchemy import sql -from sqlalchemy import types -from sqlalchemy import schema -from sqlalchemy import inspection -from sqlalchemy import engine +from .sql import ( + alias, + and_, + asc, + between, + bindparam, + case, + cast, + collate, + column, + delete, + desc, + distinct, + except_, + except_all, + exists, + extract, + false, + func, + funcfilter, + insert, + intersect, + intersect_all, + join, + literal, + literal_column, + modifier, + not_, + null, + or_, + outerjoin, + outparam, + over, + select, + subquery, + table, + text, + true, + tuple_, + type_coerce, + union, + union_all, + update, + ) -alias = sql.alias -and_ = sql.and_ -asc = sql.asc -between = sql.between -bindparam = sql.bindparam -case = sql.case -cast = sql.cast -collate = sql.collate -column = sql.column -delete = sql.delete -desc = sql.desc -distinct = sql.distinct -except_ = sql.except_ -except_all = sql.except_all -exists = sql.exists -extract = sql.extract -false = sql.false -func = sql.func -funcfilter = sql.funcfilter -insert = sql.insert -intersect = sql.intersect -intersect_all = sql.intersect_all -join = sql.join -literal = sql.literal -literal_column = sql.literal_column -modifier = sql.modifier -not_ = sql.not_ -null = sql.null -or_ = sql.or_ -outerjoin = sql.outerjoin -outparam = sql.outparam -over = sql.over -select = sql.select -subquery = sql.subquery -table = sql.table -text = sql.text -true = sql.true -tuple_ = sql.tuple_ -type_coerce = sql.type_coerce -union = sql.union -union_all = sql.union_all -update = sql.update -BIGINT = types.BIGINT -BINARY = types.BINARY -BLOB = types.BLOB -BOOLEAN = types.BOOLEAN -BigInteger = types.BigInteger -Binary = types.Binary -Boolean = types.Boolean -CHAR = types.CHAR -CLOB = types.CLOB -DATE = types.DATE -DATETIME = types.DATETIME -DECIMAL = types.DECIMAL -Date = types.Date -DateTime = types.DateTime -Enum = types.Enum -FLOAT = types.FLOAT -Float = types.Float -INT = types.INT -INTEGER = types.INTEGER -Integer = types.Integer -Interval = types.Interval -LargeBinary = types.LargeBinary -NCHAR = types.NCHAR -NVARCHAR = types.NVARCHAR -NUMERIC = types.NUMERIC -Numeric = types.Numeric -PickleType = types.PickleType -REAL = types.REAL -SMALLINT = types.SMALLINT -SmallInteger = types.SmallInteger -String = types.String -TEXT = types.TEXT -TIME = types.TIME -TIMESTAMP = types.TIMESTAMP -Text = types.Text -Time = types.Time -TypeDecorator = types.TypeDecorator -Unicode = types.Unicode -UnicodeText = types.UnicodeText -VARBINARY = types.VARBINARY -VARCHAR = types.VARCHAR -CheckConstraint = schema.CheckConstraint -Column = schema.Column -ColumnDefault = schema.ColumnDefault -Constraint = schema.Constraint -DefaultClause = schema.DefaultClause -FetchedValue = schema.FetchedValue -ForeignKey = schema.ForeignKey -ForeignKeyConstraint = schema.ForeignKeyConstraint -Index = schema.Index -MetaData = schema.MetaData -PassiveDefault = schema.PassiveDefault -PrimaryKeyConstraint = schema.PrimaryKeyConstraint -Sequence = schema.Sequence -Table = schema.Table -ThreadLocalMetaData = schema.ThreadLocalMetaData -UniqueConstraint = schema.UniqueConstraint -DDL = schema.DDL -inspect = inspection.inspect -create_engine = engine.create_engine -engine_from_config = engine.engine_from_config +from .types import ( + BIGINT, + BINARY, + BLOB, + BOOLEAN, + BigInteger, + Binary, + Boolean, + CHAR, + CLOB, + DATE, + DATETIME, + DECIMAL, + Date, + DateTime, + Enum, + FLOAT, + Float, + INT, + INTEGER, + Integer, + Interval, + LargeBinary, + NCHAR, + NVARCHAR, + NUMERIC, + Numeric, + PickleType, + REAL, + SMALLINT, + SmallInteger, + String, + TEXT, + TIME, + TIMESTAMP, + Text, + Time, + TypeDecorator, + Unicode, + UnicodeText, + VARBINARY, + VARCHAR, + ) + +from .schema import ( + CheckConstraint, + Column, + ColumnDefault, + Constraint, + DefaultClause, + FetchedValue, + ForeignKey, + ForeignKeyConstraint, + Index, + MetaData, + PassiveDefault, + PrimaryKeyConstraint, + Sequence, + Table, + ThreadLocalMetaData, + UniqueConstraint, + DDL, +) + +from . import sql as sql +from . import schema as schema +from . import types as types +from . import exc as exc +from . import dialects as dialects +from . import pool as pool +# This should re-export orm but orm is totally broken right now +# from . import orm as orm + +from .inspection import inspect +from .engine import create_engine, engine_from_config + +__version__ = ... # type: int diff --git a/third_party/2.7/sqlalchemy/log.pyi b/third_party/2.7/sqlalchemy/log.pyi new file mode 100644 index 000000000..8a5b3bf18 --- /dev/null +++ b/third_party/2.7/sqlalchemy/log.pyi @@ -0,0 +1,14 @@ +import logging +from typing import Any + +rootlogger = ... # type: Any + +class Identified(object): + def _should_log_debug(self) -> bool: ... + def _should_log_info(self) -> bool: ... + +class InstanceLogger(object): ... + +def instance_logger(instance, echoflag) -> None: ... + +class echo_property(object): ... diff --git a/third_party/2.7/sqlalchemy/orm/__init__.pyi b/third_party/2.7/sqlalchemy/orm/__init__.pyi index e4f863e9a..5a7670396 100644 --- a/third_party/2.7/sqlalchemy/orm/__init__.pyi +++ b/third_party/2.7/sqlalchemy/orm/__init__.pyi @@ -66,7 +66,6 @@ composite = ... # type: Any def backref(name, **kwargs): ... def deferred(*columns, **kw): ... -mapper = ... # type: Any synonym = ... # type: Any comparable_property = ... # type: Any diff --git a/third_party/2.7/sqlalchemy/pool.pyi b/third_party/2.7/sqlalchemy/pool.pyi index 702b8ef5d..7161dc56c 100644 --- a/third_party/2.7/sqlalchemy/pool.pyi +++ b/third_party/2.7/sqlalchemy/pool.pyi @@ -3,7 +3,7 @@ # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any -import log +from . import log from . import util threading = util.threading @@ -35,6 +35,16 @@ class Pool(log.Identified): def connect(self): ... def status(self): ... + _threadconns = ... # type: Any + _creator = ... # type: Any + _recycle = ... # type: Any + _invalidate_time = ... # type: Any + dispatch = ... # type: Any + _dialect = ... # type: Any + _orig_logging_name = ... # type: Any + _reset_on_return = ... # type: Any + _use_threadlocal = ... # type: Any + class _ConnectionRecord: connection = ... # type: Any finalize_callback = ... # type: Any @@ -57,7 +67,6 @@ class _ConnectionFairy: def invalidate(self, e=..., soft=...): ... def cursor(self, *args, **kwargs): ... def __getattr__(self, key): ... - info = ... # type: Any def detach(self): ... def close(self): ... diff --git a/third_party/2.7/sqlalchemy/schema.pyi b/third_party/2.7/sqlalchemy/schema.pyi index c70a221f2..f78889733 100644 --- a/third_party/2.7/sqlalchemy/schema.pyi +++ b/third_party/2.7/sqlalchemy/schema.pyi @@ -1,11 +1,10 @@ # Stubs for sqlalchemy.schema (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. from .sql import base from .sql import schema from .sql import naming from .sql import ddl +from .sql import elements SchemaVisitor = base.SchemaVisitor CheckConstraint = schema.CheckConstraint @@ -29,7 +28,7 @@ UniqueConstraint = schema.UniqueConstraint _get_table_key = schema._get_table_key ColumnCollectionConstraint = schema.ColumnCollectionConstraint ColumnCollectionMixin = schema.ColumnCollectionMixin -conv = naming.conv +conv = elements.conv DDL = ddl.DDL CreateTable = ddl.CreateTable DropTable = ddl.DropTable diff --git a/third_party/2.7/sqlalchemy/sql/annotation.pyi b/third_party/2.7/sqlalchemy/sql/annotation.pyi new file mode 100644 index 000000000..ba0aba437 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/annotation.pyi @@ -0,0 +1,11 @@ +class Annotated(object): + def __new__(cls, *args): ... + def __init__(self, element, values): ... + def _annotate(self, values): ... + def _with_annotations(self, values): ... + def _deannotate(self, values=..., clone: bool=...): ... + def _compiler_dispatch(self, visitor, **kw): ... + def _constructor(self): ... + def _clone(self): ... + def __hash__(self): ... + def __eq__(self): ... diff --git a/third_party/2.7/sqlalchemy/sql/base.pyi b/third_party/2.7/sqlalchemy/sql/base.pyi new file mode 100644 index 000000000..48e68c70f --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/base.pyi @@ -0,0 +1,42 @@ +from typing import Any, Iterable + +from .visitors import ClauseVisitor +from .. import util + +class Immutable(object): + def unique_params(self, *optionaldict, **kwargs): ... + def params(self, *optionaldict, **kwargs): ... + def _clone(self) -> Immutable: ... + +class DialectKWArgs(object): + def argument_for(cls, dialect_name, argument_name, default): ... + def kwargs(self): ... + def dialect_options(self): ... + +class Generative(object): ... + +class Executable(Generative): + def execution_options(self, **kw): ... + def execute(self, *multiparams, **params): ... + def scalar(self, *multiparams, **params): ... + + @property + def bind(self): ... + +class SchemaEventTarget(object): ... +class SchemaVisitor(ClauseVisitor): ... +class ColumnCollection(util.OrderedProperties): + def replace(self, column): ... + def add(self, column): ... + def clear(self): ... + def remove(self, column): ... + def update(self, iter: Iterable[Any]): ... + def extend(self, iter: Iterable[Any]): ... + def contains_column(self, col): ... + def as_immutable(self): ... + +class ImmutableColumnCollection(util.ImmutableProperties, ColumnCollection): ... + +class ColumnSet(util.ordered_column_set): ... + +def _bind_or_error(schemaitem, msg): ... diff --git a/third_party/2.7/sqlalchemy/sql/ddl.pyi b/third_party/2.7/sqlalchemy/sql/ddl.pyi new file mode 100644 index 000000000..06ac96a8a --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/ddl.pyi @@ -0,0 +1,25 @@ +from .elements import ClauseElement +from .base import Executable, SchemaVisitor + +class _DDLCompiles(ClauseElement): ... +class DDLElement(Executable, _DDLCompiles): ... +class DDL(DDLElement): ... +class _CreateDropBase(DDLElement): ... +class CreateSchema(_CreateDropBase): ... +class DropSchema(_CreateDropBase): ... +class CreateTable(_CreateDropBase): ... +class _DropView(_CreateDropBase): ... +class CreateColumn(_DDLCompiles): ... +class DropTable(_CreateDropBase): ... +class CreateSequence(_CreateDropBase): ... +class DropSequence(_CreateDropBase): ... +class CreateIndex(_CreateDropBase): ... +class DropIndex(_CreateDropBase): ... +class AddConstraint(_CreateDropBase): ... +class DropConstraint(_CreateDropBase): ... +class DDLBase(SchemaVisitor): ... +class SchemaGenerator(DDLBase): ... +class SchemaDropper(DDLBase): ... + +def sort_tables(tables, skip_fn=..., extra_dependencies=...): ... +def sort_tables_and_constraints(tables, filter_fn=..., extra_dependencies=...): ... diff --git a/third_party/2.7/sqlalchemy/sql/dml.pyi b/third_party/2.7/sqlalchemy/sql/dml.pyi new file mode 100644 index 000000000..79cb201d2 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/dml.pyi @@ -0,0 +1,20 @@ +from typing import AnyStr + +from .base import Executable, DialectKWArgs +from .elements import ClauseElement +from .selectable import HasPrefixes + +class UpdateBase(DialectKWArgs, HasPrefixes, Executable, ClauseElement): + def params(self, *arg, **kw): ... + @property + def bind(self): ... + def returning(self, *cols): ... + def with_hint(self, text, selectable=..., dialect_name: AnyStr=...): ... + +class ValuesBase(UpdateBase): + def values(self, *args, **kwargs): ... + def return_defaults(self, *cols): ... + +class Insert(ValuesBase): ... +class Update(ValuesBase): ... +class Delete(UpdateBase): ... diff --git a/third_party/2.7/sqlalchemy/sql/elements.pyi b/third_party/2.7/sqlalchemy/sql/elements.pyi new file mode 100644 index 000000000..e2a8d38b2 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/elements.pyi @@ -0,0 +1,60 @@ + +from .visitors import Visitable +from .annotation import Annotated +from .base import Executable, Immutable +from .operators import ColumnOperators +from .. import util + +class ClauseElement(Visitable): ... + +class ColumnElement(ColumnOperators, ClauseElement): ... + +class BindParameter(ColumnElement): ... +class BinaryExpression(ColumnElement): ... + +class TypeClause(ClauseElement): ... +class TextClause(Executable, ClauseElement): ... + +class Null(ColumnElement): ... +class False_(ColumnElement): ... +class True_(ColumnElement): ... + +class ClauseList(ClauseElement): ... +class BooleanClauseList(ClauseList, ColumnElement): ... +class Tuple(ClauseList, ColumnElement): ... +class Case(ColumnElement): ... +class Cast(ColumnElement): ... +class Extract(ColumnElement): ... +class _label_reference(ColumnElement): ... + +class _textual_label_reference(ColumnElement): ... +class UnaryExpression(ColumnElement): ... +class AsBoolean(UnaryExpression): ... +class Grouping(ColumnElement): ... +class Over(ColumnElement): ... +class FunctionFilter(ColumnElement): ... +class Label(ColumnElement): ... +class ColumnClause(Immutable, ColumnElement): ... +class _IdentifiedClause(Executable, ClauseElement): ... +class SavepointClause(_IdentifiedClause): ... +class RollbackToSavepointClause(_IdentifiedClause): ... +class ReleaseSavepointClause(_IdentifiedClause): ... +class quoted_name(util.MemoizedSlots, util.text_type): ... +class _truncated_label(quoted_name): ... +class conv(_truncated_label): ... +class _defer_name(_truncated_label): ... +class _defer_none_name(_defer_name): ... +class _anonymous_label(_truncated_label): ... +class AnnotatedColumnElement(Annotated): ... + +def _clone(element, **kw): ... +def _type_from_args(args): ... +def _literal_as_binds(element, name, type_=None): ... + +def collate(expression, collation) -> BinaryExpression: ... +def between(expr, lower_bound, upper_bound, symmetric: bool=...): ... +def literal(value, type_=None) -> BindParameter: ... +def outparam(key, type_=None) -> BindParameter: ... +def type_coerce(expression, type_): ... +def not_(clause): ... +def literal_column(text, type_=None): ... diff --git a/third_party/2.7/sqlalchemy/sql/expression.pyi b/third_party/2.7/sqlalchemy/sql/expression.pyi index a415d0771..fd24299ee 100644 --- a/third_party/2.7/sqlalchemy/sql/expression.pyi +++ b/third_party/2.7/sqlalchemy/sql/expression.pyi @@ -1,6 +1,4 @@ # Stubs for sqlalchemy.sql.expression (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any from . import functions @@ -9,30 +7,26 @@ from . import base from . import selectable from . import dml -func = functions.func -modifier = functions.modifier -ClauseElement = elements.ClauseElement -ColumnElement = elements.ColumnElement -not_ = elements.not_ -collate = elements.collate -literal_column = elements.literal_column -between = elements.between -literal = elements.literal -outparam = elements.outparam -type_coerce = elements.type_coerce -ColumnCollection = base.ColumnCollection -Alias = selectable.Alias -Join = selectable.Join -Select = selectable.Select -Selectable = selectable.Selectable -TableClause = selectable.TableClause -CompoundSelect = selectable.CompoundSelect -FromClause = selectable.FromClause -alias = selectable.alias -subquery = selectable.subquery -Insert = dml.Insert -Update = dml.Update -Delete = dml.Delete +func = functions.func # type: functions._FunctionGenerator +modifier = functions.modifier # type: functions._FunctionGenerator + +from .visitors import Visitable + +from .elements import ClauseElement, ColumnElement,\ + BindParameter, UnaryExpression, BooleanClauseList, \ + Label, Cast, Case, ColumnClause, TextClause, Over, Null, \ + True_, False_, BinaryExpression, Tuple, TypeClause, Extract, \ + Grouping, not_, \ + collate, literal_column, between,\ + literal, outparam, type_coerce, ClauseList, FunctionFilter +from .elements import SavepointClause, RollbackToSavepointClause, \ + ReleaseSavepointClause +from .base import ColumnCollection, Generative, Executable +from .selectable import Alias, Join, Select, Selectable, TableClause, \ + CompoundSelect, CTE, FromClause, FromGrouping, SelectBase, \ + alias, GenerativeSelect, \ + subquery, HasPrefixes, HasSuffixes, Exists, ScalarSelect, TextAsFrom +from .dml import Insert, Update, Delete, UpdateBase, ValuesBase and_ = ... # type: Any or_ = ... # type: Any @@ -59,9 +53,35 @@ nullslast = ... # type: Any asc = ... # type: Any desc = ... # type: Any distinct = ... # type: Any +true = ... # type: Any +false = ... # type: Any null = ... # type: Any join = ... # type: Any outerjoin = ... # type: Any insert = ... # type: Any update = ... # type: Any delete = ... # type: Any +funcfilter = ... # type: Any + +# old names for compatibility +_Executable = Executable +_BindParamClause = BindParameter +_Label = Label +_SelectBase = SelectBase +_BinaryExpression = BinaryExpression +_Cast = Cast +_Null = Null +_False = False_ +_True = True_ +_TextClause = TextClause +_UnaryExpression = UnaryExpression +_Case = Case +_Tuple = Tuple +_Over = Over +_Generative = Generative +_TypeClause = TypeClause +_Extract = Extract +_Exists = Exists +_Grouping = Grouping +_FromGrouping = FromGrouping +_ScalarSelect = ScalarSelect diff --git a/third_party/2.7/sqlalchemy/sql/functions.pyi b/third_party/2.7/sqlalchemy/sql/functions.pyi new file mode 100644 index 000000000..4be9907b5 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/functions.pyi @@ -0,0 +1,47 @@ + +from .base import Executable, ColumnCollection +from .elements import ClauseList, Cast, Extract, _literal_as_binds, \ + literal_column, _type_from_args, ColumnElement, _clone,\ + Over, BindParameter, FunctionFilter +from .selectable import FromClause, Select, Alias +from .visitors import VisitableType + +class FunctionElement(Executable, ColumnElement, FromClause): ... + +class _FunctionGenerator(object): + def __init__(self, **opts): ... + def __getattr__(self, name): ... + def __call__(self, *c, **kwargs) -> Function: ... + +func = ... # type: _FunctionGenerator +modifier = ... # type: _FunctionGenerator + +class Function(FunctionElement): ... + +class _GenericMeta(VisitableType): ... +# TODO: Use GenericFunction(util.with_metaclass(_GenericMeta, Function)) +class GenericFunction(_GenericMeta, Function): ... +class next_value(GenericFunction): ... + +class AnsiFunction(GenericFunction): ... +class ReturnTypeFromArgs(GenericFunction): ... + +class coalesce(ReturnTypeFromArgs): ... +class max(ReturnTypeFromArgs): ... +class min(ReturnTypeFromArgs): ... +class sum(ReturnTypeFromArgs): ... +class now(GenericFunction): ... +class concat(GenericFunction): ... + +class char_length(GenericFunction): ... +class random(GenericFunction): ... +class count(GenericFunction): ... +class current_date(AnsiFunction): ... +class current_time(AnsiFunction): ... +class current_timestamp(AnsiFunction): ... +class current_user(AnsiFunction): ... +class localtime(AnsiFunction): ... +class localtimestamp(AnsiFunction): ... +class session_user(AnsiFunction): ... +class sysdate(AnsiFunction): ... +class user(AnsiFunction): ... diff --git a/third_party/2.7/sqlalchemy/sql/naming.pyi b/third_party/2.7/sqlalchemy/sql/naming.pyi new file mode 100644 index 000000000..d9172c480 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/naming.pyi @@ -0,0 +1 @@ +class ConventionDict(object): ... diff --git a/third_party/2.7/sqlalchemy/sql/operators.pyi b/third_party/2.7/sqlalchemy/sql/operators.pyi new file mode 100644 index 000000000..1b33d003a --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/operators.pyi @@ -0,0 +1,99 @@ +from typing import Any, AnyStr, Callable + +class Operators(object): + def op(self, opstring: AnyStr, precedence: int, is_comparison: bool): ... + def operate(self, op: Callable[[Any], Any], *other, **kwargs): ... + def reverse_operator(self, op: Callable[[Any], Any], *other, **kwargs): ... + def __and__(self, other): ... + def __or__(self, other): ... + def __invert__(self): ... + + +class ColumnOperators(Operators): + def concat(self, other): ... + def like(self, other, escape=None): ... + def ilike(self, other, escape=None): ... + def notlike(self, other, escape=None): ... + def notilike(self, other, escape=None): ... + def in_(self, other): ... + def notin_(self, other): ... + def is_(self, other): ... + def startswith(self, other, **kwargs): ... + def endswith(self, other, **kwargs): ... + def contains(self, other, **kwargs): ... + def match(self, other, **kwargs): ... + def desc(self): ... + def asc(self): ... + def nullsfirst(self): ... + def nullslast(self): ... + def collate(self, collation): ... + def between(self, cleft, cright, symmetric: bool): ... + def distinct(self): ... + + def __lt__(self, other): ... + def __le__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __neg__(self, other): ... + def __getitem__(self, index): ... + def __lshift__(self, other): ... + def __rshift__(self, other): ... + + def __radd__(self, other): ... + def __rsub__(self, other): ... + def __rmul__(self, other): ... + def __rdiv__(self, other): ... + def __rmod__(self, other): ... + def __add__(self, other): ... + def __sub__(self, other): ... + def __mul__(self, other): ... + def __div__(self, other): ... + def __mod__(self, other): ... + def __truediv__(self, other): ... + def __rtruediv__(self, other): ... + +def from_(): ... +def as_(): ... +def exists(): ... +def istrue(a): ... +def isfalse(a): ... +def is_(a, b): ... +def isnot(a, b): ... +def collate(a, b): ... +def op(a, opstring, b): ... + +def like_op(a, b, escape=None): ... +def notlike_op(a, b, escape=None): ... +def ilike_op(a, b, escape=None): ... +def notilike_op(a, b, escape=None): ... +def between_op(a, b, symmetric: bool): ... +def notbetween_(a, b, symmetric: bool): ... + +def in_op(a, b): ... +def notin_op(a, b): ... +def distinct_op(a): ... + +def startswith_op(a, b, escape=None): ... +def notstartswith_op(a, b, escape=None): ... +def endswith_op(a, b, escape=None): ... +def notendswith_op(a, b, escape=None): ... +def contains_op(a, b, escape=None): ... +def notcontains_op(a, b, escape=None): ... + +def match_op(a, b, **kw): ... +def notmatch_op(a, b, **kw): ... + +def comma_op(a, b): ... +def concat_op(a, b): ... + +def desc_op(a): ... +def asc_op(a): ... +def nullsfirst_op(a): ... +def nullslast_op(a): ... + +def is_comparison(op): ... +def is_commutative(op): ... +def is_ordering_modified(op): ... +def is_precedent(operator, against): ... diff --git a/third_party/2.7/sqlalchemy/sql/schema.pyi b/third_party/2.7/sqlalchemy/sql/schema.pyi new file mode 100644 index 000000000..a2de79a7e --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/schema.pyi @@ -0,0 +1,36 @@ +from typing import AnyStr + +from .base import SchemaEventTarget, DialectKWArgs +from .base import ColumnCollection +from .elements import ClauseElement, ColumnClause, TextClause, \ + ColumnElement +from .selectable import TableClause + +from . import visitors + +class SchemaItem(SchemaEventTarget, visitors.Visitable): ... + +class Table(DialectKWArgs, SchemaItem, TableClause): ... + +class Column(SchemaItem, ColumnClause): ... +class ForeignKey(DialectKWArgs, SchemaItem): ... + +class _NotAColumnExpr(object): ... +class DefaultGenerator(_NotAColumnExpr, SchemaItem): ... +class ColumnDefault(DefaultGenerator): ... +class Sequence(DefaultGenerator): ... +class FetchedValue(_NotAColumnExpr, SchemaEventTarget): ... +class DefaultClause(FetchedValue): ... +class PassiveDefault(DefaultClause): ... +class Constraint(DialectKWArgs, SchemaItem): ... +class ColumnCollectionMixin(object): ... +class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint): ... +class CheckConstraint(ColumnCollectionConstraint): ... +class ForeignKeyConstraint(ColumnCollectionConstraint): ... +class PrimaryKeyConstraint(ColumnCollectionConstraint): ... +class UniqueConstraint(ColumnCollectionConstraint): ... +class Index(DialectKWArgs, ColumnCollectionMixin, SchemaItem): ... +class MetaData(SchemaItem): ... +class ThreadLocalMetaData(MetaData): ... + +def _get_table_key(name: AnyStr, schema: AnyStr): ... diff --git a/third_party/2.7/sqlalchemy/sql/selectable.pyi b/third_party/2.7/sqlalchemy/sql/selectable.pyi new file mode 100644 index 000000000..045170b44 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/selectable.pyi @@ -0,0 +1,60 @@ +from .base import Immutable, Executable, \ + ColumnCollection, ColumnSet, Generative +from .elements import ClauseElement, TextClause, ClauseList, \ + Grouping, UnaryExpression, BindParameter +from .annotation import Annotated +from .visitors import Visitable + +def subquery(alias, *args, **kwargs): ... +def alias(selectable, name=..., flat: bool=...): ... + +class Selectable(ClauseElement): + def selectable(self): ... + +class HasPrefixes(object): + def prefix_with(self, *expr, **kw): ... + +class HasSuffixes(object): + def suffix_with(self, *expr, **kw): ... + +class FromClause(Selectable): + def count(self, functions, whereclause=None, **params): ... + def select(self, whereclause=None, **params): ... + def join(self, right, onclause=None, isouter: bool=False): ... + def outerjoin(self, right, onclause=None): ... + def alias(self, name=None, flat: bool=False): ... + def is_derived_from(self, fromclause): ... + def _is_lexical_equivalent(self, other): ... + def replace_selectable(self, sqlutil, old, alias): ... + def correspond_on_equivalents(self, column, equivalents): ... + def corresponding_column(self, column, require_embedded: bool=False): ... + @property + def description(self): ... + def _reset_exported(self): ... + @property + def columns(self): ... + @property + def primary_key(self): ... + @property + def foreign_keys(self): ... + def _init_collections(self): ... + @property + def _cols_populated(self): ... + def _populate_column_collection(self): ... + def _refresh_for_new_column(self, column): ... + +class Join(FromClause): ... +class Alias(FromClause): ... +class CTE(Generative, HasSuffixes, Alias): ... +class FromGrouping(FromClause): ... +class TableClause(Immutable, FromClause): ... + +class ForUpdateArg(ClauseElement): ... +class SelectBase(Executable, FromClause): ... +class GenerativeSelect(SelectBase): ... +class CompoundSelect(GenerativeSelect): ... +class Select(HasPrefixes, HasSuffixes, GenerativeSelect): ... +class ScalarSelect(Generative, Grouping): ... +class Exists(UnaryExpression): ... +class TextAsFrom(SelectBase): ... +class AnnotatedFromClause(Annotated): ... diff --git a/third_party/2.7/sqlalchemy/sql/sqltypes.pyi b/third_party/2.7/sqlalchemy/sql/sqltypes.pyi new file mode 100644 index 000000000..5544ef070 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/sqltypes.pyi @@ -0,0 +1,51 @@ +from .type_api import TypeEngine, TypeDecorator +from .base import SchemaEventTarget + +class _DateAffinity(object): ... +class Concatenable(object): ... +class String(TypeEngine, Concatenable): ... +class Text(String): ... +class Unicode(String): ... +class UnicodeText(Text): ... +class Integer(TypeEngine, _DateAffinity): ... +class SmallInteger(Integer): ... +class BigInteger(Integer): ... +class Numeric(TypeEngine, _DateAffinity): ... +class Float(Numeric): ... +class DateTime(TypeEngine, _DateAffinity): ... +class Date(TypeEngine, _DateAffinity): ... +class Time(TypeEngine, _DateAffinity): ... +class _Binary(TypeEngine): ... +class LargeBinary(_Binary): ... +class Binary(LargeBinary): ... +class SchemaType(SchemaEventTarget): ... +class Enum(String, SchemaType): ... +class PickleType(TypeDecorator): ... +class Boolean(TypeEngine, SchemaType): ... +class Interval(_DateAffinity, TypeDecorator): ... + +class REAL(Float): ... +class FLOAT(Float): ... +class NUMERIC(Numeric): ... +class DECIMAL(Numeric): ... +class INTEGER(Integer): ... +# In code it's INT=INTEGER +class INT(Integer): ... +class SMALLINT(SmallInteger): ... +class BIGINT(BigInteger): ... +class TIMESTAMP(DateTime): ... +class DATETIME(DateTime): ... +class DATE(Date): ... +class TIME(Time): ... +class TEXT(Text): ... +class CLOB(Text): ... +class VARCHAR(String): ... +class NVARCHAR(Unicode): ... +class CHAR(String): ... +class NCHAR(Unicode): ... +class BLOB(LargeBinary): ... +class BINARY(_Binary): ... +class VARBINARY(_Binary): ... +class BOOLEAN(Boolean): ... +class NullType(TypeEngine): ... +class MatchType(Boolean): ... diff --git a/third_party/2.7/sqlalchemy/sql/type_api.pyi b/third_party/2.7/sqlalchemy/sql/type_api.pyi new file mode 100644 index 000000000..ccc0870c0 --- /dev/null +++ b/third_party/2.7/sqlalchemy/sql/type_api.pyi @@ -0,0 +1,9 @@ +from .. import util +from .visitors import Visitable, VisitableType + +class TypeEngine(Visitable): ... +class VisitableCheckKWArg(util.EnsureKWArgType, VisitableType): ... +# TODO: class UserDefinedType(util.with_metaclass(VisitableCheckKWArg, TypeEngine)): +class UserDefinedType(VisitableCheckKWArg, TypeEngine): ... +class TypeDecorator(TypeEngine): ... +class Variant(TypeDecorator): ... diff --git a/third_party/2.7/sqlalchemy/util/_collections.pyi b/third_party/2.7/sqlalchemy/util/_collections.pyi index dec11bbe1..a25c7e989 100644 --- a/third_party/2.7/sqlalchemy/util/_collections.pyi +++ b/third_party/2.7/sqlalchemy/util/_collections.pyi @@ -161,10 +161,10 @@ class PopulateDict(dict): def __init__(self, creator) -> None: ... def __missing__(self, key): ... -column_set = ... # type: Any -column_dict = ... # type: Any -ordered_column_set = ... # type: Any -populate_column_dict = ... # type: Any +column_set = set +column_dict = dict +ordered_column_set = OrderedSet +populate_column_dict = PopulateDict def unique_list(seq, hashfunc=...): ... diff --git a/third_party/2.7/sqlalchemy/util/compat.pyi b/third_party/2.7/sqlalchemy/util/compat.pyi index 5ea75f052..ee1063615 100644 --- a/third_party/2.7/sqlalchemy/util/compat.pyi +++ b/third_party/2.7/sqlalchemy/util/compat.pyi @@ -1,10 +1,21 @@ # Stubs for sqlalchemy.util.compat (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any from collections import namedtuple +import threading +import pickle +from six.moves.urllib.parse import (quote_plus, unquote_plus, + parse_qsl, quote, unquote) +# import configparser +from six.moves import StringIO + +from io import BytesIO as byte_buffer + +from operator import attrgetter as dottedgetter + +from six.moves import zip_longest + py33 = ... # type: Any py32 = ... # type: Any py3k = ... # type: Any @@ -23,21 +34,12 @@ def inspect_getargspec(func): ... string_types = ... # type: Any binary_type = ... # type: Any -text_type = ... # type: Any +text_type = unicode int_types = ... # type: Any -iterbytes = ... # type: Any - -def u(s): ... -def ue(s): ... -def b(s): ... - -callable = ... # type: Any def callable(fn): ... def cmp(a, b): ... -print_ = ... # type: Any -import_ = ... # type: Any itertools_filterfalse = ... # type: Any itertools_filter = ... # type: Any itertools_imap = ... # type: Any @@ -45,18 +47,13 @@ itertools_imap = ... # type: Any def b64encode(x): ... def b64decode(x): ... -inspect_getargspec = ... # type: Any - def iterbytes(buf): ... def u(s): ... def ue(s): ... def b(s): ... def import_(*args): ... -cmp = ... # type: Any reduce = ... # type: Any -b64encode = ... # type: Any -b64decode = ... # type: Any def print_(*args, **kwargs): ... @@ -64,9 +61,6 @@ time_func = ... # type: Any def reraise(tp, value, tb=..., cause=...): ... def raise_from_cause(exception, exc_info=...): ... -def raise_from_cause(exception, exc_info=...): ... - -exec_ = ... # type: Any def exec_(func_text, globals_, lcl=...): ... def with_metaclass(meta, *bases): ... diff --git a/third_party/2.7/sqlalchemy/util/langhelpers.pyi b/third_party/2.7/sqlalchemy/util/langhelpers.pyi index 4079e3d16..c16b1f91c 100644 --- a/third_party/2.7/sqlalchemy/util/langhelpers.pyi +++ b/third_party/2.7/sqlalchemy/util/langhelpers.pyi @@ -3,7 +3,7 @@ # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any -import compat +from . import compat def md5_hex(x): ... @@ -26,7 +26,6 @@ class PluginLoader: def get_cls_kwargs(cls, _set=...): ... def inspect_func_args(fn): ... -def inspect_func_args(fn): ... def get_func_kwargs(func): ... def get_callable_argspec(fn, no_self=..., _is_init=...): ... def format_argspec_plus(fn, grouped=...): ... @@ -92,7 +91,7 @@ def duck_type_collection(specimen, default=...): ... def assert_arg_type(arg, argtype, name): ... def dictlike_iteritems(dictlike): ... -class classproperty(property): +class classproperty: __doc__ = ... # type: Any def __init__(self, fget, *arg, **kw) -> None: ... def __get__(desc, self, cls): ...