optional is usually not needed
This commit is contained in:
parent
4f926b9686
commit
e8c39077df
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, Optional, Tuple, List
|
from typing import Union, Tuple, List
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -12,7 +12,7 @@ from . import util
|
||||||
class Table:
|
class Table:
|
||||||
"""Manipulate multi-dimensional spreadsheet-like data."""
|
"""Manipulate multi-dimensional spreadsheet-like data."""
|
||||||
|
|
||||||
def __init__(self, data: np.ndarray, shapes: dict, comments: Optional[Union[str, list]] = None):
|
def __init__(self, data: np.ndarray, shapes: dict, comments: Union[str, list] = None):
|
||||||
"""
|
"""
|
||||||
New spreadsheet.
|
New spreadsheet.
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class Table:
|
||||||
self.data.columns = self._label(self.shapes,how) #type: ignore
|
self.data.columns = self._label(self.shapes,how) #type: ignore
|
||||||
|
|
||||||
|
|
||||||
def _add_comment(self, label: str, shape: Tuple[int, ...], info: Optional[str]):
|
def _add_comment(self, label: str, shape: Tuple[int, ...], info: str = None):
|
||||||
if info is not None:
|
if info is not None:
|
||||||
specific = f'{label}{" "+str(shape) if np.prod(shape,dtype=int) > 1 else ""}: {info}'
|
specific = f'{label}{" "+str(shape) if np.prod(shape,dtype=int) > 1 else ""}: {info}'
|
||||||
general = util.execution_stamp('Table')
|
general = util.execution_stamp('Table')
|
||||||
|
|
Loading…
Reference in New Issue