Rename NomieImport to ImportData
This commit is contained in:
parent
539a983505
commit
70c626b748
3 changed files with 8 additions and 8 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class Event:
|
|||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class NomieImport:
|
||||
class ImportData:
|
||||
version: str
|
||||
trackers: list[Tracker]
|
||||
events: list[Event]
|
||||
|
|
Loading…
Reference in a new issue