aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/rcynic.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/rpki/rcynic.py')
-rw-r--r--rpkid/rpki/rcynic.py70
1 files changed, 35 insertions, 35 deletions
diff --git a/rpkid/rpki/rcynic.py b/rpkid/rpki/rcynic.py
index 6f5da2ca..d6c00710 100644
--- a/rpkid/rpki/rcynic.py
+++ b/rpkid/rpki/rcynic.py
@@ -16,9 +16,8 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-__revision__ = '$Id$'
+__version__ = '$Id$'
-import sys
import os
import rpki.x509
import rpki.exceptions
@@ -175,7 +174,7 @@ class rcynic_file_iterator(object):
self.rcynic_dir = os.path.join(rcynic_root, authenticated_subdir)
def __iter__(self):
- for root, dirs, files in os.walk(self.rcynic_dir):
+ for root, dirs, files in os.walk(self.rcynic_dir): # pylint: disable=W0612
for filename in files:
filename = os.path.join(root, filename)
ext = os.path.splitext(filename)[1]
@@ -183,26 +182,26 @@ class rcynic_file_iterator(object):
yield file_name_classes[ext](filename)
class validation_status_element(object):
- def __init__(self, *args, **kwargs):
- self.attrs = []
- for k,v in kwargs.iteritems():
- setattr(self, k, v)
- # attribute names are saved so that the __repr__ method can
- # display the subset of attributes the user specified
- self.attrs.append(k)
- self._obj = None
-
- def get_obj(self):
- if not self._obj:
- self._obj = self.file_class(filename=self.filename, uri=self.uri)
- return self._obj
-
- def __repr__(self):
- v = [self.__class__.__name__, 'id=%s' % str(id(self))]
- v.extend(['%s=%s' % (x, getattr(self, x)) for x in self.attrs])
- return '<%s>' % (' '.join(v),)
-
- obj = property(get_obj)
+ def __init__(self, *args, **kwargs):
+ self.attrs = []
+ for k, v in kwargs.iteritems():
+ setattr(self, k, v)
+ # attribute names are saved so that the __repr__ method can
+ # display the subset of attributes the user specified
+ self.attrs.append(k)
+ self._obj = None
+
+ def get_obj(self):
+ if not self._obj:
+ self._obj = self.file_class(filename=self.filename, uri=self.uri)
+ return self._obj
+
+ def __repr__(self):
+ v = [self.__class__.__name__, 'id=%s' % str(id(self))]
+ v.extend(['%s=%s' % (x, getattr(self, x)) for x in self.attrs])
+ return '<%s>' % (' '.join(v),)
+
+ obj = property(get_obj)
class rcynic_xml_iterator(object):
"""
@@ -251,25 +250,26 @@ class rcynic_xml_iterator(object):
# determine the path to this object
if status == 'object_accepted':
- d = self.authenticated_subdir
+ d = self.authenticated_subdir
elif generation == 'backup':
- d = self.authenticated_old_subdir
+ d = self.authenticated_old_subdir
else:
- d = self.unauthenticated_subdir
+ d = self.unauthenticated_subdir
filename = os.path.join(d, self.uri_to_filename(uri))
ext = os.path.splitext(filename)[1]
if ext in file_name_classes:
- yield validation_status_element(timestamp=timestamp, generation=generation, uri=uri,
- status=status, filename=filename, file_class=file_name_classes[ext])
+ yield validation_status_element(timestamp = timestamp, generation = generation,
+ uri=uri, status = status, filename = filename,
+ file_class = file_name_classes[ext])
def label_iterator(xml_file):
- """
- Returns an iterator which contains all defined labels from an rcynic XML
- output file. Each item is a tuple of the form
- (label, kind, description).
- """
+ """
+ Returns an iterator which contains all defined labels from an rcynic XML
+ output file. Each item is a tuple of the form
+ (label, kind, description).
+ """
- for label in ElementTree(file=xml_file).find("labels"):
- yield label.tag, label.get("kind"), label.text.strip()
+ for label in ElementTree(file=xml_file).find("labels"):
+ yield label.tag, label.get("kind"), label.text.strip()