summaryrefslogtreecommitdiffstats
path: root/hostinfo/printer.py
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb@kaidan.im>2024-04-16 17:32:42 +0200
committerJonah BrĂ¼chert <jbb@kaidan.im>2024-04-16 18:41:34 +0200
commit15f2aab7f1053a46d6d87a7c7f193767516c16cc (patch)
treeb8a11a33bfed2625b688f83ad6d7be7d362807a2 /hostinfo/printer.py
parente35a1ac2926b22ae412636a6ac6090741d6cbc01 (diff)
downloadtools-15f2aab7f1053a46d6d87a7c7f193767516c16cc.tar.gz
tools-15f2aab7f1053a46d6d87a7c7f193767516c16cc.tar.bz2
tools-15f2aab7f1053a46d6d87a7c7f193767516c16cc.zip
2to3
Diffstat (limited to 'hostinfo/printer.py')
-rw-r--r--hostinfo/printer.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/hostinfo/printer.py b/hostinfo/printer.py
index ea612a5..e467afe 100644
--- a/hostinfo/printer.py
+++ b/hostinfo/printer.py
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import
+
from hostinfo import prefix
from hostinfo import utils
+
def _get_full_key(prev_key, key):
if prev_key == '':
return key
return "%s.%s" % (prev_key, key)
+
def _sort_with_list(iterable, sort):
def helper(value):
if sort is None:
@@ -21,6 +23,7 @@ def _sort_with_list(iterable, sort):
return sorted(iterable, key=helper)
+
def _space(filter_key, full_key, printer, force=False):
if filter_key is None and full_key == '':
printer.space(force)
@@ -121,14 +124,14 @@ class Printer:
def _print_list(self, values, printer, filter_key):
for value in values:
- if isinstance(value, basestring):
+ if isinstance(value, str):
self._print_value(value, printer, filter_key)
else:
self._print(value, printer, filter_key)
def _print_dict(self, value, printer, filter_key, sort, force):
keys = _sort_with_list(
- [(key, full_key) for key in value.keys()
+ [(key, full_key) for key in list(value.keys())
for full_key in [_get_full_key(printer.full_key, key)]
if self._should_display(full_key, filter_key)],
sort)