Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class NoSuchItemError(Error):
pass
class UnknownSection(Error):
pass
class StringList(list):
def __new__(cls, *args, **kwargs):
if not args:
return list()
else:
return list(args[0].split())
class PathList(StringList):
def __new__(cls, *args, **kwargs):
if not args:
return list()
else:
return [os.path.expandvars(p) for p in args[0].split()]
class FileList(PathList):
def __new__(clk, *args, **kwargs):
if not args:
return list()
else:
return [File(p) for p in PathList(args[0])]
class EnumList(list):
def __new__(cls, *args, **kwargs):
if not args:
class NoSuchItemError(Error):
pass
class UnknownSection(Error):
pass
class StringList(list):
def __new__(cls, *args, **kwargs):
if not args:
return list()
else:
return list(args[0].split())
class PathList(StringList):
def __new__(cls, *args, **kwargs):
if not args:
return list()
else:
return [os.path.expandvars(p) for p in args[0].split()]
class FileList(PathList):
def __new__(clk, *args, **kwargs):
if not args:
return list()
else:
return [File(p) for p in PathList(args[0])]
class VlnvList(StringList):
def __new__(clk, *args, **kwargs):
if not args:
class PathList(StringList):
def __new__(cls, *args, **kwargs):
if not args:
return list()
else:
return [os.path.expandvars(p) for p in args[0].split()]
class FileList(PathList):
def __new__(clk, *args, **kwargs):
if not args:
return list()
else:
return [File(p) for p in PathList(args[0])]
class VlnvList(StringList):
def __new__(clk, *args, **kwargs):
if not args:
return list()
else:
return [Vlnv(p) for p in StringList(args[0])]
class EnumList(list):
def __new__(cls, *args, **kwargs):
if not args:
return super(EnumList, cls).__new__(cls)
else:
values = kwargs['values']
_args = args[0].split()
_valid = []
_invalid = []
for arg in _args:
def __new__(clk, *args, **kwargs):
if not args:
return list()
else:
return [Vlnv(p) for p in StringList(args[0])]
for cls in parent.__subclasses__():
_register_subclasses(cls)
if cls.TAG is None:
continue
SECTION_MAP[cls.TAG] = cls
_register_subclasses(Section)
if __name__ == "__main__":
typenames = {str : 'String',
FileList : 'Space-separated list of files',
PathList : 'Space-separated list of paths',
SimulatorList : 'Space-separated list',
SourceType : 'String',
StringList : 'Space-separated list',
list : 'List'}
SECTION_TEMPLATE = """
{}
{}
[cols="2,1,5",options="header"]
|==============================
|Name | Type | Description
{}
|==============================
"""
for k,v in sorted(SECTION_MAP.items()):
c = v()
s="\n".join(["|{} | {} | {}".format(k2, typenames[v2['type']], v2['desc']) for k2, v2 in sorted(c._members.items())])
def __init__(self, items=None):
super(GhdlSection, self).__init__()
self._add_member('analyze_options', StringList, "Extra GHDL analyzer options")
self._add_member('run_options', StringList, "Extra GHDL run options")
if items:
self.load_dict(items)
for cls in parent.__subclasses__():
_register_subclasses(cls)
if cls.TAG is None:
continue
SECTION_MAP[cls.TAG] = cls
_register_subclasses(Section)
if __name__ == "__main__":
typenames = {str : 'String',
FileList : 'Space-separated list of files',
PathList : 'Space-separated list of paths',
SimulatorList : 'Space-separated list',
SourceType : 'String',
StringList : 'Space-separated list',
VlnvList : 'Space-separated list of VLNV identifiers',
list : 'List'}
SECTION_TEMPLATE = """
{}
{}
[cols="2,1,5",options="header"]
|==============================
|Name | Type | Description
{}
|==============================
"""
for k,v in sorted(SECTION_MAP.items()):
c = v()
def __init__(self, items=None):
super(GhdlSection, self).__init__()
self._add_member('analyze_options', StringList, "Extra GHDL analyzer options")
self._add_member('run_options', StringList, "Extra GHDL run options")
if items:
self.load_dict(items)