Skip to content

Commit

Permalink
add docstring to "handle_values_input" function
Browse files Browse the repository at this point in the history
  • Loading branch information
israelpoli committed Nov 6, 2023
1 parent da2fd05 commit d26eebb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Packs/GoogleSheets/Integrations/GoogleSheets/GoogleSheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,16 @@ def handle_values_input(values: str) -> list:
)

# Converting the values the user entered into an array of arrays
if isinstance(values_as_array := ast.literal_eval(values), list) and (
not values_as_array
or not all(isinstance(item, list) for item in values_as_array)
):
values_as_array = ast.literal_eval(values)

# Checks whether the given values are a singular empty list, such as "[]".
# if that's the case, it will convert it to [[]] (a list of lists).
if isinstance(values_as_array, list) and len(values_as_array) == 0:
values_as_array = [values_as_array]

# Checks whether the given values are a single non-empty list, e.g., "[1,2,3]".
# in such a case, it will convert it to [[1,2,3]] (a list of lists).
elif not all(isinstance(item, list) for item in values_as_array):
values_as_array = [values_as_array]

# Handling all values including the `None` value to be string
Expand Down

0 comments on commit d26eebb

Please sign in to comment.