~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/textfile.py

  • Committer: Aaron Bentley
  • Date: 2006-04-16 17:49:14 UTC
  • mto: This revision was merged to the branch mainline in revision 1673.
  • Revision ID: aaron.bentley@utoronto.ca-20060416174914-99d5dec4eafbb923
Whitespace fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib.errors import BinaryFile
20
20
from bzrlib.iterablefile import IterableFile
21
21
from bzrlib.osutils import file_iterator
 
22
 
 
23
 
22
24
def text_file(input):
23
25
    """Produce a file iterator that is guaranteed to be text, without seeking.
24
26
    BinaryFile is raised if the file contains a NUL in the first 1024 bytes.
37
39
    if '\x00' in f.read(1024):
38
40
        raise BinaryFile()
39
41
 
 
42
 
40
43
def check_text_path(path):
41
44
    """Check whether the supplied path is a text, not binary file.
42
45
    Raise BinaryFile if a NUL occurs in the first 1024 bytes.