Skip to content

Commit

Permalink
fixing type-check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tnixon committed Sep 21, 2023
1 parent d250ece commit 1ca8761
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/tempo/tsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __validate_ts_string(ts_text: str) -> None:

@staticmethod
def __validated_column(df: DataFrame, colname: str) -> str:
if colname is not str:
if type(colname) != str:
raise TypeError(
f"Column names must be of type str; found {type(colname)} instead!"
)
Expand All @@ -122,20 +122,19 @@ def __validated_columns(
self, df: DataFrame, colnames: Optional[Union[str, List[str]]]
) -> List[str]:
# if provided a string, treat it as a single column
valid_colnames: List[str] = []
if colnames is str:
valid_colnames = [str(colnames)]
if type(colnames) == str:
colnames = [colnames]
# otherwise we really should have a list or None
elif colnames is None:
valid_colnames = []
elif colnames is not list:
colnames = []
elif type(colnames) != list:
raise TypeError(
f"Columns must be of type list, str, or None; found {type(colnames)} instead!"
)
# validate each column
for col in valid_colnames:
for col in colnames:
self.__validated_column(df, col)
return valid_colnames
return colnames

def __checkPartitionCols(self, tsdf_right: "TSDF") -> None:
for left_col, right_col in zip(self.partitionCols, tsdf_right.partitionCols):
Expand Down

0 comments on commit 1ca8761

Please sign in to comment.