[Python-checkins] python/dist/src/Mac/Demo/example0 checktext.py,
1.2, 1.3
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Sun Jul 18 07:58:37 CEST 2004
Update of /cvsroot/python/python/dist/src/Mac/Demo/example0
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29056/Demo/example0
Modified Files:
checktext.py
Log Message:
Whitespace normalization, via reindent.py.
Index: checktext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/example0/checktext.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** checktext.py 26 Jan 2003 20:35:37 -0000 1.2
--- checktext.py 18 Jul 2004 05:58:05 -0000 1.3
***************
*** 6,37 ****
def main():
! pathname = EasyDialogs.AskFileForOpen(message='File to check end-of-lines in:')
! if not pathname:
! sys.exit(0)
! fp = open(pathname, 'rb')
! try:
! data = fp.read()
! except MemoryError:
! EasyDialogs.Message('Sorry, file is too big.')
! sys.exit(0)
! if len(data) == 0:
! EasyDialogs.Message('File is empty.')
! sys.exit(0)
! number_cr = string.count(data, '\r')
! number_lf = string.count(data, '\n')
! if number_cr == number_lf == 0:
! EasyDialogs.Message('File contains no lines.')
! if number_cr == 0:
! EasyDialogs.Message('File has unix-style line endings')
! elif number_lf == 0:
! EasyDialogs.Message('File has mac-style line endings')
! elif number_cr == number_lf:
! EasyDialogs.Message('File probably has MSDOS-style line endings')
! else:
! EasyDialogs.Message('File has no recognizable line endings (binary file?)')
! sys.exit(0)
!
if __name__ == '__main__':
! main()
!
!
--- 6,35 ----
def main():
! pathname = EasyDialogs.AskFileForOpen(message='File to check end-of-lines in:')
! if not pathname:
! sys.exit(0)
! fp = open(pathname, 'rb')
! try:
! data = fp.read()
! except MemoryError:
! EasyDialogs.Message('Sorry, file is too big.')
! sys.exit(0)
! if len(data) == 0:
! EasyDialogs.Message('File is empty.')
! sys.exit(0)
! number_cr = string.count(data, '\r')
! number_lf = string.count(data, '\n')
! if number_cr == number_lf == 0:
! EasyDialogs.Message('File contains no lines.')
! if number_cr == 0:
! EasyDialogs.Message('File has unix-style line endings')
! elif number_lf == 0:
! EasyDialogs.Message('File has mac-style line endings')
! elif number_cr == number_lf:
! EasyDialogs.Message('File probably has MSDOS-style line endings')
! else:
! EasyDialogs.Message('File has no recognizable line endings (binary file?)')
! sys.exit(0)
!
if __name__ == '__main__':
! main()
More information about the Python-checkins
mailing list