From af7451d2eb28f3c2598d087d1a3c020f930dd87f Mon Sep 17 00:00:00 2001 From: Ethan Ruszanowski Date: Wed, 28 Feb 2024 17:55:22 -0500 Subject: [PATCH] Add type hints to classes --- app.py | 6 +++--- database/database.py | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app.py b/app.py index 4929a11..4021ee7 100644 --- a/app.py +++ b/app.py @@ -4,9 +4,9 @@ import database as db class Run: def __init__(self, moon): - self.moon = moon - self.inside_power = moon.inside_max_power - self.outside_power = moon.outside_max_power + self.moon: db.Moon = moon + self.inside_power: int = moon.inside_max_power + self.outside_power: int = moon.outside_max_power def main(): diff --git a/database/database.py b/database/database.py index ee988f0..0f79c25 100644 --- a/database/database.py +++ b/database/database.py @@ -5,28 +5,28 @@ import sqlite3 class Moon: def __init__(self, moon_id, name, risk_level, cost, default_layout, map_size_multiplier, min_scrap, max_scrap, outside_max_power, inside_max_power, tier): - self.moon_id = moon_id - self.name = name - self.risk_level = risk_level - self.cost = cost - self.default_layout = default_layout, - self.map_size_multiplier = map_size_multiplier - self.min_scrap = min_scrap - self.max_scrap = max_scrap - self.outside_max_power = outside_max_power - self.inside_max_power = inside_max_power - self.tier = tier + self.moon_id: int = moon_id + self.name: str = name + self.risk_level: str = risk_level + self.cost: int = cost + self.default_layout: str = default_layout + self.map_size_multiplier: float = map_size_multiplier + self.min_scrap: int = min_scrap + self.max_scrap: int = max_scrap + self.outside_max_power: int = outside_max_power + self.inside_max_power: int = inside_max_power + self.tier: str = tier class Scrap: def __init__(self, scrap_id, name, min_value, max_value, weight, conductive, two_handed): - self.scrap_id = scrap_id - self.name = name - self.min_value = min_value - self.max_value = max_value - self.weight = weight - self.conductive = conductive - self.two_handed = two_handed + self.scrap_id: int = scrap_id + self.name: str = name + self.min_value: int = min_value + self.max_value: int = max_value + self.weight: int = weight + self.conductive: bool = bool(conductive) + self.two_handed: bool = bool(two_handed) def get_connection() -> sqlite3.Connection: