Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Sep 5, 2023
1 parent a0ece77 commit 2913a39
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions xmipy/xmiwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def set_int(self, name: str, value: int) -> None:
def initialize(self, config_file: str = "") -> None:
if self._state == State.UNINITIALIZED:
with cd(self.working_directory):
self._execute_function(
self.lib.initialize, config_file.encode()
)
self._execute_function(self.lib.initialize, config_file.encode())
self._state = State.INITIALIZED
else:
raise InputError("The library is already initialized")
Expand Down Expand Up @@ -194,9 +192,7 @@ def get_time_step(self) -> float:
def get_component_name(self) -> str:
len_name = self.get_constant_int("BMI_LENCOMPONENTNAME")
component_name = create_string_buffer(len_name)
self._execute_function(
self.lib.get_component_name, byref(component_name)
)
self._execute_function(self.lib.get_component_name, byref(component_name))
return component_name.value.decode("ascii")

def get_version(self) -> str:
Expand Down Expand Up @@ -544,9 +540,7 @@ def get_grid_type(self, grid: int) -> str:
)
return grid_type.value.decode()

def get_grid_shape(
self, grid: int, shape: NDArray[np.int32]
) -> NDArray[np.int32]:
def get_grid_shape(self, grid: int, shape: NDArray[np.int32]) -> NDArray[np.int32]:
c_grid = c_int(grid)
self._execute_function(
self.lib.get_grid_shape,
Expand All @@ -565,9 +559,7 @@ def get_grid_origin(
) -> NDArray[np.int32]:
raise NotImplementedError

def get_grid_x(
self, grid: int, x: NDArray[np.float64]
) -> NDArray[np.float64]:
def get_grid_x(self, grid: int, x: NDArray[np.float64]) -> NDArray[np.float64]:
c_grid = c_int(grid)
self._execute_function(
self.lib.get_grid_x,
Expand All @@ -576,9 +568,7 @@ def get_grid_x(
)
return x

def get_grid_y(
self, grid: int, y: NDArray[np.float64]
) -> NDArray[np.float64]:
def get_grid_y(self, grid: int, y: NDArray[np.float64]) -> NDArray[np.float64]:
c_grid = c_int(grid)
self._execute_function(
self.lib.get_grid_y,
Expand All @@ -587,9 +577,7 @@ def get_grid_y(
)
return y

def get_grid_z(
self, grid: int, z: NDArray[np.float64]
) -> NDArray[np.float64]:
def get_grid_z(self, grid: int, z: NDArray[np.float64]) -> NDArray[np.float64]:
c_grid = c_int(grid)
self._execute_function(
self.lib.get_grid_z,
Expand Down Expand Up @@ -683,9 +671,7 @@ def solve(self, component_id: int = 1) -> bool:
cid = c_int(component_id)
has_converged = c_int(0)
with cd(self.working_directory):
self._execute_function(
self.lib.solve, byref(cid), byref(has_converged)
)
self._execute_function(self.lib.solve, byref(cid), byref(has_converged))
return has_converged.value == 1

def finalize_solve(self, component_id: int = 1) -> None:
Expand All @@ -709,9 +695,7 @@ def get_var_address(

return var_address.value.decode()

def _execute_function(
self, function: Callable[[Any], int], *args: Any
) -> None:
def _execute_function(self, function: Callable[[Any], int], *args: Any) -> None:
"""
Utility function to execute a BMI function in the kernel and checks its status
"""
Expand Down

0 comments on commit 2913a39

Please sign in to comment.