type fixes and ignores

This commit is contained in:
jan 2021-02-13 16:48:53 -08:00
commit ac57454763
10 changed files with 27 additions and 26 deletions

View file

@ -1,6 +1,6 @@
from typing import List, Dict
import numpy
from numpy.linalg import norm
from typing import List, Dict, Any
import numpy # type: ignore
from numpy.linalg import norm # type: ignore
from . import poly_t, plane_t
from .util import _get_maps, find_components, find_faces
@ -255,7 +255,7 @@ def build_polyhedron(vertices: numpy.ndarray, faces: numpy.ndarray) -> poly_t:
return {'vertices': final_vertices, 'neighbors': neighbors}
def boundary_from_poly(poly: poly_t) -> Dict:
def boundary_from_poly(poly: poly_t) -> List[Dict[str, Any]]:
'''
Generate a boundary represeentation corresponding to the provided
3-vertex-connected Schlegel diagram.
@ -275,7 +275,7 @@ def boundary_from_poly(poly: poly_t) -> Dict:
faces = find_faces(neighbors)
num_components = owning_component.max() + 1
components = [[] for _ in range(num_components)]
components: List[List[numpy.ndarray]] = [[] for _ in range(num_components)]
for face in faces:
component_ind = owning_component[face[0]]
components[component_ind].append(face)

View file

@ -1,5 +1,5 @@
from typing import Dict, Tuple
import numpy
import numpy # type: ignore
from . import poly_t, plane_t
from .util import find_faces

View file

@ -1,6 +1,6 @@
from typing import List
import numpy
from numpy.linalg import norm
import numpy # type: ignore
from numpy.linalg import norm # type: ignore
from . import poly_t, plane_t

View file

@ -8,9 +8,9 @@ from time import perf_counter
import random
import logging
import numpy
import numpy # type: ignore
from numpy import sin, cos, pi
from numpy.linalg import norm
from numpy.linalg import norm # type: ignore
import adze
import adze.util

View file

@ -1,9 +1,9 @@
import logging
import pytest
from pytest import approx
import numpy
from numpy.linalg import norm
from numpy.testing import assert_allclose, assert_array_equal
import numpy # type: ignore
from numpy.linalg import norm # type: ignore
from numpy.testing import assert_allclose, assert_array_equal # type: ignore
import adze
import adze.util

View file

@ -1,9 +1,9 @@
import logging
import pytest
from pytest import approx
import numpy
from numpy.linalg import norm
from numpy.testing import assert_allclose, assert_array_equal
import numpy # type: ignore
from numpy.linalg import norm # type: ignore
from numpy.testing import assert_allclose, assert_array_equal # type: ignore
from time import perf_counter
import adze
@ -55,8 +55,8 @@ def visualize_isosurface(grid,
show_edges: Whether to draw triangle edges. Default True
finalize: Whether to call pyplot.show() after constructing the plot. Default True
"""
from matplotlib import pyplot
import skimage.measure
from matplotlib import pyplot # type: ignore
import skimage.measure # type: ignore
# Claims to be unused, but needed for subplot(projection='3d')
from mpl_toolkits.mplot3d import Axes3D

View file

@ -1,6 +1,6 @@
import numpy
import numpy # type: ignore
from numpy import pi, cos, sin
from numpy.linalg import norm
from numpy.linalg import norm # type: ignore
import random
import adze

View file

@ -1,4 +1,5 @@
import numpy
from typing import Union
import numpy # type: ignore
from numpy import sin, cos
from . import poly_t, plane_t
@ -41,7 +42,7 @@ def translate(poly: poly_t, shift: numpy.ndarray) -> poly_t:
return poly
def scale(poly: poly_t, factor: numpy.ndarray or float) -> poly_t:
def scale(poly: poly_t, factor: Union[numpy.ndarray, float]) -> poly_t:
'''
Scale the polyhedron.
Can scale by a single value, or scale each axis individually

View file

@ -1,5 +1,5 @@
from typing import Dict, Tuple, List
import numpy
import numpy # type: ignore
plane_t = Tuple[numpy.ndarray, float]
@ -92,11 +92,11 @@ def find_faces(neighbors: numpy.ndarray) -> List[numpy.ndarray]:
# Alternative approach, less memory-intensive but slower
faces = [[v] for v in v_current]
def add_edges(edge_id, v_nxt, _k):
def add_edges(edge_id, v_nxt, k):
for i, vn in zip(edge_id, v_nxt):
faces[i].append(vn)
def cleaned_faces(remove, _k):
def cleaned_faces(remove, k):
faces_set = []
for i in numpy.where(~remove)[0]:
faces_set.append(faces[i])

View file

@ -1,5 +1,5 @@
from typing import Tuple, List
import numpy
import numpy # type: ignore
from . import poly_t, plane_t
from .split import split, clip