Skip to content

Commit

Permalink
Add type guards for random_state
Browse files Browse the repository at this point in the history
  • Loading branch information
junholee6a committed Sep 1, 2023
1 parent a279efd commit 555b0a7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dataprofiler/labelers/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,7 @@ def __init__(
random_state = random.Random(random_state)
elif isinstance(random_state, (list, tuple)) and len(random_state) == 3:
# tuple required for random state to be set, lists do not work
if isinstance(random_state[1], list):
random_state = list(random_state)
if isinstance(random_state[1], list) and isinstance(random_state, list):
random_state[1] = tuple(random_state[1])
if isinstance(random_state, list):
random_state = tuple(random_state)
Expand Down Expand Up @@ -1895,8 +1894,7 @@ def __init__(
random_state = random.Random(random_state)
elif isinstance(random_state, (list, tuple)) and len(random_state) == 3:
# tuple required for random state to be set, lists do not work
if isinstance(random_state[1], list):
random_state = list(random_state)
if isinstance(random_state[1], list) and isinstance(random_state, list):
random_state[1] = tuple(random_state[1])
if isinstance(random_state, list):
random_state = tuple(random_state)
Expand Down

0 comments on commit 555b0a7

Please sign in to comment.