1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
r"""
Empty Files (:mod:`skbio.io.format.emptyfile`)
==============================================
.. currentmodule:: skbio.io.format.emptyfile
This format exists to make debugging simpler, often an empty file is a mistake
which can take an embarrasing amount of time to notice. This format has only
a sniffer and no readers or writers, so error messages will indicate as such
if an empty file is accidentally used as input.
Format Support
--------------
**Has Sniffer: Yes**
Format Specification
--------------------
An empty file consists of only whitespace characters.
"""
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------
from skbio.io import create_format
emptyfile = create_format('<emptyfile>')
@emptyfile.sniffer()
def _empty_file_sniffer(fh):
for line in fh:
if line.strip():
return False, {}
return True, {}
|