diff --git a/chemfiles/ffi.py b/chemfiles/_c_api.py similarity index 100% rename from chemfiles/ffi.py rename to chemfiles/_c_api.py diff --git a/chemfiles/clib.py b/chemfiles/_c_lib.py similarity index 94% rename from chemfiles/clib.py rename to chemfiles/_c_lib.py index afc66719..6d6f9238 100644 --- a/chemfiles/clib.py +++ b/chemfiles/_c_lib.py @@ -1,7 +1,7 @@ # -* coding: utf-8 -* import os import sys -from ctypes import cdll, c_double, POINTER +from ctypes import POINTER, c_double, cdll try: from .external import EXTERNAL_CHEMFILES @@ -18,8 +18,7 @@ def __call__(self): path = _lib_path() self._cache = cdll.LoadLibrary(path) - from .ffi import set_interface - from .ffi import CHFL_FRAME, CHFL_ATOM, chfl_vector3d + from ._c_api import CHFL_ATOM, CHFL_FRAME, chfl_vector3d, set_interface set_interface(self._cache) # We update the arguments here, as ctypes can not pass a NULL value @@ -60,8 +59,8 @@ def _lib_path(): def _check_dll(path): - import struct import platform + import struct IMAGE_FILE_MACHINE_I386 = 332 IMAGE_FILE_MACHINE_AMD64 = 34404 diff --git a/chemfiles/cell.py b/chemfiles/cell.py index 9afaa454..84682993 100644 --- a/chemfiles/cell.py +++ b/chemfiles/cell.py @@ -5,7 +5,7 @@ import numpy as np from .utils import CxxPointer, ChemfilesError -from .ffi import chfl_cellshape, chfl_vector3d +from ._c_api import chfl_cellshape, chfl_vector3d class CellShape(IntEnum): diff --git a/chemfiles/frame.py b/chemfiles/frame.py index 871a3196..a8bbec3d 100644 --- a/chemfiles/frame.py +++ b/chemfiles/frame.py @@ -5,7 +5,7 @@ from .utils import CxxPointer, string_type from .misc import ChemfilesError -from .ffi import chfl_vector3d, chfl_bond_order +from ._c_api import chfl_vector3d, chfl_bond_order from .atom import Atom from .topology import Topology from .cell import UnitCell diff --git a/chemfiles/misc.py b/chemfiles/misc.py index 32006846..a48c1111 100644 --- a/chemfiles/misc.py +++ b/chemfiles/misc.py @@ -4,7 +4,7 @@ from ctypes import c_uint64, POINTER, create_string_buffer -from .clib import _get_c_library +from ._c_lib import _get_c_library class ChemfilesWarning(UserWarning): @@ -128,7 +128,7 @@ def formats_list(): :rtype: list(FormatMetadata) """ - from .ffi import chfl_format_metadata + from ._c_api import chfl_format_metadata lib = _get_c_library() @@ -156,7 +156,7 @@ def set_warnings_callback(function): By default, warnings are send to python ``warnings`` module. """ - from .ffi import chfl_warning_callback + from ._c_api import chfl_warning_callback def callback(message): try: diff --git a/chemfiles/property.py b/chemfiles/property.py index 0f3803e6..877d7dea 100644 --- a/chemfiles/property.py +++ b/chemfiles/property.py @@ -4,7 +4,7 @@ import numpy as np from ctypes import c_double, c_bool -from .ffi import chfl_property_kind, chfl_vector3d +from ._c_api import chfl_property_kind, chfl_vector3d from .misc import ChemfilesError from .utils import CxxPointer, _call_with_growing_buffer, string_type diff --git a/chemfiles/selection.py b/chemfiles/selection.py index 79047e67..af600b54 100644 --- a/chemfiles/selection.py +++ b/chemfiles/selection.py @@ -5,7 +5,7 @@ import numpy as np from .utils import CxxPointer, _call_with_growing_buffer -from .ffi import chfl_match +from ._c_api import chfl_match class Selection(CxxPointer): diff --git a/chemfiles/topology.py b/chemfiles/topology.py index c27fe6af..ac293174 100644 --- a/chemfiles/topology.py +++ b/chemfiles/topology.py @@ -5,7 +5,7 @@ import numpy as np from .utils import CxxPointer -from .ffi import chfl_bond_order +from ._c_api import chfl_bond_order from .atom import Atom from .residue import Residue diff --git a/chemfiles/utils.py b/chemfiles/utils.py index 06491d3e..8d94bd17 100644 --- a/chemfiles/utils.py +++ b/chemfiles/utils.py @@ -3,7 +3,7 @@ import sys from ctypes import create_string_buffer, c_uint64 -from .clib import _get_c_library +from ._c_lib import _get_c_library from .misc import ChemfilesError, _last_error diff --git a/tests/misc.py b/tests/misc.py index 46921716..faf3bc33 100644 --- a/tests/misc.py +++ b/tests/misc.py @@ -20,7 +20,7 @@ def __exit__(self, *args): class TestVersion(unittest.TestCase): def test_version(self): - version = chemfiles.clib._get_c_library().chfl_version() + version = chemfiles._c_lib._get_c_library().chfl_version() self.assertEqual(chemfiles.__version__, version.decode("utf8"))