Add isort checks to test suite
This commit is contained in:
6
.isort.cfg
Normal file
6
.isort.cfg
Normal file
@@ -0,0 +1,6 @@
|
||||
[settings]
|
||||
known_first_party=sqlalchemy_utils,tests
|
||||
line_length=79
|
||||
multi_line_output=3
|
||||
not_skip=__init__.py
|
||||
order_by_type=false
|
@@ -33,5 +33,6 @@ install:
|
||||
- pip install -e .[$EXTRAS]
|
||||
|
||||
script:
|
||||
- isort --recursive --diff sqlalchemy_utils tests && isort --recursive --check-only sqlalchemy_utils tests
|
||||
- flake8 sqlalchemy_utils tests
|
||||
- py.test
|
||||
|
3
setup.py
3
setup.py
@@ -36,7 +36,8 @@ extras_require = {
|
||||
'pytz>=2014.2',
|
||||
'python-dateutil>=2.2',
|
||||
'pymysql',
|
||||
'flake8>=2.4.0'
|
||||
'flake8>=2.4.0',
|
||||
'isort==3.9.6'
|
||||
],
|
||||
'anyjson': ['anyjson>=0.3.3'],
|
||||
'babel': ['Babel>=1.3'],
|
||||
|
@@ -1,10 +1,10 @@
|
||||
from .aggregates import aggregated # noqa
|
||||
from .asserts import ( # noqa
|
||||
assert_min_value,
|
||||
assert_max_length,
|
||||
assert_max_value,
|
||||
assert_nullable,
|
||||
assert_non_nullable
|
||||
assert_min_value,
|
||||
assert_non_nullable,
|
||||
assert_nullable
|
||||
)
|
||||
from .batch import batch_fetch, with_backrefs # noqa
|
||||
from .decorators import generates # noqa
|
||||
@@ -25,8 +25,8 @@ from .functions import ( # noqa
|
||||
get_declarative_base,
|
||||
get_hybrid_properties,
|
||||
get_mapper,
|
||||
get_query_entities,
|
||||
get_primary_keys,
|
||||
get_query_entities,
|
||||
get_referencing_foreign_keys,
|
||||
get_tables,
|
||||
group_foreign_keys,
|
||||
@@ -42,8 +42,9 @@ from .functions import ( # noqa
|
||||
render_expression,
|
||||
render_statement,
|
||||
sort_query,
|
||||
table_name,
|
||||
table_name
|
||||
)
|
||||
from .generic import generic_relationship # noqa
|
||||
from .i18n import TranslationHybrid # noqa
|
||||
from .listeners import ( # noqa
|
||||
auto_delete_orphans,
|
||||
@@ -51,9 +52,9 @@ from .listeners import ( # noqa
|
||||
force_auto_coercion,
|
||||
force_instant_defaults
|
||||
)
|
||||
from .generic import generic_relationship # noqa
|
||||
from .proxy_dict import ProxyDict, proxy_dict # noqa
|
||||
from .models import Timestamp # noqa
|
||||
from .observer import observes # noqa
|
||||
from .proxy_dict import proxy_dict, ProxyDict # noqa
|
||||
from .query_chain import QueryChain # noqa
|
||||
from .types import ( # noqa
|
||||
ArrowType,
|
||||
@@ -85,7 +86,5 @@ from .types import ( # noqa
|
||||
UUIDType,
|
||||
WeekDaysType
|
||||
)
|
||||
from .models import Timestamp # noqa
|
||||
|
||||
|
||||
__version__ = '0.29.8'
|
||||
|
@@ -365,9 +365,13 @@ TODO
|
||||
from collections import defaultdict
|
||||
from weakref import WeakKeyDictionary
|
||||
|
||||
import sqlalchemy as sa
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
||||
from .functions.orm import get_column_key
|
||||
from .relationships import chained_join, select_aggregate
|
||||
|
||||
try:
|
||||
# SQLAlchemy 0.9
|
||||
from sqlalchemy.sql.functions import _FunctionGenerator
|
||||
@@ -375,9 +379,6 @@ except ImportError:
|
||||
# SQLAlchemy 0.8
|
||||
from sqlalchemy.sql.expression import _FunctionGenerator
|
||||
|
||||
from .functions.orm import get_column_key
|
||||
from .relationships import chained_join, select_aggregate
|
||||
|
||||
|
||||
aggregated_attrs = WeakKeyDictionary(defaultdict(list))
|
||||
|
||||
|
@@ -33,6 +33,7 @@ We can easily test the constraints by assert_* functions::
|
||||
assert_max_length(user, 'email', 300)
|
||||
"""
|
||||
from decimal import Decimal
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import ARRAY
|
||||
from sqlalchemy.exc import DataError, IntegrityError
|
||||
|
@@ -1,21 +1,24 @@
|
||||
from collections import defaultdict
|
||||
from itertools import chain
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import RelationshipProperty
|
||||
from sqlalchemy.orm.attributes import (
|
||||
set_committed_value, InstrumentedAttribute
|
||||
InstrumentedAttribute,
|
||||
set_committed_value
|
||||
)
|
||||
from sqlalchemy.orm.session import object_session
|
||||
from sqlalchemy_utils.generic import GenericRelationshipProperty
|
||||
|
||||
from sqlalchemy_utils.functions.orm import (
|
||||
list_local_values,
|
||||
list_local_remote_exprs,
|
||||
list_local_values,
|
||||
local_values,
|
||||
remote,
|
||||
remote_column_names,
|
||||
remote_values,
|
||||
remote
|
||||
remote_values
|
||||
)
|
||||
from sqlalchemy_utils.generic import GenericRelationshipProperty
|
||||
|
||||
|
||||
class PathException(Exception):
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from collections import defaultdict
|
||||
import itertools
|
||||
import sqlalchemy as sa
|
||||
from collections import defaultdict
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
||||
from .functions import getdotattr
|
||||
|
||||
|
||||
|
@@ -7,22 +7,22 @@ import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
||||
from sqlalchemy.sql.annotation import AnnotatedColumn
|
||||
from sqlalchemy.sql.expression import (
|
||||
BooleanClauseList,
|
||||
BinaryExpression,
|
||||
UnaryExpression,
|
||||
BindParameter,
|
||||
Cast,
|
||||
)
|
||||
from sqlalchemy.sql.elements import (
|
||||
False_,
|
||||
True_,
|
||||
Grouping,
|
||||
ClauseList,
|
||||
Label,
|
||||
Case,
|
||||
Tuple,
|
||||
Null
|
||||
ClauseList,
|
||||
False_,
|
||||
Grouping,
|
||||
Label,
|
||||
Null,
|
||||
True_,
|
||||
Tuple
|
||||
)
|
||||
from sqlalchemy.sql.expression import (
|
||||
BinaryExpression,
|
||||
BindParameter,
|
||||
BooleanClauseList,
|
||||
Cast,
|
||||
UnaryExpression
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.compiler import compiles
|
||||
from sqlalchemy.sql import expression
|
||||
from sqlalchemy.sql.expression import (
|
||||
Executable,
|
||||
_literal_as_text,
|
||||
ClauseElement,
|
||||
_literal_as_text
|
||||
Executable
|
||||
)
|
||||
from sqlalchemy.ext.compiler import compiles
|
||||
|
||||
|
||||
class explain(Executable, ClauseElement):
|
||||
|
@@ -1,10 +1,3 @@
|
||||
from .mock import create_mock_engine, mock_engine # noqa
|
||||
from .render import render_expression, render_statement # noqa
|
||||
from .sort_query import ( # noqa
|
||||
make_order_by_deterministic,
|
||||
sort_query,
|
||||
QuerySorterException
|
||||
)
|
||||
from .database import ( # noqa
|
||||
analyze,
|
||||
create_database,
|
||||
@@ -22,8 +15,9 @@ from .foreign_keys import ( # noqa
|
||||
group_foreign_keys,
|
||||
is_indexed_foreign_key,
|
||||
merge_references,
|
||||
non_indexed_foreign_keys,
|
||||
non_indexed_foreign_keys
|
||||
)
|
||||
from .mock import create_mock_engine, mock_engine # noqa
|
||||
from .orm import ( # noqa
|
||||
get_bind,
|
||||
get_class_by_table,
|
||||
@@ -41,5 +35,11 @@ from .orm import ( # noqa
|
||||
is_loaded,
|
||||
naturally_equivalent,
|
||||
quote,
|
||||
table_name,
|
||||
table_name
|
||||
)
|
||||
from .render import render_expression, render_statement # noqa
|
||||
from .sort_query import ( # noqa
|
||||
make_order_by_deterministic,
|
||||
QuerySorterException,
|
||||
sort_query
|
||||
)
|
||||
|
@@ -5,7 +5,8 @@ from copy import copy
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.engine.url import make_url
|
||||
from sqlalchemy.exc import ProgrammingError, OperationalError
|
||||
from sqlalchemy.exc import OperationalError, ProgrammingError
|
||||
|
||||
from sqlalchemy_utils.expressions import explain_analyze
|
||||
|
||||
from .orm import quote
|
||||
|
@@ -5,10 +5,10 @@ import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.exc import NoInspectionAvailable
|
||||
from sqlalchemy.orm import object_session
|
||||
from sqlalchemy.schema import MetaData, Table, ForeignKeyConstraint
|
||||
from sqlalchemy.schema import ForeignKeyConstraint, MetaData, Table
|
||||
|
||||
from .orm import get_column_key, get_mapper, get_tables
|
||||
from ..query_chain import QueryChain
|
||||
from .orm import get_column_key, get_mapper, get_tables
|
||||
|
||||
|
||||
def get_foreign_key_values(fk, obj):
|
||||
|
@@ -2,6 +2,7 @@ import contextlib
|
||||
import datetime
|
||||
import inspect
|
||||
import re
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
@@ -2,10 +2,12 @@ try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
from ordereddict import OrderedDict
|
||||
|
||||
from functools import partial
|
||||
from inspect import isclass
|
||||
from itertools import chain
|
||||
from operator import attrgetter
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
@@ -16,6 +18,7 @@ from sqlalchemy.orm.properties import ColumnProperty
|
||||
from sqlalchemy.orm.query import _ColumnEntity
|
||||
from sqlalchemy.orm.session import object_session
|
||||
from sqlalchemy.orm.util import AliasedInsp
|
||||
|
||||
from sqlalchemy_utils.utils import is_sequence
|
||||
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import inspect
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
||||
from .mock import create_mock_engine
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql.expression import desc, asc
|
||||
from sqlalchemy.sql.expression import asc, desc
|
||||
|
||||
from .database import has_unique_index
|
||||
from .orm import get_query_descriptor, get_tables
|
||||
|
@@ -3,11 +3,11 @@ from collections import Iterable
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy.orm import attributes, class_mapper
|
||||
from sqlalchemy.orm import ColumnProperty
|
||||
from sqlalchemy.orm import attributes, class_mapper, ColumnProperty
|
||||
from sqlalchemy.orm.interfaces import MapperProperty, PropComparator
|
||||
from sqlalchemy.orm.session import _state_session
|
||||
from sqlalchemy.util import set_creation_order
|
||||
|
||||
from sqlalchemy_utils.functions import identity
|
||||
|
||||
from .exceptions import ImproperlyConfigured
|
||||
|
@@ -2,7 +2,6 @@ from sqlalchemy.ext.hybrid import hybrid_property
|
||||
|
||||
from .exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
try:
|
||||
from babel.dates import get_day_names
|
||||
except ImportError:
|
||||
@@ -13,7 +12,6 @@ except ImportError:
|
||||
'module.'
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from flask.ext.babel import get_locale
|
||||
except ImportError:
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from .exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
|
@@ -149,15 +149,15 @@ Category has many Products.
|
||||
catalog.product_count # 1
|
||||
|
||||
"""
|
||||
import itertools
|
||||
from collections import defaultdict, Iterable, namedtuple
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from collections import defaultdict, namedtuple, Iterable
|
||||
import itertools
|
||||
from sqlalchemy_utils.functions import getdotattr
|
||||
from sqlalchemy_utils.path import AttrPath
|
||||
from sqlalchemy_utils.utils import is_sequence
|
||||
|
||||
|
||||
Callback = namedtuple('Callback', ['func', 'path', 'backref', 'fullpath'])
|
||||
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
||||
from sqlalchemy.util.langhelpers import symbol
|
||||
|
||||
from .utils import str_coercible
|
||||
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
from .weekday import WeekDay
|
||||
from .weekdays import WeekDays
|
||||
|
||||
|
||||
__all__ = (
|
||||
WeekDay,
|
||||
WeekDays
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import six
|
||||
|
||||
from sqlalchemy_utils.utils import str_coercible
|
||||
|
||||
from .weekday import WeekDay
|
||||
|
||||
|
||||
|
@@ -1,22 +1,24 @@
|
||||
from functools import wraps
|
||||
|
||||
from sqlalchemy.orm.collections import InstrumentedList as _InstrumentedList
|
||||
|
||||
from .arrow import ArrowType
|
||||
from .choice import ChoiceType, Choice
|
||||
from .choice import Choice, ChoiceType
|
||||
from .color import ColorType
|
||||
from .country import CountryType, Country
|
||||
from .country import Country, CountryType
|
||||
from .email import EmailType
|
||||
from .encrypted import EncryptedType
|
||||
from .ip_address import IPAddressType
|
||||
from .json import JSONType
|
||||
from .locale import LocaleType
|
||||
from .password import Password, PasswordType
|
||||
from .phone_number import PhoneNumber, PhoneNumberType
|
||||
from .range import (
|
||||
DateRangeType,
|
||||
DateTimeRangeType,
|
||||
IntRangeType,
|
||||
NumericRangeType,
|
||||
NumericRangeType
|
||||
)
|
||||
from .password import Password, PasswordType
|
||||
from .phone_number import PhoneNumber, PhoneNumberType
|
||||
from .scalar_list import ScalarListException, ScalarListType
|
||||
from .timezone import TimezoneType
|
||||
from .ts_vector import TSVectorType
|
||||
@@ -24,7 +26,6 @@ from .url import URLType
|
||||
from .uuid import UUIDType
|
||||
from .weekdays import WeekDaysType
|
||||
|
||||
|
||||
__all__ = (
|
||||
ArrowType,
|
||||
Choice,
|
||||
|
@@ -1,16 +1,20 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from collections import Iterable
|
||||
from datetime import datetime
|
||||
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
arrow = None
|
||||
try:
|
||||
import arrow
|
||||
except:
|
||||
pass
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
class ArrowType(types.TypeDecorator, ScalarCoercible):
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from sqlalchemy import types
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
try:
|
||||
from enum import Enum
|
||||
except ImportError:
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
colour = None
|
||||
|
@@ -1,8 +1,10 @@
|
||||
from sqlalchemy import types
|
||||
import six
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils import i18n
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
class Country(object):
|
||||
def __init__(self, code_or_country):
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from ..operators import CaseInsensitiveComparator
|
||||
|
||||
|
||||
|
@@ -1,9 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import six
|
||||
import datetime
|
||||
from sqlalchemy.types import TypeDecorator, String, Binary
|
||||
|
||||
import six
|
||||
from sqlalchemy.types import Binary, String, TypeDecorator
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
cryptography = None
|
||||
|
@@ -1,4 +1,9 @@
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
ip_address = None
|
||||
try:
|
||||
@@ -10,11 +15,6 @@ except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
class IPAddressType(types.TypeDecorator, ScalarCoercible):
|
||||
"""
|
||||
Changes IPAddress objects to a string representation on the way in and
|
||||
|
@@ -1,5 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql.base import ischema_names
|
||||
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
|
||||
json = None
|
||||
try:
|
||||
@@ -7,10 +12,6 @@ try:
|
||||
except ImportError:
|
||||
import json as json
|
||||
|
||||
import six
|
||||
from sqlalchemy.dialects.postgresql.base import ischema_names
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
|
||||
try:
|
||||
from sqlalchemy.dialects.postgresql import JSON
|
||||
has_postgres_json = True
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from sqlalchemy import types
|
||||
import six
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
from sqlalchemy import types
|
||||
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
babel = None
|
||||
try:
|
||||
import babel
|
||||
|
@@ -1,11 +1,14 @@
|
||||
import six
|
||||
import weakref
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.dialects import postgresql, oracle
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
from sqlalchemy.dialects import oracle, postgresql
|
||||
from sqlalchemy.ext.mutable import Mutable
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
passlib = None
|
||||
try:
|
||||
import passlib
|
||||
|
@@ -1,13 +1,13 @@
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
from sqlalchemy_utils.utils import str_coercible
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
try:
|
||||
import phonenumbers
|
||||
from phonenumbers.phonenumber import PhoneNumber as BasePhoneNumber
|
||||
|
||||
except ImportError:
|
||||
phonenumbers = None
|
||||
BasePhoneNumber = object
|
||||
|
@@ -119,22 +119,25 @@ Membership operators
|
||||
.. _intervals: https://github.com/kvesteri/intervals
|
||||
"""
|
||||
from collections import Iterable
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.dialects.postgresql import (
|
||||
DATERANGE,
|
||||
INT4RANGE,
|
||||
NUMRANGE,
|
||||
TSRANGE
|
||||
)
|
||||
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
intervals = None
|
||||
try:
|
||||
import intervals
|
||||
except ImportError:
|
||||
pass
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import (
|
||||
INT4RANGE,
|
||||
DATERANGE,
|
||||
NUMRANGE,
|
||||
TSRANGE,
|
||||
)
|
||||
from sqlalchemy import types
|
||||
from ..exceptions import ImproperlyConfigured
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
class RangeComparator(types.TypeEngine.Comparator):
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
|
@@ -5,6 +5,7 @@ except ImportError:
|
||||
pass
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
|
@@ -1,7 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
|
@@ -5,10 +5,12 @@ except ImportError:
|
||||
pass
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
from sqlalchemy_utils.primitives import WeekDay, WeekDays
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
from .bit import BitType
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
|
||||
|
||||
class WeekDaysType(types.TypeDecorator, ScalarCoercible):
|
||||
|
@@ -1,13 +1,16 @@
|
||||
import warnings
|
||||
import sqlalchemy as sa
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base, synonym_for
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from sqlalchemy_utils import (
|
||||
InstrumentedList, coercion_listener, aggregates, i18n
|
||||
aggregates,
|
||||
coercion_listener,
|
||||
i18n,
|
||||
InstrumentedList
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from decimal import Decimal
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from decimal import Decimal
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from decimal import Decimal
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import aggregated, TSVectorType
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import aggregated
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch, with_backrefs
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sqlalchemy as sa
|
||||
from tests import TestCase
|
||||
|
||||
from sqlalchemy_utils import batch_fetch, generic_relationship
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
class TestBatchFetchGenericRelationship(TestCase):
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch, with_backrefs
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import batch_fetch
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
from pytest import raises
|
||||
|
||||
from sqlalchemy_utils import batch_fetch
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -3,20 +3,16 @@ import os
|
||||
import sqlalchemy as sa
|
||||
from flexmock import flexmock
|
||||
from pytest import mark
|
||||
|
||||
from sqlalchemy_utils import create_database, database_exists, drop_database
|
||||
from tests import TestCase
|
||||
|
||||
pymysql = None
|
||||
try:
|
||||
import pymysql # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
from sqlalchemy_utils import (
|
||||
create_database,
|
||||
drop_database,
|
||||
database_exists,
|
||||
)
|
||||
|
||||
|
||||
class DatabaseTest(TestCase):
|
||||
def test_create_and_drop(self):
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import dependent_objects, get_referencing_foreign_keys
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
from pytest import raises
|
||||
|
||||
import sqlalchemy as sa
|
||||
from pytest import raises
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from sqlalchemy_utils import get_class_by_table
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from copy import copy
|
||||
from pytest import raises
|
||||
|
||||
import sqlalchemy as sa
|
||||
from pytest import raises
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from sqlalchemy_utils import get_column_key
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
|
||||
from sqlalchemy_utils import get_hybrid_properties
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
from pytest import raises
|
||||
import sqlalchemy as sa
|
||||
from pytest import raises
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from sqlalchemy_utils import get_mapper
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,12 +1,13 @@
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
from ordereddict import OrderedDict
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from sqlalchemy_utils import get_primary_keys
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
from ordereddict import OrderedDict
|
||||
|
||||
|
||||
class TestGetPrimaryKeys(object):
|
||||
def setup_method(self, method):
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import get_query_entities
|
||||
|
||||
from sqlalchemy_utils import get_query_entities
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import get_referencing_foreign_keys
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import get_tables
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.functions import getdotattr
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from pytest import raises
|
||||
import sqlalchemy as sa
|
||||
from pytest import raises
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from sqlalchemy_utils import has_unique_index
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.functions import identity
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import json_sql
|
||||
|
||||
from sqlalchemy_utils import json_sql
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.functions.sort_query import make_order_by_deterministic
|
||||
|
||||
from tests import assert_contains, TestCase
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import merge_references
|
||||
|
||||
from sqlalchemy_utils import merge_references
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import sqlalchemy as sa
|
||||
from tests import TestCase
|
||||
|
||||
from sqlalchemy_utils.functions import non_indexed_foreign_keys
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
class TestFindNonIndexedForeignKeys(TestCase):
|
||||
|
@@ -1,10 +1,11 @@
|
||||
import sqlalchemy as sa
|
||||
from tests import TestCase
|
||||
|
||||
from sqlalchemy_utils.functions import (
|
||||
render_statement,
|
||||
mock_engine,
|
||||
render_expression,
|
||||
mock_engine
|
||||
render_statement
|
||||
)
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
class TestRender(TestCase):
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import table_name
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests.generic_relationship import GenericRelationshipTestCase
|
||||
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests.generic_relationship import GenericRelationshipTestCase
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests.generic_relationship import GenericRelationshipTestCase
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from tests import TestCase
|
||||
from sqlalchemy_utils.observer import observes
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
class TestObservesFor3LevelDeepOneToMany(TestCase):
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.observer import observes
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.observer import observes
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,14 +1,15 @@
|
||||
import pytest
|
||||
import six
|
||||
from flexmock import flexmock
|
||||
|
||||
from sqlalchemy_utils import i18n
|
||||
from sqlalchemy_utils.primitives import WeekDay, WeekDays
|
||||
|
||||
Locale = None
|
||||
try:
|
||||
from babel import Locale
|
||||
except ImportError:
|
||||
pass
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
|
||||
import six
|
||||
from sqlalchemy_utils.primitives import WeekDay, WeekDays
|
||||
from sqlalchemy_utils import i18n
|
||||
|
||||
|
||||
@pytest.mark.skipif('Locale is None')
|
||||
|
@@ -3,7 +3,7 @@ from tests import TestCase
|
||||
from tests.mixins import (
|
||||
ThreeLevelDeepManyToMany,
|
||||
ThreeLevelDeepOneToMany,
|
||||
ThreeLevelDeepOneToOne,
|
||||
ThreeLevelDeepOneToOne
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.aggregates import select_aggregate
|
||||
from tests import TestCase
|
||||
from tests.mixins import ThreeLevelDeepManyToMany
|
||||
|
@@ -1,15 +1,15 @@
|
||||
import sqlalchemy as sa
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import ARRAY
|
||||
|
||||
from sqlalchemy_utils import (
|
||||
assert_min_value,
|
||||
assert_max_length,
|
||||
assert_max_value,
|
||||
assert_nullable,
|
||||
assert_non_nullable
|
||||
assert_min_value,
|
||||
assert_non_nullable,
|
||||
assert_nullable
|
||||
)
|
||||
from sqlalchemy_utils.asserts import raises
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from pytest import raises
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import auto_delete_orphans, ImproperlyConfigured
|
||||
from pytest import raises
|
||||
|
||||
from sqlalchemy_utils import auto_delete_orphans, ImproperlyConfigured
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import EmailType
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
from sqlalchemy_utils import ExpressionParser
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql.elements import Cast, Null
|
||||
|
||||
from . import TestCase
|
||||
from sqlalchemy_utils import ExpressionParser
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
class MyExpressionParser(ExpressionParser):
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
from sqlalchemy_utils.expressions import explain, explain_analyze
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import generates
|
||||
from tests import TestCase
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
from datetime import datetime
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils.listeners import force_instant_defaults
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
force_instant_defaults()
|
||||
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
from datetime import datetime
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy_utils import Timestamp
|
||||
from tests import TestCase
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user