diff options
author | Rob Austein <sra@hactrn.net> | 2014-05-30 04:09:54 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2014-05-30 04:09:54 +0000 |
commit | 6cacde4474719bae1a1e6ba0876b9d3327054ae9 (patch) | |
tree | a769e44a389f6aff01dd0f13a5cd5f81a53011c7 /rpki/gui | |
parent | 1c85dc6fc490658d39402089dab29ae37a05db83 (diff) |
Still more PyLint.
svn path=/trunk/; revision=5850
Diffstat (limited to 'rpki/gui')
-rw-r--r-- | rpki/gui/app/models.py | 2 | ||||
-rw-r--r-- | rpki/gui/app/views.py | 4 | ||||
-rw-r--r-- | rpki/gui/cacheview/util.py | 34 | ||||
-rw-r--r-- | rpki/gui/models.py | 4 | ||||
-rw-r--r-- | rpki/gui/routeview/util.py | 6 |
5 files changed, 24 insertions, 26 deletions
diff --git a/rpki/gui/app/models.py b/rpki/gui/app/models.py index 7d643fdc..32a897c7 100644 --- a/rpki/gui/app/models.py +++ b/rpki/gui/app/models.py @@ -33,7 +33,7 @@ class TelephoneField(models.CharField): kwargs['max_length'] = 40 models.CharField.__init__(self, **kwargs) -add_introspection_rules([], ['^rpki\.gui\.app\.models\.TelephoneField']) +add_introspection_rules([], [r'^rpki\.gui\.app\.models\.TelephoneField']) class Parent(rpki.irdb.models.Parent): diff --git a/rpki/gui/app/views.py b/rpki/gui/app/views.py index f5391790..9a1c4cfe 100644 --- a/rpki/gui/app/views.py +++ b/rpki/gui/app/views.py @@ -570,7 +570,7 @@ def get_covered_routes(rng, max_prefixlen, asn): # if the route was previously unknown (no covering # ROAs), then: # if the AS matches, it is valid, otherwise invalid - if (route.asn != 0 and route.asn == asn and route.prefixlen <= max_prefixlen): + if route.asn != 0 and route.asn == asn and route.prefixlen <= max_prefixlen: route.newstatus = 'valid' else: route.newstatus = 'invalid' @@ -874,7 +874,7 @@ def roa_export(request): class GhostbusterDetailView(DetailView): def get_queryset(self): - conf = get_conf(self.request.user, self.request.session['handle']) + conf = get_conf(self.request.user, self.request.session['handle']) return conf.ghostbusters diff --git a/rpki/gui/cacheview/util.py b/rpki/gui/cacheview/util.py index 0d3d7ae3..9e8748bf 100644 --- a/rpki/gui/cacheview/util.py +++ b/rpki/gui/cacheview/util.py @@ -64,7 +64,7 @@ def rcynic_cert(cert, obj): obj.asns.add(*obj.issuer.asns.all()) else: for asr in cert.resources.asn: - logger.debug('processing %s' % asr) + logger.debug('processing %s', asr) attrs = {'min': asr.min, 'max': asr.max} q = models.ASRange.objects.filter(**attrs) @@ -86,7 +86,7 @@ def rcynic_cert(cert, obj): addr_obj.add(*parentset) else: for rng in addrset: - logger.debug('processing %s' % rng) + logger.debug('processing %s', rng) attrs = {'prefix_min': rng.min, 'prefix_max': rng.max} q = cls.objects.filter(**attrs) @@ -169,14 +169,12 @@ def save_status(repo, vs): # this repo instance (may be empty when not accepted) inst_qs = cls.objects.filter(repo=repo) - logger.debug('processing %s' % vs.filename) + logger.debug('processing %s', vs.filename) if not inst_qs: inst = cls(repo=repo) - logger.debug('object not found in db, creating new object cls=%s id=%s' % ( - cls, - id(inst) - )) + logger.debug('object not found in db, creating new object cls=%s id=%s', + cls, id(inst)) else: inst = inst_qs[0] @@ -184,8 +182,8 @@ def save_status(repo, vs): # determine if the object is changed/new mtime = os.stat(vs.filename)[stat.ST_MTIME] except OSError as e: - logger.error('unable to stat %s: %s %s' % ( - vs.filename, type(e), e)) + logger.error('unable to stat %s: %s %s', + vs.filename, type(e), e) # treat as if missing from rcynic.xml # use inst_qs rather than deleting inst so that we don't raise an # exception for newly created objects (inst_qs will be empty) @@ -197,8 +195,8 @@ def save_status(repo, vs): try: obj = vs.obj # causes object to be lazily loaded except Exception, e: - logger.warning('Caught %s while processing %s: %s' % ( - type(e), vs.filename, e)) + logger.warning('Caught %s while processing %s: %s', + type(e), vs.filename, e) return inst.not_before = obj.notBefore.to_sql() @@ -209,7 +207,7 @@ def save_status(repo, vs): # look up signing cert if obj.issuer == obj.subject: # self-signed cert (TA) - assert(isinstance(inst, models.Cert)) + assert isinstance(inst, models.Cert) inst.issuer = None else: # if an object has moved in the repository, the entry for @@ -222,12 +220,12 @@ def save_status(repo, vs): ) ncerts = len(qs) if ncerts == 0: - logger.warning('unable to find signing cert with ski=%s (%s)' % (obj.aki, obj.issuer)) + logger.warning('unable to find signing cert with ski=%s (%s)', obj.aki, obj.issuer) return else: if ncerts > 1: # multiple matching certs, all of which are valid - logger.warning('Found multiple certs matching ski=%s sn=%s' % (obj.aki, obj.issuer)) + logger.warning('Found multiple certs matching ski=%s sn=%s', obj.aki, obj.issuer) for c in qs: logger.warning(c.repo.uri) # just use the first match @@ -243,7 +241,7 @@ def save_status(repo, vs): obj.show() raise - logger.debug('object saved id=%s' % id(inst)) + logger.debug('object saved id=%s', id(inst)) else: logger.debug('object is unchanged') @@ -293,7 +291,7 @@ def process_labels(xml_file): logger.info('updating labels...') for label, kind, desc in label_iterator(xml_file): - logger.debug('label=%s kind=%s desc=%s' % (label, kind, desc)) + logger.debug('label=%s kind=%s desc=%s', label, kind, desc) if kind: q = models.ValidationLabel.objects.filter(label=label) if not q: @@ -337,7 +335,7 @@ def fetch_published_objects(): # objects which were valid and are no longer valid pass elif isinstance(pdu, rpki.left_right.report_error_elt): - logging.error('rpkid reported an error: %s' % pdu.error_code) + logging.error('rpkid reported an error: %s', pdu.error_code) class Handle(object): @@ -429,4 +427,4 @@ def import_rcynic_xml(root=default_root, logfile=default_logfile): rpki.gui.app.timestamp.update('rcynic_import') stop = time.time() - logger.info('elapsed time %d seconds.' % (stop - start)) + logger.info('elapsed time %d seconds.', (stop - start)) diff --git a/rpki/gui/models.py b/rpki/gui/models.py index 7a684f32..184383c0 100644 --- a/rpki/gui/models.py +++ b/rpki/gui/models.py @@ -67,8 +67,8 @@ add_introspection_rules( [ ([IPv4AddressField, IPv6AddressField], [], {}) ], - ['^rpki\.gui\.models\.IPv4AddressField', - '^rpki\.gui\.models\.IPv6AddressField'] + [r'^rpki\.gui\.models\.IPv4AddressField', + r'^rpki\.gui\.models\.IPv6AddressField'] ) diff --git a/rpki/gui/routeview/util.py b/rpki/gui/routeview/util.py index 7884224c..54d50f24 100644 --- a/rpki/gui/routeview/util.py +++ b/rpki/gui/routeview/util.py @@ -189,7 +189,7 @@ def import_routeviews_dump(filename=DEFAULT_URL, filetype='auto'): bname = os.path.basename(unquote(u.path)) tmpname = os.path.join('/tmp', bname) - logger.info("Downloading %s to %s" % (filename, tmpname)) + logger.info("Downloading %s to %s", filename, tmpname) if os.path.exists(tmpname): os.remove(tmpname) # filename is replaced with a local filename containing cached copy of @@ -206,7 +206,7 @@ def import_routeviews_dump(filename=DEFAULT_URL, filetype='auto'): filetype = 'mrt' else: raise UnknownInputType('unable to automatically determine input file type') - logging.info('Detected import format as "%s"' % filetype) + logging.info('Detected import format as "%s"', filetype) pipe = None if filename.endswith('.bz2'): @@ -233,4 +233,4 @@ def import_routeviews_dump(filename=DEFAULT_URL, filetype='auto'): else: input_file.close() - logger.info('Elapsed time %d secs' % (time.time() - start_time)) + logger.info('Elapsed time %d secs', (time.time() - start_time)) |