python: format with black,flake8,isort
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I08301dca84e3f0031cf9c79f7279cce20df3807a
diff --git a/tools/sdbus++ b/tools/sdbus++
index fbbc3cd..5e31357 100755
--- a/tools/sdbus++
+++ b/tools/sdbus++
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from sdbusplus.main import main
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tools/sdbusplus/__init__.py b/tools/sdbusplus/__init__.py
index 4703f22..1f509e4 100644
--- a/tools/sdbusplus/__init__.py
+++ b/tools/sdbusplus/__init__.py
@@ -1,2 +1,4 @@
-from sdbusplus.interface import Interface
from sdbusplus.error import Error
+from sdbusplus.interface import Interface
+
+__all__ = ["Error", "Interface"]
diff --git a/tools/sdbusplus/error.py b/tools/sdbusplus/error.py
index 398ebe7..e30a59a 100644
--- a/tools/sdbusplus/error.py
+++ b/tools/sdbusplus/error.py
@@ -1,5 +1,7 @@
import os
+
import yaml
+
from .namedelement import NamedElement
from .renderer import Renderer
diff --git a/tools/sdbusplus/interface.py b/tools/sdbusplus/interface.py
index a35c99a..3f6d9b3 100644
--- a/tools/sdbusplus/interface.py
+++ b/tools/sdbusplus/interface.py
@@ -1,18 +1,21 @@
import os
+
import yaml
+
+from .enum import Enum
+from .method import Method
from .namedelement import NamedElement
from .property import Property
-from .method import Method
-from .signal import Signal
-from .enum import Enum
from .renderer import Renderer
+from .signal import Signal
class Interface(NamedElement, Renderer):
@staticmethod
def load(name, rootdir="."):
- filename = os.path.join(rootdir,
- name.replace(".", "/") + ".interface.yaml")
+ filename = os.path.join(
+ rootdir, name.replace(".", "/") + ".interface.yaml"
+ )
with open(filename) as f:
data = f.read()
@@ -28,7 +31,7 @@
super(Interface, self).__init__(**kwargs)
- self.namespaces = self.name.split('.')
+ self.namespaces = self.name.split(".")
self.classname = self.namespaces.pop()
def cppNamespace(self):
diff --git a/tools/sdbusplus/main.py b/tools/sdbusplus/main.py
index b7c56d0..e056942 100644
--- a/tools/sdbusplus/main.py
+++ b/tools/sdbusplus/main.py
@@ -1,9 +1,10 @@
-import sdbusplus
-import mako.lookup
import argparse
-import sys
import os
+import mako.lookup
+
+import sdbusplus
+
def main():
module_path = os.path.dirname(sdbusplus.__file__)
diff --git a/tools/sdbusplus/method.py b/tools/sdbusplus/method.py
index 7dbb421..726355e 100644
--- a/tools/sdbusplus/method.py
+++ b/tools/sdbusplus/method.py
@@ -1,17 +1,15 @@
-from .property import Property
from .namedelement import NamedElement
+from .property import Property
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.flags = kwargs.pop('flags', [])
+ self.parameters = [Property(**p) for p in kwargs.pop("parameters", [])]
+ self.returns = [Property(**r) for r in kwargs.pop("returns", [])]
+ self.flags = kwargs.pop("flags", [])
self.cpp_flags = self.or_cpp_flags(self.flags)
- self.errors = kwargs.pop('errors', [])
+ self.errors = kwargs.pop("errors", [])
super(Method, self).__init__(**kwargs)
@@ -19,12 +17,19 @@
return self.render(loader, "method.md.mako", method=self)
def cpp_prototype(self, loader, interface, ptype):
- return self.render(loader, "method.prototype.hpp.mako", method=self,
- interface=interface, ptype=ptype, post=str.rstrip)
+ return self.render(
+ loader,
+ "method.prototype.hpp.mako",
+ method=self,
+ interface=interface,
+ ptype=ptype,
+ post=str.rstrip,
+ )
def returns_as_list(self, interface, full=False):
- return ", ".join([r.cppTypeParam(interface.name, full=full)
- for r in self.returns])
+ return ", ".join(
+ [r.cppTypeParam(interface.name, full=full) for r in self.returns]
+ )
def cpp_return_type(self, interface):
if len(self.returns) == 0:
@@ -32,9 +37,7 @@
elif len(self.returns) == 1:
return self.returns[0].cppTypeParam(interface.name)
else:
- return "std::tuple<" + \
- self.returns_as_list(interface) + \
- ">"
+ return "std::tuple<" + self.returns_as_list(interface) + ">"
def parameter(self, interface, p, defaultValue=False):
r = "%s %s" % (p.cppTypeParam(interface.name), p.camelCase)
@@ -44,21 +47,26 @@
def get_parameters_str(self, interface, defaultValue=False):
return ",\n ".join(
- [self.parameter(interface, p, defaultValue)
- for p in self.parameters])
+ [
+ self.parameter(interface, p, defaultValue)
+ for p in self.parameters
+ ]
+ )
def or_cpp_flags(self, flags):
"""Return the corresponding ORed cpp flags."""
- flags_dict = {"deprecated": "vtable::common_::deprecated",
- "hidden": "vtable::common_::hidden",
- "unprivileged": "vtable::common_::unprivileged",
- "no_reply": "vtable::method_::no_reply"}
+ flags_dict = {
+ "deprecated": "vtable::common_::deprecated",
+ "hidden": "vtable::common_::hidden",
+ "unprivileged": "vtable::common_::unprivileged",
+ "no_reply": "vtable::method_::no_reply",
+ }
cpp_flags = []
for flag in flags:
try:
cpp_flags.append(flags_dict[flag])
except KeyError:
- raise ValueError("Invalid flag \"{}\"".format(flag))
+ raise ValueError('Invalid flag "{}"'.format(flag))
return " | ".join(cpp_flags)
diff --git a/tools/sdbusplus/namedelement.py b/tools/sdbusplus/namedelement.py
index a1d617f..c7985cf 100644
--- a/tools/sdbusplus/namedelement.py
+++ b/tools/sdbusplus/namedelement.py
@@ -1,12 +1,13 @@
-import inflection
import re
+import inflection
+
class NamedElement(object):
def __init__(self, **kwargs):
super(NamedElement, self).__init__()
- self.name = kwargs.pop('name', "unnamed")
- self.description = kwargs.pop('description', "")
+ self.name = kwargs.pop("name", "unnamed")
+ self.description = kwargs.pop("description", "")
if not isinstance(self.name, str):
raise AttributeError(
@@ -15,44 +16,127 @@
)
def __getattribute__(self, name):
- lam = {'CamelCase': lambda: inflection.camelize(self.name),
- 'camelCase': lambda: NamedElement.lower_camel_case(self.name),
- 'snake_case': lambda: inflection.underscore(self.name)}\
- .get(name)
+ lam = {
+ "CamelCase": lambda: inflection.camelize(self.name),
+ "camelCase": lambda: NamedElement.lower_camel_case(self.name),
+ "snake_case": lambda: inflection.underscore(self.name),
+ }.get(name)
if lam:
return NamedElement.__fixup_name(lam())
try:
return super(NamedElement, self).__getattribute__(name)
except Exception:
- raise AttributeError("Attribute '%s' not found in %s.NamedElement"
- % (name, self.__module__))
+ raise AttributeError(
+ "Attribute '%s' not found in %s.NamedElement"
+ % (name, self.__module__)
+ )
""" Some names are reserved in some languages. Fixup names to avoid using
reserved words.
"""
+
@staticmethod
def __fixup_name(name):
# List of reserved words from http://en.cppreference.com/w/cpp/keyword
- cppReserved = frozenset({
- "alignas", "alignof", "and", "and_eq", "asm", "auto",
- "bitand", "bitor", "bool", "break", "case", "catch", "char",
- "char8_t", "char16_t", "char32_t", "class", "compl", "concept",
- "const", "consteval", "constexpr", "constinit", "const_cast",
- "continue", "co_await", "co_return", "co_yield", "decltype",
- "default", "delete", "do", "double", "dynamic_cast", "else",
- "enum", "explicit", "export", "extern", "false", "float", "for",
- "friend", "goto", "if", "inline", "int", "long", "mutable",
- "namespace", "new", "noexcept", "not", "not_eq", "nullptr",
- "operator", "or", "or_eq", "private", "protected", "public",
- "register", "reinterpret_cast", "requires", "return", "short",
- "signed", "sizeof", "static", "static_assert", "static_cast",
- "struct", "switch", "template", "this", "thread_local", "throw",
- "true", "try", "typedef", "typeid", "typename", "union",
- "unsigned", "using", "virtual", "void", "volatile", "wchar_t",
- "while", "xor", "xor_eq"})
+ cppReserved = frozenset(
+ {
+ "alignas",
+ "alignof",
+ "and",
+ "and_eq",
+ "asm",
+ "auto",
+ "bitand",
+ "bitor",
+ "bool",
+ "break",
+ "case",
+ "catch",
+ "char",
+ "char8_t",
+ "char16_t",
+ "char32_t",
+ "class",
+ "compl",
+ "concept",
+ "const",
+ "consteval",
+ "constexpr",
+ "constinit",
+ "const_cast",
+ "continue",
+ "co_await",
+ "co_return",
+ "co_yield",
+ "decltype",
+ "default",
+ "delete",
+ "do",
+ "double",
+ "dynamic_cast",
+ "else",
+ "enum",
+ "explicit",
+ "export",
+ "extern",
+ "false",
+ "float",
+ "for",
+ "friend",
+ "goto",
+ "if",
+ "inline",
+ "int",
+ "long",
+ "mutable",
+ "namespace",
+ "new",
+ "noexcept",
+ "not",
+ "not_eq",
+ "nullptr",
+ "operator",
+ "or",
+ "or_eq",
+ "private",
+ "protected",
+ "public",
+ "register",
+ "reinterpret_cast",
+ "requires",
+ "return",
+ "short",
+ "signed",
+ "sizeof",
+ "static",
+ "static_assert",
+ "static_cast",
+ "struct",
+ "switch",
+ "template",
+ "this",
+ "thread_local",
+ "throw",
+ "true",
+ "try",
+ "typedef",
+ "typeid",
+ "typename",
+ "union",
+ "unsigned",
+ "using",
+ "virtual",
+ "void",
+ "volatile",
+ "wchar_t",
+ "while",
+ "xor",
+ "xor_eq",
+ }
+ )
- while(name in cppReserved):
+ while name in cppReserved:
name = name + "_"
return name
@@ -78,15 +162,17 @@
# ex. "IPv6Address" -> "ipv6Address"
if re.match(r"^[A-Z]+v[0-9]", upper_name):
return re.sub(
- r"^([A-Z]+)(.*)$",
- lambda m: m.group(1).lower() + m.group(2),
- upper_name)
+ r"^([A-Z]+)(.*)$",
+ lambda m: m.group(1).lower() + m.group(2),
+ upper_name,
+ )
# Anything left has at least two sequential upper-case, so it is an
# acronym. Switch all but the last upper-case (which starts the next
# word) to lower-case.
# ex. "MACAddress" -> "macAddress".
return re.sub(
- r"^([A-Z]+)([A-Z].*)$",
- lambda m: m.group(1).lower() + m.group(2),
- upper_name)
+ r"^([A-Z]+)([A-Z].*)$",
+ lambda m: m.group(1).lower() + m.group(2),
+ upper_name,
+ )
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index 23c0ba7..844b8e0 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -1,6 +1,7 @@
+import yaml
+
from .namedelement import NamedElement
from .renderer import Renderer
-import yaml
class Property(NamedElement, Renderer):
@@ -9,55 +10,72 @@
NONLOCAL_ENUM_MAGIC = "<NONLOCAL_ENUM>"
def __init__(self, **kwargs):
- self.typeName = kwargs.pop('type', None)
+ self.typeName = kwargs.pop("type", None)
self.cppTypeName = self.parse_cpp_type()
- self.defaultValue = kwargs.pop('default', None)
- self.flags = kwargs.pop('flags', [])
+ self.defaultValue = kwargs.pop("default", None)
+ self.flags = kwargs.pop("flags", [])
self.cpp_flags = self.or_cpp_flags(self.flags)
- self.errors = kwargs.pop('errors', [])
+ self.errors = kwargs.pop("errors", [])
- if (self.defaultValue is not None):
- if (isinstance(self.defaultValue, bool)):
+ if self.defaultValue is not None:
+ if isinstance(self.defaultValue, bool):
# Convert True/False to 'true'/'false'
# because it will be rendered as C++ code
- self.defaultValue = 'true' if self.defaultValue else 'false'
- elif(isinstance(self.defaultValue, str) and
- self.typeName.lower() == "string"):
+ self.defaultValue = "true" if self.defaultValue else "false"
+ elif (
+ isinstance(self.defaultValue, str)
+ and self.typeName.lower() == "string"
+ ):
# Wrap string type default values with double-quotes
- self.defaultValue = "\"" + self.defaultValue + "\""
- elif(isinstance(self.defaultValue, str) and
- self.is_floating_point()):
+ self.defaultValue = '"' + self.defaultValue + '"'
+ elif (
+ isinstance(self.defaultValue, str) and self.is_floating_point()
+ ):
if self.defaultValue.lower() == "nan":
- self.defaultValue = \
- f'std::numeric_limits<{self.cppTypeName}>::quiet_NaN()'
+ self.defaultValue = (
+ f"std::numeric_limits<{self.cppTypeName}>::quiet_NaN()"
+ )
elif self.defaultValue.lower() == "infinity":
- self.defaultValue = \
- f'std::numeric_limits<{self.cppTypeName}>::infinity()'
+ self.defaultValue = (
+ f"std::numeric_limits<{self.cppTypeName}>::infinity()"
+ )
elif self.defaultValue.lower() == "-infinity":
- self.defaultValue = \
- f'-std::numeric_limits<{self.cppTypeName}>::infinity()'
+ self.defaultValue = (
+ f"-std::numeric_limits<{self.cppTypeName}>::infinity()"
+ )
elif self.defaultValue.lower() == "epsilon":
- self.defaultValue = \
- f'std::numeric_limits<{self.cppTypeName}>::epsilon()'
- elif(isinstance(self.defaultValue, str) and
- self.is_integer()):
+ self.defaultValue = (
+ f"std::numeric_limits<{self.cppTypeName}>::epsilon()"
+ )
+ elif isinstance(self.defaultValue, str) and self.is_integer():
if self.defaultValue.lower() == "maxint":
- self.defaultValue = \
- f'std::numeric_limits<{self.cppTypeName}>::max()'
+ self.defaultValue = (
+ f"std::numeric_limits<{self.cppTypeName}>::max()"
+ )
elif self.defaultValue.lower() == "minint":
- self.defaultValue = \
- f'std::numeric_limits<{self.cppTypeName}>::min()'
+ self.defaultValue = (
+ f"std::numeric_limits<{self.cppTypeName}>::min()"
+ )
super(Property, self).__init__(**kwargs)
def is_enum(self):
if not self.typeName:
return False
- return 'enum' == self.__type_tuple()[0]
+ return "enum" == self.__type_tuple()[0]
def is_integer(self):
- return self.typeName in ["byte", "int16", "uint16", "int32", "uint32",
- "int64", "uint64", "size", "ssize"]
+ return self.typeName in [
+ "byte",
+ "int16",
+ "uint16",
+ "int32",
+ "uint32",
+ "int64",
+ "uint64",
+ "size",
+ "ssize",
+ ]
def is_floating_point(self):
return self.typeName in ["double"]
@@ -65,6 +83,7 @@
""" Return a conversion of the cppTypeName valid as a function parameter.
Currently only 'enum' requires conversion.
"""
+
def cppTypeParam(self, interface, full=False, server=True):
return self.__cppTypeParam(interface, self.cppTypeName, full, server)
@@ -98,15 +117,17 @@
""" Determine the C++ namespaces of an enumeration-type property.
"""
+
def enum_namespaces(self, interface):
typeTuple = self.__type_tuple()
return self.__enum_namespaces(interface, typeTuple)
def __enum_namespaces(self, interface, typeTuple):
# Enums can be processed directly.
- if 'enum' == typeTuple[0]:
- cppType = self.__cppTypeParam(interface,
- self.__parse_cpp_type__(typeTuple))
+ if "enum" == typeTuple[0]:
+ cppType = self.__cppTypeParam(
+ interface, self.__parse_cpp_type__(typeTuple)
+ )
ns = cppType.split("::")[0:-1]
if len(ns) != 0:
return ["::".join(ns) + "::"]
@@ -126,6 +147,7 @@
""" Convert the property type into a C++ type.
"""
+
def parse_cpp_type(self):
if not self.typeName:
return None
@@ -136,6 +158,7 @@
""" Convert the 'typeName' into a tuple of ('type', [ details ]) where
'details' is a recursive type-tuple.
"""
+
def __type_tuple(self):
if not self.typeName:
return None
@@ -157,6 +180,7 @@
[('dict', [('string', []), ('dict', [('string', []),
('int64', [])]]]
"""
+
def __preprocess_yaml_type_array(self, typeArray):
result = []
@@ -167,10 +191,13 @@
# If there is a next element and it is a list, merge it with the
# current element.
- if i < len(typeArray)-1 and type(typeArray[i+1]) is list:
+ if i < len(typeArray) - 1 and type(typeArray[i + 1]) is list:
result.append(
- (typeArray[i],
- self.__preprocess_yaml_type_array(typeArray[i+1])))
+ (
+ typeArray[i],
+ self.__preprocess_yaml_type_array(typeArray[i + 1]),
+ )
+ )
else:
result.append((typeArray[i], []))
@@ -180,33 +207,41 @@
[ variant [ dict [ int32, int32 ], double ] ]
This function then converts the type-list into a C++ type string.
"""
+
def __parse_cpp_type__(self, typeTuple):
propertyMap = {
- 'byte': {'cppName': 'uint8_t', 'params': 0},
- 'boolean': {'cppName': 'bool', 'params': 0},
- 'int16': {'cppName': 'int16_t', 'params': 0},
- 'uint16': {'cppName': 'uint16_t', 'params': 0},
- 'int32': {'cppName': 'int32_t', 'params': 0},
- 'uint32': {'cppName': 'uint32_t', 'params': 0},
- 'int64': {'cppName': 'int64_t', 'params': 0},
- 'uint64': {'cppName': 'uint64_t', 'params': 0},
- 'size': {'cppName': 'size_t', 'params': 0},
- 'ssize': {'cppName': 'ssize_t', 'params': 0},
- 'double': {'cppName': 'double', 'params': 0},
- 'unixfd': {'cppName': 'sdbusplus::message::unix_fd', 'params': 0},
- 'string': {'cppName': 'std::string', 'params': 0},
- 'path': {'cppName': 'sdbusplus::message::object_path',
- 'params': 0},
- 'object_path': {'cppName': 'sdbusplus::message::object_path',
- 'params': 0},
- 'signature': {'cppName': 'sdbusplus::message::signature',
- 'params': 0},
- 'array': {'cppName': 'std::vector', 'params': 1},
- 'set': {'cppName': 'std::set', 'params': 1},
- 'struct': {'cppName': 'std::tuple', 'params': -1},
- 'variant': {'cppName': 'std::variant', 'params': -1},
- 'dict': {'cppName': 'std::map', 'params': 2},
- 'enum': {'cppName': 'enum', 'params': 1}}
+ "byte": {"cppName": "uint8_t", "params": 0},
+ "boolean": {"cppName": "bool", "params": 0},
+ "int16": {"cppName": "int16_t", "params": 0},
+ "uint16": {"cppName": "uint16_t", "params": 0},
+ "int32": {"cppName": "int32_t", "params": 0},
+ "uint32": {"cppName": "uint32_t", "params": 0},
+ "int64": {"cppName": "int64_t", "params": 0},
+ "uint64": {"cppName": "uint64_t", "params": 0},
+ "size": {"cppName": "size_t", "params": 0},
+ "ssize": {"cppName": "ssize_t", "params": 0},
+ "double": {"cppName": "double", "params": 0},
+ "unixfd": {"cppName": "sdbusplus::message::unix_fd", "params": 0},
+ "string": {"cppName": "std::string", "params": 0},
+ "path": {
+ "cppName": "sdbusplus::message::object_path",
+ "params": 0,
+ },
+ "object_path": {
+ "cppName": "sdbusplus::message::object_path",
+ "params": 0,
+ },
+ "signature": {
+ "cppName": "sdbusplus::message::signature",
+ "params": 0,
+ },
+ "array": {"cppName": "std::vector", "params": 1},
+ "set": {"cppName": "std::set", "params": 1},
+ "struct": {"cppName": "std::tuple", "params": -1},
+ "variant": {"cppName": "std::variant", "params": -1},
+ "dict": {"cppName": "std::map", "params": 2},
+ "enum": {"cppName": "enum", "params": 1},
+ }
if len(typeTuple) != 2:
raise RuntimeError("Invalid typeTuple %s" % typeTuple)
@@ -214,11 +249,11 @@
first = typeTuple[0]
entry = propertyMap[first]
- result = entry['cppName']
+ result = entry["cppName"]
# Handle 0-entry parameter lists.
- if (entry['params'] == 0):
- if (len(typeTuple[1]) != 0):
+ if entry["params"] == 0:
+ if len(typeTuple[1]) != 0:
raise RuntimeError("Invalid typeTuple %s" % typeTuple)
else:
return result
@@ -227,12 +262,13 @@
rest = typeTuple[1]
# Confirm parameter count matches.
- if (entry['params'] != -1) and (entry['params'] != len(rest)):
- raise RuntimeError("Invalid entry count for %s : %s" %
- (first, rest))
+ if (entry["params"] != -1) and (entry["params"] != len(rest)):
+ raise RuntimeError(
+ "Invalid entry count for %s : %s" % (first, rest)
+ )
# Switch enum for proper type.
- if result == 'enum':
+ if result == "enum":
result = rest[0][0]
# self. means local type.
@@ -240,27 +276,33 @@
return result.replace("self.", self.LOCAL_ENUM_MAGIC + "::")
# Insert place-holder for header-type namespace (ex. "server")
- result = result.split('.')
+ result = result.split(".")
result.insert(-2, self.NONLOCAL_ENUM_MAGIC)
result = "::".join(result)
return result
# Parse each parameter entry, if appropriate, and create C++ template
# syntax.
- result += '<'
+ result += "<"
result += ", ".join([self.__parse_cpp_type__(e) for e in rest])
- result += '>'
+ result += ">"
return result
def markdown(self, loader):
- return self.render(loader, "property.md.mako", property=self,
- post=str.strip)
+ return self.render(
+ loader, "property.md.mako", property=self, post=str.strip
+ )
def cpp_prototype(self, loader, interface, ptype):
- return self.render(loader, "property.prototype.hpp.mako",
- property=self, interface=interface, ptype=ptype,
- post=str.rstrip)
+ return self.render(
+ loader,
+ "property.prototype.hpp.mako",
+ property=self,
+ interface=interface,
+ ptype=ptype,
+ post=str.rstrip,
+ )
def or_cpp_flags(self, flags):
"""Return the corresponding ORed cpp flags."""
@@ -273,7 +315,7 @@
"hidden": "vtable::common_::hidden",
"readonly": False,
"unprivileged": "vtable::common_::unprivileged",
- }
+ }
cpp_flags = []
for flag in flags:
@@ -281,6 +323,6 @@
if flags_dict[flag]:
cpp_flags.append(flags_dict[flag])
except KeyError:
- raise ValueError("Invalid flag \"{}\"".format(flag))
+ raise ValueError('Invalid flag "{}"'.format(flag))
return " | ".join(cpp_flags)
diff --git a/tools/sdbusplus/renderer.py b/tools/sdbusplus/renderer.py
index 9a52593..89b65ef 100644
--- a/tools/sdbusplus/renderer.py
+++ b/tools/sdbusplus/renderer.py
@@ -4,6 +4,6 @@
def render(self, loader, template, **kwargs):
t = loader.get_template(template)
- post = kwargs.pop('post', lambda result: result)
+ post = kwargs.pop("post", lambda result: result)
r = t.render(loader=loader, **kwargs)
return post(r)
diff --git a/tools/sdbusplus/signal.py b/tools/sdbusplus/signal.py
index 066bde9..51d3abc 100644
--- a/tools/sdbusplus/signal.py
+++ b/tools/sdbusplus/signal.py
@@ -1,12 +1,11 @@
-from .property import Property
from .namedelement import NamedElement
+from .property import Property
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)
@@ -14,5 +13,11 @@
return self.render(loader, "signal.md.mako", signal=self)
def cpp_prototype(self, loader, interface, ptype):
- return self.render(loader, "signal.prototype.hpp.mako", signal=self,
- interface=interface, ptype=ptype, post=str.rstrip)
+ return self.render(
+ loader,
+ "signal.prototype.hpp.mako",
+ signal=self,
+ interface=interface,
+ ptype=ptype,
+ post=str.rstrip,
+ )
diff --git a/tools/setup.py b/tools/setup.py
index 673affe..c1f8ad6 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-from setuptools import setup, find_packages
+from setuptools import find_packages, setup
setup(
name="sdbusplus",