aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/libghdl
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2021-08-23 21:20:25 +0200
committerumarcor <unai.martinezcorral@ehu.eus>2021-08-23 21:20:25 +0200
commita3255c69df60fee697e1ee546052a8abe86fb4ff (patch)
tree524c352b917e25f61f7c7b1aeec19bf831c41f7f /pyGHDL/libghdl
parent8cf15b9abb3a197857627f55ef28111f9492d9d5 (diff)
downloadghdl-a3255c69df60fee697e1ee546052a8abe86fb4ff.tar.gz
ghdl-a3255c69df60fee697e1ee546052a8abe86fb4ff.tar.bz2
ghdl-a3255c69df60fee697e1ee546052a8abe86fb4ff.zip
black: rerun, to pick pyproject settings
Diffstat (limited to 'pyGHDL/libghdl')
-rw-r--r--pyGHDL/libghdl/__init__.py10
-rw-r--r--pyGHDL/libghdl/_decorator.py28
-rw-r--r--pyGHDL/libghdl/_types.py4
-rw-r--r--pyGHDL/libghdl/files_map.py12
-rw-r--r--pyGHDL/libghdl/files_map_editor.py4
-rw-r--r--pyGHDL/libghdl/flags.py4
-rw-r--r--pyGHDL/libghdl/libraries.py8
-rw-r--r--pyGHDL/libghdl/vhdl/canon.py4
-rw-r--r--pyGHDL/libghdl/vhdl/ieee.py8
-rw-r--r--pyGHDL/libghdl/vhdl/std_package.py4
10 files changed, 20 insertions, 66 deletions
diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py
index 7852d4eba..04cc387d9 100644
--- a/pyGHDL/libghdl/__init__.py
+++ b/pyGHDL/libghdl/__init__.py
@@ -64,9 +64,7 @@ class LibGHDLException(GHDLBaseException):
def _get_libghdl_name() -> Path:
"""Get the name of the libghdl library (with version and extension)."""
ver = __version__.replace("-", "_").replace(".", "_")
- ext = {"win32": "dll", "cygwin": "dll", "msys": "dll", "darwin": "dylib"}.get(
- sys_platform, "so"
- )
+ ext = {"win32": "dll", "cygwin": "dll", "msys": "dll", "darwin": "dylib"}.get(sys_platform, "so")
return Path("libghdl-{version}.{ext}".format(version=ver, ext=ext))
@@ -150,11 +148,7 @@ def _initialize():
_libghdl_path = _get_libghdl_path()
# Add DLL search path(s)
- if (
- sys_platform == "win32"
- and sys_version_info.major == 3
- and sys_version_info.minor >= 8
- ):
+ if sys_platform == "win32" and sys_version_info.major == 3 and sys_version_info.minor >= 8:
from os import add_dll_directory as os_add_dll_directory
p1 = _libghdl_path.parent.parent / "bin"
diff --git a/pyGHDL/libghdl/_decorator.py b/pyGHDL/libghdl/_decorator.py
index 9c5aefa19..32a02930d 100644
--- a/pyGHDL/libghdl/_decorator.py
+++ b/pyGHDL/libghdl/_decorator.py
@@ -128,18 +128,12 @@ def BindToLibGHDL(subprogramName):
typeHintCount = len(typeHints)
if typeHintCount == 0:
- raise ValueError(
- "Function {0} is not annotated with types.".format(func.__name__)
- )
+ raise ValueError("Function {0} is not annotated with types.".format(func.__name__))
try:
returnType = typeHints["return"]
except KeyError:
- raise ValueError(
- "Function {0} is not annotated with a return type.".format(
- func.__name__
- )
- )
+ raise ValueError("Function {0} is not annotated with a return type.".format(func.__name__))
if (typeHintCount - 1) != func.__code__.co_argcount:
raise ValueError(
@@ -159,19 +153,13 @@ def BindToLibGHDL(subprogramName):
parameterTypes.append(PythonTypeToCtype(parameter))
except TypeError:
raise TypeError(
- "Unsupported parameter type '{0!s}' in function '{1}'.".format(
- parameter, func.__name__
- )
+ "Unsupported parameter type '{0!s}' in function '{1}'.".format(parameter, func.__name__)
)
try:
resultType = PythonTypeToCtype(returnType)
except TypeError:
- raise TypeError(
- "Unsupported return type '{0!s}' in function '{1}'.".format(
- returnType, func.__name__
- )
- )
+ raise TypeError("Unsupported return type '{0!s}' in function '{1}'.".format(returnType, func.__name__))
functionPointer = getattr(libghdl, subprogramName)
functionPointer.parameterTypes = parameterTypes
@@ -186,9 +174,7 @@ def BindToLibGHDL(subprogramName):
except OSError as ex:
errors = [str(ex)]
raise LibGHDLException(
- "Caught exception when calling '{func}' in libghdl.".format(
- func=subprogramName
- ),
+ "Caught exception when calling '{func}' in libghdl.".format(func=subprogramName),
errors,
) from ex
@@ -204,9 +190,7 @@ def BindToLibGHDL(subprogramName):
except OSError as ex:
errors = [str(ex)]
raise LibGHDLException(
- "Caught exception when calling '{func}' in libghdl.".format(
- func=subprogramName
- ),
+ "Caught exception when calling '{func}' in libghdl.".format(func=subprogramName),
errors,
) from ex
diff --git a/pyGHDL/libghdl/_types.py b/pyGHDL/libghdl/_types.py
index 1db333f05..b3d4c92bb 100644
--- a/pyGHDL/libghdl/_types.py
+++ b/pyGHDL/libghdl/_types.py
@@ -89,6 +89,4 @@ Iir_Design_File = TypeVar("Iir_Design_File", bound=c_int32)
Iir_Design_Unit = TypeVar("Iir_Design_Unit", bound=c_int32)
Iir_Library_Declaration = TypeVar("Iir_Library_Declaration", bound=c_int32)
Iir_Package_Declaration = TypeVar("Iir_Package_Declaration", bound=c_int32)
-Iir_Enumeration_Type_Definition = TypeVar(
- "Iir_Enumeration_Type_Definition", bound=c_int32
-)
+Iir_Enumeration_Type_Definition = TypeVar("Iir_Enumeration_Type_Definition", bound=c_int32)
diff --git a/pyGHDL/libghdl/files_map.py b/pyGHDL/libghdl/files_map.py
index 0a288fa2e..277a00706 100644
--- a/pyGHDL/libghdl/files_map.py
+++ b/pyGHDL/libghdl/files_map.py
@@ -90,9 +90,7 @@ def Location_File_To_Line(Location: LocationType, File: SourceFileEntry) -> int:
@export
@BindToLibGHDL("files_map__location_file_line_to_offset")
-def Location_File_Line_To_Offset(
- Location: LocationType, File: SourceFileEntry, Line: int
-) -> int:
+def Location_File_Line_To_Offset(Location: LocationType, File: SourceFileEntry, Line: int) -> int:
"""
Get the offset in :obj:`Line` of :obj:`Location`.
@@ -106,9 +104,7 @@ def Location_File_Line_To_Offset(
@export
@BindToLibGHDL("files_map__location_file_line_to_col")
-def Location_File_Line_To_Col(
- Location: LocationType, File: SourceFileEntry, Line: int
-) -> int:
+def Location_File_Line_To_Col(Location: LocationType, File: SourceFileEntry, Line: int) -> int:
"""
Get logical column (with HT expanded) from :obj:`Location`, :obj:`File` and
:obj:`Line`.
@@ -259,9 +255,7 @@ def Read_Source_File(Directory: NameId, Name: NameId) -> SourceFileEntry:
@export
@BindToLibGHDL("files_map__reserve_source_file")
-def Reserve_Source_File(
- Directory: NameId, Name: NameId, Length: int
-) -> SourceFileEntry:
+def Reserve_Source_File(Directory: NameId, Name: NameId, Length: int) -> SourceFileEntry:
"""
Reserve an entry, but do not read any file.
diff --git a/pyGHDL/libghdl/files_map_editor.py b/pyGHDL/libghdl/files_map_editor.py
index 996db5931..9afd46bdc 100644
--- a/pyGHDL/libghdl/files_map_editor.py
+++ b/pyGHDL/libghdl/files_map_editor.py
@@ -113,9 +113,7 @@ def Fill_Text(File: SourceFileEntry, Text_Pointer, Text_Length: int) -> None:
@export
# @BindToLibGHDL("files_map__editor__check_buffer_content")
-def Check_Buffer_Content(
- File: SourceFileEntry, String_Pointer: c_char_p, String_Length: c_uint32
-) -> None:
+def Check_Buffer_Content(File: SourceFileEntry, String_Pointer: c_char_p, String_Length: c_uint32) -> None:
"""
Check that content of :obj:`File` is STR[1 .. STR_LEN].
diff --git a/pyGHDL/libghdl/flags.py b/pyGHDL/libghdl/flags.py
index fc3107e79..f62d5de2c 100644
--- a/pyGHDL/libghdl/flags.py
+++ b/pyGHDL/libghdl/flags.py
@@ -49,8 +49,6 @@ Flag_Elocations = c_bool.in_dll(libghdl, "flags__flag_elocations")
Verbose = c_bool.in_dll(libghdl, "flags__verbose")
-Flag_Elaborate_With_Outdated = c_bool.in_dll(
- libghdl, "flags__flag_elaborate_with_outdated"
-)
+Flag_Elaborate_With_Outdated = c_bool.in_dll(libghdl, "flags__flag_elaborate_with_outdated")
Flag_Force_Analysis = c_bool.in_dll(libghdl, "flags__flag_force_analysis")
diff --git a/pyGHDL/libghdl/libraries.py b/pyGHDL/libghdl/libraries.py
index 07075044d..06b5f044c 100644
--- a/pyGHDL/libghdl/libraries.py
+++ b/pyGHDL/libghdl/libraries.py
@@ -54,9 +54,7 @@ A location for library declarations (such as library WORK). Use ``.value`` to
access this variable inside libghdl.
"""
-Work_Library: Iir_Library_Declaration = c_int32.in_dll(
- libghdl, "libraries__work_library"
-)
+Work_Library: Iir_Library_Declaration = c_int32.in_dll(libghdl, "libraries__work_library")
"""
Library declaration for the work library. Note: the identifier of the work_library
is ``work_library_name``, which may be different from 'WORK'. Use ``.value`` to
@@ -134,9 +132,7 @@ def Get_Library_No_Create(Ident: NameId) -> Iir_Library_Declaration:
@export
@BindToLibGHDL("libraries__find_primary_unit")
-def Find_Primary_Unit(
- Library: Iir_Library_Declaration, Name: NameId
-) -> Iir_Design_Unit:
+def Find_Primary_Unit(Library: Iir_Library_Declaration, Name: NameId) -> Iir_Design_Unit:
"""
Just return the design_unit for :obj:`Name`, or ``NULL`` if not found.
diff --git a/pyGHDL/libghdl/vhdl/canon.py b/pyGHDL/libghdl/vhdl/canon.py
index 086755c35..3d892788c 100644
--- a/pyGHDL/libghdl/vhdl/canon.py
+++ b/pyGHDL/libghdl/vhdl/canon.py
@@ -38,9 +38,7 @@ from pyGHDL.libghdl import libghdl
__all__ = ["Flag_Concurrent_Stmts", "Flag_Configurations", "Flag_Associations"]
-Flag_Concurrent_Stmts = c_bool.in_dll(
- libghdl, "vhdl__canon__canon_flag_concurrent_stmts"
-)
+Flag_Concurrent_Stmts = c_bool.in_dll(libghdl, "vhdl__canon__canon_flag_concurrent_stmts")
Flag_Configurations = c_bool.in_dll(libghdl, "vhdl__canon__canon_flag_configurations")
diff --git a/pyGHDL/libghdl/vhdl/ieee.py b/pyGHDL/libghdl/vhdl/ieee.py
index 652782b55..83a635b78 100644
--- a/pyGHDL/libghdl/vhdl/ieee.py
+++ b/pyGHDL/libghdl/vhdl/ieee.py
@@ -37,17 +37,13 @@ from pyGHDL.libghdl import libghdl
__all__ = ["Std_Logic_1164_Pkg", "Std_Logic_Type", "Std_Logic_Vector_Type"]
-Std_Logic_1164_Pkg = c_int.in_dll(
- libghdl, "vhdl__ieee__std_logic_1164__std_logic_1164_pkg"
-)
+Std_Logic_1164_Pkg = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_1164_pkg")
# Get value
Std_Logic_Type = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_type")
# Get value
-Std_Logic_Vector_Type = c_int.in_dll(
- libghdl, "vhdl__ieee__std_logic_1164__std_logic_vector_type"
-)
+Std_Logic_Vector_Type = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__std_logic_vector_type")
# Get value
# Rising_Edge = c_int.in_dll(libghdl, "vhdl__ieee__std_logic_1164__rising_edge")
diff --git a/pyGHDL/libghdl/vhdl/std_package.py b/pyGHDL/libghdl/vhdl/std_package.py
index 6ea6462fd..f2c46385a 100644
--- a/pyGHDL/libghdl/vhdl/std_package.py
+++ b/pyGHDL/libghdl/vhdl/std_package.py
@@ -48,9 +48,7 @@ __all__ = ["Std_Location", "Standard_Package", "Character_Type_Definition"]
Std_Location: LocationType = c_int32.in_dll(libghdl, "vhdl__std_package__std_location")
"""Virtual location for the ``std.standard`` package. Use ``.value`` to access this variable inside libghdl."""
-Standard_Package: Iir_Package_Declaration = c_int32.in_dll(
- libghdl, "vhdl__std_package__standard_package"
-)
+Standard_Package: Iir_Package_Declaration = c_int32.in_dll(libghdl, "vhdl__std_package__standard_package")
"""Virtual package ``std.package``. Use ``.value`` to access this variable inside libghdl."""
Character_Type_Definition: Iir_Enumeration_Type_Definition = c_int32.in_dll(