Skip to content

Commit

Permalink
Merge 594c693 into 3c9a76c
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Nov 7, 2019
2 parents 3c9a76c + 594c693 commit 33810a2
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/build.py
Expand Up @@ -74,6 +74,7 @@ def abspath(rel):

# build the API doc
api = ['sphinx-apidoc',
'-e',
'-o',
cwd,
abspath('../trimesh')]
Expand Down
11 changes: 10 additions & 1 deletion docs/conf.py
Expand Up @@ -26,7 +26,10 @@ def abspath(rel):
return os.path.abspath(os.path.join(cwd, rel))


extensions = ['sphinxcontrib.napoleon']
extensions = [
'sphinx.ext.napoleon',
'autodocsumm',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -82,3 +85,9 @@ def abspath(rel):

# Output file base name for HTML help builder.
htmlhelp_basename = 'trimeshdoc'

# -- Extensions configuration ----------------------------------------

autodoc_default_options = {
'autosummary': True,
}
1 change: 1 addition & 0 deletions docs/requirements.txt
Expand Up @@ -8,3 +8,4 @@ sphinx
jupyter
sphinx_rtd_theme
pyopenssl
autodocsumm
5 changes: 5 additions & 0 deletions tests/test_dae.py
Expand Up @@ -7,6 +7,11 @@
import collada
except ImportError:
collada = None
except BaseException:
# TODO : REMOVE WHEN UPSTREAM RELEASE FIXED
# https://github.com/pycollada/pycollada/pull/92
g.log.error('DAE fix not pushed yet!')
collada = None


class DAETest(g.unittest.TestCase):
Expand Down
18 changes: 18 additions & 0 deletions tests/test_graph.py
Expand Up @@ -203,6 +203,24 @@ def test_adjacency(self):
m.faces[0][2] = m.faces[0][0]
# degenerate faces should be filtered
assert g.np.not_equal(*m.face_adjacency.T).all()

# check the various paths of calling face adjacency
a = g.trimesh.graph.face_adjacency(
m.faces.view(g.np.ndarray).copy(),
return_edges=False)
b, be = g.trimesh.graph.face_adjacency(
m.faces.view(g.np.ndarray).copy(),
return_edges=True)
c = g.trimesh.graph.face_adjacency(
mesh=m, return_edges=False)
c, ce = g.trimesh.graph.face_adjacency(
mesh=m, return_edges=True)
# make sure they all return the expected result
assert g.np.allclose(a, b)
assert g.np.allclose(a, c)
assert len(be) == len(a)
assert len(ce) == len(a)

# package properties to loop through
zips = zip(m.face_adjacency,
m.face_adjacency_edges,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_packing.py
Expand Up @@ -2,12 +2,12 @@
from . import generic as g
except BaseException:
import generic as g
from shapely.geometry import Polygon


class PackingTest(g.unittest.TestCase):

def setUp(self):
from shapely.geometry import Polygon
self.nestable = [Polygon(i) for i in g.data['nestable']]

def test_obb(self):
Expand Down
8 changes: 6 additions & 2 deletions trimesh/caching.py
Expand Up @@ -6,7 +6,6 @@
and clearing cached values based on those changes.
"""

import collections
import numpy as np

import zlib
Expand All @@ -15,6 +14,11 @@

from functools import wraps

try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping

from .constants import log
from .util import is_sequence

Expand Down Expand Up @@ -491,7 +495,7 @@ def __exit__(self, *args):
self.id_current = self._id_function()


class DataStore(collections.Mapping):
class DataStore(Mapping):
"""
A class to store multiple numpy arrays and track them all
for changes.
Expand Down
2 changes: 1 addition & 1 deletion trimesh/graph.py
Expand Up @@ -113,7 +113,7 @@ def face_adjacency(faces=None,
adjacency_edges = edges[edge_groups[:, 0][nondegenerate]]
assert len(adjacency_edges) == len(adjacency)
return adjacency, adjacency_edges
return face_adjacency
return adjacency


def face_adjacency_unshared(mesh):
Expand Down
7 changes: 6 additions & 1 deletion trimesh/util.py
Expand Up @@ -45,6 +45,11 @@
StringIO.__exit__ = lambda a, b, c, d: a.close()
BytesIO = StringIO

try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping

# create a default logger
log = logging.getLogger('trimesh')

Expand Down Expand Up @@ -2058,7 +2063,7 @@ def allclose(a, b, atol):
return np.all(np.abs(a - b).max() < atol)


class FunctionRegistry(collections.Mapping):
class FunctionRegistry(Mapping):
"""
Non-overwritable mapping of string keys to functions.
Expand Down
2 changes: 1 addition & 1 deletion trimesh/version.py
@@ -1 +1 @@
__version__ = '3.3.9'
__version__ = '3.4.0'

0 comments on commit 33810a2

Please sign in to comment.