Skip to content

Commit

Permalink
format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
s-bessey committed Feb 15, 2023
1 parent 080a8d4 commit a27b361
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 95 deletions.
112 changes: 40 additions & 72 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nanoid = "^2.0"
numpy = "^1.23"
black = {version = "^23.1.0", optional = true}
flake8 = {version = "^3.8", optional = true}
mypy = {version = "^0.812", optional = true}
mypy = {version = "^1.0.0", optional = true}
mkdocs = {version = "^1.1", optional = true}
mkdocs-material = {version = "^7.0", optional = true}
mkdocstrings = {version = "^0.15.0", optional = true}
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from titan.agent import Agent, Relationship
from titan.location import Location


# helper method to generate a fake number deterministically
class FakeRandom:
def __init__(self, num: float, fake_choice: int = 0):
Expand Down
1 change: 0 additions & 1 deletion tests/exposures/knowledge_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def test_knowledge_influence(make_model, make_agent):

@pytest.mark.unit
def test_knowledge_exposure(make_model, make_agent, params):

# test update all agents for knowledge
params.exposures.knowledge = True
params.knowledge.prob = 0.0
Expand Down
1 change: 1 addition & 0 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from titan.model import TITAN
from titan.run_titan import script_init


# overwrite
@pytest.fixture
def params_integration(tmpdir):
Expand Down
1 change: 0 additions & 1 deletion titan/exposures/base_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class BaseExposure:

name: str = ""
"""Name of exposure in the params file. Also used to name the attribute in Agent"""

Expand Down
1 change: 0 additions & 1 deletion titan/exposures/hiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class HIV(base_exposure.BaseExposure):

name: str = "hiv"
stats: List[str] = ["hiv", "hiv_dx", "hiv_aids", "hiv_new", "hiv_dx_new"]
"""
Expand Down
1 change: 0 additions & 1 deletion titan/exposures/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Knowledge(base_exposure.BaseExposure):

name: str = "knowledge"
stats: List[str] = ["knowledge_aware"]
"""
Expand Down
1 change: 0 additions & 1 deletion titan/exposures/monkeypox.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class MonkeyPox(base_exposure.BaseExposure):

name: str = "monkeypox"
stats: List[str] = [
"monkeypox",
Expand Down
1 change: 0 additions & 1 deletion titan/features/external_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class ExternalExposure(base_feature.BaseFeature):

name = "external_exposure"

def __init__(self, agent: "agent.Agent"):
Expand Down
2 changes: 0 additions & 2 deletions titan/features/high_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class HighRisk(base_feature.BaseFeature):

name = "high_risk"
stats = [
"high_risk_new",
Expand Down Expand Up @@ -76,7 +75,6 @@ def update_agent(self, model: "model.TITAN"):

# incarcerated last step, evaluate agent's partners for high risk
elif self.agent.incar.time == model.time - 1: # type: ignore[attr-defined]

# put partners in high risk
for partner in self.agent.get_partners(
self.agent.location.params.high_risk.partnership_types
Expand Down
1 change: 0 additions & 1 deletion titan/features/incar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Incar(base_feature.BaseFeature):

name = "incar"
stats = ["incar", "incar_hiv", "new_release", "new_release_hiv"]
"""
Expand Down
1 change: 0 additions & 1 deletion titan/features/partner_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class PartnerTracing(base_feature.BaseFeature):

name = "partner_tracing"

def __init__(self, agent: "agent.Agent"):
Expand Down
1 change: 0 additions & 1 deletion titan/features/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Prep(base_feature.BaseFeature):

name = "prep"
stats = ["prep", "prep_new", "prep_injectable", "prep_oral"]
"""
Expand Down
1 change: 0 additions & 1 deletion titan/features/random_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class RandomTrial(base_feature.BaseFeature):

name = "random_trial"
stats = [
"random_trial",
Expand Down
1 change: 0 additions & 1 deletion titan/features/syringe_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class SyringeServices(base_feature.BaseFeature):

name = "syringe_services"

enrolled_risk = 0.0
Expand Down
1 change: 0 additions & 1 deletion titan/features/vaccine.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Vaccine(base_feature.BaseFeature):

name = "vaccine"
stats = ["vaccine"]
"""
Expand Down
1 change: 0 additions & 1 deletion titan/interactions/base_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class BaseInteraction:

name: str = ""
"""Name of interaction in the params file."""

Expand Down
1 change: 0 additions & 1 deletion titan/interactions/injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Injection(base_interaction.BaseInteraction):

name = "injection"

@classmethod
Expand Down
1 change: 0 additions & 1 deletion titan/interactions/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class PCA(base_interaction.BaseInteraction):

name = "pca"

@classmethod
Expand Down
1 change: 0 additions & 1 deletion titan/interactions/sex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Sex(base_interaction.BaseInteraction):

name = "sex"

@classmethod
Expand Down
1 change: 0 additions & 1 deletion titan/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def add_weight(d, v, w):
# * how will mobility be implemented?
# * assorting?
class LocationEdge:

next_edge_id = 0

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion titan/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def print_components(
"\tdensity\tEffectiveSize\tdeg_cent\n"
)

for (id, comp) in enumerate(components):
for id, comp in enumerate(components):
num_nodes = comp.number_of_nodes()

average_size = effective_size(comp) / num_nodes
Expand Down
1 change: 0 additions & 1 deletion titan/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ def update_partner_assignments(self, t: int):
while eligible_agents:
agent = eligible_agents.popleft()
if len(agent.partners[bond]) < agent.target_partners[bond]:

# no match
if self.update_agent_partners(agent, bond, network_components):
attempts[agent] += 1
Expand Down
2 changes: 1 addition & 1 deletion titan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def grid_file_to_edges(file_path: str, diagonal_neighbors: bool = False) -> Dict
add_edge(edges, loc, grid[i + 1][j - 1])

res = {}
for (i, edge) in enumerate(edges):
for i, edge in enumerate(edges):
res[f"edge_{i+1}"] = {"location_1": edge[0], "location_2": edge[1]}

return res
Expand Down

0 comments on commit a27b361

Please sign in to comment.