From 70c626b74834fdca94453e1caad9be19563fb7ec Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 16 Dec 2021 13:09:52 +0100 Subject: [PATCH] Rename NomieImport to ImportData --- src/habitmove/cli.py | 6 +++--- src/habitmove/nomie.py | 8 ++++---- src/habitmove/nomiedata.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/habitmove/cli.py b/src/habitmove/cli.py index 489cb8a..6e4141d 100755 --- a/src/habitmove/cli.py +++ b/src/habitmove/cli.py @@ -3,13 +3,13 @@ import habitmove.schema as schema import habitmove.habits as habits import habitmove.repetitions as rep import habitmove.nomie as nomie -from habitmove.nomiedata import NomieImport +from habitmove.nomiedata import ImportData import click from . import __version__ -def migrate(data: NomieImport): +def migrate(data: ImportData): db = schema.migrate("output.db") if not db: raise ConnectionError @@ -29,7 +29,7 @@ def migrate(data: NomieImport): @click.version_option(version=__version__) @click.argument("inputfile") def main(inputfile): - data = nomie.get_data(inputfile) + data = nomie.get_data(inputfile, False) migrate(data) diff --git a/src/habitmove/nomie.py b/src/habitmove/nomie.py index 847edf6..bc6b7af 100644 --- a/src/habitmove/nomie.py +++ b/src/habitmove/nomie.py @@ -3,7 +3,7 @@ import json import re from click import secho, echo -from habitmove.nomiedata import Tracker, Event, Activity, NomieImport +from habitmove.nomiedata import Tracker, Event, Activity, ImportData def load_file(filename): @@ -26,7 +26,7 @@ def confirmation_question(question, default_no=True): # display stats and ask user to confirm if they seem okay -def verify_continue(data: NomieImport): +def verify_continue(data: ImportData): trackers = "" for t in data.trackers: trackers += t.label + ", " @@ -94,14 +94,14 @@ def get_activities_for_event(event_text, tracker_list): # return the data belonging to nomie -def get_data(file, interactive=True): +def get_data(file: str, interactive: bool = True): raw_data = load_file(file) nomie_version = raw_data["nomie"]["number"] tracker_list = get_trackers(raw_data["trackers"]) event_list = get_events(raw_data["events"], tracker_list) - data = NomieImport(nomie_version, tracker_list, event_list) + data = ImportData(nomie_version, tracker_list, event_list) if interactive: verify_continue(data) diff --git a/src/habitmove/nomiedata.py b/src/habitmove/nomiedata.py index 60d2670..16c6c25 100644 --- a/src/habitmove/nomiedata.py +++ b/src/habitmove/nomiedata.py @@ -59,7 +59,7 @@ class Event: @dataclass(frozen=True) -class NomieImport: +class ImportData: version: str trackers: list[Tracker] events: list[Event]