From 3c9741ac895b4c9b7eccd4da9e00e46a65822161 Mon Sep 17 00:00:00 2001 From: Ethan Ruszanowski Date: Wed, 28 Feb 2024 17:59:18 -0500 Subject: [PATCH] Add type hints to classes --- app.py | 2 +- database/database.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 4021ee7..58529b9 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,7 @@ import database as db class Run: - def __init__(self, moon): + def __init__(self, moon: db.Moon): self.moon: db.Moon = moon self.inside_power: int = moon.inside_max_power self.outside_power: int = moon.outside_max_power diff --git a/database/database.py b/database/database.py index 0f79c25..0b19401 100644 --- a/database/database.py +++ b/database/database.py @@ -3,8 +3,9 @@ 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): + def __init__(self, moon_id: int, name: str, risk_level: str, cost: int, default_layout: str, + map_size_multiplier: float, min_scrap: int, max_scrap: int, outside_max_power: int, + inside_max_power: int, tier: str): self.moon_id: int = moon_id self.name: str = name self.risk_level: str = risk_level @@ -19,7 +20,8 @@ class Moon: class Scrap: - def __init__(self, scrap_id, name, min_value, max_value, weight, conductive, two_handed): + def __init__(self, scrap_id: int, name: str, min_value: int, + max_value: int, weight: int, conductive: int, two_handed: int): self.scrap_id: int = scrap_id self.name: str = name self.min_value: int = min_value