Alejandro-STC commited on
Commit
15d61b5
·
verified ·
1 Parent(s): 8de3fa1

Update parse csv string functions with none check

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -43,11 +43,15 @@ dspy.settings.configure(lm=model)
43
  # Utils
44
  def parse_CSV_string(csv_string):
45
  # Parses a CSV string into a list
 
 
46
  return list(map(str.strip, csv_string.split(',')))
47
 
48
 
49
  def parse_CSV_string_to_unique(csv_string):
50
  # Parses a CSV string into a unique list
 
 
51
  return list(set(map(str.lower, map(str.strip, csv_string.split(',')))))
52
 
53
  def parse_list_of_CSV_strings(list_of_csv_strings):
 
43
  # Utils
44
  def parse_CSV_string(csv_string):
45
  # Parses a CSV string into a list
46
+ if not csv_string:
47
+ return []
48
  return list(map(str.strip, csv_string.split(',')))
49
 
50
 
51
  def parse_CSV_string_to_unique(csv_string):
52
  # Parses a CSV string into a unique list
53
+ if not csv_string:
54
+ return []
55
  return list(set(map(str.lower, map(str.strip, csv_string.split(',')))))
56
 
57
  def parse_list_of_CSV_strings(list_of_csv_strings):