Remove toolz dependency
This commit is contained in:
1
setup.py
1
setup.py
@@ -63,7 +63,6 @@ setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
'six',
|
'six',
|
||||||
'SQLAlchemy>=0.9.3',
|
'SQLAlchemy>=0.9.3',
|
||||||
'toolz>=0.4.1',
|
|
||||||
'total_ordering>=0.1'
|
'total_ordering>=0.1'
|
||||||
if sys.version_info[0] == 2 and sys.version_info[1] < 7 else ''
|
if sys.version_info[0] == 2 and sys.version_info[1] < 7 else ''
|
||||||
],
|
],
|
||||||
|
@@ -16,7 +16,6 @@ from sqlalchemy_utils.functions.orm import (
|
|||||||
local_values,
|
local_values,
|
||||||
local_column_names,
|
local_column_names,
|
||||||
local_remote_expr,
|
local_remote_expr,
|
||||||
mapfirst,
|
|
||||||
remote_column_names,
|
remote_column_names,
|
||||||
remote_values,
|
remote_values,
|
||||||
remote
|
remote
|
||||||
@@ -295,7 +294,7 @@ class Fetcher(object):
|
|||||||
if len(names) == 1:
|
if len(names) == 1:
|
||||||
attr = getattr(remote(self.prop), names[0])
|
attr = getattr(remote(self.prop), names[0])
|
||||||
return attr.in_(
|
return attr.in_(
|
||||||
mapfirst(list_local_values(self.prop, self.path.entities))
|
v[0] for v in list_local_values(self.prop, self.path.entities)
|
||||||
)
|
)
|
||||||
elif len(names) > 1:
|
elif len(names) > 1:
|
||||||
return sa.or_(
|
return sa.or_(
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from toolz import curry, first
|
from toolz import first
|
||||||
import six
|
import six
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy import inspect
|
from sqlalchemy import inspect
|
||||||
@@ -41,24 +41,18 @@ def getattrs(obj, attrs):
|
|||||||
return map(partial(getattr, obj), attrs)
|
return map(partial(getattr, obj), attrs)
|
||||||
|
|
||||||
|
|
||||||
def mapfirst(iterable):
|
|
||||||
return map(first, iterable)
|
|
||||||
|
|
||||||
|
|
||||||
@curry
|
|
||||||
def local_values(prop, entity):
|
def local_values(prop, entity):
|
||||||
return tuple(getattrs(entity, local_column_names(prop)))
|
return tuple(getattrs(entity, local_column_names(prop)))
|
||||||
|
|
||||||
|
|
||||||
def list_local_values(prop, entities):
|
def list_local_values(prop, entities):
|
||||||
return map(local_values(prop), entities)
|
return map(partial(local_values, prop), entities)
|
||||||
|
|
||||||
|
|
||||||
def remote_values(prop, entity):
|
def remote_values(prop, entity):
|
||||||
return tuple(getattrs(entity, remote_column_names(prop)))
|
return tuple(getattrs(entity, remote_column_names(prop)))
|
||||||
|
|
||||||
|
|
||||||
@curry
|
|
||||||
def local_remote_expr(prop, entity):
|
def local_remote_expr(prop, entity):
|
||||||
return sa.and_(
|
return sa.and_(
|
||||||
*[
|
*[
|
||||||
@@ -72,7 +66,7 @@ def local_remote_expr(prop, entity):
|
|||||||
|
|
||||||
|
|
||||||
def list_local_remote_exprs(prop, entities):
|
def list_local_remote_exprs(prop, entities):
|
||||||
return map(local_remote_expr(prop), entities)
|
return map(partial(local_remote_expr, prop), entities)
|
||||||
|
|
||||||
|
|
||||||
def remote(prop):
|
def remote(prop):
|
||||||
|
Reference in New Issue
Block a user