From f18abbf9943973d6598590082ecae4de5bb30dba Mon Sep 17 00:00:00 2001 From: haliphax Date: Tue, 28 Feb 2023 23:57:26 -0600 Subject: [PATCH] userland import fixes --- userland/__init__.py | 2 +- userland/cli/seed.py | 5 +++-- userland/scripts/__init__.py | 2 +- userland/scripts/lock_example.py | 6 +++--- userland/scripts/oneliners.py | 8 ++++---- userland/scripts/top.py | 8 ++++---- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/userland/__init__.py b/userland/__init__.py index 756e990..a393a1d 100644 --- a/userland/__init__.py +++ b/userland/__init__.py @@ -1 +1 @@ -"""xthulu default userland""" +"""Default userland""" diff --git a/userland/cli/seed.py b/userland/cli/seed.py index bfa8399..cf93ba8 100644 --- a/userland/cli/seed.py +++ b/userland/cli/seed.py @@ -5,13 +5,14 @@ from inspect import isclass # local -from xthulu import config, db +from xthulu import db +from xthulu.configuration import get_config async def seed(): """Seed userland model data.""" - await db.set_bind(config["db"]["bind"]) + await db.set_bind(get_config("db.bind")) models = __import__("userland.models", fromlist=("*",)) for m in dir(models): diff --git a/userland/scripts/__init__.py b/userland/scripts/__init__.py index 2316c2f..00c2376 100644 --- a/userland/scripts/__init__.py +++ b/userland/scripts/__init__.py @@ -1 +1 @@ -"""xthulu default userland scripts""" +"""Default userland scripts""" diff --git a/userland/scripts/lock_example.py b/userland/scripts/lock_example.py index 64ae60c..cbc8927 100644 --- a/userland/scripts/lock_example.py +++ b/userland/scripts/lock_example.py @@ -1,10 +1,10 @@ -"""xthulu lock example""" +"""Lock example""" # api -from xthulu.context import Context +from xthulu.ssh.context import SSHContext -async def main(cx: Context): +async def main(cx: SSHContext): with cx.lock("testing") as l: if not l: cx.echo("Unable to acquire lock\r\n") diff --git a/userland/scripts/oneliners.py b/userland/scripts/oneliners.py index 2de18c0..c8e1158 100644 --- a/userland/scripts/oneliners.py +++ b/userland/scripts/oneliners.py @@ -1,8 +1,8 @@ -"""oneliners script""" +"""Oneliners script""" # api -from xthulu.context import Context -from xthulu.ui.editors import LineEditor +from xthulu.ssh.context import SSHContext +from xthulu.ssh.ui.editors import LineEditor # local from userland.models import Oneliner @@ -14,7 +14,7 @@ """Number of oneliners to display on screen""" -async def main(cx: Context): +async def main(cx: SSHContext): async def get_oneliners(): recent = ( Oneliner.select("id") diff --git a/userland/scripts/top.py b/userland/scripts/top.py index c7f695d..e868d1a 100644 --- a/userland/scripts/top.py +++ b/userland/scripts/top.py @@ -1,11 +1,11 @@ """Userland entry point""" -# local -from xthulu.context import Context -from xthulu.ui import show_art +# api +from xthulu.ssh.context import SSHContext +from xthulu.ssh.ui import show_art -async def main(cx: Context): +async def main(cx: SSHContext): if cx.encoding == "utf-8": cx.echo("\x1b%G") elif cx.env["TERM"] != "ansi":