Exemple #1
0
def detect(stream, delimiter=DEFAULT_DELIMITER):
    """Returns True if given stream is valid CSV."""
    try:
        csv.Sniffer().sniff(stream, delimiters=delimiter)
        return True
    except (csv.Error, TypeError):
        return False
Exemple #2
0
def detect(stream):
    """Returns True if given stream is valid TSV."""
    try:
        csv.Sniffer().sniff(stream, delimiters='\t')
        return True
    except (csv.Error, TypeError):
        return False
Exemple #3
0
def detect(stream):
    """Returns True if given stream is valid CSV."""
    try:
        csv.Sniffer().sniff(stream)
        return True
    except csv.Error:
        return False