Skip to content

Commit

Permalink
add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
apragsdale committed Apr 1, 2021
1 parent b42101d commit 5ea3e33
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions fwdpy11/_functions/import_demes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Dict,
List,
Optional,
Union,
)
import numpy as np
import attr
Expand Down Expand Up @@ -30,7 +31,9 @@
from .._demography import exponential_growth_rate

# TODO: need type hints for dg
def demography_from_demes(dg, burnin) -> DemographicModelDetails:
def demography_from_demes(
dg: Union[str, demes.Graph], burnin: int
) -> DemographicModelDetails:
"""
The deme graph, dg, can be either a string or a resolved deme-graph.
Expand Down Expand Up @@ -465,7 +468,13 @@ def _process_epoch(
)


def _process_all_epochs(dg, idmap, model_times, burnin_generation, events):
def _process_all_epochs(
dg: demes.Graph,
idmap: Dict,
model_times: _ModelTimes,
burnin_generation: int,
events: _Fwdpy11Events,
):
"""
Processes all epochs of all demes to set sizes and selfing rates.
"""
Expand Down
5 changes: 4 additions & 1 deletion fwdpy11/discrete_demography.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import numpy as np

import fwdpy11
import demes

from .class_decorators import (
attr_add_asblack,
Expand Down Expand Up @@ -526,7 +527,9 @@ def _timed_events(self):
yield i


def from_demes(dg, burnin=10) -> "DemographicModelDetails":
def from_demes(
dg: typing.Union[str, demes.Graph], burnin: int = 10
) -> "DemographicModelDetails":
"""
Build a :class:`fwdpy11.DiscreteDemography` object using
demes.
Expand Down

0 comments on commit 5ea3e33

Please sign in to comment.