diff --git a/docs/advanced/LocalizedForceTorque.md b/docs/advanced/LocalizedForceTorque.md index f7c1280f4..406b87740 100644 --- a/docs/advanced/LocalizedForceTorque.md +++ b/docs/advanced/LocalizedForceTorque.md @@ -24,7 +24,7 @@ class EndpointForcesWithTorques(NoForces): This class applies constant forces on the endpoint nodes. """ - def __init__(self, end_force, ramp_up_time=0.0): + def __init__(self, end_force, ramp_up_time=0.0) -> None: """ Parameters diff --git a/docs/guide/workflow.md b/docs/guide/workflow.md index cf1051384..acb183a6c 100644 --- a/docs/guide/workflow.md +++ b/docs/guide/workflow.md @@ -180,7 +180,7 @@ from elastica.callback_functions import CallBackBaseClass # MyCallBack class is derived from the base call back class. class MyCallBack(CallBackBaseClass): - def __init__(self, step_skip: int, callback_params): + def __init__(self, step_skip: int, callback_params) -> None: CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/elastica/_synchronize_periodic_boundary.py b/elastica/_synchronize_periodic_boundary.py index 2ec46da7a..9dbcf2dc4 100644 --- a/elastica/_synchronize_periodic_boundary.py +++ b/elastica/_synchronize_periodic_boundary.py @@ -84,7 +84,7 @@ class _ConstrainPeriodicBoundaries(ConstraintBase): is to synchronize periodic boundaries of ring rod. """ - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) def constrain_values(self, rod, time): diff --git a/elastica/boundary_conditions.py b/elastica/boundary_conditions.py index b45353c14..ec722df83 100644 --- a/elastica/boundary_conditions.py +++ b/elastica/boundary_conditions.py @@ -35,7 +35,7 @@ class ConstraintBase(ABC): _constrained_position_idx: np.ndarray _constrained_director_idx: np.ndarray - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: """Initialize boundary condition""" try: self._system = kwargs["_system"] @@ -104,7 +104,7 @@ class FreeBC(ConstraintBase): Boundary condition template. """ - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) def constrain_values(self, system: SystemType, time: float) -> None: @@ -506,7 +506,7 @@ class FixedConstraint(GeneralConstraint): GeneralConstraint: Generalized constraint with configurable DOF. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: """ Initialization of the constraint. Any parameter passed to 'using' will be available in kwargs. diff --git a/elastica/callback_functions.py b/elastica/callback_functions.py index 4b80562b7..bbfadd723 100644 --- a/elastica/callback_functions.py +++ b/elastica/callback_functions.py @@ -21,7 +21,7 @@ class CallBackBaseClass: """ - def __init__(self): + def __init__(self) -> None: """ CallBackBaseClass does not need any input parameters. """ @@ -61,7 +61,7 @@ class MyCallBack(CallBackBaseClass): Collected callback data is saved in this dictionary. """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: """ Parameters diff --git a/elastica/contact_forces.py b/elastica/contact_forces.py index 8f9b0ab5e..353e3052c 100644 --- a/elastica/contact_forces.py +++ b/elastica/contact_forces.py @@ -32,7 +32,7 @@ class NoContact: """ - def __init__(self): + def __init__(self) -> None: """ NoContact class does not need any input parameters. """ @@ -101,7 +101,7 @@ class RodRodContact(NoContact): """ - def __init__(self, k: float, nu: float): + def __init__(self, k: float, nu: float) -> None: """ Parameters ---------- @@ -338,7 +338,7 @@ class RodSelfContact(NoContact): """ - def __init__(self, k: float, nu: float): + def __init__(self, k: float, nu: float) -> None: """ Parameters diff --git a/elastica/dissipation.py b/elastica/dissipation.py index b53a37161..3d0555d25 100644 --- a/elastica/dissipation.py +++ b/elastica/dissipation.py @@ -29,7 +29,7 @@ class DamperBase(ABC): _system: SystemType - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: """Initialize damping module""" try: self._system = kwargs["_system"] @@ -113,7 +113,7 @@ class AnalyticalLinearDamper(DamperBase): Damping coefficient acting on rotational velocity. """ - def __init__(self, damping_constant: float, time_step: float, **kwargs): + def __init__(self, damping_constant: float, time_step: float, **kwargs) -> None: """ Analytical linear damper initializer @@ -202,7 +202,7 @@ class LaplaceDissipationFilter(DamperBase): Filter term that modifies rod rotational velocity. """ - def __init__(self, filter_order: int, **kwargs): + def __init__(self, filter_order: int, **kwargs) -> None: """ Filter damper initializer diff --git a/elastica/external_forces.py b/elastica/external_forces.py index cb9c61e6c..8f668b81d 100644 --- a/elastica/external_forces.py +++ b/elastica/external_forces.py @@ -22,7 +22,7 @@ class NoForces: """ - def __init__(self): + def __init__(self) -> None: """ NoForces class does not need any input parameters. """ @@ -70,7 +70,7 @@ class GravityForces(NoForces): """ - def __init__(self, acc_gravity=np.array([0.0, -9.80665, 0.0])): + def __init__(self, acc_gravity=np.array([0.0, -9.80665, 0.0])) -> None: """ Parameters @@ -122,7 +122,7 @@ class EndpointForces(NoForces): """ - def __init__(self, start_force, end_force, ramp_up_time): + def __init__(self, start_force, end_force, ramp_up_time) -> None: """ Parameters @@ -190,7 +190,7 @@ class UniformTorques(NoForces): """ - def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])) -> None: """ Parameters @@ -224,7 +224,7 @@ class UniformForces(NoForces): 2D (dim, 1) array containing data with 'float' type. Total force applied to a rod-like object. """ - def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])) -> None: """ Parameters diff --git a/elastica/interaction.py b/elastica/interaction.py index 1cbd056f8..ebe05f737 100644 --- a/elastica/interaction.py +++ b/elastica/interaction.py @@ -496,7 +496,7 @@ class SlenderBodyTheory(NoForces): """ - def __init__(self, dynamic_viscosity: float): + def __init__(self, dynamic_viscosity: float) -> None: """ Parameters diff --git a/elastica/joint.py b/elastica/joint.py index 59e20c373..a04a5aecb 100644 --- a/elastica/joint.py +++ b/elastica/joint.py @@ -31,7 +31,7 @@ class FreeJoint: # pass the k and nu for the forces # also the necessary rods for the joint # indices should be 0 or -1, we will provide wrappers for users later - def __init__(self, k: float, nu: float): + def __init__(self, k: float, nu: float) -> None: """ Parameters @@ -720,7 +720,7 @@ class SelfContact(FreeJoint): """ - def __init__(self, k: float, nu: float): + def __init__(self, k: float, nu: float) -> None: super().__init__(k, nu) log = logging.getLogger(self.__class__.__name__) log.warning( diff --git a/elastica/memory_block/memory_block_rigid_body.py b/elastica/memory_block/memory_block_rigid_body.py index 827363784..1f0e78ecc 100644 --- a/elastica/memory_block/memory_block_rigid_body.py +++ b/elastica/memory_block/memory_block_rigid_body.py @@ -7,7 +7,7 @@ class MemoryBlockRigidBody(RigidBodyBase, _RigidRodSymplecticStepperMixin): - def __init__(self, systems: Sequence, system_idx_list: Sequence[np.int64]): + def __init__(self, systems: Sequence, system_idx_list: Sequence[np.int64]) -> None: self.n_bodies = len(systems) self.n_elems = self.n_bodies diff --git a/elastica/memory_block/memory_block_rod.py b/elastica/memory_block/memory_block_rod.py index b6a6b73f7..2c6c0da09 100644 --- a/elastica/memory_block/memory_block_rod.py +++ b/elastica/memory_block/memory_block_rod.py @@ -31,7 +31,7 @@ class MemoryBlockCosseratRod( TODO: need more documentation! """ - def __init__(self, systems: Sequence, system_idx_list): + def __init__(self, systems: Sequence, system_idx_list) -> None: # separate straight and ring rods system_straight_rod = [] diff --git a/elastica/memory_block/memory_block_rod_base.py b/elastica/memory_block/memory_block_rod_base.py index c9bcc77e1..ebd271c8d 100644 --- a/elastica/memory_block/memory_block_rod_base.py +++ b/elastica/memory_block/memory_block_rod_base.py @@ -160,5 +160,5 @@ class MemoryBlockRodBase: This is the base class for memory blocks for rods. """ - def __init__(self): + def __init__(self) -> None: pass diff --git a/elastica/modules/base_system.py b/elastica/modules/base_system.py index 8cbc918e0..4273006b1 100644 --- a/elastica/modules/base_system.py +++ b/elastica/modules/base_system.py @@ -44,7 +44,7 @@ class BaseSystemCollection(MutableSequence): https://stackoverflow.com/q/3945940 """ - def __init__(self): + def __init__(self) -> None: # Collection of functions. Each group is executed as a collection at the different steps. # Each component (Forcing, Connection, etc.) registers the executable (callable) function # in the group that that needs to be executed. These should be initialized before mixin. diff --git a/elastica/modules/callbacks.py b/elastica/modules/callbacks.py index af1482add..a0cd12a68 100644 --- a/elastica/modules/callbacks.py +++ b/elastica/modules/callbacks.py @@ -20,7 +20,7 @@ class CallBacks: List of call back classes defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._callback_list = [] super(CallBacks, self).__init__() self._feature_group_callback.append(self._callback_execution) @@ -92,7 +92,7 @@ class _CallBack: Arbitrary keyword arguments. """ - def __init__(self, sys_idx: int): + def __init__(self, sys_idx: int) -> None: """ Parameters diff --git a/elastica/modules/connections.py b/elastica/modules/connections.py index 29e17ca03..1a92804d7 100644 --- a/elastica/modules/connections.py +++ b/elastica/modules/connections.py @@ -21,7 +21,7 @@ class Connections: List of joint classes defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._connections = [] super(Connections, self).__init__() self._feature_group_synchronize.append(self._call_connections) diff --git a/elastica/modules/constraints.py b/elastica/modules/constraints.py index 1085e143d..eac06c035 100644 --- a/elastica/modules/constraints.py +++ b/elastica/modules/constraints.py @@ -20,7 +20,7 @@ class Constraints: List of boundary condition classes defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._constraints = [] super(Constraints, self).__init__() self._feature_group_constrain_values.append(self._constrain_values) @@ -98,7 +98,7 @@ class _Constraint: Arbitrary keyword arguments. """ - def __init__(self, sys_idx: int): + def __init__(self, sys_idx: int) -> None: """ Parameters diff --git a/elastica/modules/contact.py b/elastica/modules/contact.py index 4f0120c50..3039373a9 100644 --- a/elastica/modules/contact.py +++ b/elastica/modules/contact.py @@ -20,7 +20,7 @@ class Contact: List of contact classes defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._contacts = [] super(Contact, self).__init__() self._feature_group_synchronize.append(self._call_contacts) diff --git a/elastica/modules/damping.py b/elastica/modules/damping.py index 027eebdad..b03e15d66 100644 --- a/elastica/modules/damping.py +++ b/elastica/modules/damping.py @@ -24,7 +24,7 @@ class Damping: List of damper classes defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._dampers = [] super(Damping, self).__init__() self._feature_group_constrain_rates.append(self._dampen_rates) @@ -88,7 +88,7 @@ class _Damper: Arbitrary keyword arguments. """ - def __init__(self, sys_idx: int): + def __init__(self, sys_idx: int) -> None: """ Parameters diff --git a/elastica/modules/forcing.py b/elastica/modules/forcing.py index d8a46b64b..b0ab392b5 100644 --- a/elastica/modules/forcing.py +++ b/elastica/modules/forcing.py @@ -20,7 +20,7 @@ class Forcing: List of forcing class defined for rod-like objects. """ - def __init__(self): + def __init__(self) -> None: self._ext_forces_torques = [] super(Forcing, self).__init__() self._feature_group_synchronize.append(self._call_ext_forces_torques) @@ -101,7 +101,7 @@ class _ExtForceTorque: Arbitrary keyword arguments. """ - def __init__(self, sys_idx: int): + def __init__(self, sys_idx: int) -> None: """ Parameters diff --git a/elastica/rigidbody/cylinder.py b/elastica/rigidbody/cylinder.py index f9078d493..9878738f1 100644 --- a/elastica/rigidbody/cylinder.py +++ b/elastica/rigidbody/cylinder.py @@ -8,7 +8,7 @@ class Cylinder(RigidBodyBase): - def __init__(self, start, direction, normal, base_length, base_radius, density): + def __init__(self, start, direction, normal, base_length, base_radius, density) -> None: """ Rigid body cylinder initializer. diff --git a/elastica/rigidbody/data_structures.py b/elastica/rigidbody/data_structures.py index e246c1fc8..4e1d72775 100644 --- a/elastica/rigidbody/data_structures.py +++ b/elastica/rigidbody/data_structures.py @@ -9,7 +9,7 @@ # FIXME : Explicit Stepper doesn't work as States lose the # views they initially had when working with a timestepper. class _RigidRodExplicitStepperMixin: - def __init__(self): + def __init__(self) -> None: ( self.state, self.__deriv_state, @@ -44,7 +44,7 @@ def __call__(self, time, *args, **kwargs): class _RigidRodSymplecticStepperMixin(_RodSymplecticStepperMixin): - def __init__(self): + def __init__(self) -> None: super(_RigidRodSymplecticStepperMixin, self).__init__() # Expose rate returning functions in the interface # to be used by the time-stepping algorithm @@ -286,7 +286,7 @@ def _bootstrap_from_data(stepper_type: str, n_elems: int, vector_states, matrix_ # /multiplication used. # """ # -# def __init__(self, _unused_n_elems: int, rate_collection_view): +# def __init__(self, _unused_n_elems: int, rate_collection_view) -> None: # """ # Parameters # ---------- @@ -380,7 +380,7 @@ class _KinematicState: only these methods are provided. """ - def __init__(self, position_collection_view, director_collection_view): + def __init__(self, position_collection_view, director_collection_view) -> None: """ Parameters ---------- diff --git a/elastica/rigidbody/rigid_body.py b/elastica/rigidbody/rigid_body.py index a3724da0a..2c60ffb76 100644 --- a/elastica/rigidbody/rigid_body.py +++ b/elastica/rigidbody/rigid_body.py @@ -15,7 +15,7 @@ class RigidBodyBase(ABC): """ - def __init__(self): + def __init__(self) -> None: self.position_collection = NotImplementedError self.velocity_collection = NotImplementedError diff --git a/elastica/rigidbody/sphere.py b/elastica/rigidbody/sphere.py index 48cb56da4..c75d6b098 100644 --- a/elastica/rigidbody/sphere.py +++ b/elastica/rigidbody/sphere.py @@ -8,7 +8,7 @@ class Sphere(RigidBodyBase): - def __init__(self, center, base_radius, density): + def __init__(self, center, base_radius, density) -> None: """ Rigid body sphere initializer. diff --git a/elastica/rod/data_structures.py b/elastica/rod/data_structures.py index 3c8b40328..6a1121039 100644 --- a/elastica/rod/data_structures.py +++ b/elastica/rod/data_structures.py @@ -9,7 +9,7 @@ # FIXME : Explicit Stepper doesn't work as States lose the # views they initially had when working with a timestepper. # class _RodExplicitStepperMixin: -# def __init__(self): +# def __init__(self) -> None: # ( # self.state, # self.__deriv_state, @@ -43,7 +43,7 @@ class _RodSymplecticStepperMixin: - def __init__(self): + def __init__(self) -> None: self.kinematic_states = _KinematicState( self.position_collection, self.director_collection ) @@ -296,7 +296,7 @@ class _DerivativeState: /multiplication used. """ - def __init__(self, _unused_n_elems: int, rate_collection_view): + def __init__(self, _unused_n_elems: int, rate_collection_view) -> None: """ Parameters ---------- @@ -388,7 +388,7 @@ class _KinematicState: only these methods are provided. """ - def __init__(self, position_collection_view, director_collection_view): + def __init__(self, position_collection_view, director_collection_view) -> None: """ Parameters ---------- diff --git a/elastica/rod/knot_theory.py b/elastica/rod/knot_theory.py index 23d2b009f..c66ff0e27 100644 --- a/elastica/rod/knot_theory.py +++ b/elastica/rod/knot_theory.py @@ -46,7 +46,7 @@ class KnotTheory: KnotTheory can be mixed with any rod-class based on RodBase:: class MyRod(RodBase, KnotTheory): - def __init__(self): + def __init__(self) -> None: super().__init__() rod = MyRod(...) diff --git a/elastica/rod/rod_base.py b/elastica/rod/rod_base.py index dda88f7a2..e3e22400c 100644 --- a/elastica/rod/rod_base.py +++ b/elastica/rod/rod_base.py @@ -11,7 +11,7 @@ class RodBase: """ - def __init__(self): + def __init__(self) -> None: """ RodBase does not take any arguments. """ diff --git a/elastica/surface/plane.py b/elastica/surface/plane.py index a68a5be6e..493a6cb9b 100644 --- a/elastica/surface/plane.py +++ b/elastica/surface/plane.py @@ -7,7 +7,7 @@ class Plane(SurfaceBase): - def __init__(self, plane_origin: np.ndarray, plane_normal: np.ndarray): + def __init__(self, plane_origin: np.ndarray, plane_normal: np.ndarray) -> None: """ Plane surface initializer. diff --git a/elastica/surface/surface_base.py b/elastica/surface/surface_base.py index 8d60d2f06..d1ea018b5 100644 --- a/elastica/surface/surface_base.py +++ b/elastica/surface/surface_base.py @@ -11,7 +11,7 @@ class SurfaceBase: """ - def __init__(self): + def __init__(self) -> None: """ SurfaceBase does not take any arguments. """ diff --git a/elastica/systems/__init__.py b/elastica/systems/__init__.py index 16a17ff20..d144253f5 100644 --- a/elastica/systems/__init__.py +++ b/elastica/systems/__init__.py @@ -52,7 +52,7 @@ def make_memory_for_explicit_stepper(stepper, system): # Bad way of doing it, introduces tight coupling # this should rather be taken from the class itself class MemoryRungeKutta4: - def __init__(self): + def __init__(self) -> None: super(MemoryRungeKutta4, self).__init__() self.initial_state = None self.k_1 = None @@ -91,7 +91,7 @@ class MemoryCollection: every stage. """ - def __init__(self, memory, n_memory_slots): + def __init__(self, memory, n_memory_slots) -> None: super(MemoryCollection, self).__init__() self.__memories = [None] * n_memory_slots diff --git a/elastica/systems/analytical.py b/elastica/systems/analytical.py index b03a917aa..4d5515a1e 100644 --- a/elastica/systems/analytical.py +++ b/elastica/systems/analytical.py @@ -7,7 +7,7 @@ class BaseStatefulSystem: - def __init__(self): + def __init__(self) -> None: pass @property @@ -20,7 +20,7 @@ def state(self, new_state): class BaseSymplecticSystem: - def __init__(self): + def __init__(self) -> None: pass def kinematic_rates(self, *args): @@ -47,7 +47,7 @@ def dynamic_states(self, new_dyn_state): class TestKinematicState: - def __init__(self, state): + def __init__(self, state) -> None: self.position_collection = np.zeros((3, state.shape[0])) self.director_collection = np.zeros((3, 3, state.shape[0])) # Expand rate vector in order to be consistent with time-stepper implementation @@ -58,7 +58,7 @@ def __init__(self, state): class TestDynamicState: - def __init__(self, state): + def __init__(self, state) -> None: blocksize = state.shape[0] self.rate_collection = np.zeros((3, blocksize + 1)) # Expand rate vector in order to be consistent with time-stepper implementation @@ -68,7 +68,7 @@ def __init__(self, state): # class BaseLinearStatefulSystem: -# def __init__(self): +# def __init__(self) -> None: # pass # # @property @@ -81,7 +81,7 @@ def __init__(self, state): class ScalarExponentialDecaySystem(BaseStatefulSystem): - def __init__(self, exponent=-1, init_val=1): + def __init__(self, exponent=-1, init_val=1) -> None: super(ScalarExponentialDecaySystem, self).__init__() self.exponent = np.float64(exponent) self.initial_value = np.float64(init_val) @@ -95,7 +95,7 @@ def __call__(self, *args, **kwargs): class BaseUndampedSimpleHarmonicOscillatorSystem: - def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])): + def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])) -> None: self.omega = omega self.initial_value = init_val.copy() self._state = init_val.copy() @@ -120,7 +120,7 @@ def __call__(self, time, *args, **kwargs): # class UndampedSimpleHarmonicOscillatorSystem( # BaseUndampedSimpleHarmonicOscillatorSystem, BaseStatefulSystem # ): -# def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])): +# def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])) -> None: # BaseUndampedSimpleHarmonicOscillatorSystem.__init__( # self, omega=omega, init_val=init_val # ) @@ -129,7 +129,7 @@ def __call__(self, time, *args, **kwargs): class SymplecticUndampedSimpleHarmonicOscillatorSystem( BaseUndampedSimpleHarmonicOscillatorSystem, BaseSymplecticSystem ): - def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])): + def __init__(self, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])) -> None: BaseUndampedSimpleHarmonicOscillatorSystem.__init__( self, omega=omega, init_val=init_val ) @@ -172,7 +172,7 @@ def reset_external_forces_and_torques(self, time): class DampedSimpleHarmonicOscillatorSystem( BaseUndampedSimpleHarmonicOscillatorSystem, BaseStatefulSystem ): - def __init__(self, damping=0.5, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])): + def __init__(self, damping=0.5, omega=2.0 * np.pi, init_val=np.array([1.0, 0.0])) -> None: super(DampedSimpleHarmonicOscillatorSystem, self).__init__(omega, init_val) self.zeta = 0.5 * damping self.modified_omega = np.sqrt(self.omega**2 - self.zeta**2, dtype=np.complex128) @@ -211,7 +211,7 @@ def analytical_solution(self, time): # class MultipleFrameRotationSystem(BaseLinearStatefulSystem): -# def __init__(self, n_frames=128): +# def __init__(self, n_frames=128) -> None: # super(MultipleFrameRotationSystem, self).__init__() # self.initial_value = np.tile( # np.eye(3, 3).reshape(3, 3, 1), n_frames @@ -246,7 +246,7 @@ def analytical_solution(self, time): # _dyn_state are [v, ω], taken as a slice # """ # -# def __init__(self, init_x=5.0, init_f=3.0, init_v=1.0, init_w=1.0): +# def __init__(self, init_x=5.0, init_f=3.0, init_v=1.0, init_w=1.0) -> None: # """""" # # Contains initial_values for all dofs # self.initial_value = np.array([init_x, init_f, init_v, init_w]) @@ -298,7 +298,7 @@ def analytical_solution(self, time): class CollectiveSystem: """This collective system class is to test multiple memory structure blocks.""" - def __init__(self): + def __init__(self) -> None: self._memory_blocks = [] self.systems = self._memory_blocks @@ -325,7 +325,7 @@ def apply_callbacks(self, time, current_step: int): class SymplecticUndampedHarmonicOscillatorCollectiveSystem(CollectiveSystem): - def __init__(self): + def __init__(self) -> None: super(SymplecticUndampedHarmonicOscillatorCollectiveSystem, self).__init__() self._memory_blocks.append( SymplecticUndampedSimpleHarmonicOscillatorSystem( @@ -340,7 +340,7 @@ def __init__(self): class ScalarExponentialDampedHarmonicOscillatorCollectiveSystem(CollectiveSystem): - def __init__(self): + def __init__(self) -> None: super( ScalarExponentialDampedHarmonicOscillatorCollectiveSystem, self ).__init__() @@ -357,8 +357,7 @@ def make_simple_system_with_positions_directors( class SimpleSystemWithPositionsDirectors(_RodSymplecticStepperMixin, RodBase): - def __init__(self, start_position, end_position, start_director): - self.ring_rod_flag = False # TODO: + def __init__(self, start_position, end_position, start_director) -> None: self.a = 0.5 self.b = 1 self.c = 2 diff --git a/elastica/timestepper/explicit_steppers.py b/elastica/timestepper/explicit_steppers.py index aeb4cab03..1a1ea632d 100644 --- a/elastica/timestepper/explicit_steppers.py +++ b/elastica/timestepper/explicit_steppers.py @@ -94,7 +94,7 @@ class ExplicitStepperMixin: Can also be used as a mixin with optional cls argument below """ - def __init__(self: ExplicitStepperProtocol): + def __init__(self: ExplicitStepperProtocol) -> None: self.steps_and_prefactors = self.step_methods() def step_methods(self: ExplicitStepperProtocol) -> SteppersOperatorsType: @@ -305,13 +305,13 @@ def _fourth_update( # class ExplicitLinearExponentialIntegrator( # _LinearExponentialIntegratorMixin, ExplicitStepper # ): -# def __init__(self): +# def __init__(self) -> None: # _LinearExponentialIntegratorMixin.__init__(self) # ExplicitStepper.__init__(self, _LinearExponentialIntegratorMixin) # # # class StatefulLinearExponentialIntegrator(_StatefulStepper): -# def __init__(self): +# def __init__(self) -> None: # super(StatefulLinearExponentialIntegrator, self).__init__() # self.stepper = ExplicitLinearExponentialIntegrator() # self.linear_operator = None diff --git a/elastica/timestepper/protocol.py b/elastica/timestepper/protocol.py index 6eff40dd9..3645b912a 100644 --- a/elastica/timestepper/protocol.py +++ b/elastica/timestepper/protocol.py @@ -59,7 +59,7 @@ def get_updates(self) -> list[OperatorType]: ... # Linear Exponential integrator mixin wrapper. # """ # -# def __init__(self): +# def __init__(self) -> None: # pass # # def _do_stage(self, System, Memory, time, dt): diff --git a/elastica/timestepper/symplectic_steppers.py b/elastica/timestepper/symplectic_steppers.py index 84a87ce20..7f1426313 100644 --- a/elastica/timestepper/symplectic_steppers.py +++ b/elastica/timestepper/symplectic_steppers.py @@ -32,7 +32,7 @@ class SymplecticStepperMixin: - def __init__(self: SymplecticStepperProtocol): + def __init__(self: SymplecticStepperProtocol) -> None: self.steps_and_prefactors: Final[SteppersOperatorsType] = self.step_methods() def step_methods(self: SymplecticStepperProtocol) -> SteppersOperatorsType: diff --git a/examples/AxialStretchingCase/axial_stretching.py b/examples/AxialStretchingCase/axial_stretching.py index e0fd55966..cfb37866f 100644 --- a/examples/AxialStretchingCase/axial_stretching.py +++ b/examples/AxialStretchingCase/axial_stretching.py @@ -98,7 +98,7 @@ class AxialStretchingCallBack(ea.CallBackBaseClass): Tracks the velocity norms of the rod """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/Binder/2_Slithering_Snake.ipynb b/examples/Binder/2_Slithering_Snake.ipynb index 3ec91b971..33bb33500 100644 --- a/examples/Binder/2_Slithering_Snake.ipynb +++ b/examples/Binder/2_Slithering_Snake.ipynb @@ -306,7 +306,7 @@ " Call back function for continuum snake\n", " \"\"\"\n", "\n", - " def __init__(self, step_skip: int, callback_params: dict):\n", + " def __init__(self, step_skip: int, callback_params: dict) -> None:\n", " CallBackBaseClass.__init__(self)\n", " self.every = step_skip\n", " self.callback_params = callback_params\n", diff --git a/examples/ButterflyCase/butterfly.py b/examples/ButterflyCase/butterfly.py index d8ffd0b82..12a210d21 100644 --- a/examples/ButterflyCase/butterfly.py +++ b/examples/ButterflyCase/butterfly.py @@ -82,7 +82,7 @@ class VelocityCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/CatenaryCase/catenary.py b/examples/CatenaryCase/catenary.py index 6a2d9e88e..3cb2fde44 100644 --- a/examples/CatenaryCase/catenary.py +++ b/examples/CatenaryCase/catenary.py @@ -76,7 +76,7 @@ class CatenaryCallBack(CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: super().__init__() self.every = step_skip self.callback_params = callback_params diff --git a/examples/ContinuumFlagellaCase/continuum_flagella.py b/examples/ContinuumFlagellaCase/continuum_flagella.py index e4314349d..78b884e2e 100644 --- a/examples/ContinuumFlagellaCase/continuum_flagella.py +++ b/examples/ContinuumFlagellaCase/continuum_flagella.py @@ -91,7 +91,7 @@ class ContinuumFlagellaCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/ContinuumSnakeCase/continuum_snake.py b/examples/ContinuumSnakeCase/continuum_snake.py index 8987b1554..4d51cbca8 100644 --- a/examples/ContinuumSnakeCase/continuum_snake.py +++ b/examples/ContinuumSnakeCase/continuum_snake.py @@ -120,7 +120,7 @@ class ContinuumSnakeCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/ContinuumSnakeWithLiftingWaveCase/continuum_snake_with_lifting_wave.py b/examples/ContinuumSnakeWithLiftingWaveCase/continuum_snake_with_lifting_wave.py index fec1fc909..5b52139f6 100755 --- a/examples/ContinuumSnakeWithLiftingWaveCase/continuum_snake_with_lifting_wave.py +++ b/examples/ContinuumSnakeWithLiftingWaveCase/continuum_snake_with_lifting_wave.py @@ -151,7 +151,7 @@ class ContinuumSnakeCallBack(CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/DynamicCantileverCase/dynamic_cantilever.py b/examples/DynamicCantileverCase/dynamic_cantilever.py index 36f95c168..cc72ecb7b 100644 --- a/examples/DynamicCantileverCase/dynamic_cantilever.py +++ b/examples/DynamicCantileverCase/dynamic_cantilever.py @@ -95,7 +95,7 @@ class DynamicCantileverSimulator( # Add call backs class CantileverCallBack(ea.CallBackBaseClass): - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/ExperimentalCases/ParallelConnectionExample/parallel_connection_example.py b/examples/ExperimentalCases/ParallelConnectionExample/parallel_connection_example.py index 26bcb8e0c..b008cb960 100644 --- a/examples/ExperimentalCases/ParallelConnectionExample/parallel_connection_example.py +++ b/examples/ExperimentalCases/ParallelConnectionExample/parallel_connection_example.py @@ -158,7 +158,7 @@ class ParallelConnecitonCallback(ea.CallBackBaseClass): Call back function for parallel connection """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/FlexibleSwingingPendulumCase/flexible_swinging_pendulum.py b/examples/FlexibleSwingingPendulumCase/flexible_swinging_pendulum.py index d5215ad63..c1fae99ec 100644 --- a/examples/FlexibleSwingingPendulumCase/flexible_swinging_pendulum.py +++ b/examples/FlexibleSwingingPendulumCase/flexible_swinging_pendulum.py @@ -58,7 +58,7 @@ class HingeBC(ea.ConstraintBase): the end of the rod fixed x[0] """ - def __init__(self, fixed_position, fixed_directors, **kwargs): + def __init__(self, fixed_position, fixed_directors, **kwargs) -> None: super().__init__(**kwargs) self.fixed_position = np.array(fixed_position) self.fixed_directors = np.array(fixed_directors) @@ -87,7 +87,7 @@ class PendulumCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/MuscularFlagella/muscle_forces_flagella.py b/examples/MuscularFlagella/muscle_forces_flagella.py index 5822ada3a..744627c28 100644 --- a/examples/MuscularFlagella/muscle_forces_flagella.py +++ b/examples/MuscularFlagella/muscle_forces_flagella.py @@ -17,7 +17,7 @@ class MuscleForces(NoForces): Wave number of cyclic muscle contraction. """ - def __init__(self, amplitude, frequency): + def __init__(self, amplitude, frequency) -> None: """ Parameters diff --git a/examples/MuscularFlagella/muscular_flagella.py b/examples/MuscularFlagella/muscular_flagella.py index 8b8e13635..dacf42bf5 100644 --- a/examples/MuscularFlagella/muscular_flagella.py +++ b/examples/MuscularFlagella/muscular_flagella.py @@ -202,7 +202,7 @@ class MuscularFlagellaSimulator( # Add call backs class MuscularFlagellaCallBack(ea.CallBackBaseClass): - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/MuscularSnake/muscular_snake.py b/examples/MuscularSnake/muscular_snake.py index c2e1c7bb6..af89c8419 100644 --- a/examples/MuscularSnake/muscular_snake.py +++ b/examples/MuscularSnake/muscular_snake.py @@ -361,7 +361,7 @@ class MuscularSnakeSimulator( class MuscularSnakeCallBack(ea.CallBackBaseClass): - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact.py b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact.py index e15a3c96e..51265612a 100644 --- a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact.py +++ b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact.py @@ -92,7 +92,7 @@ class StraightRodCallBack(ea.CallBackBaseClass): Call back function for two arm octopus """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_friction.py b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_friction.py index 8507ba7ca..ca5cd71c2 100644 --- a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_friction.py +++ b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_friction.py @@ -112,7 +112,7 @@ class StraightRodCallBack(ea.CallBackBaseClass): Call back function for two arm octopus """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_validation.py b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_validation.py index f1700a772..d9c5d2690 100644 --- a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_validation.py +++ b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_validation.py @@ -120,7 +120,7 @@ class PositionCollector(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_with_y_normal.py b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_with_y_normal.py index 11fc79194..84fbb7cfb 100644 --- a/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_with_y_normal.py +++ b/examples/RigidBodyCases/RodRigidBodyContact/rod_cylinder_contact_with_y_normal.py @@ -98,7 +98,7 @@ class PositionCollector(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/rigid_cylinder_rotational_motion_case.py b/examples/RigidBodyCases/rigid_cylinder_rotational_motion_case.py index caa529fb3..f76c16ec4 100644 --- a/examples/RigidBodyCases/rigid_cylinder_rotational_motion_case.py +++ b/examples/RigidBodyCases/rigid_cylinder_rotational_motion_case.py @@ -48,7 +48,7 @@ class PointCoupleToCenter(ea.NoForces): Applies torque on rigid body """ - def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])) -> None: super(PointCoupleToCenter, self).__init__() self.torque = (torque * direction).reshape(3, 1) @@ -68,7 +68,7 @@ class RigidSphereCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/rigid_cylinder_translational_motion_case.py b/examples/RigidBodyCases/rigid_cylinder_translational_motion_case.py index 0f95ffcb0..5056bd95e 100644 --- a/examples/RigidBodyCases/rigid_cylinder_translational_motion_case.py +++ b/examples/RigidBodyCases/rigid_cylinder_translational_motion_case.py @@ -48,7 +48,7 @@ class PointForceToCenter(ea.NoForces): Applies force on rigid body """ - def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])) -> None: super(PointForceToCenter, self).__init__() self.force = (force * direction).reshape(3, 1) @@ -66,7 +66,7 @@ class RigidSphereCallBack(ea.CallBackBaseClass): Call back function """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/rigid_sphere_rotational_motion_case.py b/examples/RigidBodyCases/rigid_sphere_rotational_motion_case.py index 5c2f5d837..892984e19 100644 --- a/examples/RigidBodyCases/rigid_sphere_rotational_motion_case.py +++ b/examples/RigidBodyCases/rigid_sphere_rotational_motion_case.py @@ -39,7 +39,7 @@ class PointCoupleToCenter(ea.NoForces): Applies torque on rigid body """ - def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, torque, direction=np.array([0.0, 0.0, 0.0])) -> None: super(PointCoupleToCenter, self).__init__() self.torque = (torque * direction).reshape(3, 1) @@ -59,7 +59,7 @@ class RigidSphereCallBack(ea.CallBackBaseClass): Call back function """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RigidBodyCases/rigid_sphere_translational_motion_case.py b/examples/RigidBodyCases/rigid_sphere_translational_motion_case.py index 3a3ab0719..48f9a0b91 100644 --- a/examples/RigidBodyCases/rigid_sphere_translational_motion_case.py +++ b/examples/RigidBodyCases/rigid_sphere_translational_motion_case.py @@ -40,7 +40,7 @@ class PointForceToCenter(ea.NoForces): Applies force on rigid body """ - def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])): + def __init__(self, force, direction=np.array([0.0, 0.0, 0.0])) -> None: super(PointForceToCenter, self).__init__() self.force = (force * direction).reshape(3, 1) @@ -60,7 +60,7 @@ class RigidSphereCallBack(ea.CallBackBaseClass): Call back function """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RingRodCase/ring_rod.py b/examples/RingRodCase/ring_rod.py index eec6588e6..552d587dd 100644 --- a/examples/RingRodCase/ring_rod.py +++ b/examples/RingRodCase/ring_rod.py @@ -73,7 +73,7 @@ class RingRodCallBack(ea.CallBackBaseClass): Call back function for ring rod """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RodContactCase/RodRodContact/rod_rod_contact_inclined_validation.py b/examples/RodContactCase/RodRodContact/rod_rod_contact_inclined_validation.py index d60940ced..eba370354 100644 --- a/examples/RodContactCase/RodRodContact/rod_rod_contact_inclined_validation.py +++ b/examples/RodContactCase/RodRodContact/rod_rod_contact_inclined_validation.py @@ -111,7 +111,7 @@ class InclinedRodRodContact( class RodCallBack(ea.CallBackBaseClass): """ """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RodContactCase/RodRodContact/rod_rod_contact_parallel_validation.py b/examples/RodContactCase/RodRodContact/rod_rod_contact_parallel_validation.py index 042efd701..c06b1725d 100644 --- a/examples/RodContactCase/RodRodContact/rod_rod_contact_parallel_validation.py +++ b/examples/RodContactCase/RodRodContact/rod_rod_contact_parallel_validation.py @@ -108,7 +108,7 @@ class ParallelRodRodContact( class RodCallBack(ea.CallBackBaseClass): """ """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RodContactCase/RodSelfContact/PlectonemesCase/plectoneme_case.py b/examples/RodContactCase/RodSelfContact/PlectonemesCase/plectoneme_case.py index 5f3fb851d..d1f8e5343 100644 --- a/examples/RodContactCase/RodSelfContact/PlectonemesCase/plectoneme_case.py +++ b/examples/RodContactCase/RodSelfContact/PlectonemesCase/plectoneme_case.py @@ -174,7 +174,7 @@ def constrain_rates(self, rod, time): class RodCallBack(ea.CallBackBaseClass): """ """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/RodContactCase/RodSelfContact/SolenoidsCase/solenoid_case.py b/examples/RodContactCase/RodSelfContact/SolenoidsCase/solenoid_case.py index 3ff7d528c..49deff025 100644 --- a/examples/RodContactCase/RodSelfContact/SolenoidsCase/solenoid_case.py +++ b/examples/RodContactCase/RodSelfContact/SolenoidsCase/solenoid_case.py @@ -185,7 +185,7 @@ def constrain_rates(self, rod, time): class RodCallBack(ea.CallBackBaseClass): """ """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/TimoshenkoBeamCase/timoshenko.py b/examples/TimoshenkoBeamCase/timoshenko.py index 5f04f8031..55eec406c 100644 --- a/examples/TimoshenkoBeamCase/timoshenko.py +++ b/examples/TimoshenkoBeamCase/timoshenko.py @@ -107,7 +107,7 @@ class VelocityCallBack(ea.CallBackBaseClass): Tracks the velocity norms of the rod """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/Visualization/ContinuumSnakeVisualization/continuum_snake.py b/examples/Visualization/ContinuumSnakeVisualization/continuum_snake.py index 60e1867cf..d9103cb72 100644 --- a/examples/Visualization/ContinuumSnakeVisualization/continuum_snake.py +++ b/examples/Visualization/ContinuumSnakeVisualization/continuum_snake.py @@ -96,7 +96,7 @@ class ContinuumSnakeCallBack(ea.CallBackBaseClass): Call back function for continuum snake """ - def __init__(self, step_skip: int, callback_params: dict): + def __init__(self, step_skip: int, callback_params: dict) -> None: ea.CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params diff --git a/examples/Visualization/_povmacros.py b/examples/Visualization/_povmacros.py index c68d104ff..f0ac8e7fd 100644 --- a/examples/Visualization/_povmacros.py +++ b/examples/Visualization/_povmacros.py @@ -180,7 +180,7 @@ class Stages: The number of viewpoints """ - def __init__(self, pre_scripts="", post_scripts=""): + def __init__(self, pre_scripts="", post_scripts="") -> None: self.pre_scripts = pre_scripts self.post_scripts = post_scripts self.cameras = [] @@ -258,7 +258,7 @@ class StageObject: Change triplet tuple (or list) of position vector into string. """ - def __init__(self): + def __init__(self) -> None: self.str = "" self.update_script() @@ -302,7 +302,7 @@ class Camera(StageObject): Tilt of the camera (length=3) [default=[0,1,0]] """ - def __init__(self, name, location, angle, look_at, sky=(0, 1, 0)): + def __init__(self, name, location, angle, look_at, sky=(0, 1, 0)) -> None: self.name = name self.location = location self.angle = angle @@ -337,7 +337,7 @@ class Light(StageObject): Example) color='White', color=[1,1,1] """ - def __init__(self, position, color): + def __init__(self, position, color) -> None: self.position = position self.color = color super().__init__() diff --git a/tests/test_boundary_conditions.py b/tests/test_boundary_conditions.py index 868a026dd..a15331a6e 100644 --- a/tests/test_boundary_conditions.py +++ b/tests/test_boundary_conditions.py @@ -35,7 +35,7 @@ def test_constraint_base(): test_rod.omega_collection = np.ones(3) * 11.0 class TestBC(ConstraintBase): - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) def constrain_values(self, rod, time): @@ -59,7 +59,7 @@ def test_constraint_base_properties_access(): test_rod = MockTestRod() class TestBC(ConstraintBase): - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) # Able to access properties in constraint class assert self._system == test_rod diff --git a/tests/test_callback_functions.py b/tests/test_callback_functions.py index 8c6362b36..a560b19d4 100644 --- a/tests/test_callback_functions.py +++ b/tests/test_callback_functions.py @@ -12,7 +12,7 @@ class MockRod: - def __init__(self): + def __init__(self) -> None: self.n_elems = 0.0 self.position_collection = 0.0 self.velocity_collection = 0.0 @@ -22,7 +22,7 @@ def __init__(self): class MockRodWithElements: - def __init__(self, n_elems): + def __init__(self, n_elems) -> None: self.n_elems = n_elems self.position_collection = np.random.rand(3, n_elems) self.velocity_collection = np.random.rand(3, n_elems) diff --git a/tests/test_dissipation.py b/tests/test_dissipation.py index 49fde7126..c61f887d1 100644 --- a/tests/test_dissipation.py +++ b/tests/test_dissipation.py @@ -22,7 +22,7 @@ def test_damper_base(): test_rod.omega_collection = np.ones(3) * 11.0 class TestDamper(DamperBase): - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) def dampen_rates(self, rod, time): @@ -39,7 +39,7 @@ def test_damper_base_properties_access(): test_rod = MockTestRod() class TestDamper(DamperBase): - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__(**kwargs) # Able to access properties in constraint class assert self._system == test_rod diff --git a/tests/test_interaction.py b/tests/test_interaction.py index 8d2b0e13c..f5027ad4b 100644 --- a/tests/test_interaction.py +++ b/tests/test_interaction.py @@ -22,7 +22,7 @@ class BaseRodClass(MockTestRod): - def __init__(self, n_elem): + def __init__(self, n_elem) -> None: """ This class initialize a straight rod, which is for testing interaction functions. diff --git a/tests/test_math/test_governing_equations.py b/tests/test_math/test_governing_equations.py index eca87eefb..c8ff0296e 100644 --- a/tests/test_math/test_governing_equations.py +++ b/tests/test_math/test_governing_equations.py @@ -22,7 +22,7 @@ class BaseClass: - def __init__(self, n_elem): + def __init__(self, n_elem) -> None: super(BaseClass, self).__init__() self.n_elem = n_elem self.start = np.array([0.0, 0.0, 0.0]) diff --git a/tests/test_math/test_memory_block_with_symplectic_timestepper.py b/tests/test_math/test_memory_block_with_symplectic_timestepper.py index bfbc2e71b..c408a7fc7 100644 --- a/tests/test_math/test_memory_block_with_symplectic_timestepper.py +++ b/tests/test_math/test_memory_block_with_symplectic_timestepper.py @@ -14,7 +14,7 @@ class MockRod: - def __init__(self, n_elems): + def __init__(self, n_elems) -> None: self.n_elems = n_elems # np.random.randint(10, 30 + 1) self.n_nodes = self.n_elems + 1 self.n_voronoi = self.n_elems - 1 @@ -79,7 +79,7 @@ def __init__(self, n_elems): class BlockStructureWithSymplecticStepper( MemoryBlockCosseratRod, _RodSymplecticStepperMixin ): - def __init__(self, systems): + def __init__(self, systems) -> None: MemoryBlockCosseratRod.__init__(self, systems, [i for i in range(len(systems))]) _RodSymplecticStepperMixin.__init__(self) diff --git a/tests/test_memory_block_validity.py b/tests/test_memory_block_validity.py index 12fbd2346..7bfceb91f 100644 --- a/tests/test_memory_block_validity.py +++ b/tests/test_memory_block_validity.py @@ -7,7 +7,7 @@ class MockRod: - def __init__(self, n_elems): + def __init__(self, n_elems) -> None: self.n_elems = n_elems # np.random.randint(10, 30 + 1) self.n_nodes = self.n_elems + 1 self.n_voronoi = self.n_elems - 1 @@ -72,7 +72,7 @@ def __init__(self, n_elems): class MockRingRod: - def __init__(self, n_elems): + def __init__(self, n_elems) -> None: self.n_elems = n_elems # np.random.randint(10, 30 + 1) self.n_nodes = self.n_elems self.n_voronoi = self.n_elems diff --git a/tests/test_modules/test_callbacks.py b/tests/test_modules/test_callbacks.py index 57d4a4268..c84cb0d16 100644 --- a/tests/test_modules/test_callbacks.py +++ b/tests/test_modules/test_callbacks.py @@ -69,7 +69,7 @@ class SystemCollectionWithCallBacksMixedin(BaseSystemCollection, CallBacks): from elastica.rod import RodBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: pass @pytest.fixture(scope="function", params=[2, 10]) diff --git a/tests/test_modules/test_connections.py b/tests/test_modules/test_connections.py index bdc2715a4..2d23d0b5b 100644 --- a/tests/test_modules/test_connections.py +++ b/tests/test_modules/test_connections.py @@ -190,7 +190,7 @@ class SystemCollectionWithConnectionsMixin(BaseSystemCollection, Connections): from elastica.rod import RodBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self.n_elems = 3 # arbitrary number @pytest.fixture(scope="function", params=[2, 10]) diff --git a/tests/test_modules/test_constraints.py b/tests/test_modules/test_constraints.py index aeee1873b..807c980f8 100644 --- a/tests/test_modules/test_constraints.py +++ b/tests/test_modules/test_constraints.py @@ -67,7 +67,7 @@ def mock_init(self, *args, **kwargs): assert mock_bc.k == 1 class MockRod: - def __init__(self): + def __init__(self) -> None: self.position_collection = np.random.randn(3, 8) self.director_collection = np.random.randn(3, 3, 7) @@ -216,7 +216,7 @@ class SystemCollectionWithConstraintsMixedin(BaseSystemCollection, Constraints): from elastica.rod import RodBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: pass @pytest.fixture(scope="function", params=[2, 10]) @@ -295,7 +295,7 @@ def load_rod_with_constraints(self, load_system_with_constraints): # in place class class MockBC(self.ConstraintBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) def constrain_values(self, *args, **kwargs) -> None: diff --git a/tests/test_modules/test_contact.py b/tests/test_modules/test_contact.py index 3979bebee..1880f8e6e 100644 --- a/tests/test_modules/test_contact.py +++ b/tests/test_modules/test_contact.py @@ -93,7 +93,7 @@ class SystemCollectionWithContactMixin(BaseSystemCollection, Contact): from elastica.surface import SurfaceBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self.n_elems = 2 self.position_collection = np.array([[1, 2, 3], [0, 0, 0], [0, 0, 0]]) self.radius = np.array([1, 1]) @@ -110,11 +110,11 @@ def __init__(self, *args, **kwargs): ) class MockRigidBody(RigidBodyBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self.n_elems = 1 class MockSurface(SurfaceBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self.n_facets = 1 @pytest.fixture(scope="function", params=[2, 10]) diff --git a/tests/test_modules/test_damping.py b/tests/test_modules/test_damping.py index d36f0187c..750308306 100644 --- a/tests/test_modules/test_damping.py +++ b/tests/test_modules/test_damping.py @@ -63,7 +63,7 @@ def mock_init(self, *args, **kwargs): assert mock_damper.k == 1 class MockRod: - def __init__(self): + def __init__(self) -> None: self.mass = np.random.randn(3, 8) def test_call_improper_bc_throws_type_error(self, load_damper): @@ -92,7 +92,7 @@ class SystemCollectionWithDampingMixedin(BaseSystemCollection, Damping): from elastica.rod import RodBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: pass @pytest.fixture(scope="function", params=[2, 10]) @@ -167,7 +167,7 @@ def load_rod_with_dampers(self, load_system_with_dampers): # in place class class MockDamper(self.DamperBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) def dampen_rates(self, *args, **kwargs) -> None: diff --git a/tests/test_modules/test_forcing.py b/tests/test_modules/test_forcing.py index 67732767d..4223b3fa4 100644 --- a/tests/test_modules/test_forcing.py +++ b/tests/test_modules/test_forcing.py @@ -76,7 +76,7 @@ class SystemCollectionWithForcingMixedin(BaseSystemCollection, Forcing): from elastica.rod import RodBase class MockRod(RodBase): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: pass @pytest.fixture(scope="function", params=[2, 10]) diff --git a/tests/test_modules/test_memory_block_cosserat_rod.py b/tests/test_modules/test_memory_block_cosserat_rod.py index 7a76c852f..dcb9d170c 100644 --- a/tests/test_modules/test_memory_block_cosserat_rod.py +++ b/tests/test_modules/test_memory_block_cosserat_rod.py @@ -11,7 +11,7 @@ class BaseRodForTesting(RodBase): - def __init__(self, n_elems: np.int64, ring_rod_flag: bool): + def __init__(self, n_elems: np.int64, ring_rod_flag: bool) -> None: self.n_elems = n_elems # np.random.randint(10, 30 + 1) self.n_nodes = n_elems if ring_rod_flag else n_elems + 1 self.n_voronoi = n_elems if ring_rod_flag else n_elems - 1 diff --git a/tests/test_modules/test_memory_block_rigid_body.py b/tests/test_modules/test_memory_block_rigid_body.py index 5616d0a93..8649ca8f3 100644 --- a/tests/test_modules/test_memory_block_rigid_body.py +++ b/tests/test_modules/test_memory_block_rigid_body.py @@ -10,7 +10,7 @@ class MockRigidBodyForTesting(RigidBodyBase): - def __init__(self): + def __init__(self) -> None: super().__init__() self.radius = np.random.uniform(low=1, high=5) self.length = np.random.uniform(low=1, high=10) diff --git a/tests/test_rigid_body/test_rigid_body_data_structures.py b/tests/test_rigid_body/test_rigid_body_data_structures.py index b482202b8..37ba33525 100644 --- a/tests/test_rigid_body/test_rigid_body_data_structures.py +++ b/tests/test_rigid_body/test_rigid_body_data_structures.py @@ -19,7 +19,7 @@ def make_simple_system_with_positions_directors(start_position, start_director): class SimpleSystemWithPositionsDirectors(_RigidRodSymplecticStepperMixin): - def __init__(self, start_position, start_director): + def __init__(self, start_position, start_director) -> None: self.a = 0.5 self.b = 1 self.c = 2 diff --git a/tests/test_rigid_body_memory_block_validity.py b/tests/test_rigid_body_memory_block_validity.py index d5fb6b245..44b4843a1 100644 --- a/tests/test_rigid_body_memory_block_validity.py +++ b/tests/test_rigid_body_memory_block_validity.py @@ -7,7 +7,7 @@ class MockRigidBody: - def __init__(self): + def __init__(self) -> None: self.radius = np.random.randn() self.length = np.random.randn() diff --git a/tests/test_rod/mock_rod.py b/tests/test_rod/mock_rod.py index 499dc7697..4c77a6832 100644 --- a/tests/test_rod/mock_rod.py +++ b/tests/test_rod/mock_rod.py @@ -9,7 +9,7 @@ class MockTestRod: - def __init__(self): + def __init__(self) -> None: self.n_elems = 32 self.ring_rod_flag = False self.position_collection = np.random.randn( @@ -27,7 +27,7 @@ def __init__(self): class MockTestRingRod: - def __init__(self): + def __init__(self) -> None: self.n_elems = 32 self.ring_rod_flag = True self.position_collection = np.random.randn(MaxDimension.value(), self.n_elems) diff --git a/tests/test_rod/test_knot_theory.py b/tests/test_rod/test_knot_theory.py index a5630d73a..a2c15d436 100644 --- a/tests/test_rod/test_knot_theory.py +++ b/tests/test_rod/test_knot_theory.py @@ -34,7 +34,7 @@ def test_knot_theory_protocol(): def test_knot_theory_mixin_methods(knot_theory): class TestRodWithKnotTheory(MockTestRod, knot_theory.KnotTheory): - def __init__(self): + def __init__(self) -> None: super().__init__() self.radius = np.random.randn(MaxDimension.value(), self.n_elems) @@ -55,7 +55,7 @@ def __init__(self): def test_knot_theory_mixin_methods_with_no_radius(knot_theory): class TestRodWithKnotTheoryWithoutRadius(MockTestRod, knot_theory.KnotTheory): - def __init__(self): + def __init__(self) -> None: super().__init__() rod = TestRodWithKnotTheoryWithoutRadius()