tools/spec: conform argument spacing to PEP8
This commit is contained in:
parent
7aca56ce9e
commit
a1e15882f6
@ -96,7 +96,7 @@ class AliasType(Type):
|
|||||||
May be serialised using an appropriate host language facility
|
May be serialised using an appropriate host language facility
|
||||||
(eg, a typedef)
|
(eg, a typedef)
|
||||||
"""
|
"""
|
||||||
def __init__(self, name: str, target: str, depends: List[str]=None):
|
def __init__(self, name: str, target: str, depends: List[str] = None):
|
||||||
depends = depends or []
|
depends = depends or []
|
||||||
super().__init__(name, depends=depends+[target])
|
super().__init__(name, depends=depends+[target])
|
||||||
self.target = target
|
self.target = target
|
||||||
@ -139,7 +139,7 @@ class Unscoped(Type):
|
|||||||
def declare(self):
|
def declare(self):
|
||||||
return "\n".join(t.declare() for t in self.values)
|
return "\n".join(t.declare() for t in self.values)
|
||||||
|
|
||||||
def define(self,reg):
|
def define(self, reg):
|
||||||
return "\n".join(t.define(reg.types) for t in self.values)
|
return "\n".join(t.define(reg.types) for t in self.values)
|
||||||
|
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ class Enum(Type):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def define(self, reg: Registry):
|
def define(self, reg: Registry):
|
||||||
values = ("%(name)s = %(value)s" % { "name": k, "value": v.value } for (k,v) in self.values.items())
|
values = ("%(name)s = %(value)s" % {"name": k, "value": v.value} for (k, v) in self.values.items())
|
||||||
|
|
||||||
return "enum %(name)s : int32_t { %(values)s };" % {
|
return "enum %(name)s : int32_t { %(values)s };" % {
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
@ -425,7 +425,7 @@ class Command(Type):
|
|||||||
assert node.tag == 'param'
|
assert node.tag == 'param'
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
name = node.find('name').text,
|
name=node.find('name').text,
|
||||||
depends=[node.find('type').text],
|
depends=[node.find('type').text],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
@ -489,7 +489,7 @@ class Command(Type):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_device(self, reg:Registry):
|
def is_device(self, reg: Registry):
|
||||||
return not self.is_instance(reg)
|
return not self.is_instance(reg)
|
||||||
|
|
||||||
|
|
||||||
@ -608,12 +608,13 @@ class Extension(Type):
|
|||||||
|
|
||||||
logging.info("Applying extension:", self.name, file=sys.stderr)
|
logging.info("Applying extension:", self.name, file=sys.stderr)
|
||||||
for node in self.requires:
|
for node in self.requires:
|
||||||
required += node.apply(reg,extnumber=self.number)
|
required += node.apply(reg, extnumber=self.number)
|
||||||
return required
|
return required
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
def ignore_node(types:Dict[str, Type], root):
|
def ignore_node(types: Dict[str, Type], root):
|
||||||
|
types, root
|
||||||
pass
|
pass
|
||||||
|
|
||||||
parse_comment = ignore_node
|
parse_comment = ignore_node
|
||||||
@ -643,7 +644,7 @@ def parse_types(reg: Registry, root):
|
|||||||
#
|
#
|
||||||
# eg, 'Display' depends on 'X11/Xlib.h'
|
# eg, 'Display' depends on 'X11/Xlib.h'
|
||||||
if not category:
|
if not category:
|
||||||
reg.types[name] = Placeholder (name)
|
reg.types[name] = Placeholder(name)
|
||||||
else:
|
else:
|
||||||
# Whitelist the known types so we don't accidentally instantiate
|
# Whitelist the known types so we don't accidentally instantiate
|
||||||
# something whacky
|
# something whacky
|
||||||
@ -736,7 +737,6 @@ def write_header(path: str, q: List[Type], reg: Registry):
|
|||||||
dst.write(obj.define(reg))
|
dst.write(obj.define(reg))
|
||||||
dst.write('\n')
|
dst.write('\n')
|
||||||
|
|
||||||
|
|
||||||
# Define the default case for device and instance type traits.
|
# Define the default case for device and instance type traits.
|
||||||
dst.write("""
|
dst.write("""
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -868,7 +868,6 @@ def write_dispatch(path: str, q: List[Type], reg: Registry):
|
|||||||
else:
|
else:
|
||||||
raise Exception("Unknown param type")
|
raise Exception("Unknown param type")
|
||||||
|
|
||||||
|
|
||||||
dispatch.write(f"""
|
dispatch.write(f"""
|
||||||
extern "C" {obj.result} {rename(obj.name)} ({", ".join(p.param for p in obj.params)}) noexcept {{
|
extern "C" {obj.result} {rename(obj.name)} ({", ".join(p.param for p in obj.params)}) noexcept {{
|
||||||
using first_arg_t = std::decay_t<decltype({obj.params[0].name})>;
|
using first_arg_t = std::decay_t<decltype({obj.params[0].name})>;
|
||||||
|
Loading…
Reference in New Issue
Block a user