예제 #1
0
파일: _csv.py 프로젝트: farzeni/tablib
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
예제 #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
예제 #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