diff options
author | Rob Austein <sra@hactrn.net> | 2009-04-29 04:07:41 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-04-29 04:07:41 +0000 |
commit | 55769ccf0d1230698646ab5afa331e7617505f4f (patch) | |
tree | 126f9e21c2e4dd8dfbdc6c266f18d5c4d6004fa3 /rpkid | |
parent | 4762069728c3874b8a240c5c99c87f935051fd5a (diff) |
More lint
svn path=/rpkid/Makefile; revision=2373
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/Makefile | 8 | ||||
-rw-r--r-- | rpkid/cronjob.py | 4 | ||||
-rw-r--r-- | rpkid/cross_certify.py | 6 | ||||
-rw-r--r-- | rpkid/extract-key.py | 6 | ||||
-rw-r--r-- | rpkid/irbe-setup.py | 8 | ||||
-rwxr-xr-x | rpkid/irbe_cli.py | 2 | ||||
-rwxr-xr-x | rpkid/irdbd.py | 4 | ||||
-rw-r--r-- | rpkid/missing-oids.py | 2 | ||||
-rwxr-xr-x | rpkid/pubd.py | 4 | ||||
-rwxr-xr-x | rpkid/rootd.py | 6 | ||||
-rw-r--r-- | rpkid/rpki/config.py | 6 | ||||
-rw-r--r-- | rpkid/rpki/https.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/oids.py | 2 | ||||
-rw-r--r-- | rpkid/rpki/resource_set.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/sql.py | 2 | ||||
-rw-r--r-- | rpkid/rpki/up_down.py | 2 | ||||
-rw-r--r-- | rpkid/rpki/xml_utils.py | 4 | ||||
-rwxr-xr-x | rpkid/rpkid.py | 4 | ||||
-rw-r--r-- | rpkid/testbed.py | 6 | ||||
-rw-r--r-- | rpkid/testpoke.py | 4 |
20 files changed, 41 insertions, 47 deletions
diff --git a/rpkid/Makefile b/rpkid/Makefile index 981085c7..04059c84 100644 --- a/rpkid/Makefile +++ b/rpkid/Makefile @@ -135,11 +135,5 @@ dox doxygen: irbe_cli.usage doc/irdbd.dot doc/pubd.dot doc/rpkid.dot doc:: dox -# Preliminary experiment with pylint. Its default coding style -# differs enough from mine that it's not really usable without -# customization. In the long run this should be use a pylint config -# file rather than attempting to do it inline here. Useful options -# which lead to the others: --help, --rcfile, --generate-rcfile. - lint: - find * -name .svn -prune -o -type f -name '*.py' -print0 | xargs -0 pylint --output-format parseable --indent-string ' ' + pylint --rcfile ../scripts/pylint.rc rpki/[a-z]*.py cronjob.py cross_certify.py irbe_cli.py irdbd.py pubd.py rootd.py rpkid.py testbed.py testpoke.py diff --git a/rpkid/cronjob.py b/rpkid/cronjob.py index 12765ba1..22cadd2c 100644 --- a/rpkid/cronjob.py +++ b/rpkid/cronjob.py @@ -29,8 +29,8 @@ import rpki.config, rpki.https, getopt, sys cfg_file = "cronjob.conf" debug = False -opts,argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) diff --git a/rpkid/cross_certify.py b/rpkid/cross_certify.py index 88c5718f..97d436af 100644 --- a/rpkid/cross_certify.py +++ b/rpkid/cross_certify.py @@ -46,9 +46,9 @@ def usage(code): output = None lifetime = rpki.sundial.timedelta(days = 30) -opts,argv = getopt.getopt(sys.argv[1:], "h?i:o:c:k:s:l:", - ["help", "in=", "out=", "ca=", "key=", "serial=", "lifetime="]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "h?i:o:c:k:s:l:", + ["help", "in=", "out=", "ca=", "key=", "serial=", "lifetime="]) +for o, a in opts: if o in ("-h", "--help", "-?"): usage(0) elif o in ("-i", "--in"): diff --git a/rpkid/extract-key.py b/rpkid/extract-key.py index dabca32a..74db1c02 100644 --- a/rpkid/extract-key.py +++ b/rpkid/extract-key.py @@ -53,9 +53,9 @@ user = "rpki" passwd = "fnord" db = "rpki" -opts,argv = getopt.getopt(sys.argv[1:], "s:b:u:p:d:h?", - ["self=", "bsc=", "user=", "password=", "db=", "help"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "s:b:u:p:d:h?", + ["self=", "bsc=", "user=", "password=", "db=", "help"]) +for o, a in opts: if o in ("-h", "--help", "-?"): usage(0) elif o in ("-s", "--self"): diff --git a/rpkid/irbe-setup.py b/rpkid/irbe-setup.py index 15b0d346..e04f4abe 100644 --- a/rpkid/irbe-setup.py +++ b/rpkid/irbe-setup.py @@ -66,10 +66,10 @@ pdu = call_rpkid(pdu) bsc_id = pdu.bsc_id print "Issue the business cert" -i,o = os.popen2(("openssl", "x509", "-req", - "-CA", "biz-certs/Bob-CA.cer", - "-CAkey", "biz-certs/Bob-CA.key", - "-CAserial", "biz-certs/Bob-CA.srl")) +i, o = os.popen2(("openssl", "x509", "-req", + "-CA", "biz-certs/Bob-CA.cer", + "-CAkey", "biz-certs/Bob-CA.key", + "-CAserial", "biz-certs/Bob-CA.srl")) i.write(pdu.pkcs10_request.get_PEM()) i.close() cer = rpki.x509.X509(PEM = o.read()) diff --git a/rpkid/irbe_cli.py b/rpkid/irbe_cli.py index 8c2b3d81..af18d591 100755 --- a/rpkid/irbe_cli.py +++ b/rpkid/irbe_cli.py @@ -106,7 +106,7 @@ class cmd_msg_mixin(object): @classmethod def usage(cls): """Generate usage message for this PDU.""" - for k,v in cls.pdus.items(): + for k, v in cls.pdus.items(): print usage_fill(k, v.usage()) # left-right protcol diff --git a/rpkid/irdbd.py b/rpkid/irdbd.py index 46669049..5274926f 100755 --- a/rpkid/irdbd.py +++ b/rpkid/irdbd.py @@ -88,8 +88,8 @@ rpki.log.init("irdbd") cfg_file = "irdbd.conf" -opts,argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) diff --git a/rpkid/missing-oids.py b/rpkid/missing-oids.py index c9597531..f5571753 100644 --- a/rpkid/missing-oids.py +++ b/rpkid/missing-oids.py @@ -22,7 +22,7 @@ import POW.pkix, rpki.oids need_header = True -for oid,name in rpki.oids.oid2name.items(): +for oid, name in rpki.oids.oid2name.items(): try: POW.pkix.oid2obj(oid) except: diff --git a/rpkid/pubd.py b/rpkid/pubd.py index 5fbfcb9a..1fb2bace 100755 --- a/rpkid/pubd.py +++ b/rpkid/pubd.py @@ -115,8 +115,8 @@ rpki.log.init("pubd") cfg_file = "pubd.conf" profile = False -opts,argv = getopt.getopt(sys.argv[1:], "c:hp:?", ["config=", "help"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:hp:?", ["config=", "help"]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) diff --git a/rpkid/rootd.py b/rpkid/rootd.py index 74157281..65af010b 100755 --- a/rpkid/rootd.py +++ b/rpkid/rootd.py @@ -177,7 +177,7 @@ class message_pdu(rpki.up_down.message_pdu): "revoke" : revoke_pdu, "revoke_response" : rpki.up_down.revoke_response_pdu, "error_response" : rpki.up_down.error_response_pdu } - type2name = dict((v,k) for k,v in name2type.items()) + type2name = dict((v, k) for k, v in name2type.items()) class sax_handler(rpki.up_down.sax_handler): pdu = message_pdu @@ -213,8 +213,8 @@ rpki.log.init("rootd") cfg_file = "rootd.conf" -opts,argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:h?", ["config=", "help"]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) diff --git a/rpkid/rpki/config.py b/rpkid/rpki/config.py index df856311..72bbc589 100644 --- a/rpkid/rpki/config.py +++ b/rpkid/rpki/config.py @@ -22,11 +22,11 @@ import ConfigParser class parser(ConfigParser.RawConfigParser): - def __init__(self, file = None, section = None): + def __init__(self, filename = None, section = None): """Initialize this parser.""" ConfigParser.RawConfigParser.__init__(self) - if file: - self.read(file) + if filename: + self.read(filename) self.default_section = section def multiget(self, option, section = None): diff --git a/rpkid/rpki/https.py b/rpkid/rpki/https.py index 0e51cec9..b461f0cf 100644 --- a/rpkid/rpki/https.py +++ b/rpkid/rpki/https.py @@ -216,7 +216,7 @@ class requestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def rpki_find_handler(self): """Helper method to search self.rpki_handlers.""" - for s,h in self.rpki_handlers: + for s, h in self.rpki_handlers: if self.path.startswith(s): return h return None @@ -321,5 +321,5 @@ def server(handlers, server_key, server_cert, port = 4433, host ="", client_ta = except rpki.exceptions.ServerShuttingDown: pass finally: - for sig,handler in old_signal_handlers: + for sig, handler in old_signal_handlers: signal.signal(sig, handler) diff --git a/rpkid/rpki/oids.py b/rpkid/rpki/oids.py index 5824ad17..59c36cf8 100644 --- a/rpkid/rpki/oids.py +++ b/rpkid/rpki/oids.py @@ -54,4 +54,4 @@ oid2name = { ## @var name2oid # Mapping table of string names to OIDs -name2oid = dict((v,k) for k,v in oid2name.items()) +name2oid = dict((v, k) for k, v in oid2name.items()) diff --git a/rpkid/rpki/resource_set.py b/rpkid/rpki/resource_set.py index baaccfc4..10736812 100644 --- a/rpkid/rpki/resource_set.py +++ b/rpkid/rpki/resource_set.py @@ -307,7 +307,7 @@ class resource_set(list): sql.execute(query, args) return cls(ini = [cls.range_type(cls.range_type.datum_type(b), cls.range_type.datum_type(e)) - for (b,e) in sql.fetchall()]) + for (b, e) in sql.fetchall()]) class resource_set_as(resource_set): """ASN resource set.""" @@ -690,7 +690,7 @@ class roa_prefix_set(list): sql.execute(query, args) return cls([cls.prefix_type(cls.prefix_type.range_type.datum_type(x), int(y), int(z)) - for (x,y,z) in sql.fetchall()]) + for (x, y, z) in sql.fetchall()]) def to_roa_tuple(self): """Convert ROA prefix set into tuple format used by ROA ASN.1 encoder. diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py index 6705e53b..61c1ed8f 100644 --- a/rpkid/rpki/sql.py +++ b/rpkid/rpki/sql.py @@ -97,7 +97,7 @@ class template(object): """SQL template generator.""" def __init__(self, table_name, index_column, *data_columns): """Build a SQL template.""" - type_map = dict((x[0],x[1]) for x in data_columns if isinstance(x, tuple)) + type_map = dict((x[0], x[1]) for x in data_columns if isinstance(x, tuple)) data_columns = tuple(isinstance(x, tuple) and x[0] or x for x in data_columns) columns = (index_column,) + data_columns self.table = table_name diff --git a/rpkid/rpki/up_down.py b/rpkid/rpki/up_down.py index 2d087b0d..e5031c00 100644 --- a/rpkid/rpki/up_down.py +++ b/rpkid/rpki/up_down.py @@ -476,7 +476,7 @@ class message_pdu(base_elt): "revoke_response" : revoke_response_pdu, "error_response" : error_response_pdu } - type2name = dict((v,k) for k,v in name2type.items()) + type2name = dict((v, k) for k, v in name2type.items()) def toXML(self): """Generate payload of message PDU.""" diff --git a/rpkid/rpki/xml_utils.py b/rpkid/rpki/xml_utils.py index 2f29b312..566c9a50 100644 --- a/rpkid/rpki/xml_utils.py +++ b/rpkid/rpki/xml_utils.py @@ -62,7 +62,7 @@ class sax_handler(xml.sax.handler.ContentHandler): that's the object we'll be returning as our final result. """ a = dict() - for k,v in attrs.items(): + for k, v in attrs.items(): if isinstance(k, tuple): if k == ("http://www.w3.org/XML/1998/namespace", "lang"): k = "xml:lang" @@ -168,7 +168,7 @@ class base_elt(object): def make_pdu(cls, **kargs): """Generic PDU constructor.""" self = cls() - for k,v in kargs.items(): + for k, v in kargs.items(): if isinstance(v, bool): v = 1 if v else 0 setattr(self, k, v) diff --git a/rpkid/rpkid.py b/rpkid/rpkid.py index e9f16941..0990c39d 100755 --- a/rpkid/rpkid.py +++ b/rpkid/rpkid.py @@ -37,8 +37,8 @@ rpki.log.init("rpkid") cfg_file = "rpkid.conf" profile = None -opts,argv = getopt.getopt(sys.argv[1:], "c:hp:?", ["config=", "help", "profile="]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:hp:?", ["config=", "help", "profile="]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) diff --git a/rpkid/testbed.py b/rpkid/testbed.py index 6df60086..f47f71c3 100644 --- a/rpkid/testbed.py +++ b/rpkid/testbed.py @@ -63,8 +63,8 @@ profile = False # Debugging hack whiel converting to event-driven I/O rpki.https.trace_synchronous_calls = True -opts,argv = getopt.getopt(sys.argv[1:], "c:hpy:?", ["config=", "help", "profile", "yaml="]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "c:hpy:?", ["config=", "help", "profile", "yaml="]) +for o, a in opts: if o in ("-h", "--help", "-?"): print __doc__ sys.exit(0) @@ -242,7 +242,7 @@ class main(object): rpki.log.info("Shutting down") for a in self.db.engines: a.kill_daemons() - for p,n in ((self.rootd_process, "rootd"), (self.pubd_process, "pubd"), (self.rsyncd_process, "rsyncd")): + for p, n in ((self.rootd_process, "rootd"), (self.pubd_process, "pubd"), (self.rsyncd_process, "rsyncd")): if p is not None: rpki.log.info("Killing %s" % n) os.kill(p.pid, signal.SIGTERM) diff --git a/rpkid/testpoke.py b/rpkid/testpoke.py index e1c583e4..86e7aaef 100644 --- a/rpkid/testpoke.py +++ b/rpkid/testpoke.py @@ -43,8 +43,8 @@ yaml_file = "testpoke.yaml" yaml_cmd = None debug = False -opts,argv = getopt.getopt(sys.argv[1:], "y:r:h?d", ["yaml=", "request=", "help", "debug"]) -for o,a in opts: +opts, argv = getopt.getopt(sys.argv[1:], "y:r:h?d", ["yaml=", "request=", "help", "debug"]) +for o, a in opts: if o in ("-h", "--help", "-?"): usage(0) elif o in ("-y", "--yaml"): |