Skip to content

Commit

Permalink
Fix mixin inheritance to preserve protocol base class attributes.
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
lohedges committed Apr 18, 2023
1 parent f047673 commit d29bfa2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions python/BioSimSpace/Protocol/_equilibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ._protocol import Protocol as _Protocol


class Equilibration(_PositionRestraintMixin):
class Equilibration(_Protocol, _PositionRestraintMixin):
"""A class for storing equilibration protocols."""

def __init__(
Expand Down Expand Up @@ -168,7 +168,7 @@ def _get_parm(self):
f"pressure={self._pressure}, "
f"report_interval={self._report_interval}, "
f"restart_interval={self._restart_interval}, "
f"restart={self._restart}, " + _PositionRestraintMixin._get_parm(self)
+ _PositionRestraintMixin._get_parm(self)
)

def __str__(self):
Expand Down
4 changes: 1 addition & 3 deletions python/BioSimSpace/Protocol/_free_energy_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@

from .. import Types as _Types

from ._protocol import Protocol as _Protocol


class _FreeEnergyMixin(_Protocol):
class _FreeEnergyMixin:
"""A mixin for alchemical free energy protocols."""

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion python/BioSimSpace/Protocol/_minimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from ._protocol import Protocol as _Protocol


class Minimisation(_PositionRestraintMixin):
class Minimisation(_Protocol, _PositionRestraintMixin):
"""A class for storing minimisation protocols."""

def __init__(
Expand Down
4 changes: 1 addition & 3 deletions python/BioSimSpace/Protocol/_position_restraint_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
from .. import Types as _Types
from .. import Units as _Units

from ._protocol import Protocol as _Protocol


class _PositionRestraintMixin(_Protocol):
class _PositionRestraintMixin:
"""A mixin for applying position restraints to other protocols."""

# Supported restraint keywords.
Expand Down
2 changes: 1 addition & 1 deletion python/BioSimSpace/Protocol/_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ._protocol import Protocol as _Protocol


class Production(_PositionRestraintMixin):
class Production(_Protocol, _PositionRestraintMixin):
"""A class for storing production protocols."""

def __init__(
Expand Down

0 comments on commit d29bfa2

Please sign in to comment.