Show
Ignore:
Timestamp:
10/06/08 00:22:07 (16 years ago)
Author:
jerome
Message:

Removed spaces at EOL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/cfax.py

    r3410 r3436  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2929    """A parser for Structured Fax documents.""" 
    3030    format = "Structured Fax" 
    31     def isValid(self) :         
     31    def isValid(self) : 
    3232        """Returns True if data is Structured Fax, else False.""" 
    3333        if self.firstblock.startswith("Sfff") : 
    3434            return True 
    35         else :     
     35        else : 
    3636            return False 
    37              
     37 
    3838    def getJobSize(self) : 
    3939        """Counts pages in a Structured Fax document. 
    40          
     40 
    4141           Algorithm by Jerome Alet. 
    42             
     42 
    4343           The documentation used for this was : 
    44           
     44 
    4545           http://delphi.pjh2.de/articles/graphic/sff_format.php 
    4646        """ 
     
    5757             offsetlastpage, 
    5858             offsetdocumentend) = unpack("<4sBBHHHII", docheader) 
    59             self.infile.seek(offsetfirstpage - len(docheader), 1)      
     59            self.infile.seek(offsetfirstpage - len(docheader), 1) 
    6060            while True : 
    6161                headerid = self.infile.read(1) 
    6262                if not headerid : 
    6363                    break 
    64                 headerid = ord(headerid)     
     64                headerid = ord(headerid) 
    6565                if 1 <= headerid <= 216 : # Normal record header 
    6666                    self.infile.seek(headerid, 1) 
     
    6969                    if not additionalbyte : 
    7070                        break 
    71                     additionalbyte = ord(additionalbyte)     
     71                    additionalbyte = ord(additionalbyte) 
    7272                    if 1 <= additionalbyte <= 255 : 
    7373                        # Skip additional user information (reserved) 
    7474                        self.infile.seek(additionalbyte, 1) 
    75                 elif not headerid :         
     75                elif not headerid : 
    7676                    # Record with more than 216 MH-coded bytes 
    7777                    recordlen = self.infile.read(2) 
    7878                    if not recordlen : 
    7979                        break 
    80                     recordlen = unpack("<H", recordlen)[0]     
     80                    recordlen = unpack("<H", recordlen)[0] 
    8181                    self.infile.seek(recordlen, 1) 
    8282                elif headerid == 254 : # Page header 
    8383                    pageheader = self.infile.read(17) 
    84                     if not pageheader :  
     84                    if not pageheader : 
    8585                        break 
    8686                    headerlen = ord(pageheader[0]) 
     
    9595                     offsetpreviouspage, 
    9696                     offsetnextpage) = unpack("<4BHHII", pageheader[1:]) 
    97                     pagecount += 1     
     97                    pagecount += 1 
    9898                    if (offsetnextpage == 1) or (vres == 255) : 
    9999                        break # End Of Document 
    100                     self.infile.seek(offsetnextpage, 1)     
    101         except struct.error :      
     100                    self.infile.seek(offsetnextpage, 1) 
     101        except struct.error : 
    102102             raise pdlparser.PDLParserError, "Invalid Structured Fax datas" 
    103         return max(docpagecount, pagecount)      
     103        return max(docpagecount, pagecount)