Beispiel #1
0
 def detect(cls, stream):
     """Return True if stream is valid."""
     try:
         csv.Sniffer().sniff(stream, delimiters=cls.delimiter)
         return True
     except (csv.Error, TypeError):
         return False
Beispiel #2
0
 def detect(stream):
     '''Return True if stream is valid CSV.'''
     try:
         csv.Sniffer().sniff(stream, delimiters="\t")
         return True
     except (csv.Error, TypeError):
         return False