Skip to content

Commit

Permalink
Merge pull request #14 from edelooff/fix-python3-errors
Browse files Browse the repository at this point in the history
Fixes Python 3 errors
  • Loading branch information
edelooff authored Sep 9, 2019
2 parents 07787e1 + 770356a commit 05f1041
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kalpa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __new__(mcs, name, bases, attrs):
should_register = not attrs.pop('__abstract__', False)
attributes = {'__child_cls__': None}
branches = attributes['_BRANCHES'] = inherited_branches(bases)
for attr, value in attrs.iteritems():
for attr, value in iteritems(attrs):
if isinstance(value, DeclaredBranch):
branches.update(value.generate_resources(attr))
else:
Expand Down
5 changes: 3 additions & 2 deletions kalpa/tests/test_branch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import itertools
import operator

Expand Down Expand Up @@ -97,8 +98,8 @@ def test_branch_alternate_loading(root, user, node_class):
('objects', 'leaf'), ('people', 'charlie'), ('people', 'eve')])
def test_branch_load_cache(root, key_path):
"""Retrieving the same object twice should provide the same one."""
first = reduce(operator.getitem, key_path, root)
second = reduce(operator.getitem, key_path, root)
first = functools.reduce(operator.getitem, key_path, root)
second = functools.reduce(operator.getitem, key_path, root)
assert first is second


Expand Down
5 changes: 3 additions & 2 deletions kalpa/tests/test_traversal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests compatiblity and integration with Pyramid's traversal utlities."""

import functools
import operator

import pytest
Expand All @@ -19,7 +20,7 @@ def test_find_root(root):
('/objects/apple/votes', ('objects', 'apple', 'votes'))])
def test_find_resource(root, path, keys):
"""Resolving paths yields the expected resource."""
resource = reduce(operator.getitem, keys, root)
resource = functools.reduce(operator.getitem, keys, root)
assert traversal.find_resource(root, path) == resource


Expand All @@ -28,7 +29,7 @@ def test_find_resource(root, path, keys):
(('objects', 'pear', 'votes'), '/objects/pear/votes')])
def test_resource_path(root, keys, path):
"""Resources generate the expected path."""
resource = reduce(operator.getitem, keys, root)
resource = functools.reduce(operator.getitem, keys, root)
assert traversal.resource_path(resource) == path


Expand Down
5 changes: 3 additions & 2 deletions kalpa/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import operator

import pytest
Expand Down Expand Up @@ -26,7 +27,7 @@ def test_util_lineage(root):
def test_find_parent_by_class(root, selector, expected_key_path):
"""Finding a parent resource by its class."""
alice = root['people']['alice']
expected = reduce(operator.getitem, expected_key_path, root)
expected = functools.reduce(operator.getitem, expected_key_path, root)
assert parent_by_class(alice, selector) is expected


Expand All @@ -37,7 +38,7 @@ def test_find_parent_by_class(root, selector, expected_key_path):
def test_find_parent_by_class_name(root, selector, expected_key_path):
"""Finding a parent resource by its class name."""
alice = root['people']['alice']
expected = reduce(operator.getitem, expected_key_path, root)
expected = functools.reduce(operator.getitem, expected_key_path, root)
assert parent_by_class(alice, selector) is expected


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def contents(filename):

setup(
name='kalpa',
version='0.5.0',
version='0.5.1',
packages=find_packages(),
author='Elmer de Looff',
author_email='elmer.delooff@gmail.com',
Expand Down

0 comments on commit 05f1041

Please sign in to comment.