Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark low-level discrete_demography API deprecated. #1064

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions fwdpy11/discrete_demography.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import itertools
import typing
import warnings
from collections import defaultdict
from dataclasses import dataclass

Expand Down Expand Up @@ -87,6 +88,8 @@ class MassMigration(fwdpy11._fwdpy11._ll_MassMigration):
resets_growth_rate: bool = attr.ib(default=True)

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
super(MassMigration, self).__init__(
self.when,
self.source,
Expand Down Expand Up @@ -120,6 +123,8 @@ def move_individuals(

:rtype: :class:`fwdpy11.MassMigration`
"""
warnings.warn(
"move_individuals is deprecated and will be removed soon", DeprecationWarning)
return MassMigration(when, source, destination, fraction, True, resets_growth_rate)


Expand All @@ -146,6 +151,8 @@ def copy_individuals(

:rtype: :class:`fwdpy11.MassMigration`
"""
warnings.warn(
"copy_individuals is deprecated and will be removed soon", DeprecationWarning)
return MassMigration(when, source, destination, fraction, False, resets_growth_rate)


Expand Down Expand Up @@ -185,6 +192,8 @@ class SetDemeSize(fwdpy11._fwdpy11._ll_SetDemeSize):
resets_growth_rate: bool = attr.ib(default=True)

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
super(SetDemeSize, self).__init__(
self.when, self.deme, self.new_size, self.resets_growth_rate
)
Expand Down Expand Up @@ -222,6 +231,8 @@ class SetExponentialGrowth(fwdpy11._fwdpy11._ll_SetExponentialGrowth):
G: float = attr.ib()

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
super(SetExponentialGrowth, self).__init__(
self.when, self.deme, self.G)

Expand Down Expand Up @@ -258,6 +269,8 @@ class SetSelfingRate(fwdpy11._fwdpy11._ll_SetSelfingRate):
S: float = attr.ib()

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
super(SetSelfingRate, self).__init__(self.when, self.deme, self.S)

def __getstate__(self):
Expand Down Expand Up @@ -298,6 +311,8 @@ class MigrationMatrix(fwdpy11._fwdpy11._ll_MigrationMatrix):
scaled: bool = attr.ib(default=False)

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
super(MigrationMatrix, self).__init__(self.migmatrix, self.scaled)

def __eq__(self, other):
Expand Down Expand Up @@ -361,6 +376,8 @@ class SetMigrationRates(fwdpy11._fwdpy11._ll_SetMigrationRates):
migrates: np.ndarray = attr.ib()

def __attrs_post_init__(self):
warnings.warn(
f"{self.__class__} is deprecated and will be removed soon", DeprecationWarning)
if self.deme >= 0:
try:
super(SetMigrationRates, self).__init__(
Expand Down