Changeset 2830

Show
Ignore:
Timestamp:
04/04/06 11:40:56 (19 years ago)
Author:
jerome
Message:

Improved the code's quality a bit with pylint.

Location:
pykota/trunk/pykota
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/pjl.py

    r2637 r2830  
    202202    """Tries PJL accounting for a printer host.""" 
    203203    class fakeFilter : 
     204        """Fakes a filter for testing purposes.""" 
    204205        def __init__(self) : 
     206            """Initializes the fake filter.""" 
    205207            self.PrinterName = "FakePrintQueue" 
    206208            self.JobSizeBytes = 1 
    207209             
    208210        def printInfo(self, msg, level="info") : 
     211            """Prints informational message.""" 
    209212            sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 
    210213            sys.stderr.flush() 
    211214             
    212215        def logdebug(self, msg) :     
     216            """Prints debug message.""" 
    213217            self.printInfo(msg, "debug") 
    214218             
    215219    class fakeAccounter :         
     220        """Fakes an accounter for testing purposes.""" 
    216221        def __init__(self) : 
     222            """Initializes fake accounter.""" 
    217223            self.arguments = "pjl:9100" 
    218224            self.filter = fakeFilter() 
     
    220226             
    221227        def getLastPageCounter(self) :     
     228            """Fakes the return of a page counter.""" 
    222229            return 0 
    223230         
  • pykota/trunk/pykota/accounters/snmp.py

    r2637 r2830  
    211211    """Tries SNMP accounting for a printer host.""" 
    212212    class fakeFilter : 
     213        """Fakes a filter for testing purposes.""" 
    213214        def __init__(self) : 
     215            """Initializes the fake filter.""" 
    214216            self.PrinterName = "FakePrintQueue" 
    215217            self.JobSizeBytes = 1 
    216218             
    217219        def printInfo(self, msg, level="info") : 
     220            """Prints informational message.""" 
    218221            sys.stderr.write("%s : %s\n" % (level.upper(), msg)) 
    219222            sys.stderr.flush() 
    220223             
    221224        def logdebug(self, msg) :     
     225            """Prints debug message.""" 
    222226            self.printInfo(msg, "debug") 
    223227             
    224228    class fakeAccounter :         
     229        """Fakes an accounter for testing purposes.""" 
    225230        def __init__(self) : 
     231            """Initializes fake accounter.""" 
    226232            self.arguments = "snmp:public" 
    227233            self.filter = fakeFilter() 
     
    229235             
    230236        def getLastPageCounter(self) :     
     237            """Fakes the return of a page counter.""" 
    231238            return 0 
    232239         
  • pykota/trunk/pykota/dumper.py

    r2664 r2830  
    249249        sortindex = fields["jobdate"]     
    250250        entries = entries[1:] 
    251         entries.sort(lambda m,n,si=sortindex : cmp(m[si], n[si])) 
     251        entries.sort(lambda m, n, si=sortindex : cmp(m[si], n[si])) 
    252252        for entry in entries :     
    253253            printername = entry[fields["printername"]] 
  • pykota/trunk/pykota/reporters/html.py

    r2622 r2830  
    2525import os 
    2626import urllib 
    27 from mx import DateTime 
    2827 
    29 from pykota.reporter import BaseReporter, PyKotaReporterError 
     28from pykota.reporter import BaseReporter 
    3029     
    3130class Reporter(BaseReporter) :     
  • pykota/trunk/pykota/reporters/text.py

    r2622 r2830  
    2323# 
    2424 
    25 from pykota.reporter import BaseReporter, PyKotaReporterError 
     25from pykota.reporter import BaseReporter 
    2626     
    2727class Reporter(BaseReporter) :     
  • pykota/trunk/pykota/storages/ldapstorage.py

    r2798 r2830  
    3030 
    3131import sys 
    32 import os 
    3332import types 
    3433import time 
     
    3938from mx import DateTime 
    4039 
    41 from pykota.storage import PyKotaStorageError, BaseStorage, StorageObject, \ 
     40from pykota.storage import PyKotaStorageError, BaseStorage, \ 
    4241                           StorageUser, StorageGroup, StoragePrinter, \ 
    4342                           StorageJob, StorageLastJob, StorageUserPQuota, \ 
     
    827826        names = [self.userCharsetToDatabase(n) for n in names] 
    828827        if self.info["userquotabase"].lower() == "user" : 
    829            base = self.info["userbase"] 
     828            base = self.info["userbase"] 
    830829        else : 
    831            base = self.info["userquotabase"] 
     830            base = self.info["userquotabase"] 
    832831        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % \ 
    833832                                  (pname, "".join(["(pykotaUserName=%s)" % uname for uname in names])), \ 
     
    872871        names = [self.userCharsetToDatabase(n) for n in names] 
    873872        if self.info["groupquotabase"].lower() == "group" : 
    874            base = self.info["groupbase"] 
     873            base = self.info["groupbase"] 
    875874        else : 
    876            base = self.info["groupquotabase"] 
     875            base = self.info["groupquotabase"] 
    877876        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s)(|%s))" % \ 
    878877                                  (pname, "".join(["(pykotaGroupName=%s)" % gname for gname in names])), \ 
  • pykota/trunk/pykota/storages/mysqlstorage.py

    r2821 r2830  
    2626import time 
    2727 
    28 from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageJob,StorageLastJob,StorageUserPQuota,StorageGroupPQuota 
     28from pykota.storage import PyKotaStorageError, BaseStorage 
    2929from pykota.storages.sql import SQLStorage 
    3030 
  • pykota/trunk/pykota/storages/pgstorage.py

    r2773 r2830  
    2626from types import StringType 
    2727 
    28 from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageJob,StorageLastJob,StorageUserPQuota,StorageGroupPQuota 
     28from pykota.storage import PyKotaStorageError, BaseStorage 
    2929from pykota.storages.sql import SQLStorage 
    3030 
  • pykota/trunk/pykota/storages/sqlitestorage.py

    r2773 r2830  
    2525import time 
    2626 
    27 from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageJob,StorageLastJob,StorageUserPQuota,StorageGroupPQuota 
     27from pykota.storage import PyKotaStorageError, BaseStorage 
    2828from pykota.storages.sql import SQLStorage 
    2929 
  • pykota/trunk/pykota/storages/sql.py

    r2787 r2830  
    2323# 
    2424 
    25 from pykota.storage import PyKotaStorageError, BaseStorage, StorageObject, \ 
    26                            StorageUser, StorageGroup, StoragePrinter, \ 
     25from pykota.storage import StorageUser, StorageGroup, StoragePrinter, \ 
    2726                           StorageJob, StorageLastJob, StorageUserPQuota, \ 
    2827                           StorageGroupPQuota, StorageBillingCode 
  • pykota/trunk/pykota/tool.py

    r2807 r2830  
    3131import gettext 
    3232import locale 
    33 import signal 
    3433import socket 
    35 import tempfile 
    36 import md5 
    3734import time 
    38 import ConfigParser 
    39 import popen2 
    4035from email.MIMEText import MIMEText 
    4136from email.Header import Header 
     
    4338from mx import DateTime 
    4439 
    45 from pykota import config, storage, logger, accounter 
     40from pykota import config, storage, logger 
    4641from pykota.version import __version__, __author__, __years__, __gplblurb__ 
    4742