Onyx logo

Previous topic

onyx.doctestmod – Module for running of doctest on Onyx modules.

Next topic

onyx.lint – Verify and/or generate various boilerplate for copyright and license.

This Page

onyx.istext – Classifies file data into text or binary, with line-ending and tab flags.

Use –unix argument to only print the filenames of non-TAB unix files.

>>> module_dir, module_name = os.path.split(__file__)
>>> main([os.path.join(module_dir, 'SConscript'), 'no_such_file']) 
istext: ...SConscript   unix 
istext: no_such_file   not-a-file 
>>> for text in _test_sets:
...   print repr(text), ' ', classify(text)
'abc'   noends
'a\tbc'   noends TAB
'ab\nc'   unix
'ab\rc'   mac
'ab\r\nc'   dos
'a\tbc'   noends TAB
'a\tb\nc'   unix TAB
'a\tb\rc'   mac TAB
'a\tb\r\nc'   dos TAB
'\x00abc'   binary
'abc\xff'   binary
onyx.istext.classify(data)
onyx.istext.main(args)