Skip to content

Commit

Permalink
fix imprecise resource type-hinting (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmudambi committed Nov 13, 2024
1 parent 6c454ce commit 8491afb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/vivarium/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
from vivarium.framework.event import Event
from vivarium.framework.lookup import LookupTable
from vivarium.framework.population import PopulationView, SimulantData
from vivarium.framework.randomness import RandomnessStream
from vivarium.framework.values import Pipeline
from vivarium.framework.resource import Resource
from vivarium.types import LookupTableData

DEFAULT_EVENT_PRIORITY = 5
Expand Down Expand Up @@ -239,7 +238,7 @@ def columns_required(self) -> Optional[List[str]]:
@property
def initialization_requirements(
self,
) -> list[str | Pipeline | RandomnessStream]:
) -> list[str | Resource]:
"""A list containing the columns, pipelines, and randomness streams
required by this component's simulant initializer."""
return []
Expand Down
5 changes: 2 additions & 3 deletions src/vivarium/examples/disease_model/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

if TYPE_CHECKING:
from vivarium.framework.engine import Builder
from vivarium.framework.randomness import RandomnessStream
from vivarium.framework.values import Pipeline
from vivarium.framework.resource import Resource


class Risk(Component):
Expand All @@ -33,7 +32,7 @@ def columns_created(self) -> List[str]:
return [self.propensity_column]

@property
def initialization_requirements(self) -> list[str | Pipeline | RandomnessStream]:
def initialization_requirements(self) -> list[str | Resource]:
return [self.randomness]

#####################
Expand Down
5 changes: 2 additions & 3 deletions src/vivarium/framework/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from vivarium.framework.engine import Builder
from vivarium.framework.event import Event
from vivarium.framework.population import PopulationView, SimulantData
from vivarium.framework.randomness import RandomnessStream
from vivarium.framework.values import Pipeline
from vivarium.framework.resource import Resource
from vivarium.types import ClockTime, LookupTableData


Expand Down Expand Up @@ -495,7 +494,7 @@ def columns_created(self) -> List[str]:
@property
def initialization_requirements(
self,
) -> list[str | Pipeline | RandomnessStream]:
) -> list[str | Resource]:
return [self.randomness]

#####################
Expand Down
5 changes: 2 additions & 3 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from vivarium.framework.engine import Builder
from vivarium.framework.event import Event
from vivarium.framework.population import SimulantData
from vivarium.framework.randomness import RandomnessStream
from vivarium.framework.values import Pipeline
from vivarium.framework.resource import Resource


class MockComponentA(Observer):
Expand Down Expand Up @@ -247,7 +246,7 @@ def columns_created(self) -> List[str]:
return ["test_column_4"]

@property
def initialization_requirements(self) -> list[str | Pipeline | RandomnessStream]:
def initialization_requirements(self) -> list[str | Resource]:
return ["test_column_2", self.pipeline, self.randomness]

def setup(self, builder: Builder) -> None:
Expand Down

0 comments on commit 8491afb

Please sign in to comment.