optional is usually not needed

This commit is contained in:
Martin Diehl 2022-01-26 06:26:37 +01:00
parent 4f926b9686
commit e8c39077df
1 changed files with 3 additions and 3 deletions

View File

@ -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')