sdbus++: fix PEP8 style errors
Change-Id: I51ce57d22c86ac80322559fa1c03cb26df8eb278
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/sdbus++ b/tools/sdbus++
index 01922c9..76998c9 100755
--- a/tools/sdbus++
+++ b/tools/sdbus++
@@ -4,11 +4,12 @@
import argparse
import sys
+
def main():
- valid_types = { 'interface': sdbusplus.Interface }
- valid_processes = { 'markdown' : "markdown",
- 'server-header' : "server_header",
- 'server-cpp' : "server_cpp" }
+ valid_types = {'interface': sdbusplus.Interface}
+ valid_processes = {'markdown': "markdown",
+ 'server-header': "server_header",
+ 'server-cpp': "server_cpp"}
parser = argparse.ArgumentParser(description='Process sdbus++ YAML files.')
@@ -25,9 +26,9 @@
parser.add_argument('item', metavar='ITEM', type=str,
help='Item to process.')
- args = parser.parse_args();
+ args = parser.parse_args()
- if sys.version_info < (3,0):
+ if sys.version_info < (3, 0):
lookup = mako.lookup.TemplateLookup(directories=[args.templatedir],
disable_unicode=True)
else:
diff --git a/tools/sdbusplus/interface.py b/tools/sdbusplus/interface.py
index 7bbae38..bf1b8ba 100644
--- a/tools/sdbusplus/interface.py
+++ b/tools/sdbusplus/interface.py
@@ -6,6 +6,7 @@
from .signal import Signal
from .renderer import Renderer
+
class Interface(NamedElement, Renderer):
@staticmethod
def load(name, rootdir='.'):
@@ -13,18 +14,18 @@
name.replace('.', '/') + ".interface.yaml")
with open(filename) as f:
- data = f.read();
+ data = f.read()
y = yaml.safe_load(data)
y['name'] = name
return Interface(**y)
def __init__(self, **kwargs):
- self.properties = [ Property(**p) for p in
- kwargs.pop('properties', []) ]
- self.methods = [ Method(**m) for m in
- kwargs.pop('methods', []) ]
- self.signals = [ Signal(**s) for s in
- kwargs.pop('signals', []) ]
+ self.properties = \
+ [Property(**p) for p in kwargs.pop('properties', [])]
+ self.methods = \
+ [Method(**m) for m in kwargs.pop('methods', [])]
+ self.signals = \
+ [Signal(**s) for s in kwargs.pop('signals', [])]
super(Interface, self).__init__(**kwargs)
diff --git a/tools/sdbusplus/method.py b/tools/sdbusplus/method.py
index 84d6095..49a382b 100644
--- a/tools/sdbusplus/method.py
+++ b/tools/sdbusplus/method.py
@@ -2,12 +2,13 @@
from .namedelement import NamedElement
from .renderer import Renderer
+
class Method(NamedElement, Renderer):
def __init__(self, **kwargs):
- self.parameters = [ Property(**p) for p in
- kwargs.pop('parameters', []) ]
- self.returns = [ Property(**r) for r in
- kwargs.pop('returns', []) ]
+ self.parameters = \
+ [Property(**p) for p in kwargs.pop('parameters', [])]
+ self.returns = \
+ [Property(**r) for r in kwargs.pop('returns', [])]
self.errors = kwargs.pop('errors', [])
super(Method, self).__init__(**kwargs)
diff --git a/tools/sdbusplus/namedelement.py b/tools/sdbusplus/namedelement.py
index 24a2f1f..438043d 100644
--- a/tools/sdbusplus/namedelement.py
+++ b/tools/sdbusplus/namedelement.py
@@ -1,5 +1,6 @@
import inflection
+
class NamedElement(object):
def __init__(self, **kwargs):
self.name = kwargs.pop('name', "unnamed")
@@ -7,15 +8,15 @@
super(NamedElement, self).__init__(**kwargs)
def __getattr__(self, name):
- l = { 'CamelCase': lambda: inflection.camelize(self.name),
- 'camelCase': lambda: inflection.camelize(self.name, False),
- 'snake_case': lambda: inflection.underscore(self.name) }\
+ l = {'CamelCase': lambda: inflection.camelize(self.name),
+ 'camelCase': lambda: inflection.camelize(self.name, False),
+ 'snake_case': lambda: inflection.underscore(self.name)}\
.get(name)
if l:
return l()
try:
- return super(NamedElement,self).__getattr__(name)
+ return super(NamedElement, self).__getattr__(name)
except:
raise AttributeError("Attribute '%s' not found in %s.NamedElement"
% (name, self.__module__))
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index 38edd3e..2c35b63 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -1,6 +1,7 @@
from .namedelement import NamedElement
from .renderer import Renderer
+
class Property(NamedElement, Renderer):
def __init__(self, **kwargs):
self.typeName = kwargs.pop('type', None)
@@ -10,4 +11,4 @@
def markdown(self, loader):
return self.render(loader, "property.mako.md", property=self,
- post = str.strip)
+ post=str.strip)
diff --git a/tools/sdbusplus/signal.py b/tools/sdbusplus/signal.py
index dd77f76..cd843d9 100644
--- a/tools/sdbusplus/signal.py
+++ b/tools/sdbusplus/signal.py
@@ -2,10 +2,11 @@
from .namedelement import NamedElement
from .renderer import Renderer
+
class Signal(NamedElement, Renderer):
def __init__(self, **kwargs):
- self.properties = [ Property(**p) for p in
- kwargs.pop('properties', []) ]
+ self.properties = \
+ [Property(**p) for p in kwargs.pop('properties', [])]
super(Signal, self).__init__(**kwargs)