doc and type hint fixes

This commit is contained in:
Jan Petykiewicz 2021-10-24 19:06:15 -07:00
parent 7340d41f10
commit b9f6507498
2 changed files with 5 additions and 6 deletions

View File

@ -198,7 +198,7 @@ def draw_polygon(self,
surface_normal: Axis normal to the plane we're drawing on. Integer in `range(3)`. surface_normal: Axis normal to the plane we're drawing on. Integer in `range(3)`.
center: 3-element ndarray or list specifying an offset applied to the polygon center: 3-element ndarray or list specifying an offset applied to the polygon
polygon: Nx2 or Nx3 ndarray specifying the vertices of a polygon (non-closed, polygon: Nx2 or Nx3 ndarray specifying the vertices of a polygon (non-closed,
clockwise). If Nx3, the surface_normal coordinate is ignored. Must have at clockwise). If Nx3, the `surface_normal` coordinate is ignored. Must have at
least 3 vertices. least 3 vertices.
thickness: Thickness of the layer to draw thickness: Thickness of the layer to draw
eps: Value to draw with ('epsilon'). See `draw_polygons()` for details. eps: Value to draw with ('epsilon'). See `draw_polygons()` for details.

View File

@ -1,4 +1,4 @@
from typing import List, Tuple, Callable, Dict, Optional, Union, Sequence, ClassVar from typing import List, Tuple, Callable, Dict, Optional, Union, Sequence, ClassVar, TypeVar
import numpy # type: ignore import numpy # type: ignore
from numpy import diff, floor, ceil, zeros, hstack, newaxis from numpy import diff, floor, ceil, zeros, hstack, newaxis
@ -10,9 +10,8 @@ import copy
from . import GridError from . import GridError
__author__ = 'Jan Petykiewicz'
eps_callable_type = Callable[[numpy.ndarray, numpy.ndarray, numpy.ndarray], numpy.ndarray] eps_callable_type = Callable[[numpy.ndarray, numpy.ndarray, numpy.ndarray], numpy.ndarray]
T = TypeVar('T', bound='Grid')
class Grid: class Grid:
@ -227,7 +226,7 @@ class Grid:
dxyz = self.shifted_dxyz(which_shifts) dxyz = self.shifted_dxyz(which_shifts)
return [exyz[a][:-1] + dxyz[a] / 2.0 for a in range(3)] return [exyz[a][:-1] + dxyz[a] / 2.0 for a in range(3)]
def autoshifted_dxyz(self): def autoshifted_dxyz(self) -> List[numpy.ndarray]:
""" """
Return cell widths, with each dimension shifted by the corresponding shifts. Return cell widths, with each dimension shifted by the corresponding shifts.
@ -325,7 +324,7 @@ class Grid:
with open(filename, 'wb') as f: with open(filename, 'wb') as f:
pickle.dump(self.__dict__, f, protocol=2) pickle.dump(self.__dict__, f, protocol=2)
def copy(self): def copy(self: T) -> T:
""" """
Returns: Returns:
Deep copy of the grid. Deep copy of the grid.