[pykota-devel] r3502 - pkpgcounter/trunk/pkpgpdls
trac at pykota.com
trac at pykota.com
Sat Jul 18 09:35:13 CEST 2009
Author: jerome
Date: 2009-07-18 09:35:07 +0200 (Sat, 18 Jul 2009)
New Revision: 3502
Modified:
pkpgcounter/trunk/pkpgpdls/plain.py
Log:
Doesn't check anymore if the current line ends with an EOL marker. From
what I understand from reading Python's documentation, this can only
occur on the very last line of the file anyway. Fixes #44.
Modified: pkpgcounter/trunk/pkpgpdls/plain.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/plain.py 2009-06-02 04:06:21 UTC (rev 3501)
+++ pkpgcounter/trunk/pkpgpdls/plain.py 2009-07-18 07:35:07 UTC (rev 3502)
@@ -56,16 +56,14 @@
pagecount = 0
linecount = 0
for line in self.infile :
- if line.endswith("\n") :
- linecount += 1
- if (linecount > pagesize) :
- pagecount += 1
- linecount = 0
- else :
- cnt = line.count("\f")
- if cnt :
- pagecount += cnt
- linecount = 0
+ linecount += 1
+ if (linecount > pagesize) :
+ pagecount += 1
+ linecount = 0
else :
- raise pdlparser.PDLParserError, "Unsupported file format. Please send the file to %s" % version.__authoremail__
+ cnt = line.count("\f")
+ if cnt :
+ pagecount += cnt
+ linecount = 0
+
return pagecount + 1 # NB : empty files are catched in isValid()
More information about the pykota-devel
mailing list