Show
Ignore:
Timestamp:
08/14/06 00:49:13 (18 years ago)
Author:
jerome
Message:

Cleaned up some uglyness, thanks to pylint.

Files:
1 modified

Legend:

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

    r351 r353  
    2020# 
    2121 
     22"""This is the main module of pkpgcounter. 
     23 
     24It defines the PDLAnalyzer class, which provides a generic way to parse 
     25input files, by automatically detecting the best parser to use.""" 
     26 
    2227import sys 
    2328import tempfile 
     
    2631       escp2, dvi, tiff, ooo, zjstream 
    2732 
    28 class NoOption : 
    29     """A class for use as a default parameter to PDLAnalyzer's constructor.""" 
    30     debug = None 
    31     colorspace = None 
    32     resolution = None 
     33 
     34class AnalyzerOption : 
     35    """A class for use as the options parameter to PDLAnalyzer's constructor.""" 
     36    def __init__(self, debug=None, 
     37                       colorspace=None, 
     38                       resolution=None) : 
     39        """Sets initial attributes.""" 
     40        self.debug = debug 
     41        self.colorspace = colorspace 
     42        self.resolution = resolution 
     43     
    3344     
    3445class PDLAnalyzer :     
    3546    """Class for PDL autodetection.""" 
    36     def __init__(self, filename, options=NoOption()) : 
     47    def __init__(self, filename, options=AnalyzerOption()) : 
    3748        """Initializes the PDL analyzer. 
    3849         
     
    4354        self.options = options 
    4455        self.filename = filename 
     56        self.infile = None 
     57        self.mustclose = None 
    4558         
    4659    def getJobSize(self) :     
     
    95108            try : 
    96109                self.infile.seek(0) 
    97             except :     
     110            except IOError :     
    98111                pass    # probably stdin, which is not seekable 
    99112         
     
    142155            return valower 
    143156        else :     
    144             choices = ", ".join(map(repr, option.cichoices)) 
     157            choices = ", ".join([repr(o) for o in option.cichoices]) 
    145158            raise optparse.OptionValueError( 
    146159                "option %s: invalid choice: %r (choose from %s)"