consistent and correct type hinting/documentation for comments
This commit is contained in:
parent
164c7b4bc3
commit
92a4883344
|
@ -50,15 +50,16 @@ class Grid:
|
||||||
Coordinates of grid origin in meter. Defaults to [0.0,0.0,0.0].
|
Coordinates of grid origin in meter. Defaults to [0.0,0.0,0.0].
|
||||||
initial_conditions : dictionary, optional
|
initial_conditions : dictionary, optional
|
||||||
Labels and values of the inital conditions at each material point.
|
Labels and values of the inital conditions at each material point.
|
||||||
comments : (list of) str, optional
|
comments : str or iterable of str, optional
|
||||||
Comments, e.g. history of operations.
|
Additional, human-readable information, e.g. history of operations.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.material = material
|
self.material = material
|
||||||
self.size = size # type: ignore
|
self.size = size # type: ignore
|
||||||
self.origin = origin # type: ignore
|
self.origin = origin # type: ignore
|
||||||
self.initial_conditions = {} if initial_conditions is None else initial_conditions
|
self.initial_conditions = {} if initial_conditions is None else initial_conditions
|
||||||
self.comments = [] if comments is None else comments # type: ignore
|
comments_ = [comments] if isinstance(comments,str) else comments
|
||||||
|
self.comments = [] if comments_ is None else [str(c) for c in comments_]
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
"""Give short human-readable summary."""
|
"""Give short human-readable summary."""
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Table:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
shapes: dict,
|
shapes: dict,
|
||||||
data: np.ndarray,
|
data: np.ndarray,
|
||||||
comments: Union[str, Iterable] = None):
|
comments: Union[str, Iterable[str]] = None):
|
||||||
"""
|
"""
|
||||||
New spreadsheet.
|
New spreadsheet.
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class Table:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
comments_ = [comments] if isinstance(comments,str) else comments
|
comments_ = [comments] if isinstance(comments,str) else comments
|
||||||
self.comments = [] if comments_ is None else [c for c in comments_]
|
self.comments = [] if comments_ is None else [str(c) for c in comments_]
|
||||||
self.shapes = { k:(v,) if isinstance(v,(np.int64,np.int32,int)) else v for k,v in shapes.items() }
|
self.shapes = { k:(v,) if isinstance(v,(np.int64,np.int32,int)) else v for k,v in shapes.items() }
|
||||||
self.data = pd.DataFrame(data=data)
|
self.data = pd.DataFrame(data=data)
|
||||||
self._relabel('uniform')
|
self._relabel('uniform')
|
||||||
|
|
|
@ -103,7 +103,7 @@ class VTK:
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
comments : str or list of str
|
comments : str or sequence of str
|
||||||
Comments.
|
Comments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue